-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
While working on #115750, I was attempting to conditionally change the duration of the SnackBar animation, depending on whether the theme was Material 3 or not.
The Scaffold creates the animation controller for its snackbars in the ScaffoldMessengerState method showSnackBar():
_snackBarController ??= SnackBar.createAnimationController(vsync: this)
createAnimationController is a static method of SnackBar:
static AnimationController createAnimationController({ required TickerProvider vsync }) {
return AnimationController(
duration: _snackBarTransitionDuration,
debugLabel: 'SnackBar',
vsync: vsync,
);
}
Ideally we could pass an optional useMaterial3 parameter to this method, and change the duration accordingly.
However, when running a Material 3 example (like snackbar.2.dart in the above mentioned PR) I can't seem to access a value of Theme.of(context).useMaterial3 = true from ScaffoldMessengerState, though I can from ScaffoldState.
Perhaps there's a trivial solution to this, but I need some insight from someone with more Scaffold familiarity.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status