fix: add validation form data id card
This commit is contained in:
parent
27ba55314b
commit
f84fe1017d
|
@ -176,79 +176,107 @@ class SubmitDataIdCard extends StatelessWidget {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Consumer<SubmissionDataViewModel>(
|
child: Consumer<SubmissionDataViewModel>(
|
||||||
builder: (context, provider, child) {
|
builder: (context, provider, child) {
|
||||||
return Column(
|
return Form(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
key: provider.formKeySubmitIdCard,
|
||||||
children: [
|
child: Column(
|
||||||
const TextCaption(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
title: 'Check your ID card data for accuracy'),
|
children: [
|
||||||
TextFormView(
|
const TextCaption(
|
||||||
name: 'NIK',
|
title: 'Check your ID card data for accuracy'),
|
||||||
keyboardType: TextInputType.number,
|
TextFormView(
|
||||||
),
|
name: 'NIK',
|
||||||
TextFormView(name: 'Full Name'),
|
keyboardType: TextInputType.number,
|
||||||
DatePickerView(
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Field must be filled';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextFormView(
|
||||||
|
name: 'Full Name',
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Field must be filled';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
DatePickerView(
|
||||||
name: 'Birth Date',
|
name: 'Birth Date',
|
||||||
ctrl: provider.ctrlBirthDate,
|
ctrl: provider.ctrlBirthDate,
|
||||||
maxDate: DateTime.now(),
|
maxDate: DateTime.now(),
|
||||||
isMultipleSelection: false,
|
isMultipleSelection: false,
|
||||||
enabled: true),
|
enabled: true,
|
||||||
photoDocument(provider),
|
validatorDate: (value) {
|
||||||
Container(
|
if (value!.isEmpty) {
|
||||||
width: SizeConfig.width,
|
return 'Field must be filled';
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
}
|
||||||
margin: const EdgeInsets.symmetric(vertical: 16.0),
|
return null;
|
||||||
decoration: BoxDecoration(
|
},
|
||||||
color: ColorPalette.blue50,
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
border: Border.all(
|
|
||||||
color: ColorPalette.greyLights,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Row(
|
photoDocument(provider),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
Container(
|
||||||
children: [
|
width: SizeConfig.width,
|
||||||
const ImageView(
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
image: PathAssets.iconShield,
|
margin: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
width: 20,
|
decoration: BoxDecoration(
|
||||||
height: 22,
|
color: ColorPalette.blue50,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
border: Border.all(
|
||||||
|
color: ColorPalette.greyLights,
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
width: 8,
|
child: Row(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
const Expanded(
|
children: [
|
||||||
child: Text(
|
const ImageView(
|
||||||
'Will my data be safe?',
|
image: PathAssets.iconShield,
|
||||||
style: TextStyle(
|
width: 20,
|
||||||
fontWeight: FontWeight.w600,
|
height: 22,
|
||||||
color: ColorPalette.primary,
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
const Expanded(
|
||||||
|
child: Text(
|
||||||
|
'Will my data be safe?',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: ColorPalette.primary,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
IconButton(
|
||||||
IconButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
bottomSheet();
|
||||||
bottomSheet();
|
},
|
||||||
},
|
icon: const Icon(
|
||||||
icon: const Icon(
|
Icons.arrow_forward_ios,
|
||||||
Icons.arrow_forward_ios,
|
color: ColorPalette.primary,
|
||||||
color: ColorPalette.primary,
|
size: 20,
|
||||||
size: 20,
|
),
|
||||||
),
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
ButtonView(
|
||||||
ButtonView(
|
name: 'Next',
|
||||||
name: 'Next',
|
onPressed: () async {
|
||||||
onPressed: () async {
|
if (provider.formKeySubmitIdCard.currentState!
|
||||||
await provider.next(context).then((value) {
|
.validate()) {
|
||||||
if (value) {
|
await provider.next(context).then((value) {
|
||||||
routePush(context, page: const SubmissionParent());
|
if (value) {
|
||||||
|
routePush(context,
|
||||||
|
page: const SubmissionParent());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
},
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,6 +14,8 @@ class SubmissionDataViewModel extends ChangeNotifier {
|
||||||
bool _isEmailVerify = false;
|
bool _isEmailVerify = false;
|
||||||
bool get isEmailVerify => _isEmailVerify;
|
bool get isEmailVerify => _isEmailVerify;
|
||||||
var formKeyPersonalData = GlobalKey<FormState>();
|
var formKeyPersonalData = GlobalKey<FormState>();
|
||||||
|
var formKeySubmitEmail = GlobalKey<FormState>();
|
||||||
|
var formKeySubmitIdCard = GlobalKey<FormState>();
|
||||||
TextEditingController ctrlOccupation = TextEditingController();
|
TextEditingController ctrlOccupation = TextEditingController();
|
||||||
TextEditingController ctrlIncome = TextEditingController();
|
TextEditingController ctrlIncome = TextEditingController();
|
||||||
TextEditingController ctrlMarital = TextEditingController();
|
TextEditingController ctrlMarital = TextEditingController();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user