Rename Sample classes (#124080)

Rename Sample classes
This commit is contained in:
Greg Spencer
2023-04-04 13:34:29 -07:00
committed by GitHub
parent c8a3dbaf06
commit e3bc8efd39
480 changed files with 3125 additions and 3816 deletions

View File

@@ -11,7 +11,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.ActionIconThemeExampleApp(),
),
),
);

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.BottomNavigationBarExampleApp(),
);
expect(find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), findsOneWidget);

View File

@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Card has clip applied', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.CardExampleApp());
final Card card = tester.firstWidget(find.byType(Card));
expect(card.clipBehavior, Clip.hardEdge);

View File

@@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('showing and hiding the custom context menu in the whole app', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.ContextMenuControllerExampleApp(),
);
expect(BrowserContextMenu.enabled, !kIsWeb);

View File

@@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('showing and hiding the context menu in TextField with custom buttons', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.EditableTextToolbarBuilderExampleApp(),
);
expect(BrowserContextMenu.enabled, !kIsWeb);

View File

@@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('showing and hiding the custom context menu in TextField with a specific selection', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.EditableTextToolbarBuilderExampleApp(),
);
expect(BrowserContextMenu.enabled, !kIsWeb);

View File

@@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('showing and hiding the context menu in TextField with a custom toolbar', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.EditableTextToolbarBuilderExampleApp(),
);
expect(BrowserContextMenu.enabled, !kIsWeb);

View File

@@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('showing and hiding the custom context menu on SelectionArea', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.SelectableRegionToolbarBuilderExampleApp(),
);
expect(BrowserContextMenu.enabled, !kIsWeb);

View File

@@ -12,7 +12,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.AlertDialogExampleApp(),
),
),
);

View File

@@ -12,7 +12,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.AlertDialogExampleApp(),
),
),
);

View File

@@ -13,7 +13,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.DialogExampleApp(),
),
),
);
@@ -35,7 +35,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.DialogExampleApp(),
),
),
);

View File

@@ -12,7 +12,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.ShowDialogExampleApp(),
),
),
);

View File

@@ -12,7 +12,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.ShowDialogExampleApp(),
),
),
);

View File

@@ -12,7 +12,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.ShowDialogExampleApp(),
),
),
);

View File

@@ -11,7 +11,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.DividerExampleApp(),
),
),
);

View File

@@ -11,7 +11,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.DividerExampleApp(),
),
),
);

View File

@@ -11,7 +11,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.VerticalDividerExampleApp(),
),
),
);

View File

@@ -11,7 +11,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.VerticalDividerExampleApp(),
),
),
);

View File

@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('FloatingActionButton', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.FloatingActionButtonExampleApp(),
);
expect(find.byType(FloatingActionButton), findsOneWidget);

View File

@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('FloatingActionButton.extended', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.FloatingActionButtonExampleApp(),
);
expect(find.byType(FloatingActionButton), findsOneWidget);

View File

@@ -13,7 +13,7 @@ void main() {
return tester.widget<RawMaterialButton>(finder);
}
await tester.pumpWidget(
const example.MyApp(),
const example.FloatingActionButtonExampleApp(),
);
expect(find.byType(FloatingActionButton), findsOneWidget);

View File

@@ -14,7 +14,7 @@ void main() {
}
await tester.pumpWidget(
const example.MyApp(),
const example.FloatingActionButtonExampleApp(),
);
final ThemeData theme = ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true);

View File

@@ -21,7 +21,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: example.MyStatelessWidget(
body: example.ImageClipExample(
image: MemoryImage(Uint8List.fromList(kTransparentImage)),
),
),

View File

@@ -21,7 +21,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: example.MyStatelessWidget(
body: example.ImageClipExample(
image: MemoryImage(Uint8List.fromList(kTransparentImage)),
),
),

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('InputDecorator label uses error color', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.FloatingLabelStyleErrorExampleApp(),
);
final Theme theme = tester.firstWidget(find.byType(Theme));

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('InputDecorator label uses error color', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.LabelStyleErrorExampleApp(),
);
final Theme theme = tester.firstWidget(find.byType(Theme));

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('InputDecorator prefixIcon alignment', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.PrefixIconExampleApp(),
);
expect(tester.getCenter(find.byIcon(Icons.person)).dy, 28.0);
});

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('InputDecorator suffixIcon alignment', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.SuffixIconExampleApp(),
);
expect(tester.getCenter(find.byIcon(Icons.remove_red_eye)).dy, 28.0);
});

View File

@@ -11,7 +11,7 @@ void main() {
testWidgets('Navigation rail updates destination on tap',
(WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
final NavigationRail navigationRailWidget =
tester.firstWidget(find.byType(NavigationRail));
@@ -37,7 +37,7 @@ void main() {
testWidgets('Navigation rail updates label type', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
// initial label type set to all.
@@ -56,7 +56,7 @@ void main() {
testWidgets('Navigation rail updates group alignment', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
// initial group alignment set top top.
@@ -75,7 +75,7 @@ void main() {
testWidgets('Navigation rail shows leading/trailing widgets', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
// Initially leading/trailing widgets are hidden.

View File

@@ -11,7 +11,7 @@ void main() {
testWidgets('Navigation rail updates destination on tap',
(WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
final NavigationRail navigationRailWidget =
tester.firstWidget(find.byType(NavigationRail));
@@ -37,7 +37,7 @@ void main() {
testWidgets('Navigation rail updates label type', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
// initial label type set to all.
@@ -56,7 +56,7 @@ void main() {
testWidgets('Navigation rail updates group alignment', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
// initial group alignment set top top.
@@ -75,7 +75,7 @@ void main() {
testWidgets('Navigation rail shows leading/trailing widgets', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.NavigationRailExampleApp(),
);
// Initially leading/trailing widgets are hidden.

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Trigger RefreshIndicator - Pull from top', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.RefreshIndicatorExampleApp(),
);
await tester.fling(find.text('Item 1'), const Offset(0.0, 300.0), 1000.0);
@@ -22,7 +22,7 @@ void main() {
testWidgets('Trigger RefreshIndicator - Button', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.RefreshIndicatorExampleApp(),
);
await tester.tap(find.byType(FloatingActionButton));

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Pulling from nested scroll view triggers refresh indicator', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.RefreshIndicatorExampleApp(),
);
// Pull from the upper scroll view.

View File

@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('TextField is obscured and has "Password" as labelText', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.TextFieldExampleApp());
expect(find.byType(TextField), findsOneWidget);

View File

@@ -15,7 +15,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.ToggleButtonsExampleApp(),
),
),
);
@@ -50,7 +50,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.ToggleButtonsExampleApp(),
),
),
);
@@ -86,7 +86,7 @@ void main() {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.MyApp(),
body: example.ToggleButtonsExampleApp(),
),
),
);

View File

@@ -12,7 +12,7 @@ void main() {
const String tooltipText = 'I am a Tooltip';
await tester.pumpWidget(
const example.MyApp(),
const example.TooltipExampleApp(),
);
TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);

View File

@@ -12,7 +12,7 @@ void main() {
const String tooltipText = 'I am a Tooltip';
await tester.pumpWidget(
const example.MyApp(),
const example.TooltipExampleApp(),
);
TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);

View File

@@ -12,7 +12,7 @@ void main() {
const String tooltipText = 'I am a rich tooltip. I am another span of this rich tooltip';
await tester.pumpWidget(
const example.MyApp(),
const example.TooltipExampleApp(),
);
TestGesture? gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);

View File

@@ -11,7 +11,7 @@ void main() {
const String tooltipText = 'I am a Tooltip';
await tester.pumpWidget(
const example.MyApp(),
const example.TooltipExampleApp(),
);
// Tooltip is not visible before tapping the button.

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Uses Text Cursor', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.MouseCursorExampleApp(),
);
expect(find.byType(MouseRegion), findsNWidgets(2)); // There's one in the MaterialApp

View File

@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Enter text using the VKB', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.TextInputControlExampleApp());
await tester.pumpAndSettle();
await tester.tap(find.descendant(

View File

@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('WidgetsApp test', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.WidgetsAppExampleApp(),
);
expect(find.text('Hello World'), findsOneWidget);

View File

@@ -18,7 +18,7 @@ void main() {
}
await tester.pumpWidget(
const example.MyApp(),
const example.WidgetBindingObserverExampleApp(),
);
expect(find.text('There are no AppLifecycleStates to show.'), findsOneWidget);

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('has two containers when wide', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.LayoutBuilderExampleApp(),
);
final Finder containerFinder = find.byType(Container);
@@ -19,7 +19,7 @@ void main() {
await tester.pumpWidget(
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400),
child: const example.MyApp(),
child: const example.LayoutBuilderExampleApp(),
),
);

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('should update magnifier position on drag', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.MagnifierExampleApp());
Matcher isPositionedAt(Offset at) {
return isA<Positioned>().having(
@@ -40,7 +40,7 @@ void main() {
});
testWidgets('should match golden', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.MagnifierExampleApp());
final Offset centerOfFlutterLogo = tester.getCenter(find.byType(Positioned));
const Offset dragDistance = Offset(10, 10);

View File

@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
const String tooltipText = 'tooltip';
testWidgets('Tooltip is shown on press', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.OverlayPortalExampleApp());
expect(find.text(tooltipText), findsNothing);
await tester.tap(find.byType(example.ClickableTooltipWidget));
@@ -22,11 +22,11 @@ void main() {
});
testWidgets('Tooltip is shown at the right location', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.OverlayPortalExampleApp());
await tester.tap(find.byType(example.ClickableTooltipWidget));
await tester.pump();
final Size canvasSize = tester.getSize(find.byType(example.MyApp));
final Size canvasSize = tester.getSize(find.byType(example.OverlayPortalExampleApp));
expect(
tester.getBottomRight(find.text(tooltipText)),
canvasSize - const Size(50, 50),
@@ -34,7 +34,7 @@ void main() {
});
testWidgets('Tooltip is shown with the right font size', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp());
await tester.pumpWidget(const example.OverlayPortalExampleApp());
await tester.tap(find.byType(example.ClickableTooltipWidget));
await tester.pump();

View File

@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/widgets/scroll_view/listview_select.1.dart'
import 'package:flutter_api_samples/widgets/scroll_view/list_view.0.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
@@ -11,7 +11,7 @@ void main() {
testWidgets('long press ListTile should enable edit mode',
(WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.ListViewExampleApp(),
);
final Finder listView = find.byType(ListView);
@@ -29,7 +29,7 @@ void main() {
testWidgets('Pressing cross button should disable edit mode',
(WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.ListViewExampleApp(),
);
final Finder listView = find.byType(ListView);
@@ -52,7 +52,7 @@ void main() {
testWidgets('tapping ListTile or checkBox should toggle ListTile state',
(WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.ListViewExampleApp(),
);
final Finder listView = find.byType(ListView);

View File

@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('SliverOpacity example', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.SliverOpacityExampleApp(),
);
final Finder button = find.byType(FloatingActionButton);

View File

@@ -84,13 +84,13 @@ void main() {
}
testWidgets('should show custom magnifier on drag', (WidgetTester tester) async {
await tester.pumpWidget(const example.MyApp(text: defaultText));
await tester.pumpWidget(const example.TextMagnifierExampleApp(text: defaultText));
await showMagnifier(tester, 'e');
expect(find.byType(example.CustomMagnifier), findsOneWidget);
await expectLater(
find.byType(example.MyApp),
find.byType(example.TextMagnifierExampleApp),
matchesGoldenFile('text_magnifier.0_test.png'),
);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.android }));
@@ -101,7 +101,7 @@ void main() {
final String text = textDirection == TextDirection.rtl ? 'أثارت زر' : defaultText;
final String textToTapOn = textDirection == TextDirection.rtl ? 'ت' : 'e';
await tester.pumpWidget(example.MyApp(textDirection: textDirection, text: text));
await tester.pumpWidget(example.TextMagnifierExampleApp(textDirection: textDirection, text: text));
await showMagnifier(tester, textToTapOn);

View File

@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('pressing shouldPop button changes shouldPop', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.WillPopScopeExampleApp(),
);
final Finder buttonFinder = find.text('shouldPop: true');
@@ -19,14 +19,14 @@ void main() {
});
testWidgets('pressing Push button pushes route', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MyApp(),
const example.WillPopScopeExampleApp(),
);
final Finder buttonFinder = find.text('Push');
expect(buttonFinder, findsOneWidget);
expect(find.byType(example.MyStatefulWidget), findsOneWidget);
expect(find.byType(example.WillPopScopeExample), findsOneWidget);
await tester.tap(buttonFinder);
await tester.pumpAndSettle();
expect(find.byType(example.MyStatefulWidget, skipOffstage: false), findsNWidgets(2));
expect(find.byType(example.WillPopScopeExample, skipOffstage: false), findsNWidgets(2));
});
}