-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Custom actions - Center actions #88
Labels
enhancement
New feature or request
Comments
Why don't you jsut pass your actions in the content via the |
I tried using the following code but:
void _onDisplayRating(BuildContext context) {
final AppLocalizations loc = AppLocalizations.of(context);
final ThemeData theme = Theme.of(context);
bloc.rateMyApp.showRateDialog(
context,
ignoreNativeDialog: Platform.isAndroid,
// Only use native popup on iOS
// Called when the user dismissed the dialog (either by taping outside
// or by pressing the "back" button).
onDismissed: () => bloc.rateMyApp.callEvent(
RateMyAppEventType.laterButtonPressed,
),
title: loc.translate(Message.ratingDialogTitle),
contentBuilder: (_, Widget title) => _ratingContent(loc, theme),
dialogStyle: DialogStyle(
titleAlign: TextAlign.center,
titleStyle: theme.textTheme.headline3.copyWith(
color: theme.colorScheme.secondary,
),
dialogShape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(10),
),
),
),
);
}
Widget _ratingContent(AppLocalizations loc, ThemeData theme) => Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
child: Text(
loc.translate(Message.ratingDialogSubTitle),
style: theme.textTheme.headline6
.copyWith(color: AppTheme.greenColor),
textAlign: TextAlign.center,
),
),
Container(
height: _ratingVectorSize,
child: Vectors.carrotHeart,
),
Row(
children: <Widget>[
_ratingActionBuilder(
() => bloc.onRateClick(),
Message.ratingDialogRateButton,
),
_ratingActionBuilder(
() => bloc.onRateLaterClick(),
Message.ratingDialogLaterButton,
),
_ratingActionBuilder(
() => bloc.onNoClick(),
Message.ratingDialogNoThanksButton,
),
],
)
],
);
Widget _ratingActionBuilder(void Function() onPressed, Message text) =>
FlatButton(
onPressed: onPressed,
child: Text(
AppLocalizations.of(context).translate(text),
style: Theme.of(context)
.textTheme
.headline6
.copyWith(color: Theme.of(context).colorScheme.secondary),
),
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
I want to center the actions buttons I added in the
actionsBuilder
property on theshowRateDialog
method.However, as the builder must return a
List<Widget>
, I cannot specify the alignment.Describe the solution you'd like
Be able to custom the entire dialog using
Widget
builder or with an improvedDialogStyle
classDescribe alternatives you've considered
dialogStyle
propertyWidget
as every other..builder
property are doing in the entire frameworkAdditional context
Your package is really cool and helps! Thanks a lot!
The text was updated successfully, but these errors were encountered: