Unverified Commit 61cf946b authored by Dan Field's avatar Dan Field Committed by GitHub

Refactor of cupertino/material/widgets app (#22161)

* Make CupertinoApp and MaterialApp both use WidgetsApp for Navigator

* Make CupertinoApp and MaterialApp const constructors

* Make WidgetsApp routes aware

* Update tests
parent 6776352f
......@@ -15,7 +15,7 @@ void main() {
await WidgetsBinding.instance.reassembleApplication();
return log;
});
runApp(MaterialApp(home: const Test()));
runApp(const MaterialApp(home: Test()));
}
class Test extends SingleChildRenderObjectWidget {
......
......@@ -7,9 +7,9 @@ import 'package:flutter/material.dart';
class AnimatedIconsTestApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
return const MaterialApp(
title: 'Animated Icons Test',
home: const Scaffold(
home: Scaffold(
body: IconsList(),
),
);
......
......@@ -474,7 +474,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
}
void main() {
runApp(MaterialApp(
home: const AnimationDemo(),
runApp(const MaterialApp(
home: AnimationDemo(),
));
}
......@@ -91,7 +91,7 @@ void main() {
testWidgets('grid_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const GridListDemo()));
await tester.pumpWidget(const MaterialApp(home: GridListDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
......@@ -105,21 +105,21 @@ void main() {
testWidgets('leave_behind_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const LeaveBehindDemo()));
await tester.pumpWidget(const MaterialApp(home: LeaveBehindDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const ListDemo()));
await tester.pumpWidget(const MaterialApp(home: ListDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('menu_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const MenuDemo()));
await tester.pumpWidget(const MaterialApp(home: MenuDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
......@@ -133,7 +133,7 @@ void main() {
testWidgets('overscroll_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const OverscrollDemo()));
await tester.pumpWidget(const MaterialApp(home: OverscrollDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
......@@ -161,7 +161,7 @@ void main() {
testWidgets('reorderable_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const ReorderableListDemo()));
await tester.pumpWidget(const MaterialApp(home: ReorderableListDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
......@@ -196,7 +196,7 @@ void main() {
testWidgets('snack_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const SnackBarDemo()));
await tester.pumpWidget(const MaterialApp(home: SnackBarDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
......@@ -217,7 +217,7 @@ void main() {
testWidgets('text_form_field_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(home: const TextFormFieldDemo()));
await tester.pumpWidget(const MaterialApp(home: TextFormFieldDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
......@@ -380,12 +380,12 @@ void main() {
handle.dispose();
});
testWidgets('overscroll_demo $themeName', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(MaterialApp(theme: theme, home: const OverscrollDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('overscroll_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(const MaterialApp(home: OverscrollDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('page_selector_demo $themeName', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
......
......@@ -14,7 +14,7 @@ void main() {
// We press the "1" and the "2" buttons and check that the display
// reads "12".
testWidgets('Flutter calculator app smoke test', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: const CalculatorDemo()));
await tester.pumpWidget(const MaterialApp(home: CalculatorDemo()));
final Finder oneButton = find.widgetWithText(InkResponse, '1');
expect(oneButton, findsOneWidget);
......
......@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('validates name field correctly', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: const TextFormFieldDemo()));
await tester.pumpWidget(const MaterialApp(home: TextFormFieldDemo()));
final Finder submitButton = find.widgetWithText(RaisedButton, 'SUBMIT');
expect(submitButton, findsOneWidget);
......
This diff is collapsed.
......@@ -4,6 +4,7 @@
import 'package:flutter/widgets.dart';
import 'app.dart' show CupertinoApp;
import 'route.dart';
/// A single tab view with its own [Navigator] state and history.
......@@ -114,7 +115,7 @@ class _CupertinoTabViewState extends State<CupertinoTabView> {
@override
void initState() {
super.initState();
_heroController = HeroController(); // Linear tweening.
_heroController = CupertinoApp.createCupertinoHeroController();
_updateObservers();
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -66,7 +66,7 @@ void main() {
testWidgets('Has semantic annotations', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(MaterialApp(home: const Material(
await tester.pumpWidget(const MaterialApp(home: Material(
child: CupertinoAlertDialog(
title: Text('The Title'),
content: Text('Content'),
......
......@@ -16,8 +16,8 @@ int count = 0;
void main() {
testWidgets('Middle still in center with asymmetrical actions', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
leading: CupertinoButton(child: Text('Something'), onPressed: null,),
middle: Text('Title'),
),
......@@ -30,8 +30,8 @@ void main() {
testWidgets('Middle still in center with back button', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
middle: Text('Title'),
),
),
......@@ -54,8 +54,8 @@ void main() {
testWidgets('Opaque background does not add blur effects', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
middle: Text('Title'),
backgroundColor: Color(0xFFE5E5E5),
),
......@@ -66,8 +66,8 @@ void main() {
testWidgets('Non-opaque background adds blur effects', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
middle: Text('Title'),
),
),
......@@ -120,8 +120,8 @@ void main() {
testWidgets('Padding works in RTL', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Directionality(
const CupertinoApp(
home: Directionality(
textDirection: TextDirection.rtl,
child: Align(
alignment: Alignment.topCenter,
......@@ -151,8 +151,8 @@ void main() {
testWidgets('Verify styles of each slot', (WidgetTester tester) async {
count = 0x000000;
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
leading: _ExpectStyles(color: Color(0xFF001122), index: 0x000001),
middle: _ExpectStyles(color: Color(0xFF000000), letterSpacing: -0.08, index: 0x000100),
trailing: _ExpectStyles(color: Color(0xFF001122), index: 0x010000),
......@@ -165,8 +165,8 @@ void main() {
testWidgets('No slivers with no large titles', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoPageScaffold(
const CupertinoApp(
home: CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('Title'),
),
......@@ -431,8 +431,8 @@ void main() {
testWidgets('Auto back/close button', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
middle: Text('Home page'),
),
),
......@@ -486,8 +486,8 @@ void main() {
testWidgets('Long back label turns into "back"', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......@@ -529,8 +529,8 @@ void main() {
testWidgets('Border should be displayed by default', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
middle: Text('Title'),
),
),
......@@ -551,8 +551,8 @@ void main() {
testWidgets('Overrides border color', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
middle: Text('Title'),
border: Border(
bottom: BorderSide(
......@@ -580,8 +580,8 @@ void main() {
testWidgets('Border should not be displayed when null', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoNavigationBar(
const CupertinoApp(
home: CupertinoNavigationBar(
middle: Text('Title'),
border: null,
),
......@@ -746,8 +746,8 @@ void main() {
'Standard title golden',
(WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const RepaintBoundary(
const CupertinoApp(
home: RepaintBoundary(
child: CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('Bling bling'),
......
......@@ -14,8 +14,8 @@ Future<void> startTransitionBetween(
String toTitle,
}) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......@@ -195,8 +195,8 @@ void main() {
testWidgets('Fullscreen dialogs do not create heroes',
(WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......
......@@ -146,8 +146,8 @@ void main() {
testWidgets('test iOS fullscreen dialog transition', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Center(child: Text('Page 1')),
const CupertinoApp(
home: Center(child: Text('Page 1')),
),
);
......
......@@ -9,8 +9,8 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Middle auto-populates with title', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......@@ -39,8 +39,8 @@ void main() {
testWidgets('Large title auto-populates with title', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......@@ -104,8 +104,8 @@ void main() {
testWidgets('Leading auto-populates with back button with previous title', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......@@ -150,8 +150,8 @@ void main() {
testWidgets('Previous title is correct on first transition frame', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......@@ -193,8 +193,8 @@ void main() {
testWidgets('Previous title stays up to date with changing routes', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const Placeholder(),
const CupertinoApp(
home: Placeholder(),
),
);
......
......@@ -11,8 +11,8 @@ import '../painting/mocks_for_image_cache.dart';
void main() {
testWidgets('Contents are behind translucent bar', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoPageScaffold(
const CupertinoApp(
home: CupertinoPageScaffold(
// Default nav bar is translucent.
navigationBar: CupertinoNavigationBar(
middle: Text('Title'),
......@@ -276,8 +276,8 @@ void main() {
testWidgets('Decorated with white background by default', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoPageScaffold(
const CupertinoApp(
home: CupertinoPageScaffold(
child: Center(),
),
),
......@@ -292,8 +292,8 @@ void main() {
testWidgets('Overrides background color', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: const CupertinoPageScaffold(
const CupertinoApp(
home: CupertinoPageScaffold(
child: Center(),
backgroundColor: Color(0xFF010203),
),
......
......@@ -67,9 +67,9 @@ void main() {
testWidgets('About box logic defaults to executable name for app name', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
title: 'flutter_tester',
home: const Material(child: AboutListTile()),
home: Material(child: AboutListTile()),
),
);
expect(find.text('About flutter_tester'), findsOneWidget);
......@@ -89,8 +89,8 @@ void main() {
});
await tester.pumpWidget(
MaterialApp(
home: const Center(
const MaterialApp(
home: Center(
child: LicensePage(),
),
),
......
......@@ -28,9 +28,9 @@ class StateMarkerState extends State<StateMarker> {
void main() {
testWidgets('Can nest apps', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
home: MaterialApp(
home: const Text('Home sweet home'),
home: Text('Home sweet home'),
),
),
);
......@@ -57,8 +57,8 @@ void main() {
await tester.pumpWidget(FocusScope(
autofocus: true,
node: focusScopeNode,
child: MaterialApp(
home: const Text('Home'),
child: const MaterialApp(
home: Text('Home'),
),
));
......@@ -67,8 +67,8 @@ void main() {
testWidgets('Can show grid without losing sync', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const StateMarker(),
const MaterialApp(
home: StateMarker(),
),
);
......@@ -76,9 +76,9 @@ void main() {
state1.marker = 'original';
await tester.pumpWidget(
MaterialApp(
const MaterialApp(
debugShowMaterialGrid: true,
home: const StateMarker(),
home: StateMarker(),
),
);
......@@ -205,7 +205,7 @@ void main() {
});
testWidgets('Cannot pop the initial route', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: const Text('Home')));
await tester.pumpWidget(const MaterialApp(home: Text('Home')));
expect(find.text('Home'), findsOneWidget);
......@@ -400,9 +400,9 @@ void main() {
home: const Placeholder(),
));
expect(key.currentState, isInstanceOf<NavigatorState>());
await tester.pumpWidget(MaterialApp(
color: const Color(0xFF112233),
home: const Placeholder(),
await tester.pumpWidget(const MaterialApp(
color: Color(0xFF112233),
home: Placeholder(),
));
expect(key.currentState, isNull);
await tester.pumpWidget(MaterialApp(
......
......@@ -9,8 +9,8 @@ import 'package:flutter/rendering.dart';
void main() {
testWidgets('no overlap with floating action button', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: null,
),
......@@ -95,8 +95,8 @@ void main() {
// _BottomAppBarClipper will try an illegal downcast.
testWidgets('toggle shape to null', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar: BottomAppBar(
shape: RectangularNotch(),
),
......@@ -105,8 +105,8 @@ void main() {
);
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar: BottomAppBar(
shape: null,
),
......@@ -115,8 +115,8 @@ void main() {
);
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar: BottomAppBar(
shape: RectangularNotch(),
),
......@@ -127,8 +127,8 @@ void main() {
testWidgets('no notch when notch param is null', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar: ShapeListener(BottomAppBar(
shape: null,
)),
......@@ -159,8 +159,8 @@ void main() {
testWidgets('notch no margin', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar: ShapeListener(
BottomAppBar(
child: SizedBox(height: 100.0),
......@@ -211,8 +211,8 @@ void main() {
testWidgets('notch with margin', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar: ShapeListener(
BottomAppBar(
child: SizedBox(height: 100.0),
......@@ -263,8 +263,8 @@ void main() {
testWidgets('observes safe area', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const MediaQuery(
const MaterialApp(
home: MediaQuery(
data: MediaQueryData(
padding: EdgeInsets.all(50.0),
),
......@@ -287,8 +287,8 @@ void main() {
testWidgets('clipBehavior is propagated', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar:
BottomAppBar(
child: SizedBox(height: 100.0),
......@@ -303,8 +303,8 @@ void main() {
expect(physicalShape.clipBehavior, Clip.none);
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomNavigationBar:
BottomAppBar(
child: SizedBox(height: 100.0),
......
......@@ -1181,8 +1181,8 @@ void main() {
testWidgets('label only', (WidgetTester tester) async {
final SemanticsTester semanticsTester = SemanticsTester(tester);
await tester.pumpWidget(MaterialApp(
home: const Material(
await tester.pumpWidget(const MaterialApp(
home: Material(
child: RawChip(
label: Text('test'),
),
......
......@@ -106,8 +106,8 @@ void main() {
testWidgets('Simple dialog control test', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: Center(
child: RaisedButton(
onPressed: null,
......@@ -149,8 +149,8 @@ void main() {
testWidgets('Barrier dismissible', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: Center(
child: RaisedButton(
onPressed: null,
......@@ -212,8 +212,8 @@ void main() {
final SemanticsTester semantics = SemanticsTester(tester);
const String buttonText = 'A button covered by dialog overlay';
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: Center(
child: RaisedButton(
onPressed: null,
......
......@@ -61,8 +61,8 @@ void main() {
final SemanticsTester semantics = SemanticsTester(tester);
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
drawer: Drawer()
),
),
......@@ -86,8 +86,8 @@ void main() {
testWidgets('Drawer dismiss barrier has no label on Android', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
drawer: Drawer()
),
),
......
......@@ -36,8 +36,8 @@ void main() {
testWidgets('Floating Action Button tooltip', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: null,
tooltip: 'Add',
......@@ -54,8 +54,8 @@ void main() {
// Regression test for: https://github.com/flutter/flutter/pull/21084
testWidgets('Floating Action Button tooltip (long press button edge)', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: null,
tooltip: 'Add',
......@@ -75,8 +75,8 @@ void main() {
// Regression test for: https://github.com/flutter/flutter/pull/21084
testWidgets('Floating Action Button tooltip (long press button edge - no child)', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: null,
tooltip: 'Add',
......@@ -94,8 +94,8 @@ void main() {
testWidgets('Floating Action Button tooltip (no child)', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: null,
tooltip: 'Add',
......@@ -150,8 +150,8 @@ void main() {
testWidgets('FloatingActionButton.isExtended', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton(onPressed: null),
),
),
......
......@@ -180,8 +180,8 @@ void main() {
// Remove the persistent bottomSheet
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
bottomSheet: null,
body: Placeholder(),
),
......
......@@ -124,7 +124,7 @@ void main() {
});
testWidgets('Floating action entrance/exit animation', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: const Scaffold(
await tester.pumpWidget(const MaterialApp(home: Scaffold(
floatingActionButton: FloatingActionButton(
key: Key('one'),
onPressed: null,
......@@ -134,7 +134,7 @@ void main() {
expect(tester.binding.transientCallbackCount, 0);
await tester.pumpWidget(MaterialApp(home: const Scaffold(
await tester.pumpWidget(const MaterialApp(home: Scaffold(
floatingActionButton: FloatingActionButton(
key: Key('two'),
onPressed: null,
......@@ -146,11 +146,11 @@ void main() {
await tester.pumpWidget(Container());
expect(tester.binding.transientCallbackCount, 0);
await tester.pumpWidget(MaterialApp(home: const Scaffold()));
await tester.pumpWidget(const MaterialApp(home: Scaffold()));
expect(tester.binding.transientCallbackCount, 0);
await tester.pumpWidget(MaterialApp(home: const Scaffold(
await tester.pumpWidget(const MaterialApp(home: Scaffold(
floatingActionButton: FloatingActionButton(
key: Key('one'),
onPressed: null,
......@@ -569,7 +569,7 @@ void main() {
const String drawerLabel = 'I am the reason for this test';
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(MaterialApp(home: const Scaffold(
await tester.pumpWidget(const MaterialApp(home: Scaffold(
body: Text(bodyLabel),
persistentFooterButtons: <Widget>[Text(persistentFooterButtonLabel)],
bottomNavigationBar: Text(bottomNavigationBarLabel),
......@@ -970,7 +970,7 @@ void main() {
const String endDrawerLabel = 'I am the label on end side';
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(MaterialApp(home: const Scaffold(
await tester.pumpWidget(const MaterialApp(home: Scaffold(
body: Text(bodyLabel),
drawer: Drawer(child: Text(drawerLabel)),
endDrawer: Drawer(child: Text(endDrawerLabel)),
......
......@@ -37,8 +37,8 @@ void main() {
expect(tester.testTextInput.isVisible, isFalse);
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: Center(
child: TextField(
autofocus: true,
......@@ -59,8 +59,8 @@ void main() {
expect(tester.testTextInput.isVisible, isFalse);
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: Center(
child: TextField(),
),
......@@ -93,8 +93,8 @@ void main() {
expect(tester.testTextInput.isVisible, isFalse);
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: Center(
child: TextField(
autofocus: true,
......@@ -211,8 +211,8 @@ void main() {
// Regression test for https://github.com/flutter/flutter/issues/16880
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: Center(
child: TextField(
decoration: null
......
......@@ -7,11 +7,11 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('TextField works correctly when changing helperText', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: const Material(child: TextField(decoration: InputDecoration(helperText: 'Awesome')))));
await tester.pumpWidget(const MaterialApp(home: Material(child: TextField(decoration: InputDecoration(helperText: 'Awesome')))));
expect(find.text('Awesome'), findsNWidgets(1));
await tester.pump(const Duration(milliseconds: 100));
expect(find.text('Awesome'), findsNWidgets(1));
await tester.pumpWidget(MaterialApp(home: const Material(child: TextField(decoration: InputDecoration(errorText: 'Awesome')))));
await tester.pumpWidget(const MaterialApp(home: Material(child: TextField(decoration: InputDecoration(errorText: 'Awesome')))));
expect(find.text('Awesome'), findsNWidgets(2));
});
}
......@@ -1721,8 +1721,8 @@ void main() {
});
testWidgets('setting maxLength shows counter', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: const Material(
await tester.pumpWidget(const MaterialApp(
home: Material(
child: DefaultTextStyle(
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0),
child: Center(
......@@ -1746,8 +1746,8 @@ void main() {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(
MaterialApp(
home: const Material(
const MaterialApp(
home: Material(
child: DefaultTextStyle(
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0),
child: Center(
......
......@@ -610,8 +610,8 @@ void main() {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(
MaterialApp(
home: const Center(
const MaterialApp(
home: Center(
child: Tooltip(
message: 'Foo',
child: Text('Bar'),
......@@ -645,8 +645,8 @@ void main() {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(
MaterialApp(
home: const Center(
const MaterialApp(
home: Center(
child: Tooltip(
message: 'Foo',
child: Text('Bar'),
......
......@@ -269,7 +269,7 @@ void main() {
testWidgets('Banner widget in MaterialApp', (WidgetTester tester) async {
debugDisableShadows = false;
await tester.pumpWidget(MaterialApp(home: const Placeholder()));
await tester.pumpWidget(const MaterialApp(home: Placeholder()));
expect(find.byType(CheckedModeBanner), paints
..save()
..translate(x: 800.0, y: 0.0)
......
......@@ -7,8 +7,8 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('reassemble does not crash', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: const Text('Hello World')
await tester.pumpWidget(const MaterialApp(
home: Text('Hello World')
));
await tester.pump();
tester.binding.reassembleApplication();
......
......@@ -10,8 +10,8 @@ void main() {
testWidgets('receiveAction() forwards exception when exception occurs during action processing',
(WidgetTester tester) async {
// Setup a widget that can receive focus so that we can open the keyboard.
final Widget widget = MaterialApp(
home: const Material(
const Widget widget = MaterialApp(
home: Material(
child: TextField(),
),
);
......
......@@ -533,8 +533,8 @@ void main() {
group('getSemanticsData', () {
testWidgets('throws when there are no semantics', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Scaffold(
const MaterialApp(
home: Scaffold(
body: Text('hello'),
),
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment