feat: update bank account form to display as a dialog and add account type selection

This commit is contained in:
Achintha Isuru
2026-01-25 10:34:50 -05:00
parent 9dae80e66e
commit 1ef222febf
2 changed files with 37 additions and 29 deletions

View File

@@ -72,43 +72,50 @@ 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(
color: UiColors.background, // Was surface
border: Border(top: BorderSide(color: UiColors.border)),
),
child: SafeArea(
child: UiButton.primary(
text: strings.add_account,
leadingIcon: UiIcons.add,
onPressed: () => cubit.toggleForm(true),
fullWidth: true,
),
Container(
padding: const EdgeInsets.all(UiConstants.space5),
decoration: const BoxDecoration(
color: UiColors.background, // Was surface
border: Border(top: BorderSide(color: UiColors.border)),
),
child: SafeArea(
child: UiButton.primary(
text: strings.add_account,
leadingIcon: UiIcons.add,
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,
),
),
),
],
);
},

View File

@@ -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,