Fakultas Ilmu Komputer UI

Commit 2d780c37 authored by wibias fuad's avatar wibias fuad
Browse files

ngepull data pendukung punya aan, udah bikin radiobutton dan validasi nya

parent 1bb85a51
......@@ -283,6 +283,12 @@
"packageUri": "lib/",
"languageVersion": "2.0"
},
{
"name": "grouped_checkbox",
"rootUri": "file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/grouped_checkbox-1.0.0",
"packageUri": "lib/",
"languageVersion": "2.1"
},
{
"name": "html",
"rootUri": "file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.15.0",
......@@ -668,7 +674,7 @@
"languageVersion": "2.7"
}
],
"generated": "2021-05-23T20:57:01.676757Z",
"generated": "2021-05-24T15:17:07.761125Z",
"generator": "pub",
"generatorVersion": "2.12.2"
}
......@@ -174,6 +174,10 @@ graphs
2.0
file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/graphs-0.2.0/
file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/graphs-0.2.0/lib/
grouped_checkbox
2.1
file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/grouped_checkbox-1.0.0/
file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/grouped_checkbox-1.0.0/lib/
html
2.12
file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.15.0/
......
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-24 04:16:34.088508","version":"2.0.3"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\flutter\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-25 00:43:12.034793","version":"2.0.3"}
\ No newline at end of file
......@@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2021-05-24 03:57:01.611759.
# Generated by pub on 2021-05-24 22:17:07.567107.
_fe_analyzer_shared:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-14.0.0/lib/
analyzer:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/
args:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.0.0/lib/
......@@ -51,6 +51,7 @@ flutter_web_plugins:file:///C:/flutter/flutter/packages/flutter_web_plugins/lib/
glob:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/glob-2.0.1/lib/
google_fonts:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/google_fonts-2.0.0/lib/
graphs:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/graphs-0.2.0/lib/
grouped_checkbox:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/grouped_checkbox-1.0.0/lib/
html:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.15.0/lib/
http:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.0/lib/
http_multi_server:file:///C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.2.0/lib/
......
......@@ -24,6 +24,7 @@ const gray5 = Color.fromRGBO(224, 224, 224, 1.0);
// Element Colors
const red1 = Color.fromRGBO(159, 25, 25, 1.0);
const formError = Color.fromRGBO(211, 47, 47, 1.0);
const info = Color.fromRGBO(151, 182, 255, 1.0);
// Color for Akun
......
import 'package:flutter/material.dart';
import 'package:fundex_app/pages/kyc/biodata_pendukung.dart';
import 'package:fundex_app/pages/register/register.dart';
void main() {
runApp(MaterialApp(home: RegisterPage()));
runApp(MaterialApp(home: DataPendukung()));
}
class MyApp extends StatelessWidget {
......
......@@ -4,17 +4,18 @@ import 'package:fundex_app/main-screen.dart';
import 'package:fundex_app/pages/kyc/data_identitas.dart';
import 'package:fundex_app/pages/kyc/design.dart';
import 'package:fundex_app/pages/transaction/Transaction.dart';
import 'package:grouped_checkbox/grouped_checkbox.dart';
class Validasi {
static String validate(String val) {
return val.isEmpty ? 'Harus di isi.' : null;
return val.isEmpty ? 'Harus diisi' : null;
}
}
class ValidasiEmail {
static String validate(String value) {
if (value.isEmpty) {
return 'Email harus di isi';
return 'Email harus diisi';
}
if (!RegExp("^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+.[a-z]").hasMatch(value)) {
return 'Email tidak valid';
......@@ -49,34 +50,80 @@ class _DataPendukungState extends State<DataPendukung> {
String _emailKantor;
// ignore: unused_field
String _tujuanInvestasi;
bool valueCheckbox = false;
bool _checkBox = false;
var _onPressed;
List<String> tujuanInvestasiList = [
'Pendapatan',
'Spekulasi',
'Investasi',
'Price Appreciation',
'Lain-lain',
];
List<String> checkedtujuanInvestasiList = [];
final notifikasiCheckbox = [
CheckboxNotificationSetting(title: 'Gaji'),
CheckboxNotificationSetting(title: 'Hibah'),
CheckboxNotificationSetting(
title: 'Pasangan, Orang Tua, Keluarga atau Teman'),
CheckboxNotificationSetting(
title: 'Santunan (Dana Pensiun, Donatur, Asuransi)'),
CheckboxNotificationSetting(title: 'Hasil Usaha'),
CheckboxNotificationSetting(title: 'Warisan'),
CheckboxNotificationSetting(
title: 'Hasil Investasi (Bunga, Capital Gain, Dividen)'),
CheckboxNotificationSetting(title: 'Undian / Hadiah'),
List<String> sumberPenghasilanList = [
'Gaji',
'Hibah',
'Pasangan, Orang Tua, Keluarga atau Teman',
'Santunan (Dana Pensiun, Donatur, Asuransi)',
'Hasil Usaha',
'Warisan',
'Hasil Investasi (Bunga, Capital Gain, Dividen)',
'Undian / Hadiah',
];
List<String> checkedSumberPenghasilanList = [];
double opacitySumberPenghasilan = 0;
double opacityTujuanInvestasi = 0;
bool tujuanInvestasi = false;
bool sumberPenghasilan = false;
void validasiTujuanInvestasi(itemList) {
checkedtujuanInvestasiList = itemList;
print('CHECKED SUMBER PENGHASILAN $itemList');
if (checkedtujuanInvestasiList.isNotEmpty) {
setState(() {
tujuanInvestasi = true;
opacityTujuanInvestasi = 0;
});
} else {
setState(() {
tujuanInvestasi = false;
opacityTujuanInvestasi = 1;
});
}
}
void validasiSumberPenghasilan(itemList) {
checkedSumberPenghasilanList = itemList;
print('CHECKED SUMBER PENGHASILAN $itemList');
if (checkedSumberPenghasilanList.isNotEmpty) {
setState(() {
sumberPenghasilan = true;
opacitySumberPenghasilan = 0;
});
} else {
setState(() {
sumberPenghasilan = false;
opacitySumberPenghasilan = 1;
});
}
}
@override
Widget build(BuildContext context) {
if (_checkBox == true) {
_onPressed = () {
if (!_formkey.currentState.validate()) {
validasiSumberPenghasilan(checkedSumberPenghasilanList);
validasiTujuanInvestasi(checkedtujuanInvestasiList);
print("Failed");
return;
}
print(valueCheckbox);
if (valueCheckbox == false) {
if (tujuanInvestasi == false || sumberPenghasilan == false) {
validasiSumberPenghasilan(checkedSumberPenghasilanList);
validasiTujuanInvestasi(checkedtujuanInvestasiList);
print('Tujuan Investasi or Sumber Penghasilan masih kosong bro');
return;
}
Navigator.push(context, MaterialPageRoute(builder: (context) {
......@@ -216,6 +263,7 @@ class _DataPendukungState extends State<DataPendukung> {
child: Form(
key: _formkey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// biodata data identitas
Container(
......@@ -261,8 +309,9 @@ class _DataPendukungState extends State<DataPendukung> {
// checkbox sumber penghasilan
Container(
child: Column(
child: Flex(
mainAxisAlignment: MainAxisAlignment.start,
direction: Axis.vertical,
children: <Widget>[
Container(
width: 343,
......@@ -276,19 +325,35 @@ class _DataPendukungState extends State<DataPendukung> {
Container(
margin: EdgeInsets.fromLTRB(0, 4, 0, 0),
width: 343,
height: 450,
child: ListView(
key: Key("listViewCheckbox"),
children: [
...notifikasiCheckbox
.map(buildSingleCheckbox)
.toList(),
],
child: GroupedCheckbox(
itemList: sumberPenghasilanList,
checkedItemList:
checkedSumberPenghasilanList,
onChanged: (itemList) {
validasiSumberPenghasilan(itemList);
},
orientation:
CheckboxOrientation.VERTICAL,
checkColor: white,
activeColor: primary,
),
)
),
],
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Opacity(
opacity: opacitySumberPenghasilan,
child: Text(
'Harus diisi',
style: TextStyle(
color: formError,
fontSize: 12,
),
),
),
),
// form pekerjaan
Container(
......@@ -463,61 +528,92 @@ class _DataPendukungState extends State<DataPendukung> {
// form email kantor
Container(
child: Row(children: <Widget>[
Column(children: <Widget>[
Container(
width: 343,
margin:
const EdgeInsets.fromLTRB(0, 12, 0, 4),
child: Text(
"Email Kantor *",
style: miniTitleTextStyle(),
),
),
Container(
width: 343,
margin: EdgeInsets.fromLTRB(0, 4, 0, 0),
child: TextFormField(
key: Key('emailKantor'),
keyboardType: TextInputType.emailAddress,
decoration: formInputDecoration(),
validator: ValidasiEmail.validate,
onSaved: (String emailKantor) {
_emailKantor = emailKantor;
},
child: Row(
children: <Widget>[
Column(
children: <Widget>[
Container(
width: 343,
margin: const EdgeInsets.fromLTRB(
0, 12, 0, 4),
child: Text(
"Email Kantor *",
style: miniTitleTextStyle(),
),
),
Container(
width: 343,
margin:
EdgeInsets.fromLTRB(0, 4, 0, 0),
child: TextFormField(
key: Key('emailKantor'),
keyboardType:
TextInputType.emailAddress,
decoration: formInputDecoration(),
validator: ValidasiEmail.validate,
onSaved: (String emailKantor) {
_emailKantor = emailKantor;
},
),
),
],
),
),
])
])),
],
),
),
// form tujuan investasi
Container(
child: Row(children: <Widget>[
Column(children: <Widget>[
Container(
width: 343,
margin:
const EdgeInsets.fromLTRB(0, 12, 0, 4),
child: Text(
"Tujuan Investasi *",
style: miniTitleTextStyle(),
child: Row(
children: <Widget>[
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
width: 343,
margin: const EdgeInsets.fromLTRB(
0, 12, 0, 4),
child: Text(
"Tujuan Investasi *",
style: miniTitleTextStyle(),
),
),
Container(
width: 343,
margin:
EdgeInsets.fromLTRB(0, 4, 0, 0),
child: GroupedCheckbox(
itemList: tujuanInvestasiList,
checkedItemList:
checkedtujuanInvestasiList,
onChanged: (itemList) {
validasiTujuanInvestasi(itemList);
},
orientation:
CheckboxOrientation.VERTICAL,
checkColor: white,
activeColor: primary,
),
),
],
),
),
Container(
width: 343,
margin: EdgeInsets.fromLTRB(0, 4, 0, 0),
child: TextFormField(
key: Key('tujuanInvestasi'),
keyboardType: TextInputType.text,
decoration: formInputDecoration(),
validator: Validasi.validate,
onSaved: (String tujuanInvestasi) {
_tujuanInvestasi = tujuanInvestasi;
},
],
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Opacity(
opacity: opacityTujuanInvestasi,
child: Text(
'Harus diisi',
style: TextStyle(
color: formError,
fontSize: 12,
),
),
])
])),
),
),
// container text
Container(
......@@ -676,42 +772,4 @@ class _DataPendukungState extends State<DataPendukung> {
color: primary,
);
}
Widget buildSingleCheckbox(CheckboxNotificationSetting notification) =>
grupCheckbox(
notification: notification,
onClicked: () {
setState(() {
final newValue = !notification.value;
notification.value = newValue;
valueCheckbox = newValue;
});
},
);
Widget grupCheckbox({
@required CheckboxNotificationSetting notification,
@required VoidCallback onClicked,
}) =>
ListTile(
onTap: onClicked,
leading: Checkbox(
value: notification.value,
onChanged: (valueCheckbox) => onClicked(),
),
title: Text(
notification.title,
style: checkboxTextStyle(),
),
);
}
class CheckboxNotificationSetting {
String title;
bool value;
CheckboxNotificationSetting({
@required this.title,
this.value = false,
});
}
......@@ -324,6 +324,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
grouped_checkbox:
dependency: "direct main"
description:
name: grouped_checkbox
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
html:
dependency: transitive
description:
......
......@@ -36,6 +36,7 @@ dependencies:
dotted_border: ^1.0.7
image_picker: any
flutter_multi_carousel: ^1.0.0
grouped_checkbox: ^1.0.0
# The following adds the Cupertino Icons font to your application.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment