feat: update bank account form to display as a dialog and add account type selection
This commit is contained in:
@@ -72,43 +72,50 @@ class BankAccountPage extends StatelessWidget {
|
|||||||
const SizedBox(height: UiConstants.space3),
|
const SizedBox(height: UiConstants.space3),
|
||||||
...state.accounts.map((BankAccount a) => _buildAccountCard(a, strings)), // Added type
|
...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
|
// Add extra padding at bottom
|
||||||
const SizedBox(height: 80),
|
const SizedBox(height: 80),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!state.showForm)
|
Container(
|
||||||
Container(
|
padding: const EdgeInsets.all(UiConstants.space5),
|
||||||
padding: const EdgeInsets.all(UiConstants.space5),
|
decoration: const BoxDecoration(
|
||||||
decoration: const BoxDecoration(
|
color: UiColors.background, // Was surface
|
||||||
color: UiColors.background, // Was surface
|
border: Border(top: BorderSide(color: UiColors.border)),
|
||||||
border: Border(top: BorderSide(color: UiColors.border)),
|
),
|
||||||
),
|
child: SafeArea(
|
||||||
child: SafeArea(
|
child: UiButton.primary(
|
||||||
child: UiButton.primary(
|
text: strings.add_account,
|
||||||
text: strings.add_account,
|
leadingIcon: UiIcons.add,
|
||||||
leadingIcon: UiIcons.add,
|
onPressed: () {
|
||||||
onPressed: () => cubit.toggleForm(true),
|
showDialog(
|
||||||
fullWidth: true,
|
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(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
widget.strings.add_new_account,
|
widget.strings.add_new_account,
|
||||||
|
|||||||
Reference in New Issue
Block a user