fix: add validation form data bank
This commit is contained in:
@@ -6,107 +6,120 @@ import 'package:cims_apps/application/theme/color_palette.dart';
|
||||
import 'package:cims_apps/core/route/route.dart';
|
||||
import 'package:cims_apps/core/utils/size_config.dart';
|
||||
import 'package:cims_apps/features/auth/registration/view/submission_data/submission_parent.dart';
|
||||
import 'package:cims_apps/features/auth/registration/viewmodel/submission_data_viewmodel.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ModelDataBank {
|
||||
final String? title, subtitle;
|
||||
ModelDataBank(this.title, this.subtitle);
|
||||
}
|
||||
|
||||
class ConfirmBankAccount extends StatelessWidget {
|
||||
const ConfirmBankAccount({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List listData = [
|
||||
{'title': 'Bank Name', 'subtitle': 'Bank Mandiri'},
|
||||
{'title': 'Account Number', 'subtitle': '123002212084'},
|
||||
{'title': 'Account Owner Name', 'subtitle': 'Muhamad Rosyidin'},
|
||||
{'title': 'Name on ID card', 'subtitle': 'Muhamad Rosyidin'},
|
||||
];
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 70,
|
||||
backgroundColor: Colors.white,
|
||||
surfaceTintColor: Colors.white,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const BackButtonView(),
|
||||
const Text('Registration'),
|
||||
SizedBox(
|
||||
width: SizeConfig.width * 0.1,
|
||||
)
|
||||
],
|
||||
),
|
||||
shape: const RoundedRectangleBorder(
|
||||
side: BorderSide(color: ColorPalette.slate200)),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SizedBox(
|
||||
height: SizeConfig.height * .85,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TextCaption(title: 'Bank account confirmation'),
|
||||
SizedBox(
|
||||
height: SizeConfig.height * .6,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
...listData.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
final listDataBank =
|
||||
ModalRoute.of(context)!.settings.arguments as List<ModelDataBank>;
|
||||
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => SubmissionDataViewModel(),
|
||||
builder: (context, child) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 70,
|
||||
backgroundColor: Colors.white,
|
||||
surfaceTintColor: Colors.white,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const BackButtonView(),
|
||||
const Text('Registration'),
|
||||
SizedBox(
|
||||
width: SizeConfig.width * 0.1,
|
||||
)
|
||||
],
|
||||
),
|
||||
shape: const RoundedRectangleBorder(
|
||||
side: BorderSide(color: ColorPalette.slate200)),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SizedBox(
|
||||
height: SizeConfig.height * .85,
|
||||
child: Consumer<SubmissionDataViewModel>(
|
||||
builder: (context, provider, child) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TextCaption(title: 'Bank account confirmation'),
|
||||
SizedBox(
|
||||
height: SizeConfig.height * .6,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
e['title'],
|
||||
style: const TextStyle(
|
||||
color: ColorPalette.slate400, fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
e['subtitle'],
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: ColorPalette.slate800,
|
||||
fontWeight: FontWeight.w600),
|
||||
...listDataBank.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
e.title!,
|
||||
style: const TextStyle(
|
||||
color: ColorPalette.slate400,
|
||||
fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
e.subtitle!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: ColorPalette.slate800,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
const ListTileView(
|
||||
title:
|
||||
'Make sure your data is correct as it will affect the disbursement process',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
const ListTileView(
|
||||
title:
|
||||
'Make sure your data is correct as it will affect the disbursement process',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ButtonView(
|
||||
name: 'Recheck',
|
||||
isOutlined: true,
|
||||
width: SizeConfig.width * .42,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
ButtonView(
|
||||
name: 'Confirm',
|
||||
width: SizeConfig.width * .42,
|
||||
onPressed: () {
|
||||
routePush(context,
|
||||
page: const SubmissionParent());
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ButtonView(
|
||||
name: 'Recheck',
|
||||
isOutlined: true,
|
||||
width: SizeConfig.width * .42,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
ButtonView(
|
||||
name: 'Confirm',
|
||||
width: SizeConfig.width * .42,
|
||||
onPressed: () {
|
||||
routePush(context, page: const SubmissionParent());
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,61 +63,98 @@ class SubmitBankAccount extends StatelessWidget {
|
||||
return SizedBox(
|
||||
child: Consumer<SubmissionDataViewModel>(
|
||||
builder: (context, provider, child) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TextCaption(title: 'Input your bank account data'),
|
||||
TextFormView(
|
||||
name: 'Bank Name',
|
||||
hintText: 'Select bank',
|
||||
readOnly: true,
|
||||
ctrl: provider.ctrlBankName,
|
||||
onTap: () {
|
||||
showSearchBank(provider.ctrlBankName);
|
||||
},
|
||||
suffixIcon: const Icon(
|
||||
Icons.keyboard_arrow_down_outlined,
|
||||
return SizedBox(
|
||||
height: SizeConfig.height * .8,
|
||||
child: Form(
|
||||
key: provider.formKeySubmitDataBank,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const TextCaption(title: 'Input your bank account data'),
|
||||
TextFormView(
|
||||
name: 'Bank Name',
|
||||
hintText: 'Select bank',
|
||||
readOnly: true,
|
||||
ctrl: provider.ctrlBankName,
|
||||
onTap: () {
|
||||
showSearchBank(provider.ctrlBankName);
|
||||
},
|
||||
suffixIcon: const Icon(
|
||||
Icons.keyboard_arrow_down_outlined,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Field must be filled';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
TextFormView(
|
||||
name: 'Account Number',
|
||||
hintText: 'Input Account Number',
|
||||
keyboardType: TextInputType.number,
|
||||
trailingTitleWidget: SizedBox(
|
||||
width: 24,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
routePush(context, page: const GuideScreen());
|
||||
},
|
||||
child:
|
||||
const ImageView(image: PathAssets.iconQuestion),
|
||||
TextFormView(
|
||||
name: 'Account Number',
|
||||
hintText: 'Input Account Number',
|
||||
ctrl: provider.ctrlNoAccountBank,
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Field must be filled';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
trailingTitleWidget: SizedBox(
|
||||
width: 24,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
routePush(context, page: const GuideScreen());
|
||||
},
|
||||
child:
|
||||
const ImageView(image: PathAssets.iconQuestion),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormView(
|
||||
name: 'Account Owner Name',
|
||||
hintText: 'Input Account Name',
|
||||
),
|
||||
const Text(
|
||||
"Make sure the account you use is in your name, not someone else's",
|
||||
style: TextStyle(
|
||||
color: ColorPalette.slate400,
|
||||
),
|
||||
),
|
||||
SizedBox(height: SizeConfig.height * .08),
|
||||
ButtonView(
|
||||
name: 'Next',
|
||||
onPressed: () {
|
||||
provider.next(context).then((value) {
|
||||
if (value) {
|
||||
routePush(context,
|
||||
page: const ConfirmBankAccount());
|
||||
TextFormView(
|
||||
name: 'Account Owner Name',
|
||||
hintText: 'Input Account Name',
|
||||
ctrl: provider.ctrlNameAccountBank,
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Field must be filled';
|
||||
}
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const Text(
|
||||
"Make sure the account you use is in your name, not someone else's",
|
||||
style: TextStyle(
|
||||
color: ColorPalette.slate400,
|
||||
),
|
||||
),
|
||||
SizedBox(height: SizeConfig.height * .08),
|
||||
ButtonView(
|
||||
name: 'Next',
|
||||
onPressed: () {
|
||||
if (provider.formKeySubmitDataBank.currentState!
|
||||
.validate()) {
|
||||
provider
|
||||
.submitDataBank(
|
||||
bankName: provider.ctrlBankName.text,
|
||||
accountNumber: provider.ctrlNoAccountBank.text,
|
||||
accountName: provider.ctrlNameAccountBank.text,
|
||||
)
|
||||
.then((values) {
|
||||
provider.next(context).then((value) {
|
||||
if (value) {
|
||||
routePush(context,
|
||||
page: const ConfirmBankAccount(),
|
||||
arguments: values);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -61,7 +61,6 @@ class SubmitEmail extends StatelessWidget {
|
||||
}
|
||||
|
||||
showEmailVerify(BuildContext context, SubmissionDataViewModel provider) {
|
||||
Navigator.pop(context);
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
|
||||
Reference in New Issue
Block a user