Can't modify SnackBar animation duration

This issue has been created since 2022-11-23.

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)

(scaffold.dart)

createAnimationController is a static method of SnackBar:

  static AnimationController createAnimationController({ required TickerProvider vsync }) {
    return AnimationController(
      duration: _snackBarTransitionDuration,
      debugLabel: 'SnackBar',
      vsync: vsync,
    );
  }

(snack_bar.dart)

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.

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-12-10
Star Count 147243
Watcher Count 3561
Fork Count 23950
Issue Count 11325

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
[Security] d3-color vulnerable to ReDoS 1 2022-11-03 2022-12-03
The format is JSON, and the dynamic column update is specified. Why not add columns in the code by default like CSV? 2 2022-08-19 2022-12-03
Consistent crash for version 2021.3 running online since yesterday 3 2022-05-17 2022-11-08
How to add a yield sign? 2 2022-05-16 2022-11-08
Support 'orthogonal' only sequence elements 0 2021-10-16 2022-09-27
Installer + Safe Mode - Addon beim Updaten temporär aktivieren 4 2022-03-17 2022-05-16
Could buildout work if setuptools required pip to install? 9 2016-08-01 2022-11-04
App icon is not shown for many apps 4 2022-11-09 2022-12-01
Fields on a struct declared after method not recognized 0 2022-02-25 2022-12-01
Combine duplicate faces when labeling 0 2022-04-20 2022-10-08
Optimize subdomain import 2 2022-02-25 2022-09-22
加载更多写法按照demo来的 任意点击跳转push的控制器cell采用自动布局的 后再次回到界面刷新数据会抖动闪烁并向上偏移大段距离 0 2021-06-15 2022-11-12
Build failed on Linux MIPS 32bit 6 2021-05-26 2022-12-02
System Error when running Ganache 2.5.4 on win32 1 2022-01-24 2022-10-26
Treemap zoom broken in `1.0.1` 0 2021-11-22 2022-07-06
Limiting ModelSchema / Field queryset 2 2021-12-23 2022-11-02
[iOS] shared library is missing some public symbols 3 2022-08-15 2022-09-04
Creates folder but doesn't download videos 2 2021-06-14 2022-10-19
Site author does not utilize author reference 26 2016-04-26 2022-12-09
Update vulnerable dependency 1 2021-06-11 2022-11-29
Style option for token text 3 2021-06-23 2022-11-30
Disk shader does not work in HDRP (2019.1.0f2) 2 2019-04-29 2022-11-27
Insert Row - break page 6 2021-10-06 2022-12-03
[BUG]-Field Mapping using 2 Different Namespaces Generating Error 8 2021-11-08 2022-11-02
Update try-it-out-locally.adoc 0 2021-10-11 2022-11-17
Support Minecraft 1.19.31 2 2022-10-04 2022-11-21
Terraform Cloud - module ecs_alb_service_task has a broken symlink 3 2021-10-21 2022-12-02
browser based Lazy loading 7 2021-11-15 2022-12-05
Dear ImGui window contents don't render due to incorrect buffer binding 9 2022-11-15 2022-11-28
AsyncStorage caching not working, local chunks are forcibly fetched from the remote url provided in the ChunkManager.configure() instead of the local filesystem 3 2022-06-30 2022-11-30
Upgrade prettierJavaVersion default to 1.0.2 4 2021-04-29 2022-11-25
Upgrade to BlueprintJS 4 2 2022-04-21 2022-12-03
Error: ModuleNotFoundError: No module named 'm3u8' 0 2021-08-01 2022-11-14
Testcontainer query does not work with current jaeger 1 2021-07-15 2022-11-15
Define default buckets for Prometheus Histogram 1 2021-03-28 2022-11-19
(*BPFMap) GetValue return unexpected value when using BPF_MAP_TYPE_PERCPU_ARRAY 4 2022-07-19 2022-11-28
add parsing for bpf program type 0 2022-07-21 2022-11-28
JCenter shutdown impact on Gradle builds 2 2022-01-12 2022-12-03
az vm list crash: 'Namespace' object has no attribute '_cmd' 3 2021-11-12 2022-11-10
Show Output Channel server option not working 8 2021-02-22 2022-11-12
Require AVIF to contain HandlerBox (hdlr) of type 'pict' as the first box within the MetaBox (meta) 0 2021-03-27 2022-12-02
[CP] Imports can't be found by analyzer inside a bazel workspace 6 2022-07-27 2022-10-20
feature: Support IAM role instead of access / secret keys to use AWS S3 bucket 1 2022-12-06 2022-12-03
JVM exception when trying to use os-lib in almond Jupiter notebook 3 2020-02-28 2022-11-27
I get error on vagrant plugin install vagrant-vbguest 1 2018-10-21 2022-12-04
beautify datafusion's site: https://arrow.apache.org/datafusion/ 1 2022-02-12 2022-11-09
cosine similarity 2 2020-10-15 2022-01-16
These credentials do not match our records. when use Fortify::authenticateUsing 0 2022-11-19 2022-12-10
Infinite loop when InterruptException in @KafkaListener 0 2021-06-28 2022-12-09
Relay 13: understanding the new Flow types 5 2022-01-05 2022-12-08