Unverified Commit 0d4b5ae1 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Dev, examples/api, etc updated for Material 3 by default (#129683)

Updated tests in dev, examples/api, and tests/widgets to ensure that
they continue to pass when the default for `ThemeData.useMaterial3` is
changed to true.

This is the final set of changes required for
https://github.com/flutter/flutter/issues/127064.
parent 32fe4d7f
...@@ -10,6 +10,7 @@ void main() { ...@@ -10,6 +10,7 @@ void main() {
// This should fail with user created widget = Row. // This should fail with user created widget = Row.
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('RenderFlex OverFlow'), title: const Text('RenderFlex OverFlow'),
......
...@@ -50,11 +50,13 @@ class StocksAppState extends State<StocksApp> { ...@@ -50,11 +50,13 @@ class StocksAppState extends State<StocksApp> {
switch (_configuration.stockMode) { switch (_configuration.stockMode) {
case StockMode.optimistic: case StockMode.optimistic:
return ThemeData( return ThemeData(
useMaterial3: false,
brightness: Brightness.light, brightness: Brightness.light,
primarySwatch: Colors.purple, primarySwatch: Colors.purple,
); );
case StockMode.pessimistic: case StockMode.pessimistic:
return ThemeData( return ThemeData(
useMaterial3: false,
brightness: Brightness.dark, brightness: Brightness.dark,
primarySwatch: Colors.purple, primarySwatch: Colors.purple,
); );
......
...@@ -104,6 +104,7 @@ class ContactsDemoState extends State<ContactsDemo> { ...@@ -104,6 +104,7 @@ class ContactsDemoState extends State<ContactsDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Theme( return Theme(
data: ThemeData( data: ThemeData(
useMaterial3: false,
brightness: Brightness.light, brightness: Brightness.light,
primarySwatch: Colors.indigo, primarySwatch: Colors.indigo,
platform: Theme.of(context).platform, platform: Theme.of(context).platform,
......
...@@ -26,6 +26,7 @@ ThemeData _buildDarkTheme() { ...@@ -26,6 +26,7 @@ ThemeData _buildDarkTheme() {
background: const Color(0xFF202124), background: const Color(0xFF202124),
); );
final ThemeData base = ThemeData( final ThemeData base = ThemeData(
useMaterial3: false,
brightness: Brightness.dark, brightness: Brightness.dark,
colorScheme: colorScheme, colorScheme: colorScheme,
primaryColor: primaryColor, primaryColor: primaryColor,
...@@ -50,6 +51,7 @@ ThemeData _buildLightTheme() { ...@@ -50,6 +51,7 @@ ThemeData _buildLightTheme() {
error: const Color(0xFFB00020), error: const Color(0xFFB00020),
); );
final ThemeData base = ThemeData( final ThemeData base = ThemeData(
useMaterial3: false,
brightness: Brightness.light, brightness: Brightness.light,
colorScheme: colorScheme, colorScheme: colorScheme,
primaryColor: primaryColor, primaryColor: primaryColor,
......
...@@ -10,7 +10,7 @@ void main() { ...@@ -10,7 +10,7 @@ void main() {
testWidgets('Button locations are OK', (WidgetTester tester) async { testWidgets('Button locations are OK', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/pull/85351 // Regression test for https://github.com/flutter/flutter/pull/85351
{ {
await tester.pumpWidget(const MaterialApp(home: ButtonsDemo())); await tester.pumpWidget(MaterialApp(theme: ThemeData(useMaterial3: false), home: const ButtonsDemo()));
expect(find.byType(ElevatedButton).evaluate().length, 2); expect(find.byType(ElevatedButton).evaluate().length, 2);
final Offset topLeft1 = tester.getTopLeft(find.byType(ElevatedButton).first); final Offset topLeft1 = tester.getTopLeft(find.byType(ElevatedButton).first);
final Offset topLeft2 = tester.getTopLeft(find.byType(ElevatedButton).last); final Offset topLeft2 = tester.getTopLeft(find.byType(ElevatedButton).last);
......
...@@ -79,30 +79,29 @@ class _BodyState extends State<Body> with WidgetsBindingObserver { ...@@ -79,30 +79,29 @@ class _BodyState extends State<Body> with WidgetsBindingObserver {
return Center( return Center(
child: SizedBox( child: SizedBox(
width: 300, width: 300,
child: IntrinsicHeight( child: Column(
child: Column( mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
RadioListTile<bool>( RadioListTile<bool>(
title: const Text('Do Not Allow Exit'), title: const Text('Do Not Allow Exit'),
groupValue: _shouldExit, groupValue: _shouldExit,
value: false, value: false,
onChanged: _radioChanged, onChanged: _radioChanged,
), ),
RadioListTile<bool>( RadioListTile<bool>(
title: const Text('Allow Exit'), title: const Text('Allow Exit'),
groupValue: _shouldExit, groupValue: _shouldExit,
value: true, value: true,
onChanged: _radioChanged, onChanged: _radioChanged,
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
ElevatedButton( ElevatedButton(
onPressed: _quit, onPressed: _quit,
child: const Text('Quit'), child: const Text('Quit'),
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
Text(lastResponse), Text(lastResponse),
], ],
),
), ),
), ),
); );
......
...@@ -18,8 +18,9 @@ class HeroApp extends StatelessWidget { ...@@ -18,8 +18,9 @@ class HeroApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return MaterialApp(
home: HeroExample(), theme: ThemeData(useMaterial3: true),
home: const HeroExample(),
); );
} }
} }
......
...@@ -13,8 +13,9 @@ class AnimatedSlideApp extends StatelessWidget { ...@@ -13,8 +13,9 @@ class AnimatedSlideApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return MaterialApp(
home: AnimatedSlideExample(), theme: ThemeData(useMaterial3: true),
home: const AnimatedSlideExample(),
); );
} }
} }
......
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
// Jump 25% into the transition (total length = 300ms) // Jump 25% into the transition (total length = 300ms)
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
heroSize = tester.getSize(find.byType(Container).first); heroSize = tester.getSize(find.byType(Container).first);
expect(heroSize.width.roundToDouble(), 171.0); expect(heroSize.width.roundToDouble(), 170.0);
expect(heroSize.height.roundToDouble(), 73.0); expect(heroSize.height.roundToDouble(), 73.0);
// Jump to 50% into the transition. // Jump to 50% into the transition.
...@@ -61,7 +61,7 @@ void main() { ...@@ -61,7 +61,7 @@ void main() {
// Jump to 75% into the transition. // Jump to 75% into the transition.
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
heroSize = tester.getSize(find.byType(Container).first); heroSize = tester.getSize(find.byType(Container).first);
expect(heroSize.width.roundToDouble(), 171.0); expect(heroSize.width.roundToDouble(), 170.0);
expect(heroSize.height.roundToDouble(), 73.0); expect(heroSize.height.roundToDouble(), 73.0);
// Jump to 100% into the transition. // Jump to 100% into the transition.
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
logoOffset = tester.getCenter(find.byType(FlutterLogo)); logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx.roundToDouble(), 376.0); expect(logoOffset.dx.roundToDouble(), 376.0);
expect(logoOffset.dy.roundToDouble(), 140.0); expect(logoOffset.dy.roundToDouble(), 137.0);
// Test X axis slider. // Test X axis slider.
final Offset x = tester.getCenter(find.text('X')); final Offset x = tester.getCenter(find.text('X'));
...@@ -32,6 +32,6 @@ void main() { ...@@ -32,6 +32,6 @@ void main() {
logoOffset = tester.getCenter(find.byType(FlutterLogo)); logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx.roundToDouble(), 178.0); expect(logoOffset.dx.roundToDouble(), 178.0);
expect(logoOffset.dy.roundToDouble(), 140.0); expect(logoOffset.dy.roundToDouble(), 137.0);
}); });
} }
...@@ -463,6 +463,7 @@ void main() { ...@@ -463,6 +463,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
body: Row( body: Row(
crossAxisAlignment: CrossAxisAlignment.baseline, crossAxisAlignment: CrossAxisAlignment.baseline,
...@@ -517,6 +518,7 @@ void main() { ...@@ -517,6 +518,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
body: Row( body: Row(
crossAxisAlignment: CrossAxisAlignment.baseline, crossAxisAlignment: CrossAxisAlignment.baseline,
......
...@@ -41,7 +41,7 @@ void main() { ...@@ -41,7 +41,7 @@ void main() {
colorFilter: sepia, colorFilter: sepia,
child: MaterialApp( child: MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue), theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: false),
home: Scaffold( home: Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Sepia ColorFilter Test'), title: const Text('Sepia ColorFilter Test'),
......
...@@ -927,6 +927,7 @@ void main() { ...@@ -927,6 +927,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Padding( home: Padding(
padding: const EdgeInsets.only(top: 0.25), padding: const EdgeInsets.only(top: 0.25),
child: Material( child: Material(
......
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
imageFilter: matrix, imageFilter: matrix,
child: MaterialApp( child: MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue), theme: ThemeData(useMaterial3: false, primarySwatch: Colors.blue),
home: Scaffold( home: Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Matrix ImageFilter Test'), title: const Text('Matrix ImageFilter Test'),
...@@ -132,7 +132,7 @@ void main() { ...@@ -132,7 +132,7 @@ void main() {
imageFilter: matrixFilter, imageFilter: matrixFilter,
child: MaterialApp( child: MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue), theme: ThemeData(useMaterial3: false, primarySwatch: Colors.blue),
home: Scaffold( home: Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Matrix ImageFilter Test'), title: const Text('Matrix ImageFilter Test'),
......
...@@ -231,7 +231,7 @@ void main() { ...@@ -231,7 +231,7 @@ void main() {
testWidgets('ListView reinvoke builders', (WidgetTester tester) async { testWidgets('ListView reinvoke builders', (WidgetTester tester) async {
late StateSetter setState; late StateSetter setState;
ThemeData themeData = ThemeData.light(); ThemeData themeData = ThemeData.light(useMaterial3: false);
Widget itemBuilder(BuildContext context, int index) { Widget itemBuilder(BuildContext context, int index) {
return Container( return Container(
...@@ -263,7 +263,7 @@ void main() { ...@@ -263,7 +263,7 @@ void main() {
expect(widget.color, equals(Colors.blue)); expect(widget.color, equals(Colors.blue));
setState(() { setState(() {
themeData = ThemeData(primarySwatch: Colors.green); themeData = ThemeData(primarySwatch: Colors.green, useMaterial3: false);
}); });
await tester.pump(); await tester.pump();
......
...@@ -32,17 +32,8 @@ Widget buildTest({ ...@@ -32,17 +32,8 @@ Widget buildTest({
Key? key, Key? key,
bool expanded = true, bool expanded = true,
}) { }) {
return Localizations( return MaterialApp(
locale: const Locale('en', 'US'), home: Scaffold(
delegates: const <LocalizationsDelegate<dynamic>>[
DefaultMaterialLocalizations.delegate,
DefaultWidgetsLocalizations.delegate,
],
child: Directionality(
textDirection: TextDirection.ltr,
child: MediaQuery(
data: const MediaQueryData(),
child: Scaffold(
drawerDragStartBehavior: DragStartBehavior.down, drawerDragStartBehavior: DragStartBehavior.down,
body: DefaultTabController( body: DefaultTabController(
length: 4, length: 4,
...@@ -114,8 +105,6 @@ Widget buildTest({ ...@@ -114,8 +105,6 @@ Widget buildTest({
), ),
), ),
), ),
),
),
); );
} }
...@@ -577,7 +566,7 @@ void main() { ...@@ -577,7 +566,7 @@ void main() {
const List<String> tabs = <String>['Hello', 'World']; const List<String> tabs = <String>['Hello', 'World'];
int buildCount = 0; int buildCount = 0;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp(home: Material(child: MaterialApp(theme: ThemeData(useMaterial3: false), home: Material(child:
// THE FOLLOWING SECTION IS FROM THE NestedScrollView DOCUMENTATION // THE FOLLOWING SECTION IS FROM THE NestedScrollView DOCUMENTATION
// (EXCEPT FOR THE CHANGES TO THE buildCount COUNTER) // (EXCEPT FOR THE CHANGES TO THE buildCount COUNTER)
DefaultTabController( DefaultTabController(
...@@ -2274,6 +2263,7 @@ void main() { ...@@ -2274,6 +2263,7 @@ void main() {
// Regression tests for https://github.com/flutter/flutter/issues/17096 // Regression tests for https://github.com/flutter/flutter/issues/17096
Widget buildBallisticTest(ScrollController controller) { Widget buildBallisticTest(ScrollController controller) {
return MaterialApp( return MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
body: NestedScrollView( body: NestedScrollView(
controller: controller, controller: controller,
......
...@@ -155,6 +155,7 @@ void main() { ...@@ -155,6 +155,7 @@ void main() {
testWidgets('offset is correctly handled in Opacity', (WidgetTester tester) async { testWidgets('offset is correctly handled in Opacity', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
body: SingleChildScrollView( body: SingleChildScrollView(
child: RepaintBoundary( child: RepaintBoundary(
......
...@@ -47,20 +47,23 @@ void main() { ...@@ -47,20 +47,23 @@ void main() {
testWidgets('PhysicalModel - clips when overflows and elevation is 0', (WidgetTester tester) async { testWidgets('PhysicalModel - clips when overflows and elevation is 0', (WidgetTester tester) async {
const Key key = Key('test'); const Key key = Key('test');
await tester.pumpWidget( await tester.pumpWidget(
const MediaQuery( Theme(
key: key, data: ThemeData(useMaterial3: false),
data: MediaQueryData(), child: const MediaQuery(
child: Directionality( key: key,
textDirection: TextDirection.ltr, data: MediaQueryData(),
child: Padding( child: Directionality(
padding: EdgeInsets.all(50), textDirection: TextDirection.ltr,
child: Row( child: Padding(
children: <Widget>[ padding: EdgeInsets.all(50),
Material(child: Text('A long long long long long long long string')), child: Row(
Material(child: Text('A long long long long long long long string')), children: <Widget>[
Material(child: Text('A long long long long long long long string')), Material(child: Text('A long long long long long long long string')),
Material(child: Text('A long long long long long long long string')), Material(child: Text('A long long long long long long long string')),
], Material(child: Text('A long long long long long long long string')),
Material(child: Text('A long long long long long long long string')),
],
),
), ),
), ),
), ),
......
...@@ -158,6 +158,7 @@ void main() { ...@@ -158,6 +158,7 @@ void main() {
testWidgets('select to scroll works for small scrollable', (WidgetTester tester) async { testWidgets('select to scroll works for small scrollable', (WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: SelectionArea( home: SelectionArea(
selectionControls: materialTextSelectionControls, selectionControls: materialTextSelectionControls,
child: Scaffold( child: Scaffold(
......
...@@ -947,6 +947,7 @@ void main() { ...@@ -947,6 +947,7 @@ void main() {
final ScrollController outerController = ScrollController(); final ScrollController outerController = ScrollController();
final ScrollController innerController = ScrollController(); final ScrollController innerController = ScrollController();
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
body: SingleChildScrollView( body: SingleChildScrollView(
controller: outerController, controller: outerController,
......
...@@ -1248,6 +1248,7 @@ void main() { ...@@ -1248,6 +1248,7 @@ void main() {
final UniqueKey outerText = UniqueKey(); final UniqueKey outerText = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: SelectableRegion( home: SelectableRegion(
focusNode: FocusNode(), focusNode: FocusNode(),
selectionControls: materialTextSelectionControls, selectionControls: materialTextSelectionControls,
......
...@@ -59,20 +59,23 @@ Widget overlay({ Widget? child }) { ...@@ -59,20 +59,23 @@ Widget overlay({ Widget? child }) {
} }
Widget overlayWithEntry(OverlayEntry entry) { Widget overlayWithEntry(OverlayEntry entry) {
return Localizations( return Theme(
locale: const Locale('en', 'US'), data: ThemeData(useMaterial3: false),
delegates: <LocalizationsDelegate<dynamic>>[ child: Localizations(
WidgetsLocalizationsDelegate(), locale: const Locale('en', 'US'),
MaterialLocalizationsDelegate(), delegates: <LocalizationsDelegate<dynamic>>[
], WidgetsLocalizationsDelegate(),
child: Directionality( MaterialLocalizationsDelegate(),
textDirection: TextDirection.ltr, ],
child: MediaQuery( child: Directionality(
data: const MediaQueryData(size: Size(800.0, 600.0)), textDirection: TextDirection.ltr,
child: Overlay( child: MediaQuery(
initialEntries: <OverlayEntry>[ data: const MediaQueryData(size: Size(800.0, 600.0)),
entry, child: Overlay(
], initialEntries: <OverlayEntry>[
entry,
],
),
), ),
), ),
), ),
...@@ -80,19 +83,22 @@ Widget overlayWithEntry(OverlayEntry entry) { ...@@ -80,19 +83,22 @@ Widget overlayWithEntry(OverlayEntry entry) {
} }
Widget boilerplate({ Widget? child }) { Widget boilerplate({ Widget? child }) {
return Localizations( return Theme(
locale: const Locale('en', 'US'), data: ThemeData(useMaterial3: false),
delegates: <LocalizationsDelegate<dynamic>>[ child:Localizations(
WidgetsLocalizationsDelegate(), locale: const Locale('en', 'US'),
MaterialLocalizationsDelegate(), delegates: <LocalizationsDelegate<dynamic>>[
], WidgetsLocalizationsDelegate(),
child: Directionality( MaterialLocalizationsDelegate(),
textDirection: TextDirection.ltr, ],
child: MediaQuery( child: Directionality(
data: const MediaQueryData(size: Size(800.0, 600.0)), textDirection: TextDirection.ltr,
child: Center( child: MediaQuery(
child: Material( data: const MediaQueryData(size: Size(800.0, 600.0)),
child: child, child: Center(
child: Material(
child: child,
),
), ),
), ),
), ),
...@@ -100,6 +106,7 @@ Widget boilerplate({ Widget? child }) { ...@@ -100,6 +106,7 @@ Widget boilerplate({ Widget? child }) {
); );
} }
Future<void> skipPastScrollingAnimation(WidgetTester tester) async { Future<void> skipPastScrollingAnimation(WidgetTester tester) async {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 200)); await tester.pump(const Duration(milliseconds: 200));
...@@ -4130,7 +4137,7 @@ void main() { ...@@ -4130,7 +4137,7 @@ void main() {
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText('something'), child: SelectableText('something'),
...@@ -4153,7 +4160,7 @@ void main() { ...@@ -4153,7 +4160,7 @@ void main() {
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -4174,7 +4181,7 @@ void main() { ...@@ -4174,7 +4181,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -4200,7 +4207,7 @@ void main() { ...@@ -4200,7 +4207,7 @@ void main() {
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -4224,7 +4231,7 @@ void main() { ...@@ -4224,7 +4231,7 @@ void main() {
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -4256,7 +4263,7 @@ void main() { ...@@ -4256,7 +4263,7 @@ void main() {
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -4285,7 +4292,7 @@ void main() { ...@@ -4285,7 +4292,7 @@ void main() {
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -4314,7 +4321,7 @@ void main() { ...@@ -4314,7 +4321,7 @@ void main() {
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(platform: TargetPlatform.android), theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
home: const Material( home: const Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -5019,6 +5026,7 @@ void main() { ...@@ -5019,6 +5026,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Material( home: Material(
child: Center( child: Center(
child: SelectableText( child: SelectableText(
...@@ -5186,6 +5194,7 @@ void main() { ...@@ -5186,6 +5194,7 @@ void main() {
testWidgets('keeps alive when has focus', (WidgetTester tester) async { testWidgets('keeps alive when has focus', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: DefaultTabController( home: DefaultTabController(
length: 2, length: 2,
child: Scaffold( child: Scaffold(
...@@ -5349,8 +5358,9 @@ void main() { ...@@ -5349,8 +5358,9 @@ void main() {
const TextStyle textStyle = TextStyle(color: Color(0xff00ff00), fontSize: 12.0); const TextStyle textStyle = TextStyle(color: Color(0xff00ff00), fontSize: 12.0);
await tester.pumpWidget( await tester.pumpWidget(
const MaterialApp( MaterialApp(
home: SelectableText.rich( theme: ThemeData(useMaterial3: false),
home: const SelectableText.rich(
TextSpan( TextSpan(
text: 'Abcd', text: 'Abcd',
style: textStyle, style: textStyle,
...@@ -5369,6 +5379,7 @@ void main() { ...@@ -5369,6 +5379,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: SelectableText( home: SelectableText(
'I love Flutter!', 'I love Flutter!',
onSelectionChanged: (TextSelection s, _) { onSelectionChanged: (TextSelection s, _) {
...@@ -5408,6 +5419,7 @@ void main() { ...@@ -5408,6 +5419,7 @@ void main() {
TextSelection? selection; TextSelection? selection;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Material( home: Material(
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
......
...@@ -24,6 +24,7 @@ void main() { ...@@ -24,6 +24,7 @@ void main() {
}) { }) {
return MaterialApp( return MaterialApp(
theme: ThemeData( theme: ThemeData(
useMaterial3: false,
materialTapTargetSize: MaterialTapTargetSize.padded, materialTapTargetSize: MaterialTapTargetSize.padded,
), ),
home: Scaffold( home: Scaffold(
......
...@@ -244,35 +244,25 @@ void main() { ...@@ -244,35 +244,25 @@ void main() {
testWidgets('Sliver appbars - floating and pinned - second app bar stacks below', (WidgetTester tester) async { testWidgets('Sliver appbars - floating and pinned - second app bar stacks below', (WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
await tester.pumpWidget( await tester.pumpWidget(
Localizations( MaterialApp(
locale: const Locale('en', 'us'), theme: ThemeData(useMaterial3: false),
delegates: const <LocalizationsDelegate<dynamic>>[ home: CustomScrollView(
DefaultWidgetsLocalizations.delegate, controller: controller,
DefaultMaterialLocalizations.delegate, slivers: <Widget>[
], const SliverAppBar(floating: true, pinned: true, expandedHeight: 200.0, title: Text('A')),
child: Directionality( const SliverAppBar(primary: false, pinned: true, title: Text('B')),
textDirection: TextDirection.ltr, SliverList(
child: MediaQuery( delegate: SliverChildListDelegate(
data: const MediaQueryData(), const <Widget>[
child: CustomScrollView( Text('C'),
controller: controller, Text('D'),
slivers: <Widget>[ SizedBox(height: 500.0),
const SliverAppBar(floating: true, pinned: true, expandedHeight: 200.0, title: Text('A')), Text('E'),
const SliverAppBar(primary: false, pinned: true, title: Text('B')), SizedBox(height: 500.0),
SliverList( ],
delegate: SliverChildListDelegate( ),
const <Widget>[
Text('C'),
Text('D'),
SizedBox(height: 500.0),
Text('E'),
SizedBox(height: 500.0),
],
),
),
],
), ),
), ],
), ),
), ),
); );
......
...@@ -426,6 +426,7 @@ void main() { ...@@ -426,6 +426,7 @@ void main() {
} }
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
body: CustomScrollView( body: CustomScrollView(
slivers: <Widget> [ slivers: <Widget> [
......
...@@ -191,6 +191,7 @@ void main() { ...@@ -191,6 +191,7 @@ void main() {
testWidgets('Text Fade', (WidgetTester tester) async { testWidgets('Text Fade', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: RepaintBoundary( body: RepaintBoundary(
...@@ -520,7 +521,7 @@ void main() { ...@@ -520,7 +521,7 @@ void main() {
testWidgets('Text Inline widget', (WidgetTester tester) async { testWidgets('Text Inline widget', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
Center( Theme(data: ThemeData(useMaterial3: false), child: Center(
child: RepaintBoundary( child: RepaintBoundary(
child: Material( child: Material(
child: Directionality( child: Directionality(
...@@ -604,7 +605,7 @@ void main() { ...@@ -604,7 +605,7 @@ void main() {
), ),
), ),
), ),
), )),
); );
await expectLater( await expectLater(
find.byType(Container), find.byType(Container),
...@@ -616,6 +617,7 @@ void main() { ...@@ -616,6 +617,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
Center( Center(
child: MaterialApp( child: MaterialApp(
theme: ThemeData(useMaterial3: false),
home: RepaintBoundary( home: RepaintBoundary(
child: Material( child: Material(
child: Container( child: Container(
...@@ -662,6 +664,7 @@ void main() { ...@@ -662,6 +664,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
Center( Center(
child: MaterialApp( child: MaterialApp(
theme: ThemeData(useMaterial3: false),
home: RepaintBoundary( home: RepaintBoundary(
child: Material( child: Material(
child: Container( child: Container(
......
...@@ -208,6 +208,7 @@ void main() { ...@@ -208,6 +208,7 @@ void main() {
double textScaleFactor = 1.0; double textScaleFactor = 1.0;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
appBar: AppBar(title: const Text('title')), appBar: AppBar(title: const Text('title')),
body: Center( body: Center(
...@@ -236,6 +237,7 @@ void main() { ...@@ -236,6 +237,7 @@ void main() {
textScaleFactor = textScaleFactor * 5; textScaleFactor = textScaleFactor * 5;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
appBar: AppBar(title: const Text('title')), appBar: AppBar(title: const Text('title')),
body: Center( body: Center(
...@@ -1132,6 +1134,7 @@ void main() { ...@@ -1132,6 +1134,7 @@ void main() {
Future<void> createText(TextWidthBasis textWidthBasis) { Future<void> createText(TextWidthBasis textWidthBasis) {
return tester.pumpWidget( return tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold( home: Scaffold(
body: Center( body: Center(
// Each word takes up more than a half of a line. Together they // Each word takes up more than a half of a line. Together they
......
...@@ -46,6 +46,7 @@ Widget simpleBuilderTest({ ...@@ -46,6 +46,7 @@ Widget simpleBuilderTest({
bool setLayoutOffset = true, bool setLayoutOffset = true,
}) { }) {
return MaterialApp( return MaterialApp(
theme: ThemeData(useMaterial3: false),
restorationScopeId: restorationID, restorationScopeId: restorationID,
home: Scaffold( home: Scaffold(
body: SimpleBuilderTableView( body: SimpleBuilderTableView(
......
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