useMaterial3 property
A temporary flag that can be used to opt-out of Material 3 features.
This flag is true by default. If false, then components will continue to use the colors, typography and other features of Material 2.
In the long run this flag will be deprecated and eventually only Material 3 will be supported. We recommend that applications migrate to Material 3 as soon as that's practical. Until that migration is complete, this flag can be set to false.
Defaults
If a ThemeData is constructed with useMaterial3 set to true, then some properties will get updated defaults. However, the ThemeData.copyWith method with useMaterial3 set to true will not change any of these properties in the resulting ThemeData.
Property | Material 3 default | Material 2 default |
---|---|---|
colorScheme | M3 baseline light color scheme | M2 baseline light color scheme |
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.
If brightness is Brightness.dark then the default color scheme will be either the M3 baseline dark color scheme or the M2 baseline dark color scheme depending on useMaterial3.
Affected widgets
This flag affects styles and components.
Styles
- Color: ColorScheme, Material (see table above)
- Shape: (see components below)
- Typography: Typography (see table above)
Components
- Badges: Badge
- Bottom app bar: BottomAppBar
- Bottom sheets: BottomSheet
- Buttons
- Common buttons: ElevatedButton, FilledButton, FilledButton.tonal, OutlinedButton, TextButton
- FAB: FloatingActionButton, FloatingActionButton.extended
- Icon buttons: IconButton, IconButton.filled (new), IconButton.filledTonal, IconButton.outlined
- Segmented buttons: SegmentedButton (replacing ToggleButtons)
- Cards: Card
- Checkbox: Checkbox, CheckboxListTile
- Chips:
- ActionChip (used for Assist and Suggestion chips),
- FilterChip, ChoiceChip (used for single selection filter chips),
- InputChip
- Date pickers: showDatePicker, showDateRangePicker, DatePickerDialog, DateRangePickerDialog, InputDatePickerFormField
- Dialogs: AlertDialog, Dialog.fullscreen
- Divider: Divider, VerticalDivider
- Lists: ListTile
- Menus: MenuAnchor, DropdownMenu, MenuBar
- Navigation bar: NavigationBar (replacing BottomNavigationBar)
- Navigation drawer: NavigationDrawer (replacing Drawer)
- Navigation rail: NavigationRail
- Progress indicators: CircularProgressIndicator, LinearProgressIndicator
- Radio button: Radio, RadioListTile
- Search: SearchBar, SearchAnchor,
- Snack bar: SnackBar
- Slider: Slider, RangeSlider
- Switch: Switch, SwitchListTile
- Tabs: TabBar, TabBar.secondary
- TextFields: TextField together with its InputDecoration
- Time pickers: showTimePicker, TimePickerDialog
- Top app bar: AppBar, SliverAppBar, SliverAppBar.medium, SliverAppBar.large
In addition, this flag enables features introduced in Android 12.
- Stretch overscroll: MaterialScrollBehavior
- Ripple:
splashFactory
(see table above)
See also:
Implementation
final bool useMaterial3;