-
-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge the 2 distinct "Like this app?" widgets into only one #5038
Comments
Hey! Can I work on this issue? |
@Smit56R Sure! |
Okay, I will do that. |
I'm not sure this is a nice idea to merge things, as here, yes, they do the same thing, but that's not the expected behavior. The one on the carousel is a returning message VS a one-time message for the one in the login. |
@g123k I sort of agree with you, the "merge" wording is not correct, the goal is not a unique widget used in both cases. |
@g123k @monsieurtanuki While you decide, I have altered the ![]() ![]() Here is the code snippet for class SmoothAlertDialog extends StatelessWidget {
const SmoothAlertDialog({
this.title,
required this.body,
this.positiveAction,
this.negativeAction,
this.delayAction,
this.actionsAxis,
this.actionsOrder,
this.close = false,
this.margin,
this.contentPadding,
}) : assert(
body is! LayoutBuilder,
"LayoutBuilder isn't supported with Dialogs",
),
assert(
delayAction == null ||
(positiveAction != null || negativeAction != null),
"Delay action isn't supported without positive action and negative action",
);
final String? title;
final bool close;
final Widget body;
final SmoothActionButton? positiveAction;
final SmoothActionButton? negativeAction;
final SmoothActionButton? delayAction;
final Axis? actionsAxis;
final SmoothButtonsBarOrder? actionsOrder;
final EdgeInsets? margin;
final EdgeInsetsDirectional? contentPadding;
/// Default value [_defaultInsetPadding] in dialog.dart
static const EdgeInsets defaultMargin = EdgeInsets.symmetric(
horizontal: 40.0,
vertical: 24.0,
);
static const EdgeInsetsDirectional _smallContentPadding =
EdgeInsetsDirectional.only(
start: SMALL_SPACE,
top: MEDIUM_SPACE,
end: SMALL_SPACE,
bottom: SMALL_SPACE,
);
static const EdgeInsetsDirectional _contentPadding =
EdgeInsetsDirectional.only(
start: 22.0,
top: VERY_LARGE_SPACE,
end: 22.0,
bottom: 22.0,
);
@override
Widget build(BuildContext context) {
final Widget content = _buildContent(context);
final EdgeInsetsDirectional padding =
contentPadding ?? defaultContentPadding(context);
return AlertDialog(
scrollable: false,
elevation: 4.0,
insetPadding: margin ?? defaultMargin,
contentPadding: EdgeInsets.zero,
shape: const RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS),
content: ClipRRect(
borderRadius: ROUNDED_BORDER_RADIUS,
child: Scrollbar(
child: SingleChildScrollView(
child: Padding(
padding: padding,
child: Column(
children: <Widget>[
content,
if (hasActions) _buildBottomBar(padding),
],
),
),
),
),
),
);
}
Padding _buildBottomBar(EdgeInsetsDirectional padding) {
final bool singleButton = (positiveAction != null &&
negativeAction == null &&
delayAction == null) ||
(negativeAction != null &&
positiveAction == null &&
delayAction == null) ||
(delayAction != null &&
positiveAction == null &&
negativeAction == null);
return Padding(
padding: EdgeInsetsDirectional.only(
top: padding.bottom,
start: (actionsAxis == Axis.horizontal || singleButton)
? SMALL_SPACE
: 0.0,
end: positiveAction != null &&
negativeAction != null &&
delayAction != null
? 0.0
: SMALL_SPACE,
),
child: SmoothActionButtonsBar(
positiveAction: positiveAction,
negativeAction: negativeAction,
delayAction: delayAction,
axis: actionsAxis,
order: actionsOrder,
),
);
}
bool get hasActions =>
positiveAction != null || negativeAction != null || delayAction != null;
Widget _buildContent(final BuildContext context) => DefaultTextStyle.merge(
style: const TextStyle(height: 1.5),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
if (title != null) _SmoothDialogTitle(label: title!, close: close),
body,
],
),
);
static EdgeInsetsDirectional defaultContentPadding(BuildContext context) {
return (context.isSmallDevice() ? _smallContentPadding : _contentPadding);
}
} Is this how you want it to work? |
@Smit56R Please just add a |
@monsieurtanuki Okay. I will do it that way. |
@monsieurtanuki I have completed the code. I just need clarification on a few things.
|
@Smit56R Please put the neutral button between positive and negative, and display neutral identical to the current negative button display. |
What
Screenshot/Mockup/Before-After
login_page.dart
)smooth_product_carousel.dart
)The text was updated successfully, but these errors were encountered: