1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00
Files
samples/material_3_demo
James Williams 78d3ea47c9 m3_demo - Enables edge to edge support. (#2441)
Edge to edge is coming by default to Flutter 3.26+ (or thereabouts) when
the targetSdk is raised to Android 15(API 35). In the meantime, it can
be done manually by adjusting the theme and setting
`WindowCompat.setDecorFitsSystemWindows`.

The fix is purely on the Android side. iOS is unaffected.

Sourced from
https://developer.android.com/develop/ui/views/layout/edge-to-edge-manually

Fixes #1720 .

## Pre-launch Checklist

- [X] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [X] I signed the [CLA].
- [X] I read the [Contributors Guide].
- [X] I updated/added relevant documentation (doc comments with `///`).
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
2024-09-21 04:34:12 +10:00
..
2023-04-08 07:44:56 +10:00
2024-09-01 17:25:33 +10:00
2023-04-08 07:44:56 +10:00
2024-08-29 14:51:13 +02:00
2023-04-08 07:44:56 +10:00
2023-04-08 07:44:56 +10:00
2023-01-25 09:08:51 +10:00

Material 3 Demo

This sample Flutter app showcases Material 3 features in the Flutter Material library. These features include updated components, typography, color system and elevation support. The app supports light and dark themes, different color palettes, as well as the ability to switch between Material 2 and Material 3. For more information about Material 3, the guidance is now live at https://m3.material.io/.

This app also includes new M3 components such as IconButtons, Chips, TextFields, Switches, Checkboxes, Radio buttons and ProgressIndicators.

Preview

Screen Shot 2022-08-12 at 12 00 28 PMScreen Shot 2022-08-12 at 12 00 38 PM

Features

Icon Buttons on the Top App Bar

Users can switch between a light or dark theme with this button.

Users can switch between Material 2 and Material 3 for the displayed components with this button.

This button will bring up a pop-up menu that allows the user to change the base color used for the light and dark themes. This uses a new color seed feature to generate entire color schemes from a single color.

Component Screen

The default screen displays all the updated components in Material 3: AppBar, common Buttons, Floating Action Button(FAB), Chips, Card, Checkbox, Dialog, NavigationBar, NavigationRail, ProgressIndicators, Radio buttons, TextFields and Switch.

Adaptive Layout

Based on the fact that NavigationRail is not recommended on a small screen, the app changes its layout based on the screen width. If it's played on iOS or Android devices which have a narrow screen, a Navigation Bar will show at the bottom and will be used to navigate. But if it's played as a desktop or a web app, a Navigation Rail will show on the left side and at the same time, a Navigation Bar will show as an example but will not have any functionality.

Users can see both layouts on one device by running a desktop app and adjusting the screen width.

Color Screen

With Material 3, we have added support for generating a full color scheme from a single seed color. The Color Screen shows users all of the colors in light and dark color palettes that are generated from the currently selected color.

Typography Screen

The Typography Screen displays the text styles used in for the default TextTheme.

Elevation Screen

The Elevation screen shows different ways of elevation with a new supported feature "surfaceTintColor" in the Material library.