Skip to content

Commit

Permalink
move action buttons in a row
Browse files Browse the repository at this point in the history
  • Loading branch information
ubbabeck committed Sep 18, 2023
1 parent 895998e commit db38951
Showing 1 changed file with 41 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,45 +141,49 @@ class EnterPaymentInfoDialogState extends State<EnterPaymentInfoDialog> {
final texts = context.texts();

List<Widget> actions = [
SimpleDialogOption(
onPressed: () => Navigator.pop(context),
child: Text(
texts.payment_info_dialog_action_cancel,
style: themeData.primaryTextTheme.labelLarge,
),
)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SimpleDialogOption(
padding: const EdgeInsets.symmetric(),
onPressed: () => Navigator.pop(context),
child: Text(
texts.payment_info_dialog_action_cancel,
style: themeData.primaryTextTheme.labelLarge,
),
),
if (_paymentInfoController.text.isNotEmpty) ...[
SimpleDialogOption(
onPressed: (() async {
final inputBloc = context.read<InputBloc>();
final navigator = Navigator.of(context);
_setLoading(true);

try {
await _validateInput(_paymentInfoController.text);
if (_formKey.currentState!.validate()) {
_setLoading(false);
navigator.pop();
inputBloc.addIncomingInput(_paymentInfoController.text);
}
} catch (error) {
_setLoading(false);
_log.w(error.toString(), ex: error);
_setValidatorErrorMessage(texts.payment_info_dialog_error);
} finally {
_setLoading(false);
}
}),
child: Text(
texts.payment_info_dialog_action_approve,
style: themeData.primaryTextTheme.labelLarge,
),
)
],
],
),
];

if (_paymentInfoController.text.isNotEmpty) {
actions.add(
SimpleDialogOption(
onPressed: (() async {
final inputBloc = context.read<InputBloc>();
final navigator = Navigator.of(context);
_setLoading(true);

try {
await _validateInput(_paymentInfoController.text);
if (_formKey.currentState!.validate()) {
_setLoading(false);
navigator.pop();
inputBloc.addIncomingInput(_paymentInfoController.text);
}
} catch (error) {
_setLoading(false);
_log.w(error.toString(), ex: error);
_setValidatorErrorMessage(texts.payment_info_dialog_error);
} finally {
_setLoading(false);
}
}),
child: Text(
texts.payment_info_dialog_action_approve,
style: themeData.primaryTextTheme.labelLarge,
),
),
);
}
return actions;
}

Expand Down

0 comments on commit db38951

Please sign in to comment.