mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
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 `///`).
93 lines
3.2 KiB
Dart
93 lines
3.2 KiB
Dart
// Copyright 2021 The Flutter team. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// ignore_for_file: avoid_types_on_closure_parameters
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:material_3_demo/main.dart';
|
|
import 'package:material_3_demo/src/elevation_screen.dart';
|
|
|
|
import 'component_screen_test.dart';
|
|
|
|
void main() {
|
|
testWidgets(
|
|
'Surface Tones screen shows correctly when the corresponding icon is '
|
|
'selected on NavigationBar',
|
|
(tester) async {
|
|
widgetSetup(tester, 449);
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
await tester.pumpWidget(const App());
|
|
|
|
expect(find.text('Surface Tint Color Only'), findsNothing);
|
|
expect(find.byType(NavigationBar), findsOneWidget);
|
|
Finder tintIconOnBar = find.descendant(
|
|
of: find.byType(NavigationBar),
|
|
matching: find.widgetWithIcon(
|
|
NavigationDestination,
|
|
Icons.invert_colors_on_outlined,
|
|
),
|
|
);
|
|
expect(tintIconOnBar, findsOneWidget);
|
|
await tester.tap(tintIconOnBar);
|
|
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
|
expect(tintIconOnBar, findsNothing);
|
|
Finder selectedTintIconOnBar = find.descendant(
|
|
of: find.byType(NavigationBar),
|
|
matching: find.widgetWithIcon(
|
|
NavigationDestination,
|
|
Icons.opacity,
|
|
),
|
|
);
|
|
expect(selectedTintIconOnBar, findsOneWidget);
|
|
expect(find.text('Surface Tint Color Only'), findsOneWidget);
|
|
},
|
|
);
|
|
|
|
testWidgets(
|
|
'Surface Tones screen shows correctly when the corresponding icon is '
|
|
'selected on NavigationRail',
|
|
(tester) async {
|
|
widgetSetup(
|
|
tester,
|
|
1200,
|
|
); // NavigationRail shows only when width is > 1000.
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
await tester.pumpWidget(const App());
|
|
expect(find.text('Surface Tint Color Only'), findsNothing);
|
|
Finder tintIconOnRail = find.descendant(
|
|
of: find.byType(NavigationRail),
|
|
matching: find.byIcon(Icons.invert_colors_on_outlined),
|
|
);
|
|
expect(tintIconOnRail, findsOneWidget);
|
|
await tester.tap(tintIconOnRail);
|
|
await tester.pumpAndSettle(const Duration(microseconds: 500));
|
|
expect(tintIconOnRail, findsNothing);
|
|
Finder selectedTintIconOnRail = find.descendant(
|
|
of: find.byType(NavigationRail),
|
|
matching: find.byIcon(Icons.opacity),
|
|
);
|
|
expect(selectedTintIconOnRail, findsOneWidget);
|
|
expect(find.text('Surface Tint Color Only'), findsOneWidget);
|
|
},
|
|
);
|
|
|
|
testWidgets('Surface Tones screen shows correct content', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
const MaterialApp(
|
|
home: Scaffold(body: Row(children: [ElevationScreen()])),
|
|
),
|
|
);
|
|
expect(find.text('Surface Tint Color Only'), findsOneWidget);
|
|
expect(
|
|
find.text('Surface Tint Color and Shadow Color'),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.text('Shadow Color Only'), findsOneWidget);
|
|
expect(find.byType(ElevationGrid), findsNWidgets(3));
|
|
expect(find.byType(ElevationCard), findsNWidgets(18));
|
|
});
|
|
}
|