useMaterial3 property Null safety
A temporary flag used to opt-in to Material 3 features.
If true, then widgets that have been migrated to Material 3 will use new colors, typography and other features of Material 3. If false, they will use the Material 2 look and feel.
During the migration to Material 3, turning this on may yield inconsistent look and feel in your app as some widgets are migrated while others have yet to be.
Defaults to false. When the Material 3 specification is complete
and all widgets are migrated on stable, we will change this flag to be
true by default. After that change has landed on stable, we will deprecate
this flag and remove all uses of it. At that point, the material
library
will aim to only support Material 3.
Defaults
If a ThemeData is constructed with useMaterial3 set to true, then some properties will get updated defaults. Please note that ThemeData.copyWith with useMaterial3 set to true will not change any of these properties in the resulting ThemeData.
Property | Material 3 default | Material 2 default |
---|---|---|
typography | Typography.material2021 | Typography.material2014 |
splashFactory | InkSparkle* or InkRipple | InkSplash |
* if the target platform is Android and the app is not running on the web, otherwise it will fallback to InkRipple.
Affected widgets
This flag affects styles and components.
Styles
- Color: ColorScheme, Material
- Shape: (see components below)
- Typography:
typography
(see table above)
Components
- Common buttons: TextButton, OutlinedButton, ElevatedButton
- FAB: FloatingActionButton
- Extended FAB: FloatingActionButton.extended
- Cards: Card
- TextFields: TextField together with its InputDecoration
- Chips:
- ActionChip (used for Assist and Suggestion chips),
- FilterChip, ChoiceChip (used for single selection filter chips),
- InputChip
- Dialogs: Dialog, AlertDialog
- Lists: ListTile
- Navigation bar: NavigationBar (new, replacing BottomNavigationBar)
- Navigation rail: NavigationRail
- Top app bar: AppBar
In addition, this flag enables features introduced in Android 12.
- Stretch overscroll: MaterialScrollBehavior
- Ripple:
splashFactory
(see table above)
See also:
Implementation
final bool useMaterial3;