mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Dart 3.9 / Flutter 3.35 [first LLM release] (#2714)
I got carried away with Gemini and basically rewrote CI and the release process for the new LLM reality. This work was largely completed by Gemini. - Bump all SDK versions to the current beta (3.9.0-0) - Run `flutter channel beta` - Wrote `ci_script.dart` to replace the bash scripts - Converted repository to pub workspace #2499 - Added llm.md and release.md - Added redirect for deprecated Samples Index ## 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 have added sample code updates to the [changelog]. - [x] I updated/added relevant documentation (doc comments with `///`).
This commit is contained in:
@@ -20,14 +20,26 @@ void main() {
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_2), findsOneWidget);
|
||||
expect(find.widgetWithIcon(AppBar, Icons.palette_outlined), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithIcon(AppBar, Icons.palette_outlined),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// Elements on the component screen
|
||||
// Common buttons
|
||||
expect(find.widgetWithText(ElevatedButton, 'Elevated'), findsNWidgets(2));
|
||||
expect(
|
||||
find.widgetWithText(ElevatedButton, 'Elevated'),
|
||||
findsNWidgets(2),
|
||||
);
|
||||
expect(find.widgetWithText(FilledButton, 'Filled'), findsNWidgets(2));
|
||||
expect(find.widgetWithText(FilledButton, 'Filled tonal'), findsNWidgets(2));
|
||||
expect(find.widgetWithText(OutlinedButton, 'Outlined'), findsNWidgets(2));
|
||||
expect(
|
||||
find.widgetWithText(FilledButton, 'Filled tonal'),
|
||||
findsNWidgets(2),
|
||||
);
|
||||
expect(
|
||||
find.widgetWithText(OutlinedButton, 'Outlined'),
|
||||
findsNWidgets(2),
|
||||
);
|
||||
expect(find.widgetWithText(TextButton, 'Text'), findsNWidgets(2));
|
||||
expect(find.widgetWithText(Buttons, 'Icon'), findsNWidgets(5));
|
||||
|
||||
@@ -36,7 +48,10 @@ void main() {
|
||||
find.byType(FloatingActionButton),
|
||||
findsNWidgets(6),
|
||||
); // 2 more show up in the bottom app bar. 1 more in the navigation rail
|
||||
expect(find.widgetWithText(FloatingActionButton, 'Create'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(FloatingActionButton, 'Create'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// Icon buttons
|
||||
expect(
|
||||
@@ -52,13 +67,18 @@ void main() {
|
||||
expect(find.byType(Badge), findsNWidgets(4));
|
||||
|
||||
// Progress indicators
|
||||
Finder circularProgressIndicator = find.byType(CircularProgressIndicator);
|
||||
Finder circularProgressIndicator = find.byType(
|
||||
CircularProgressIndicator,
|
||||
);
|
||||
expect(circularProgressIndicator, findsOneWidget);
|
||||
Finder linearProgressIndicator = find.byType(LinearProgressIndicator);
|
||||
expect(linearProgressIndicator, findsOneWidget);
|
||||
|
||||
// Snackbar
|
||||
expect(find.widgetWithText(TextButton, 'Show snackbar'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(TextButton, 'Show snackbar'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// Bottom sheet
|
||||
expect(
|
||||
@@ -128,8 +148,14 @@ void main() {
|
||||
expect(find.byType(InputChip), findsNWidgets(2));
|
||||
|
||||
// Date and time pickers
|
||||
expect(find.widgetWithText(DatePicker, 'Show date picker'), findsOneWidget);
|
||||
expect(find.widgetWithText(TimePicker, 'Show time picker'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(DatePicker, 'Show date picker'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.widgetWithText(TimePicker, 'Show time picker'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// Menus
|
||||
expect(find.byType(MenuAnchor), findsNWidgets(5));
|
||||
@@ -152,175 +178,221 @@ void main() {
|
||||
expect(find.widgetWithText(TextField, 'Outlined'), findsNWidgets(2));
|
||||
});
|
||||
|
||||
testWidgets('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 App());
|
||||
await tester.pumpAndSettle();
|
||||
testWidgets(
|
||||
'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 App());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// When screen width is less than 1000, NavigationBar will show. At the same
|
||||
// time, the NavigationBar example still show up in the navigation group.
|
||||
expect(
|
||||
find.byType(NavigationBars),
|
||||
findsNWidgets(3),
|
||||
); // The real navBar, badges example and navBar example
|
||||
expect(find.widgetWithText(NavigationBar, 'Components'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationBar, 'Color'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationBar, 'Typography'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationBar, 'Elevation'), findsOneWidget);
|
||||
// When screen width is less than 1000, NavigationBar will show. At the same
|
||||
// time, the NavigationBar example still show up in the navigation group.
|
||||
expect(
|
||||
find.byType(NavigationBars),
|
||||
findsNWidgets(3),
|
||||
); // The real navBar, badges example and navBar example
|
||||
expect(
|
||||
find.widgetWithText(NavigationBar, 'Components'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.widgetWithText(NavigationBar, 'Color'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(NavigationBar, 'Typography'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.widgetWithText(NavigationBar, 'Elevation'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
expect(find.widgetWithText(NavigationBar, 'Explore'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationBar, 'Pets'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationBar, 'Account'), findsOneWidget);
|
||||
});
|
||||
expect(
|
||||
find.widgetWithText(NavigationBar, 'Explore'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.widgetWithText(NavigationBar, 'Pets'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(NavigationBar, 'Account'),
|
||||
findsOneWidget,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('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 App());
|
||||
await tester.pumpAndSettle();
|
||||
testWidgets(
|
||||
'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 App());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// When screen width is greater than or equal to 1000, NavigationRail will show.
|
||||
// At the same time, the NavigationBar will NOT show.
|
||||
expect(find.byType(NavigationRail), findsNWidgets(2));
|
||||
expect(find.byType(Tooltip, skipOffstage: false), findsWidgets);
|
||||
expect(find.widgetWithText(NavigationRail, 'Components'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationRail, 'Color'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationRail, 'Typography'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationRail, 'Elevation'), findsOneWidget);
|
||||
// When screen width is greater than or equal to 1000, NavigationRail will show.
|
||||
// At the same time, the NavigationBar will NOT show.
|
||||
expect(find.byType(NavigationRail), findsNWidgets(2));
|
||||
expect(find.byType(Tooltip, skipOffstage: false), findsWidgets);
|
||||
expect(
|
||||
find.widgetWithText(NavigationRail, 'Components'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.widgetWithText(NavigationRail, 'Color'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(NavigationRail, 'Typography'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.widgetWithText(NavigationRail, 'Elevation'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
expect(find.widgetWithText(NavigationBar, 'Explore'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationBar, 'Pets'), findsOneWidget);
|
||||
expect(find.widgetWithText(NavigationBar, 'Account'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(NavigationBar, 'Explore'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.widgetWithText(NavigationBar, 'Pets'), findsOneWidget);
|
||||
expect(
|
||||
find.widgetWithText(NavigationBar, 'Account'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// the Navigation bar should be out of screen.
|
||||
final RenderBox box = tester.renderObject(
|
||||
find.widgetWithText(NavigationBar, 'Components'),
|
||||
);
|
||||
expect(box.localToGlobal(Offset.zero), const Offset(0.0, 3080.0));
|
||||
});
|
||||
// the Navigation bar should be out of screen.
|
||||
final RenderBox box = tester.renderObject(
|
||||
find.widgetWithText(NavigationBar, 'Components'),
|
||||
);
|
||||
expect(box.localToGlobal(Offset.zero), const Offset(0.0, 3080.0));
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('Material version switches between Material3 and Material2 when '
|
||||
'the version icon is clicked', (tester) async {
|
||||
widgetSetup(tester, 450, windowHeight: 7000);
|
||||
await tester.pumpWidget(const App());
|
||||
BuildContext defaultElevatedButton = tester.firstElement(
|
||||
find.byType(ElevatedButton),
|
||||
);
|
||||
BuildContext defaultIconButton = tester.firstElement(
|
||||
find.byType(IconButton),
|
||||
);
|
||||
BuildContext defaultFAB = tester.firstElement(
|
||||
find.byType(FloatingActionButton),
|
||||
);
|
||||
BuildContext defaultCard = tester.firstElement(
|
||||
find.widgetWithText(Card, 'Elevated'),
|
||||
);
|
||||
BuildContext defaultChip = tester.firstElement(
|
||||
find.widgetWithText(ActionChip, 'Assist'),
|
||||
);
|
||||
Finder dialog = find.text('Show dialog');
|
||||
await tester.tap(dialog);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext defaultAlertDialog = tester.element(find.byType(AlertDialog));
|
||||
expect(Theme.of(defaultAlertDialog).useMaterial3, true);
|
||||
Finder dismiss = find.text('Okay');
|
||||
await tester.tap(dismiss);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
testWidgets(
|
||||
'Material version switches between Material3 and Material2 when '
|
||||
'the version icon is clicked',
|
||||
(tester) async {
|
||||
widgetSetup(tester, 450, windowHeight: 7000);
|
||||
await tester.pumpWidget(const App());
|
||||
BuildContext defaultElevatedButton = tester.firstElement(
|
||||
find.byType(ElevatedButton),
|
||||
);
|
||||
BuildContext defaultIconButton = tester.firstElement(
|
||||
find.byType(IconButton),
|
||||
);
|
||||
BuildContext defaultFAB = tester.firstElement(
|
||||
find.byType(FloatingActionButton),
|
||||
);
|
||||
BuildContext defaultCard = tester.firstElement(
|
||||
find.widgetWithText(Card, 'Elevated'),
|
||||
);
|
||||
BuildContext defaultChip = tester.firstElement(
|
||||
find.widgetWithText(ActionChip, 'Assist'),
|
||||
);
|
||||
Finder dialog = find.text('Show dialog');
|
||||
await tester.tap(dialog);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext defaultAlertDialog = tester.element(
|
||||
find.byType(AlertDialog),
|
||||
);
|
||||
expect(Theme.of(defaultAlertDialog).useMaterial3, true);
|
||||
Finder dismiss = find.text('Okay');
|
||||
await tester.tap(dismiss);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_2), findsOneWidget);
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_3), findsNothing);
|
||||
expect(find.text('Material 3'), findsOneWidget);
|
||||
expect(Theme.of(defaultElevatedButton).useMaterial3, true);
|
||||
expect(Theme.of(defaultIconButton).useMaterial3, true);
|
||||
expect(Theme.of(defaultFAB).useMaterial3, true);
|
||||
expect(Theme.of(defaultCard).useMaterial3, true);
|
||||
expect(Theme.of(defaultChip).useMaterial3, true);
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_2), findsOneWidget);
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_3), findsNothing);
|
||||
expect(find.text('Material 3'), findsOneWidget);
|
||||
expect(Theme.of(defaultElevatedButton).useMaterial3, true);
|
||||
expect(Theme.of(defaultIconButton).useMaterial3, true);
|
||||
expect(Theme.of(defaultFAB).useMaterial3, true);
|
||||
expect(Theme.of(defaultCard).useMaterial3, true);
|
||||
expect(Theme.of(defaultChip).useMaterial3, true);
|
||||
|
||||
Finder appbarM3Icon = find.descendant(
|
||||
of: find.byType(AppBar),
|
||||
matching: find.widgetWithIcon(IconButton, Icons.filter_2),
|
||||
);
|
||||
await tester.tap(appbarM3Icon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext updatedElevatedButton = tester.firstElement(
|
||||
find.byType(ElevatedButton),
|
||||
);
|
||||
BuildContext updatedIconButton = tester.firstElement(
|
||||
find.byType(IconButton),
|
||||
);
|
||||
BuildContext updatedFAB = tester.firstElement(
|
||||
find.byType(FloatingActionButton),
|
||||
);
|
||||
BuildContext updatedCard = tester.firstElement(find.byType(Card));
|
||||
BuildContext updatedChip = tester.firstElement(
|
||||
find.widgetWithText(ActionChip, 'Assist'),
|
||||
);
|
||||
Finder updatedDialog = find.text('Show dialog');
|
||||
await tester.tap(updatedDialog);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext updatedAlertDialog = tester.firstElement(
|
||||
find.byType(AlertDialog),
|
||||
);
|
||||
expect(Theme.of(updatedAlertDialog).useMaterial3, false);
|
||||
Finder updatedDismiss = find.text('Dismiss');
|
||||
await tester.tap(updatedDismiss);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
Finder appbarM3Icon = find.descendant(
|
||||
of: find.byType(AppBar),
|
||||
matching: find.widgetWithIcon(IconButton, Icons.filter_2),
|
||||
);
|
||||
await tester.tap(appbarM3Icon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext updatedElevatedButton = tester.firstElement(
|
||||
find.byType(ElevatedButton),
|
||||
);
|
||||
BuildContext updatedIconButton = tester.firstElement(
|
||||
find.byType(IconButton),
|
||||
);
|
||||
BuildContext updatedFAB = tester.firstElement(
|
||||
find.byType(FloatingActionButton),
|
||||
);
|
||||
BuildContext updatedCard = tester.firstElement(find.byType(Card));
|
||||
BuildContext updatedChip = tester.firstElement(
|
||||
find.widgetWithText(ActionChip, 'Assist'),
|
||||
);
|
||||
Finder updatedDialog = find.text('Show dialog');
|
||||
await tester.tap(updatedDialog);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext updatedAlertDialog = tester.firstElement(
|
||||
find.byType(AlertDialog),
|
||||
);
|
||||
expect(Theme.of(updatedAlertDialog).useMaterial3, false);
|
||||
Finder updatedDismiss = find.text('Dismiss');
|
||||
await tester.tap(updatedDismiss);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_3), findsOneWidget);
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_2), findsNothing);
|
||||
expect(find.text('Material 2'), findsOneWidget);
|
||||
expect(Theme.of(updatedElevatedButton).useMaterial3, false);
|
||||
expect(Theme.of(updatedIconButton).useMaterial3, false);
|
||||
expect(Theme.of(updatedFAB).useMaterial3, false);
|
||||
expect(Theme.of(updatedCard).useMaterial3, false);
|
||||
expect(Theme.of(updatedChip).useMaterial3, false);
|
||||
});
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_3), findsOneWidget);
|
||||
expect(find.widgetWithIcon(AppBar, Icons.filter_2), findsNothing);
|
||||
expect(find.text('Material 2'), findsOneWidget);
|
||||
expect(Theme.of(updatedElevatedButton).useMaterial3, false);
|
||||
expect(Theme.of(updatedIconButton).useMaterial3, false);
|
||||
expect(Theme.of(updatedFAB).useMaterial3, false);
|
||||
expect(Theme.of(updatedCard).useMaterial3, false);
|
||||
expect(Theme.of(updatedChip).useMaterial3, false);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('Other screens become Material2 mode after changing mode from '
|
||||
'main screen', (tester) async {
|
||||
await tester.pumpWidget(const App());
|
||||
Finder appbarM2Icon = find.descendant(
|
||||
of: find.byType(AppBar),
|
||||
matching: find.widgetWithIcon(IconButton, Icons.filter_2),
|
||||
);
|
||||
await tester.tap(appbarM2Icon);
|
||||
Finder secondScreenIcon = find.descendant(
|
||||
of: find.byType(NavigationBar),
|
||||
matching: find.widgetWithIcon(
|
||||
NavigationDestination,
|
||||
Icons.format_paint_outlined,
|
||||
),
|
||||
);
|
||||
await tester.tap(secondScreenIcon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext lightThemeText = tester.element(
|
||||
find.text('Light ColorScheme'),
|
||||
);
|
||||
expect(Theme.of(lightThemeText).useMaterial3, false);
|
||||
Finder thirdScreenIcon = find.descendant(
|
||||
of: find.byType(NavigationBar),
|
||||
matching: find.widgetWithIcon(
|
||||
NavigationDestination,
|
||||
Icons.text_snippet_outlined,
|
||||
),
|
||||
);
|
||||
await tester.tap(thirdScreenIcon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext displayLargeText = tester.element(find.text('Display Large'));
|
||||
expect(Theme.of(displayLargeText).useMaterial3, false);
|
||||
Finder fourthScreenIcon = find.descendant(
|
||||
of: find.byType(NavigationBar),
|
||||
matching: find.widgetWithIcon(
|
||||
NavigationDestination,
|
||||
Icons.invert_colors_on_outlined,
|
||||
),
|
||||
);
|
||||
await tester.tap(fourthScreenIcon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext material = tester.firstElement(find.byType(Material));
|
||||
expect(Theme.of(material).useMaterial3, false);
|
||||
});
|
||||
testWidgets(
|
||||
'Other screens become Material2 mode after changing mode from '
|
||||
'main screen',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(const App());
|
||||
Finder appbarM2Icon = find.descendant(
|
||||
of: find.byType(AppBar),
|
||||
matching: find.widgetWithIcon(IconButton, Icons.filter_2),
|
||||
);
|
||||
await tester.tap(appbarM2Icon);
|
||||
Finder secondScreenIcon = find.descendant(
|
||||
of: find.byType(NavigationBar),
|
||||
matching: find.widgetWithIcon(
|
||||
NavigationDestination,
|
||||
Icons.format_paint_outlined,
|
||||
),
|
||||
);
|
||||
await tester.tap(secondScreenIcon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext lightThemeText = tester.element(
|
||||
find.text('Light ColorScheme'),
|
||||
);
|
||||
expect(Theme.of(lightThemeText).useMaterial3, false);
|
||||
Finder thirdScreenIcon = find.descendant(
|
||||
of: find.byType(NavigationBar),
|
||||
matching: find.widgetWithIcon(
|
||||
NavigationDestination,
|
||||
Icons.text_snippet_outlined,
|
||||
),
|
||||
);
|
||||
await tester.tap(thirdScreenIcon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext displayLargeText = tester.element(
|
||||
find.text('Display Large'),
|
||||
);
|
||||
expect(Theme.of(displayLargeText).useMaterial3, false);
|
||||
Finder fourthScreenIcon = find.descendant(
|
||||
of: find.byType(NavigationBar),
|
||||
matching: find.widgetWithIcon(
|
||||
NavigationDestination,
|
||||
Icons.invert_colors_on_outlined,
|
||||
),
|
||||
);
|
||||
await tester.tap(fourthScreenIcon);
|
||||
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
||||
BuildContext material = tester.firstElement(find.byType(Material));
|
||||
expect(Theme.of(material).useMaterial3, false);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('Brightness mode switches between dark and light when'
|
||||
'the brightness icon is clicked', (tester) async {
|
||||
|
||||
Reference in New Issue
Block a user