diff --git a/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart b/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart index 4e8a13935f9..2c16c41b9ae 100644 --- a/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart +++ b/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart @@ -21,7 +21,6 @@ class SmoothAlertDialog extends StatelessWidget { required this.body, this.positiveAction, this.negativeAction, - this.actionsAxis, this.close = false, }); @@ -30,7 +29,6 @@ class SmoothAlertDialog extends StatelessWidget { final Widget body; final SmoothActionButton? positiveAction; final SmoothActionButton? negativeAction; - final Axis? actionsAxis; static const EdgeInsets _contentPadding = EdgeInsets.only( left: 24.0, @@ -68,7 +66,6 @@ class SmoothAlertDialog extends StatelessWidget { child: SmoothActionButtonsBar( positiveAction: positiveAction, negativeAction: negativeAction, - axis: actionsAxis, ), ); } @@ -126,15 +123,10 @@ class SmoothAlertDialog extends StatelessWidget { } } -/// Will display one or two buttons. -/// If the [axis] is [Axis.horizontal], the positive button will be on the end -/// If the [axis] is [Axis.vertical], the positive button will be on the start -/// Note: This Widget supports both RTL and LTR languages. class SmoothActionButtonsBar extends StatelessWidget { const SmoothActionButtonsBar({ this.positiveAction, this.negativeAction, - this.axis, super.key, }) : assert(positiveAction != null || negativeAction != null, 'At least one action must be passed!'); @@ -149,31 +141,17 @@ class SmoothActionButtonsBar extends StatelessWidget { final SmoothActionButton? positiveAction; final SmoothActionButton? negativeAction; - final Axis? axis; @override Widget build(BuildContext context) { - final Axis buttonsAxis = axis ?? Axis.horizontal; - final List actions = _buildActions( - context, - buttonsAxis, - positiveAction: positiveAction, - negativeAction: negativeAction, - )!; - - if (axis == Axis.horizontal) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: actions, - ); - } else { - return IntrinsicWidth( - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: actions, - ), - ); - } + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: _buildActions( + context, + positiveAction: positiveAction, + negativeAction: negativeAction, + )!, + ); } } @@ -181,8 +159,7 @@ class SmoothActionButtonsBar extends StatelessWidget { /// In LTR mode: Negative - Positive /// In RTL mode: Positive - Negative List? _buildActions( - BuildContext context, - Axis axis, { + BuildContext context, { SmoothActionButton? positiveAction, SmoothActionButton? negativeAction, }) { @@ -190,43 +167,20 @@ List? _buildActions( return null; } - List actions; - - if (axis == Axis.horizontal) { - // Negative action first - actions = [ - if (negativeAction != null) - Expanded( - child: _SmoothActionFlatButton( - buttonData: negativeAction, - ), - ), - if (positiveAction != null) - Expanded( - child: _SmoothActionElevatedButton( - buttonData: positiveAction, - ), - ), - ]; - } else { - // Positive first - actions = [ - if (positiveAction != null) - SizedBox( - width: double.infinity, - child: _SmoothActionElevatedButton( - buttonData: positiveAction, - ), + final List actions = [ + if (negativeAction != null) + Expanded( + child: _SmoothActionFlatButton( + buttonData: negativeAction, ), - if (negativeAction != null) - SizedBox( - width: double.infinity, - child: _SmoothActionFlatButton( - buttonData: negativeAction, - ), + ), + if (positiveAction != null) + Expanded( + child: _SmoothActionElevatedButton( + buttonData: positiveAction, ), - ]; - } + ), + ]; if (Directionality.of(context) == TextDirection.rtl) { return actions.reversed.toList(growable: false); diff --git a/packages/smooth_app/lib/pages/product/common/product_refresher.dart b/packages/smooth_app/lib/pages/product/common/product_refresher.dart index 2c09c9cfeab..8cd14c7159e 100644 --- a/packages/smooth_app/lib/pages/product/common/product_refresher.dart +++ b/packages/smooth_app/lib/pages/product/common/product_refresher.dart @@ -22,7 +22,6 @@ class ProductRefresher { context: context, builder: (BuildContext context) => SmoothAlertDialog( body: Text(appLocalizations.sign_in_mandatory), - actionsAxis: Axis.vertical, positiveAction: SmoothActionButton( text: appLocalizations.sign_in, onPressed: () async {