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