mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Improvements to M3 demo app (#1647)
* improvements * fix focus * add comment * add comment * copy changes to root material_3_demo * fix large breakpoint * fix large breakpoint * Create integration_test.dart * refactor main.dart into home.dart and constants.dart * add integration_test to pubspec * copy to root material_3_demo * remove removal of constraints * address feedback
This commit is contained in:
@@ -16,7 +16,7 @@ void main() {
|
||||
'on NavigationBar', (tester) async {
|
||||
widgetSetup(tester, 449);
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
|
||||
expect(find.text('Light ColorScheme'), findsNothing);
|
||||
expect(find.text('Dark ColorScheme'), findsNothing);
|
||||
@@ -45,7 +45,7 @@ void main() {
|
||||
widgetSetup(
|
||||
tester, 1200); // NavigationRail shows only when width is > 1000.
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Light ColorScheme'), findsNothing);
|
||||
expect(find.text('Dark ColorScheme'), findsNothing);
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:material_3_demo/main.dart';
|
||||
void main() {
|
||||
testWidgets('Default main page shows all M3 components', (tester) async {
|
||||
widgetSetup(tester, 800, windowHeight: 7000);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
|
||||
// Elements on the app bar
|
||||
expect(find.text('Material 3'), findsOneWidget);
|
||||
@@ -131,7 +131,7 @@ void main() {
|
||||
'NavigationRail doesn\'t show when width value is small than 1000 '
|
||||
'(in Portrait mode or narrow screen)', (tester) async {
|
||||
widgetSetup(tester, 999, windowHeight: 7000);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// When screen width is less than 1000, NavigationBar will show. At the same
|
||||
@@ -152,7 +152,7 @@ void main() {
|
||||
'NavigationRail shows when width value is greater than or equal '
|
||||
'to 1000 (in Landscape mode or wider screen)', (tester) async {
|
||||
widgetSetup(tester, 1001, windowHeight: 3000);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// When screen width is greater than or equal to 1000, NavigationRail will show.
|
||||
@@ -178,7 +178,7 @@ void main() {
|
||||
'Material version switches between Material3 and Material2 when'
|
||||
'the version icon is clicked', (tester) async {
|
||||
widgetSetup(tester, 450, windowHeight: 7000);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
BuildContext defaultElevatedButton =
|
||||
tester.firstElement(find.byType(ElevatedButton));
|
||||
BuildContext defaultIconButton =
|
||||
@@ -244,7 +244,7 @@ void main() {
|
||||
testWidgets(
|
||||
'Other screens become Material2 mode after changing mode from '
|
||||
'main screen', (tester) async {
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
Finder appbarM2Icon = find.descendant(
|
||||
of: find.byType(AppBar),
|
||||
matching: find.widgetWithIcon(IconButton, Icons.filter_2));
|
||||
@@ -279,7 +279,7 @@ void main() {
|
||||
testWidgets(
|
||||
'Brightness mode switches between dark and light when'
|
||||
'the brightness icon is clicked', (tester) async {
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
Finder lightIcon = find.descendant(
|
||||
of: find.byType(AppBar),
|
||||
matching: find.widgetWithIcon(IconButton, Icons.light_mode_outlined));
|
||||
@@ -314,7 +314,7 @@ void main() {
|
||||
(tester) async {
|
||||
Color m3BaseColor = const Color(0xff6750a4);
|
||||
await tester.pumpWidget(Container());
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
await tester.pump();
|
||||
Finder menuIcon = find.descendant(
|
||||
of: find.byType(AppBar),
|
||||
|
||||
@@ -16,7 +16,7 @@ void main() {
|
||||
'selected on NavigationBar', (tester) async {
|
||||
widgetSetup(tester, 449);
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
|
||||
expect(find.text('Surface Tint Color Only'), findsNothing);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
widgetSetup(
|
||||
tester, 1200); // NavigationRail shows only when width is > 1000.
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
expect(find.text('Surface Tint Color Only'), findsNothing);
|
||||
Finder tintIconOnRail = find.descendant(
|
||||
of: find.byType(NavigationRail),
|
||||
|
||||
@@ -16,7 +16,7 @@ void main() {
|
||||
'selected on NavigationBar', (tester) async {
|
||||
widgetSetup(tester, 449);
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
|
||||
expect(find.text('Display Large'), findsNothing);
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
@@ -40,7 +40,7 @@ void main() {
|
||||
widgetSetup(
|
||||
tester, 1200); // NavigationRail shows only when width is > 1000.
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
await tester.pumpWidget(const MaterialApp(home: Material3Demo()));
|
||||
await tester.pumpWidget(const App());
|
||||
expect(find.text('Display Large'), findsNothing);
|
||||
Finder textIconOnRail = find.descendant(
|
||||
of: find.byType(NavigationRail),
|
||||
|
||||
Reference in New Issue
Block a user