-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Add width property to SnackBarThemeData #112636
Conversation
Is this the best way to control the snack bar's width? Should it be a percentage of the parent's width plus some padding? Or the width of the snack bar's contents plus some padding? Or min/maxWidth? |
Good questions - there's a couple of things we could do here. The current behaviour is that the snackbar is full width of the parent, minus a little padding. You can override the width to a manual amount, but only on a per-widget basis, not via the theme. Options to solve the issue in #111419 are -
I don't have strong feelings either way, but option b) seems closer to the current functionality of the SnackBar (choice of no width, or fixed width) and simply adds the property to theme data. You have more insight here - is there an approach here that is more consistent with other widgets? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ ___ _____ __ __
| | / __|_ _| \/ |
| |_| (_ | | | | |\/| |
|____\___| |_| |_| |_|
/// Default value for [SnackBar.width]. | ||
/// | ||
/// If this property is null, then the snack bar will take up the full device | ||
/// width less the margin. This value is only used when behavior is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// width less the margin. This value is only used when behavior is | |
/// width less the margin. This value is only used when [behavior] is |
Adds a
width
property toSnackBarThemeData
, so it can be applied to all snackbar instances via the theme.Issue: #111419
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.