feat: update bank account form to display as a dialog and add account type selection
This commit is contained in:
@@ -72,28 +72,12 @@ class BankAccountPage extends StatelessWidget {
|
||||
const SizedBox(height: UiConstants.space3),
|
||||
...state.accounts.map((BankAccount a) => _buildAccountCard(a, strings)), // Added type
|
||||
|
||||
if (state.showForm) ...<Widget>[
|
||||
const SizedBox(height: UiConstants.space6),
|
||||
AddAccountForm(
|
||||
strings: strings,
|
||||
onSubmit: (String routing, String account, String type) { // Added types
|
||||
cubit.addAccount(
|
||||
routingNumber: routing,
|
||||
accountNumber: account,
|
||||
type: type);
|
||||
},
|
||||
onCancel: () {
|
||||
cubit.toggleForm(false);
|
||||
}
|
||||
),
|
||||
],
|
||||
// Add extra padding at bottom
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!state.showForm)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space5),
|
||||
decoration: const BoxDecoration(
|
||||
@@ -104,7 +88,30 @@ class BankAccountPage extends StatelessWidget {
|
||||
child: UiButton.primary(
|
||||
text: strings.add_account,
|
||||
leadingIcon: UiIcons.add,
|
||||
onPressed: () => cubit.toggleForm(true),
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: AddAccountForm(
|
||||
strings: strings,
|
||||
onSubmit: (String routing, String account, String type) {
|
||||
cubit.addAccount(
|
||||
routingNumber: routing,
|
||||
accountNumber: account,
|
||||
type: type,
|
||||
);
|
||||
Modular.to.popPage();
|
||||
},
|
||||
onCancel: () {
|
||||
Modular.to.popPage();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
fullWidth: true,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -37,6 +37,7 @@ class _AddAccountFormState extends State<AddAccountForm> {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.strings.add_new_account,
|
||||
|
||||
Reference in New Issue
Block a user