mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Update unit tests in material library for Material 3 (#128725)
Updates most of the unit tests in the packages/flutter/test/material folder so that they'll pass if ThemeData.useMaterial3 defaults to true. All of the tests have wired useMaterial3 to false and will need to be updated with a M3 version. related to #127064
This commit is contained in:
parent
d499533602
commit
a5f8b64ef9
@ -63,6 +63,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
title: 'Pirate app',
|
title: 'Pirate app',
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@ -167,8 +168,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Center(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Center(
|
||||||
child: LicensePage(),
|
child: LicensePage(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -220,9 +222,10 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
title: 'Pirate app',
|
title: 'Pirate app',
|
||||||
home: Center(
|
home: const Center(
|
||||||
child: LicensePage(
|
child: LicensePage(
|
||||||
applicationName: 'LicensePage test app',
|
applicationName: 'LicensePage test app',
|
||||||
applicationVersion: '0.1.2',
|
applicationVersion: '0.1.2',
|
||||||
@ -298,6 +301,7 @@ void main() {
|
|||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
primaryTextTheme: const TextTheme(
|
primaryTextTheme: const TextTheme(
|
||||||
titleLarge: titleTextStyle,
|
titleLarge: titleTextStyle,
|
||||||
titleSmall: subtitleTextStyle,
|
titleSmall: subtitleTextStyle,
|
||||||
@ -384,8 +388,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: MediaQuery(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const MediaQuery(
|
||||||
data: MediaQueryData(
|
data: MediaQueryData(
|
||||||
padding: EdgeInsets.all(safeareaPadding),
|
padding: EdgeInsets.all(safeareaPadding),
|
||||||
),
|
),
|
||||||
@ -830,7 +835,7 @@ void main() {
|
|||||||
const Color cardColor = Color(0xFF654321);
|
const Color cardColor = Color(0xFF654321);
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light(useMaterial3: false).copyWith(
|
||||||
scaffoldBackgroundColor: scaffoldColor,
|
scaffoldBackgroundColor: scaffoldColor,
|
||||||
cardColor: cardColor,
|
cardColor: cardColor,
|
||||||
),
|
),
|
||||||
@ -1051,7 +1056,12 @@ void main() {
|
|||||||
|
|
||||||
testWidgetsWithLeakTracking('Error handling test', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Error handling test', (WidgetTester tester) async {
|
||||||
LicenseRegistry.addLicense(() => Stream<LicenseEntry>.error(Exception('Injected failure')));
|
LicenseRegistry.addLicense(() => Stream<LicenseEntry>.error(Exception('Injected failure')));
|
||||||
await tester.pumpWidget(const MaterialApp(home: Material(child: AboutListTile())));
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Material(child: AboutListTile())
|
||||||
|
)
|
||||||
|
);
|
||||||
await tester.tap(find.byType(ListTile));
|
await tester.tap(find.byType(ListTile));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
await tester.pump(const Duration(seconds: 2));
|
await tester.pump(const Duration(seconds: 2));
|
||||||
@ -1082,9 +1092,10 @@ void main() {
|
|||||||
await tester.binding.setSurfaceSize(defaultSize);
|
await tester.binding.setSurfaceSize(defaultSize);
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
title: title,
|
title: title,
|
||||||
home: Scaffold(
|
home: const Scaffold(
|
||||||
body: Directionality(
|
body: Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
child: LicensePage(),
|
child: LicensePage(),
|
||||||
@ -1145,9 +1156,10 @@ void main() {
|
|||||||
await tester.binding.setSurfaceSize(defaultSize);
|
await tester.binding.setSurfaceSize(defaultSize);
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
title: title,
|
title: title,
|
||||||
home: Scaffold(
|
home: const Scaffold(
|
||||||
body: Directionality(
|
body: Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
child: LicensePage(),
|
child: LicensePage(),
|
||||||
|
@ -10,6 +10,7 @@ void main() {
|
|||||||
final List<String> log = <String>[];
|
final List<String> log = <String>[];
|
||||||
final Widget app = MaterialApp(
|
final Widget app = MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
primarySwatch: Colors.green,
|
primarySwatch: Colors.green,
|
||||||
),
|
),
|
||||||
home: const Placeholder(),
|
home: const Placeholder(),
|
||||||
@ -42,6 +43,7 @@ void main() {
|
|||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
primarySwatch: Colors.yellow,
|
primarySwatch: Colors.yellow,
|
||||||
),
|
),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
|
@ -995,6 +995,7 @@ void main() {
|
|||||||
const Color secondaryColor = Color(0xff008800);
|
const Color secondaryColor = Color(0xff008800);
|
||||||
final Color glowSecondaryColor = secondaryColor.withOpacity(0.05);
|
final Color glowSecondaryColor = secondaryColor.withOpacity(0.05);
|
||||||
final ThemeData theme = ThemeData.from(
|
final ThemeData theme = ThemeData.from(
|
||||||
|
useMaterial3: false,
|
||||||
colorScheme: const ColorScheme.light().copyWith(secondary: secondaryColor),
|
colorScheme: const ColorScheme.light().copyWith(secondary: secondaryColor),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -1264,6 +1265,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('ScrollBehavior default android overscroll indicator', (WidgetTester tester) async {
|
testWidgets('ScrollBehavior default android overscroll indicator', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
scrollBehavior: const MaterialScrollBehavior(),
|
scrollBehavior: const MaterialScrollBehavior(),
|
||||||
home: ListView(
|
home: ListView(
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
|
@ -459,7 +459,7 @@ void main() {
|
|||||||
const Color highlightColor = Color(0xFF112233);
|
const Color highlightColor = Color(0xFF112233);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light(useMaterial3: false).copyWith(
|
||||||
focusColor: highlightColor,
|
focusColor: highlightColor,
|
||||||
),
|
),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
|
@ -457,6 +457,7 @@ void main() {
|
|||||||
const String contentText = 'Content';
|
const String contentText = 'Content';
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: MaterialBanner(
|
body: MaterialBanner(
|
||||||
content: const Text(contentText),
|
content: const Text(contentText),
|
||||||
@ -503,6 +504,7 @@ void main() {
|
|||||||
const Key tapTarget = Key('tap-target');
|
const Key tapTarget = Key('tap-target');
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -120,6 +120,7 @@ void main() {
|
|||||||
child: RepaintBoundary(
|
child: RepaintBoundary(
|
||||||
key: key,
|
key: key,
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () { },
|
onPressed: () { },
|
||||||
@ -217,9 +218,10 @@ void main() {
|
|||||||
expect(babRect, const Rect.fromLTRB(240, 520, 560, 600));
|
expect(babRect, const Rect.fromLTRB(240, 520, 560, 600));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('color defaults to Theme.bottomAppBarColor', (WidgetTester tester) async {
|
testWidgets('color defaults to Theme.bottomAppBarColor in M2', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Theme(
|
return Theme(
|
||||||
@ -245,6 +247,7 @@ void main() {
|
|||||||
testWidgets('color overrides theme color', (WidgetTester tester) async {
|
testWidgets('color overrides theme color', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Theme(
|
return Theme(
|
||||||
@ -324,7 +327,7 @@ void main() {
|
|||||||
testWidgets('dark theme applies an elevation overlay color', (WidgetTester tester) async {
|
testWidgets('dark theme applies an elevation overlay color', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData.from(colorScheme: const ColorScheme.dark()),
|
theme: ThemeData.from(useMaterial3: false, colorScheme: const ColorScheme.dark()),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
bottomNavigationBar: BottomAppBar(
|
bottomNavigationBar: BottomAppBar(
|
||||||
color: const ColorScheme.dark().surface,
|
color: const ColorScheme.dark().surface,
|
||||||
@ -508,8 +511,9 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('observes safe area', (WidgetTester tester) async {
|
testWidgets('observes safe area', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: MediaQuery(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const MediaQuery(
|
||||||
data: MediaQueryData(
|
data: MediaQueryData(
|
||||||
padding: EdgeInsets.all(50.0),
|
padding: EdgeInsets.all(50.0),
|
||||||
),
|
),
|
||||||
@ -566,8 +570,10 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('BottomAppBar with shape when Scaffold.bottomNavigationBar == null', (WidgetTester tester) async {
|
testWidgets('BottomAppBar with shape when Scaffold.bottomNavigationBar == null', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/80878
|
// Regression test for https://github.com/flutter/flutter/issues/80878
|
||||||
|
final ThemeData theme = ThemeData();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: theme,
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
@ -595,7 +601,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(tester.getRect(find.byType(FloatingActionButton)), const Rect.fromLTRB(372, 528, 428, 584));
|
expect(tester.getRect(find.byType(FloatingActionButton)), const Rect.fromLTRB(372, 528, 428, 584));
|
||||||
expect(tester.getSize(find.byType(BottomAppBar)), const Size(800, 50));
|
expect(tester.getSize(find.byType(BottomAppBar)), theme.useMaterial3 ? const Size(800, 80) : const Size(800, 50));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('notch with margin and top padding, home safe area', (WidgetTester tester) async {
|
testWidgets('notch with margin and top padding, home safe area', (WidgetTester tester) async {
|
||||||
|
@ -36,6 +36,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
bottomAppBarTheme: theme,
|
bottomAppBarTheme: theme,
|
||||||
bottomAppBarColor: themeColor
|
bottomAppBarColor: themeColor
|
||||||
),
|
),
|
||||||
@ -53,6 +54,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
bottomAppBarTheme: theme,
|
bottomAppBarTheme: theme,
|
||||||
bottomAppBarColor: themeColor
|
bottomAppBarColor: themeColor
|
||||||
),
|
),
|
||||||
@ -67,7 +69,7 @@ void main() {
|
|||||||
const Color themeColor = Colors.white10;
|
const Color themeColor = Colors.white10;
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(bottomAppBarColor: themeColor),
|
theme: ThemeData(useMaterial3: false, bottomAppBarColor: themeColor),
|
||||||
home: const Scaffold(body: BottomAppBar()),
|
home: const Scaffold(body: BottomAppBar()),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -77,7 +79,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('BAB color - Default', (WidgetTester tester) async {
|
testWidgets('BAB color - Default', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(),
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: const Scaffold(body: BottomAppBar()),
|
home: const Scaffold(body: BottomAppBar()),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -102,8 +104,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('BAB theme does not affect defaults', (WidgetTester tester) async {
|
testWidgets('BAB theme does not affect defaults', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(const MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
home: Scaffold(body: BottomAppBar()),
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(body: BottomAppBar()),
|
||||||
));
|
));
|
||||||
|
|
||||||
final PhysicalShape widget = _getBabRenderObject(tester);
|
final PhysicalShape widget = _getBabRenderObject(tester);
|
||||||
|
@ -52,6 +52,7 @@ void main() {
|
|||||||
testWidgets('BottomNavigationBar content test', (WidgetTester tester) async {
|
testWidgets('BottomNavigationBar content test', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
items: const <BottomNavigationBarItem>[
|
items: const <BottomNavigationBarItem>[
|
||||||
@ -81,7 +82,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light(useMaterial3: false).copyWith(
|
||||||
colorScheme: const ColorScheme.light().copyWith(primary: primaryColor),
|
colorScheme: const ColorScheme.light().copyWith(primary: primaryColor),
|
||||||
unselectedWidgetColor: unselectedWidgetColor,
|
unselectedWidgetColor: unselectedWidgetColor,
|
||||||
),
|
),
|
||||||
@ -413,6 +414,7 @@ void main() {
|
|||||||
testWidgets('Shifting BottomNavigationBar defaults', (WidgetTester tester) async {
|
testWidgets('Shifting BottomNavigationBar defaults', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
type: BottomNavigationBarType.shifting,
|
type: BottomNavigationBarType.shifting,
|
||||||
@ -991,6 +993,7 @@ void main() {
|
|||||||
testWidgets('BottomNavigationBar adds bottom padding to height', (WidgetTester tester) async {
|
testWidgets('BottomNavigationBar adds bottom padding to height', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: MediaQuery(
|
home: MediaQuery(
|
||||||
data: const MediaQueryData(viewPadding: EdgeInsets.only(bottom: 40.0)),
|
data: const MediaQueryData(viewPadding: EdgeInsets.only(bottom: 40.0)),
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@ -1323,6 +1326,7 @@ void main() {
|
|||||||
testWidgets('BottomNavigationBar responds to textScaleFactor', (WidgetTester tester) async {
|
testWidgets('BottomNavigationBar responds to textScaleFactor', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
@ -1396,6 +1400,7 @@ void main() {
|
|||||||
testWidgets('BottomNavigationBar does not grow with textScaleFactor when labels are provided', (WidgetTester tester) async {
|
testWidgets('BottomNavigationBar does not grow with textScaleFactor when labels are provided', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
@ -1484,19 +1489,22 @@ void main() {
|
|||||||
onGenerateRoute: (RouteSettings settings) {
|
onGenerateRoute: (RouteSettings settings) {
|
||||||
return MaterialPageRoute<void>(
|
return MaterialPageRoute<void>(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Scaffold(
|
return MaterialApp(
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
theme: ThemeData(useMaterial3: false),
|
||||||
items: const <BottomNavigationBarItem>[
|
home: Scaffold(
|
||||||
BottomNavigationBarItem(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
label: label,
|
items: const <BottomNavigationBarItem>[
|
||||||
icon: Icon(Icons.ac_unit),
|
BottomNavigationBarItem(
|
||||||
tooltip: label,
|
label: label,
|
||||||
),
|
icon: Icon(Icons.ac_unit),
|
||||||
BottomNavigationBarItem(
|
tooltip: label,
|
||||||
label: 'B',
|
),
|
||||||
icon: Icon(Icons.battery_alert),
|
BottomNavigationBarItem(
|
||||||
),
|
label: 'B',
|
||||||
],
|
icon: Icon(Icons.battery_alert),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -1566,6 +1574,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
items: <BottomNavigationBarItem>[
|
items: <BottomNavigationBarItem>[
|
||||||
@ -1595,6 +1604,7 @@ void main() {
|
|||||||
testWidgets('BottomNavigationBar paints circles', (WidgetTester tester) async {
|
testWidgets('BottomNavigationBar paints circles', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
items: const <BottomNavigationBarItem>[
|
items: const <BottomNavigationBarItem>[
|
||||||
@ -1924,6 +1934,7 @@ void main() {
|
|||||||
Widget runTest() {
|
Widget runTest() {
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: StatefulBuilder(
|
home: StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -2363,6 +2374,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -2410,6 +2422,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -2455,6 +2468,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -2490,8 +2504,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget boilerplate({ Widget? bottomNavigationBar, required TextDirection textDirection }) {
|
Widget boilerplate({ Widget? bottomNavigationBar, required TextDirection textDirection, bool? useMaterial3 }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: useMaterial3),
|
||||||
home: Localizations(
|
home: Localizations(
|
||||||
locale: const Locale('en', 'US'),
|
locale: const Locale('en', 'US'),
|
||||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||||
|
@ -979,6 +979,7 @@ void main() {
|
|||||||
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
body: const Center(child: Text('body')),
|
body: const Center(child: Text('body')),
|
||||||
@ -1180,6 +1181,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('showModalBottomSheet does not use root Navigator by default', (WidgetTester tester) async {
|
testWidgets('showModalBottomSheet does not use root Navigator by default', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Navigator(onGenerateRoute: (RouteSettings settings) => MaterialPageRoute<void>(builder: (_) {
|
body: Navigator(onGenerateRoute: (RouteSettings settings) => MaterialPageRoute<void>(builder: (_) {
|
||||||
return const _TestPage();
|
return const _TestPage();
|
||||||
@ -1804,8 +1806,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('No constraints by default for bottomSheet property', (WidgetTester tester) async {
|
testWidgets('No constraints by default for bottomSheet property', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(const MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
body: Center(child: Text('body')),
|
body: Center(child: Text('body')),
|
||||||
bottomSheet: Text('BottomSheet'),
|
bottomSheet: Text('BottomSheet'),
|
||||||
),
|
),
|
||||||
@ -1819,6 +1822,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('No constraints by default for showBottomSheet', (WidgetTester tester) async {
|
testWidgets('No constraints by default for showBottomSheet', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Builder(builder: (BuildContext context) {
|
body: Builder(builder: (BuildContext context) {
|
||||||
return Center(
|
return Center(
|
||||||
@ -1846,6 +1850,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('No constraints by default for showModalBottomSheet', (WidgetTester tester) async {
|
testWidgets('No constraints by default for showModalBottomSheet', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Builder(builder: (BuildContext context) {
|
body: Builder(builder: (BuildContext context) {
|
||||||
return Center(
|
return Center(
|
||||||
@ -1875,6 +1880,7 @@ void main() {
|
|||||||
testWidgets('Theme constraints used for bottomSheet property', (WidgetTester tester) async {
|
testWidgets('Theme constraints used for bottomSheet property', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
bottomSheetTheme: const BottomSheetThemeData(
|
bottomSheetTheme: const BottomSheetThemeData(
|
||||||
constraints: BoxConstraints(maxWidth: 80),
|
constraints: BoxConstraints(maxWidth: 80),
|
||||||
),
|
),
|
||||||
@ -1902,6 +1908,7 @@ void main() {
|
|||||||
testWidgets('Theme constraints used for showBottomSheet', (WidgetTester tester) async {
|
testWidgets('Theme constraints used for showBottomSheet', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
bottomSheetTheme: const BottomSheetThemeData(
|
bottomSheetTheme: const BottomSheetThemeData(
|
||||||
constraints: BoxConstraints(maxWidth: 80),
|
constraints: BoxConstraints(maxWidth: 80),
|
||||||
),
|
),
|
||||||
@ -1935,6 +1942,7 @@ void main() {
|
|||||||
testWidgets('Theme constraints used for showModalBottomSheet', (WidgetTester tester) async {
|
testWidgets('Theme constraints used for showModalBottomSheet', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
bottomSheetTheme: const BottomSheetThemeData(
|
bottomSheetTheme: const BottomSheetThemeData(
|
||||||
constraints: BoxConstraints(maxWidth: 80),
|
constraints: BoxConstraints(maxWidth: 80),
|
||||||
),
|
),
|
||||||
@ -1969,6 +1977,7 @@ void main() {
|
|||||||
testWidgets('constraints param overrides theme for showBottomSheet', (WidgetTester tester) async {
|
testWidgets('constraints param overrides theme for showBottomSheet', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
bottomSheetTheme: const BottomSheetThemeData(
|
bottomSheetTheme: const BottomSheetThemeData(
|
||||||
constraints: BoxConstraints(maxWidth: 80),
|
constraints: BoxConstraints(maxWidth: 80),
|
||||||
),
|
),
|
||||||
@ -2003,6 +2012,7 @@ void main() {
|
|||||||
testWidgets('constraints param overrides theme for showModalBottomSheet', (WidgetTester tester) async {
|
testWidgets('constraints param overrides theme for showModalBottomSheet', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
bottomSheetTheme: const BottomSheetThemeData(
|
bottomSheetTheme: const BottomSheetThemeData(
|
||||||
constraints: BoxConstraints(maxWidth: 80),
|
constraints: BoxConstraints(maxWidth: 80),
|
||||||
),
|
),
|
||||||
|
@ -80,6 +80,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Passing no BottomSheetThemeData returns defaults', (WidgetTester tester) async {
|
testWidgets('Passing no BottomSheetThemeData returns defaults', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: BottomSheet(
|
body: BottomSheet(
|
||||||
onClosing: () {},
|
onClosing: () {},
|
||||||
@ -256,14 +257,14 @@ void main() {
|
|||||||
const Color darkShadowColor = Colors.purple;
|
const Color darkShadowColor = Colors.purple;
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light(useMaterial3: false).copyWith(
|
||||||
bottomSheetTheme: const BottomSheetThemeData(
|
bottomSheetTheme: const BottomSheetThemeData(
|
||||||
elevation: lightElevation,
|
elevation: lightElevation,
|
||||||
backgroundColor: lightBackgroundColor,
|
backgroundColor: lightBackgroundColor,
|
||||||
shadowColor: lightShadowColor,
|
shadowColor: lightShadowColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
darkTheme: ThemeData.dark().copyWith(
|
darkTheme: ThemeData.dark(useMaterial3: false).copyWith(
|
||||||
bottomSheetTheme: const BottomSheetThemeData(
|
bottomSheetTheme: const BottomSheetThemeData(
|
||||||
elevation: darkElevation,
|
elevation: darkElevation,
|
||||||
backgroundColor: darkBackgroundColor,
|
backgroundColor: darkBackgroundColor,
|
||||||
@ -323,7 +324,7 @@ void main() {
|
|||||||
|
|
||||||
Widget bottomSheetWithElevations(BottomSheetThemeData bottomSheetTheme) {
|
Widget bottomSheetWithElevations(BottomSheetThemeData bottomSheetTheme) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(bottomSheetTheme: bottomSheetTheme),
|
theme: ThemeData(bottomSheetTheme: bottomSheetTheme, useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -28,6 +28,7 @@ void main() {
|
|||||||
TextDirection textDirection = TextDirection.ltr,
|
TextDirection textDirection = TextDirection.ltr,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
|
@ -42,11 +42,14 @@ void main() {
|
|||||||
Color checkBoxCheckColor = const Color(0xffFFFFFF);
|
Color checkBoxCheckColor = const Color(0xffFFFFFF);
|
||||||
|
|
||||||
Widget buildFrame(Color? color) {
|
Widget buildFrame(Color? color) {
|
||||||
return wrap(
|
return MaterialApp(
|
||||||
child: CheckboxListTile(
|
theme: ThemeData(useMaterial3: false),
|
||||||
value: true,
|
home: Material(
|
||||||
checkColor: color,
|
child: CheckboxListTile(
|
||||||
onChanged: (bool? value) {},
|
value: true,
|
||||||
|
checkColor: color,
|
||||||
|
onChanged: (bool? value) {},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -730,14 +733,17 @@ void main() {
|
|||||||
const double splashRadius = 24.0;
|
const double splashRadius = 24.0;
|
||||||
|
|
||||||
Widget buildCheckbox({bool active = false, bool useOverlay = true}) {
|
Widget buildCheckbox({bool active = false, bool useOverlay = true}) {
|
||||||
return wrap(
|
return MaterialApp(
|
||||||
child: CheckboxListTile(
|
theme: ThemeData(useMaterial3: false),
|
||||||
value: active,
|
home: Material(
|
||||||
onChanged: (_) { },
|
child: CheckboxListTile(
|
||||||
fillColor: const MaterialStatePropertyAll<Color>(fillColor),
|
value: active,
|
||||||
overlayColor: useOverlay ? MaterialStateProperty.resolveWith(getOverlayColor) : null,
|
onChanged: (_) { },
|
||||||
hoverColor: hoverColor,
|
fillColor: const MaterialStatePropertyAll<Color>(fillColor),
|
||||||
splashRadius: splashRadius,
|
overlayColor: useOverlay ? MaterialStateProperty.resolveWith(getOverlayColor) : null,
|
||||||
|
hoverColor: hoverColor,
|
||||||
|
splashRadius: splashRadius,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ Widget wrapForChip({
|
|||||||
Brightness brightness = Brightness.light,
|
Brightness brightness = Brightness.light,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(brightness: brightness),
|
theme: ThemeData(brightness: brightness, useMaterial3: false),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
@ -220,7 +220,7 @@ void main() {
|
|||||||
|
|
||||||
Widget buildFrame(Brightness brightness) {
|
Widget buildFrame(Brightness brightness) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(brightness: brightness),
|
theme: ThemeData(brightness: brightness, useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
@ -1689,6 +1689,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Chip uses ThemeData chip theme if present', (WidgetTester tester) async {
|
testWidgets('Chip uses ThemeData chip theme if present', (WidgetTester tester) async {
|
||||||
final ThemeData theme = ThemeData(
|
final ThemeData theme = ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
platform: TargetPlatform.android,
|
platform: TargetPlatform.android,
|
||||||
primarySwatch: Colors.red,
|
primarySwatch: Colors.red,
|
||||||
);
|
);
|
||||||
@ -1792,7 +1793,7 @@ void main() {
|
|||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
wrapForChip(
|
wrapForChip(
|
||||||
child: Theme(
|
child: Theme(
|
||||||
data: ThemeData(materialTapTargetSize: MaterialTapTargetSize.padded),
|
data: ThemeData(useMaterial3: false, materialTapTargetSize: MaterialTapTargetSize.padded),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: RawChip(
|
child: RawChip(
|
||||||
key: key1,
|
key: key1,
|
||||||
@ -1809,7 +1810,7 @@ void main() {
|
|||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
wrapForChip(
|
wrapForChip(
|
||||||
child: Theme(
|
child: Theme(
|
||||||
data: ThemeData(materialTapTargetSize: MaterialTapTargetSize.shrinkWrap),
|
data: ThemeData(useMaterial3: false, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: RawChip(
|
child: RawChip(
|
||||||
key: key2,
|
key: key2,
|
||||||
@ -2466,6 +2467,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Chip elevation and shadow color work correctly', (WidgetTester tester) async {
|
testWidgets('Chip elevation and shadow color work correctly', (WidgetTester tester) async {
|
||||||
final ThemeData theme = ThemeData(
|
final ThemeData theme = ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
platform: TargetPlatform.android,
|
platform: TargetPlatform.android,
|
||||||
primarySwatch: Colors.red,
|
primarySwatch: Colors.red,
|
||||||
);
|
);
|
||||||
@ -2725,6 +2727,7 @@ void main() {
|
|||||||
|
|
||||||
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Focus(
|
body: Focus(
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
@ -2804,6 +2807,7 @@ void main() {
|
|||||||
|
|
||||||
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Focus(
|
body: Focus(
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
@ -2886,6 +2890,7 @@ void main() {
|
|||||||
|
|
||||||
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Focus(
|
body: Focus(
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
@ -2963,6 +2968,7 @@ void main() {
|
|||||||
|
|
||||||
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Focus(
|
body: Focus(
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
@ -3035,6 +3041,7 @@ void main() {
|
|||||||
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
Widget chipWidget({ bool enabled = true, bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
chipTheme: ThemeData.light().chipTheme.copyWith(
|
chipTheme: ThemeData.light().chipTheme.copyWith(
|
||||||
shape: themeShape,
|
shape: themeShape,
|
||||||
side: themeBorderSide,
|
side: themeBorderSide,
|
||||||
@ -3071,6 +3078,7 @@ void main() {
|
|||||||
Future<void> buildTest(VisualDensity visualDensity) async {
|
Future<void> buildTest(VisualDensity visualDensity) async {
|
||||||
return tester.pumpWidget(
|
return tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -147,7 +147,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light(useMaterial3: false).copyWith(
|
||||||
chipTheme: chipTheme,
|
chipTheme: chipTheme,
|
||||||
),
|
),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
@ -193,7 +193,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light(useMaterial3: false).copyWith(
|
||||||
chipTheme: shadowedChipTheme,
|
chipTheme: shadowedChipTheme,
|
||||||
),
|
),
|
||||||
home: ChipTheme(
|
home: ChipTheme(
|
||||||
@ -242,6 +242,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: ChipTheme(
|
home: ChipTheme(
|
||||||
data: shadowedChipTheme,
|
data: shadowedChipTheme,
|
||||||
child: Builder(
|
child: Builder(
|
||||||
@ -654,6 +655,7 @@ void main() {
|
|||||||
Widget chipWidget({ bool selected = false }) {
|
Widget chipWidget({ bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
chipTheme: ThemeData.light().chipTheme.copyWith(
|
chipTheme: ThemeData.light().chipTheme.copyWith(
|
||||||
side: MaterialStateBorderSide.resolveWith(getBorderSide),
|
side: MaterialStateBorderSide.resolveWith(getBorderSide),
|
||||||
),
|
),
|
||||||
@ -699,7 +701,7 @@ void main() {
|
|||||||
|
|
||||||
Widget chipWidget({ bool selected = false }) {
|
Widget chipWidget({ bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(chipTheme: chipTheme),
|
theme: ThemeData(useMaterial3: false, chipTheme: chipTheme),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: ChoiceChip(
|
body: ChoiceChip(
|
||||||
label: const Text('Chip'),
|
label: const Text('Chip'),
|
||||||
@ -739,7 +741,7 @@ void main() {
|
|||||||
|
|
||||||
Widget chipWidget({ bool selected = false }) {
|
Widget chipWidget({ bool selected = false }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(chipTheme: chipTheme),
|
theme: ThemeData(useMaterial3: false, chipTheme: chipTheme),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: ChoiceChip(
|
body: ChoiceChip(
|
||||||
label: const Text('Chip'),
|
label: const Text('Chip'),
|
||||||
|
@ -403,7 +403,7 @@ void main() {
|
|||||||
testWidgets('ChoiceChip defaults', (WidgetTester tester) async {
|
testWidgets('ChoiceChip defaults', (WidgetTester tester) async {
|
||||||
Widget buildFrame(Brightness brightness) {
|
Widget buildFrame(Brightness brightness) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(brightness: brightness),
|
theme: ThemeData(useMaterial3: false, brightness: brightness),
|
||||||
home: const Scaffold(
|
home: const Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: ChoiceChip(
|
child: ChoiceChip(
|
||||||
|
@ -287,7 +287,7 @@ void main() {
|
|||||||
// can be deleted.
|
// can be deleted.
|
||||||
|
|
||||||
testWidgets('CircleAvatar default colors with light theme', (WidgetTester tester) async {
|
testWidgets('CircleAvatar default colors with light theme', (WidgetTester tester) async {
|
||||||
final ThemeData theme = ThemeData(primaryColor: Colors.grey.shade100);
|
final ThemeData theme = ThemeData(useMaterial3: false, primaryColor: Colors.grey.shade100);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
wrap(
|
wrap(
|
||||||
child: Theme(
|
child: Theme(
|
||||||
@ -309,7 +309,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('CircleAvatar default colors with dark theme', (WidgetTester tester) async {
|
testWidgets('CircleAvatar default colors with dark theme', (WidgetTester tester) async {
|
||||||
final ThemeData theme = ThemeData(primaryColor: Colors.grey.shade800);
|
final ThemeData theme = ThemeData(useMaterial3: false, primaryColor: Colors.grey.shade800);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
wrap(
|
wrap(
|
||||||
child: Theme(
|
child: Theme(
|
||||||
@ -337,7 +337,9 @@ Widget wrap({ required Widget child }) {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
data: const MediaQueryData(),
|
data: const MediaQueryData(),
|
||||||
child: Center(child: child),
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: Center(child: child)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1680,6 +1680,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(child: buildTable()),
|
home: Material(child: buildTable()),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -382,6 +382,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Center(
|
home: Center(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -417,7 +418,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData.fallback().copyWith(dialogTheme: customDialogTheme),
|
theme: ThemeData.fallback(useMaterial3: false).copyWith(dialogTheme: customDialogTheme),
|
||||||
home: Center(
|
home: Center(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -447,6 +448,7 @@ void main() {
|
|||||||
testWidgets('OK Cancel button layout', (WidgetTester tester) async {
|
testWidgets('OK Cancel button layout', (WidgetTester tester) async {
|
||||||
Widget buildFrame(TextDirection textDirection) {
|
Widget buildFrame(TextDirection textDirection) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
|
@ -504,6 +504,7 @@ void main() {
|
|||||||
testWidgets('OK Cancel button layout', (WidgetTester tester) async {
|
testWidgets('OK Cancel button layout', (WidgetTester tester) async {
|
||||||
Widget buildFrame(TextDirection textDirection) {
|
Widget buildFrame(TextDirection textDirection) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
@ -1062,9 +1063,10 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('DatePickerDialog is state restorable', (WidgetTester tester) async {
|
testWidgets('DatePickerDialog is state restorable', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
restorationScopeId: 'app',
|
restorationScopeId: 'app',
|
||||||
home: _RestorableDateRangePickerDialogTestWidget(),
|
home: const _RestorableDateRangePickerDialogTestWidget(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ void main() {
|
|||||||
actions: <Widget>[ ],
|
actions: <Widget>[ ],
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
);
|
);
|
||||||
final ThemeData theme = ThemeData(dialogTheme: const DialogTheme(alignment: Alignment.bottomLeft));
|
final ThemeData theme = ThemeData(useMaterial3: false, dialogTheme: const DialogTheme(alignment: Alignment.bottomLeft));
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
_appWithDialog(tester, dialog, theme: theme),
|
_appWithDialog(tester, dialog, theme: theme),
|
||||||
@ -193,7 +193,7 @@ void main() {
|
|||||||
title: Text('Title'),
|
title: Text('Title'),
|
||||||
actions: <Widget>[ ],
|
actions: <Widget>[ ],
|
||||||
);
|
);
|
||||||
final ThemeData theme = ThemeData(dialogTheme: const DialogTheme(shape: customBorder));
|
final ThemeData theme = ThemeData(useMaterial3: false, dialogTheme: const DialogTheme(shape: customBorder));
|
||||||
|
|
||||||
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
|
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
|
||||||
await tester.tap(find.text('X'));
|
await tester.tap(find.text('X'));
|
||||||
@ -248,7 +248,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Custom Icon Color - Theme - lowest preference', (WidgetTester tester) async {
|
testWidgets('Custom Icon Color - Theme - lowest preference', (WidgetTester tester) async {
|
||||||
const Color iconThemeColor = Colors.yellow;
|
const Color iconThemeColor = Colors.yellow;
|
||||||
final ThemeData theme = ThemeData(iconTheme: const IconThemeData(color: iconThemeColor));
|
final ThemeData theme = ThemeData(useMaterial3: false, iconTheme: const IconThemeData(color: iconThemeColor));
|
||||||
const AlertDialog dialog = AlertDialog(
|
const AlertDialog dialog = AlertDialog(
|
||||||
icon: Icon(Icons.ac_unit),
|
icon: Icon(Icons.ac_unit),
|
||||||
actions: <Widget>[ ],
|
actions: <Widget>[ ],
|
||||||
@ -320,7 +320,7 @@ void main() {
|
|||||||
title: Text(titleText),
|
title: Text(titleText),
|
||||||
actions: <Widget>[ ],
|
actions: <Widget>[ ],
|
||||||
);
|
);
|
||||||
final ThemeData theme = ThemeData(textTheme: const TextTheme(titleLarge: titleTextStyle));
|
final ThemeData theme = ThemeData(useMaterial3: false, textTheme: const TextTheme(titleLarge: titleTextStyle));
|
||||||
|
|
||||||
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
|
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
|
||||||
await tester.tap(find.text('X'));
|
await tester.tap(find.text('X'));
|
||||||
@ -419,7 +419,7 @@ void main() {
|
|||||||
content: Text(contentText),
|
content: Text(contentText),
|
||||||
actions: <Widget>[ ],
|
actions: <Widget>[ ],
|
||||||
);
|
);
|
||||||
final ThemeData theme = ThemeData(textTheme: const TextTheme(titleMedium: contentTextStyle));
|
final ThemeData theme = ThemeData(useMaterial3: false, textTheme: const TextTheme(titleMedium: contentTextStyle));
|
||||||
|
|
||||||
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
|
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
|
||||||
await tester.tap(find.text('X'));
|
await tester.tap(find.text('X'));
|
||||||
|
@ -9,9 +9,9 @@ import '../rendering/mock_canvas.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
testWidgets('Divider control test', (WidgetTester tester) async {
|
testWidgets('Divider control test', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const Directionality(
|
MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Center(
|
home: const Center(
|
||||||
child: Divider(),
|
child: Divider(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -94,9 +94,9 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Vertical Divider Test', (WidgetTester tester) async {
|
testWidgets('Vertical Divider Test', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const Directionality(
|
MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Center(
|
home: const Center(
|
||||||
child: VerticalDivider(),
|
child: VerticalDivider(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -272,8 +272,9 @@ void main() {
|
|||||||
|
|
||||||
group('Horizontal Divider', () {
|
group('Horizontal Divider', () {
|
||||||
testWidgets('Passing no DividerThemeData returns defaults', (WidgetTester tester) async {
|
testWidgets('Passing no DividerThemeData returns defaults', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(const MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
body: Divider(),
|
body: Divider(),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
@ -285,7 +286,7 @@ void main() {
|
|||||||
final BoxDecoration decoration = container.decoration! as BoxDecoration;
|
final BoxDecoration decoration = container.decoration! as BoxDecoration;
|
||||||
expect(decoration.border!.bottom.width, 0.0);
|
expect(decoration.border!.bottom.width, 0.0);
|
||||||
|
|
||||||
final ThemeData theme = ThemeData();
|
final ThemeData theme = ThemeData(useMaterial3: false);
|
||||||
expect(decoration.border!.bottom.color, theme.dividerColor);
|
expect(decoration.border!.bottom.color, theme.dividerColor);
|
||||||
|
|
||||||
final Rect dividerRect = tester.getRect(find.byType(Divider));
|
final Rect dividerRect = tester.getRect(find.byType(Divider));
|
||||||
@ -314,8 +315,9 @@ void main() {
|
|||||||
|
|
||||||
group('Vertical Divider', () {
|
group('Vertical Divider', () {
|
||||||
testWidgets('Passing no DividerThemeData returns defaults', (WidgetTester tester) async {
|
testWidgets('Passing no DividerThemeData returns defaults', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(const MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
body: VerticalDivider(),
|
body: VerticalDivider(),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
@ -328,7 +330,7 @@ void main() {
|
|||||||
final Border border = decoration.border! as Border;
|
final Border border = decoration.border! as Border;
|
||||||
expect(border.left.width, 0.0);
|
expect(border.left.width, 0.0);
|
||||||
|
|
||||||
final ThemeData theme = ThemeData();
|
final ThemeData theme = ThemeData(useMaterial3: false);
|
||||||
expect(border.left.color, theme.dividerColor);
|
expect(border.left.color, theme.dividerColor);
|
||||||
|
|
||||||
final Rect dividerRect = tester.getRect(find.byType(VerticalDivider));
|
final Rect dividerRect = tester.getRect(find.byType(VerticalDivider));
|
||||||
|
@ -14,6 +14,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
drawer: Drawer(
|
drawer: Drawer(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
@ -16,6 +16,7 @@ library;
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
@ -161,39 +162,43 @@ Widget buildFrame({
|
|||||||
double? menuMaxHeight,
|
double? menuMaxHeight,
|
||||||
EdgeInsetsGeometry? padding,
|
EdgeInsetsGeometry? padding,
|
||||||
Alignment dropdownAlignment = Alignment.center,
|
Alignment dropdownAlignment = Alignment.center,
|
||||||
|
bool? useMaterial3,
|
||||||
}) {
|
}) {
|
||||||
return TestApp(
|
return Theme(
|
||||||
textDirection: textDirection,
|
data: ThemeData(useMaterial3: useMaterial3),
|
||||||
mediaSize: mediaSize,
|
child: TestApp(
|
||||||
child: Material(
|
textDirection: textDirection,
|
||||||
child: Align(
|
mediaSize: mediaSize,
|
||||||
alignment: dropdownAlignment,
|
child: Material(
|
||||||
child: RepaintBoundary(
|
child: Align(
|
||||||
child: buildDropdown(
|
alignment: dropdownAlignment,
|
||||||
isFormField: isFormField,
|
child: RepaintBoundary(
|
||||||
buttonKey: buttonKey,
|
child: buildDropdown(
|
||||||
value: value,
|
isFormField: isFormField,
|
||||||
hint: hint,
|
buttonKey: buttonKey,
|
||||||
disabledHint: disabledHint,
|
value: value,
|
||||||
onChanged: onChanged,
|
hint: hint,
|
||||||
onTap: onTap,
|
disabledHint: disabledHint,
|
||||||
icon: icon,
|
onChanged: onChanged,
|
||||||
iconSize: iconSize,
|
onTap: onTap,
|
||||||
iconDisabledColor: iconDisabledColor,
|
icon: icon,
|
||||||
iconEnabledColor: iconEnabledColor,
|
iconSize: iconSize,
|
||||||
isDense: isDense,
|
iconDisabledColor: iconDisabledColor,
|
||||||
isExpanded: isExpanded,
|
iconEnabledColor: iconEnabledColor,
|
||||||
underline: underline,
|
isDense: isDense,
|
||||||
focusNode: focusNode,
|
isExpanded: isExpanded,
|
||||||
autofocus: autofocus,
|
underline: underline,
|
||||||
focusColor: focusColor,
|
focusNode: focusNode,
|
||||||
dropdownColor: dropdownColor,
|
autofocus: autofocus,
|
||||||
items: items,
|
focusColor: focusColor,
|
||||||
selectedItemBuilder: selectedItemBuilder,
|
dropdownColor: dropdownColor,
|
||||||
itemHeight: itemHeight,
|
items: items,
|
||||||
alignment: alignment,
|
selectedItemBuilder: selectedItemBuilder,
|
||||||
menuMaxHeight: menuMaxHeight,
|
itemHeight: itemHeight,
|
||||||
padding: padding,
|
alignment: alignment,
|
||||||
|
menuMaxHeight: menuMaxHeight,
|
||||||
|
padding: padding,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -207,6 +212,7 @@ Widget buildDropdownWithHint({
|
|||||||
bool enableSelectedItemBuilder = false,
|
bool enableSelectedItemBuilder = false,
|
||||||
}){
|
}){
|
||||||
return buildFrame(
|
return buildFrame(
|
||||||
|
useMaterial3: false,
|
||||||
mediaSize: const Size(800, 600),
|
mediaSize: const Size(800, 600),
|
||||||
itemHeight: 100.0,
|
itemHeight: 100.0,
|
||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
@ -286,6 +292,7 @@ Future<void> checkDropdownColor(WidgetTester tester, {Color? color, bool isFormF
|
|||||||
const String text = 'foo';
|
const String text = 'foo';
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: isFormField
|
child: isFormField
|
||||||
? Form(
|
? Form(
|
||||||
@ -335,7 +342,7 @@ Future<void> checkDropdownColor(WidgetTester tester, {Color? color, bool isFormF
|
|||||||
void main() {
|
void main() {
|
||||||
testWidgets('Default dropdown golden', (WidgetTester tester) async {
|
testWidgets('Default dropdown golden', (WidgetTester tester) async {
|
||||||
final Key buttonKey = UniqueKey();
|
final Key buttonKey = UniqueKey();
|
||||||
Widget build() => buildFrame(buttonKey: buttonKey, onChanged: onChanged);
|
Widget build() => buildFrame(buttonKey: buttonKey, onChanged: onChanged, useMaterial3: false);
|
||||||
await tester.pumpWidget(build());
|
await tester.pumpWidget(build());
|
||||||
final Finder buttonFinder = find.byKey(buttonKey);
|
final Finder buttonFinder = find.byKey(buttonKey);
|
||||||
assert(tester.renderObject(buttonFinder).attached);
|
assert(tester.renderObject(buttonFinder).attached);
|
||||||
@ -347,7 +354,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Expanded dropdown golden', (WidgetTester tester) async {
|
testWidgets('Expanded dropdown golden', (WidgetTester tester) async {
|
||||||
final Key buttonKey = UniqueKey();
|
final Key buttonKey = UniqueKey();
|
||||||
Widget build() => buildFrame(buttonKey: buttonKey, isExpanded: true, onChanged: onChanged);
|
Widget build() => buildFrame(buttonKey: buttonKey, isExpanded: true, onChanged: onChanged, useMaterial3: false);
|
||||||
await tester.pumpWidget(build());
|
await tester.pumpWidget(build());
|
||||||
final Finder buttonFinder = find.byKey(buttonKey);
|
final Finder buttonFinder = find.byKey(buttonKey);
|
||||||
assert(tester.renderObject(buttonFinder).attached);
|
assert(tester.renderObject(buttonFinder).attached);
|
||||||
@ -609,6 +616,7 @@ void main() {
|
|||||||
// Regression test for https://github.com/flutter/flutter/issues/66870
|
// Regression test for https://github.com/flutter/flutter/issues/66870
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(),
|
||||||
body: Column(
|
body: Column(
|
||||||
@ -697,7 +705,7 @@ void main() {
|
|||||||
testWidgets('Dropdown button aligns selected menu item ($textDirection)', (WidgetTester tester) async {
|
testWidgets('Dropdown button aligns selected menu item ($textDirection)', (WidgetTester tester) async {
|
||||||
final Key buttonKey = UniqueKey();
|
final Key buttonKey = UniqueKey();
|
||||||
|
|
||||||
Widget build() => buildFrame(buttonKey: buttonKey, textDirection: textDirection, onChanged: onChanged);
|
Widget build() => buildFrame(buttonKey: buttonKey, textDirection: textDirection, onChanged: onChanged, useMaterial3: false);
|
||||||
|
|
||||||
await tester.pumpWidget(build());
|
await tester.pumpWidget(build());
|
||||||
final RenderBox buttonBox = tester.renderObject<RenderBox>(find.byKey(buttonKey));
|
final RenderBox buttonBox = tester.renderObject<RenderBox>(find.byKey(buttonKey));
|
||||||
@ -2382,12 +2390,12 @@ void main() {
|
|||||||
tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;
|
tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;
|
||||||
final UniqueKey buttonKey = UniqueKey();
|
final UniqueKey buttonKey = UniqueKey();
|
||||||
final FocusNode focusNode = FocusNode(debugLabel: 'DropdownButton');
|
final FocusNode focusNode = FocusNode(debugLabel: 'DropdownButton');
|
||||||
await tester.pumpWidget(buildFrame(buttonKey: buttonKey, onChanged: onChanged, focusNode: focusNode, autofocus: true));
|
await tester.pumpWidget(buildFrame(buttonKey: buttonKey, onChanged: onChanged, focusNode: focusNode, autofocus: true, useMaterial3: false));
|
||||||
await tester.pumpAndSettle(); // Pump a frame for autofocus to take effect.
|
await tester.pumpAndSettle(); // Pump a frame for autofocus to take effect.
|
||||||
expect(focusNode.hasPrimaryFocus, isTrue);
|
expect(focusNode.hasPrimaryFocus, isTrue);
|
||||||
expect(find.byType(Material), paints..rect(rect: const Rect.fromLTRB(348.0, 276.0, 452.0, 324.0), color: const Color(0x1f000000)));
|
expect(find.byType(Material), paints..rect(rect: const Rect.fromLTRB(348.0, 276.0, 452.0, 324.0), color: const Color(0x1f000000)));
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(buttonKey: buttonKey, onChanged: onChanged, focusNode: focusNode, focusColor: const Color(0xff00ff00)));
|
await tester.pumpWidget(buildFrame(buttonKey: buttonKey, onChanged: onChanged, focusNode: focusNode, focusColor: const Color(0xff00ff00), useMaterial3: false));
|
||||||
await tester.pumpAndSettle(); // Pump a frame for autofocus to take effect.
|
await tester.pumpAndSettle(); // Pump a frame for autofocus to take effect.
|
||||||
expect(find.byType(Material), paints..rect(rect: const Rect.fromLTRB(348.0, 276.0, 452.0, 324.0), color: const Color(0x1f00ff00)));
|
expect(find.byType(Material), paints..rect(rect: const Rect.fromLTRB(348.0, 276.0, 452.0, 324.0), color: const Color(0x1f00ff00)));
|
||||||
});
|
});
|
||||||
@ -2696,6 +2704,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: StatefulBuilder(
|
child: StatefulBuilder(
|
||||||
@ -3169,6 +3178,7 @@ void main() {
|
|||||||
final UniqueKey itemKey = UniqueKey();
|
final UniqueKey itemKey = UniqueKey();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: DropdownButton<String>(
|
child: DropdownButton<String>(
|
||||||
@ -3504,8 +3514,9 @@ void main() {
|
|||||||
await tester.pumpAndSettle(); // finish the menu animation
|
await tester.pumpAndSettle(); // finish the menu animation
|
||||||
|
|
||||||
// The inherited ScrollBehavior should not apply Scrollbars since they are
|
// The inherited ScrollBehavior should not apply Scrollbars since they are
|
||||||
// already built in to the widget.
|
// already built in to the widget. For iOS platform, ScrollBar directly returns
|
||||||
expect(find.byType(CupertinoScrollbar), findsNothing);
|
// CupertinoScrollbar
|
||||||
|
expect(find.byType(CupertinoScrollbar), debugDefaultTargetPlatformOverride == TargetPlatform.iOS ? findsOneWidget : findsNothing);
|
||||||
expect(find.byType(Scrollbar), findsOneWidget);
|
expect(find.byType(Scrollbar), findsOneWidget);
|
||||||
expect(find.byType(RawScrollbar), findsNothing);
|
expect(find.byType(RawScrollbar), findsNothing);
|
||||||
|
|
||||||
@ -3516,6 +3527,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: DropdownButton<String>(
|
child: DropdownButton<String>(
|
||||||
|
@ -77,6 +77,7 @@ void main() {
|
|||||||
IconTheme iconTheme;
|
IconTheme iconTheme;
|
||||||
// Light mode test
|
// Light mode test
|
||||||
await tester.pumpWidget(wrap(
|
await tester.pumpWidget(wrap(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: const ExpandIcon(onPressed: null),
|
child: const ExpandIcon(onPressed: null),
|
||||||
));
|
));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@ -87,7 +88,7 @@ void main() {
|
|||||||
// Dark mode test
|
// Dark mode test
|
||||||
await tester.pumpWidget(wrap(
|
await tester.pumpWidget(wrap(
|
||||||
child: const ExpandIcon(onPressed: null),
|
child: const ExpandIcon(onPressed: null),
|
||||||
theme: ThemeData(brightness: Brightness.dark),
|
theme: ThemeData(useMaterial3: false, brightness: Brightness.dark),
|
||||||
));
|
));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
@ -176,6 +177,7 @@ void main() {
|
|||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
const DefaultMaterialLocalizations localizations = DefaultMaterialLocalizations();
|
const DefaultMaterialLocalizations localizations = DefaultMaterialLocalizations();
|
||||||
await tester.pumpWidget(wrap(
|
await tester.pumpWidget(wrap(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: ExpandIcon(
|
child: ExpandIcon(
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
onPressed: (bool _) { },
|
onPressed: (bool _) { },
|
||||||
|
@ -183,6 +183,7 @@ void main() {
|
|||||||
final Key headerKey = UniqueKey();
|
final Key headerKey = UniqueKey();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: ExpansionPanelListSemanticsTest(headerKey: headerKey),
|
home: ExpansionPanelListSemanticsTest(headerKey: headerKey),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -1024,6 +1025,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: SingleChildScrollView(
|
home: SingleChildScrollView(
|
||||||
child: expansionList,
|
child: expansionList,
|
||||||
),
|
),
|
||||||
|
@ -167,6 +167,7 @@ void main() {
|
|||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
colorScheme: ColorScheme.fromSwatch().copyWith(primary: foregroundColor),
|
colorScheme: ColorScheme.fromSwatch().copyWith(primary: foregroundColor),
|
||||||
unselectedWidgetColor: unselectedWidgetColor,
|
unselectedWidgetColor: unselectedWidgetColor,
|
||||||
textTheme: const TextTheme(titleMedium: TextStyle(color: headerColor)),
|
textTheme: const TextTheme(titleMedium: TextStyle(color: headerColor)),
|
||||||
|
@ -13,9 +13,10 @@ Widget wrapForChip({
|
|||||||
TextDirection textDirection = TextDirection.ltr,
|
TextDirection textDirection = TextDirection.ltr,
|
||||||
double textScaleFactor = 1.0,
|
double textScaleFactor = 1.0,
|
||||||
Brightness brightness = Brightness.light,
|
Brightness brightness = Brightness.light,
|
||||||
|
bool? useMaterial3,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(brightness: brightness),
|
theme: ThemeData(brightness: brightness, useMaterial3: useMaterial3),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
@ -31,9 +32,11 @@ Future<void> pumpCheckmarkChip(
|
|||||||
required Widget chip,
|
required Widget chip,
|
||||||
Color? themeColor,
|
Color? themeColor,
|
||||||
Brightness brightness = Brightness.light,
|
Brightness brightness = Brightness.light,
|
||||||
|
ThemeData? theme,
|
||||||
}) async {
|
}) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
wrapForChip(
|
wrapForChip(
|
||||||
|
useMaterial3: false,
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -385,6 +388,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Filter chip check mark color is determined by platform brightness when light', (WidgetTester tester) async {
|
testWidgets('Filter chip check mark color is determined by platform brightness when light', (WidgetTester tester) async {
|
||||||
await pumpCheckmarkChip(
|
await pumpCheckmarkChip(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
tester,
|
tester,
|
||||||
chip: selectedFilterChip(),
|
chip: selectedFilterChip(),
|
||||||
);
|
);
|
||||||
@ -400,6 +404,7 @@ void main() {
|
|||||||
tester,
|
tester,
|
||||||
chip: selectedFilterChip(),
|
chip: selectedFilterChip(),
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
);
|
);
|
||||||
|
|
||||||
expectCheckmarkColor(
|
expectCheckmarkColor(
|
||||||
|
@ -53,6 +53,7 @@ void main() {
|
|||||||
testWidgets('FlexibleSpaceBar stretch mode blurBackground', (WidgetTester tester) async {
|
testWidgets('FlexibleSpaceBar stretch mode blurBackground', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
|
@ -81,6 +81,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
key: dragTarget,
|
key: dragTarget,
|
||||||
@ -172,6 +173,7 @@ void main() {
|
|||||||
const double expandedHeight = 200;
|
const double expandedHeight = 200;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
@ -438,6 +440,7 @@ void main() {
|
|||||||
late double width;
|
late double width;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -486,6 +489,7 @@ void main() {
|
|||||||
const double expandedTitleScale = 3.0;
|
const double expandedTitleScale = 3.0;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
@ -555,6 +559,7 @@ void main() {
|
|||||||
const double height = 300.0;
|
const double height = 300.0;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
@ -615,6 +620,7 @@ void main() {
|
|||||||
const double expandedTitleScale = 3.0;
|
const double expandedTitleScale = 3.0;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
@ -674,7 +680,7 @@ void main() {
|
|||||||
testWidgets('FlexibleSpaceBar test titlePadding defaults', (WidgetTester tester) async {
|
testWidgets('FlexibleSpaceBar test titlePadding defaults', (WidgetTester tester) async {
|
||||||
Widget buildFrame(TargetPlatform platform, bool? centerTitle) {
|
Widget buildFrame(TargetPlatform platform, bool? centerTitle) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(platform: platform),
|
theme: ThemeData(platform: platform, useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
@ -724,7 +730,7 @@ void main() {
|
|||||||
testWidgets('FlexibleSpaceBar test titlePadding override', (WidgetTester tester) async {
|
testWidgets('FlexibleSpaceBar test titlePadding override', (WidgetTester tester) async {
|
||||||
Widget buildFrame(TargetPlatform platform, bool? centerTitle) {
|
Widget buildFrame(TargetPlatform platform, bool? centerTitle) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(platform: platform),
|
theme: ThemeData(platform: platform, useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
|
@ -99,6 +99,7 @@ void main() {
|
|||||||
|
|
||||||
Widget buildFrame() {
|
Widget buildFrame() {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: PopupMenuTheme(
|
body: PopupMenuTheme(
|
||||||
data: const PopupMenuThemeData(
|
data: const PopupMenuThemeData(
|
||||||
|
@ -59,9 +59,9 @@ void main() {
|
|||||||
const BorderRadius borderRadius = BorderRadius.all(Radius.circular(6.0));
|
const BorderRadius borderRadius = BorderRadius.all(Radius.circular(6.0));
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 200.0,
|
width: 200.0,
|
||||||
@ -190,9 +190,9 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Does the Ink widget render anything', (WidgetTester tester) async {
|
testWidgets('Does the Ink widget render anything', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Ink(
|
child: Ink(
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
@ -222,9 +222,9 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Ink(
|
child: Ink(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
@ -250,9 +250,9 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: InkWell( // this is at a different depth in the tree so it's now a new InkWell
|
child: InkWell( // this is at a different depth in the tree so it's now a new InkWell
|
||||||
splashColor: Colors.green,
|
splashColor: Colors.green,
|
||||||
@ -518,9 +518,9 @@ void main() {
|
|||||||
const Color splashColor = Color(0xff00ff00);
|
const Color splashColor = Color(0xff00ff00);
|
||||||
|
|
||||||
Widget buildWidget({InteractiveInkFeatureFactory? splashFactory}) {
|
Widget buildWidget({InteractiveInkFeatureFactory? splashFactory}) {
|
||||||
return Directionality(
|
return MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 100.0,
|
width: 100.0,
|
||||||
|
@ -30,6 +30,7 @@ void main() {
|
|||||||
testWidgets('InkWell with NoSplash splashFactory paints nothing', (WidgetTester tester) async {
|
testWidgets('InkWell with NoSplash splashFactory paints nothing', (WidgetTester tester) async {
|
||||||
Widget buildFrame({ InteractiveInkFeatureFactory? splashFactory }) {
|
Widget buildFrame({ InteractiveInkFeatureFactory? splashFactory }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Material(
|
child: Material(
|
||||||
|
@ -338,23 +338,26 @@ void main() {
|
|||||||
FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTouch;
|
FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTouch;
|
||||||
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
||||||
const Color splashColor = Color(0xffff0000);
|
const Color splashColor = Color(0xffff0000);
|
||||||
await tester.pumpWidget(Material(
|
await tester.pumpWidget(MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Center(
|
child: Directionality(
|
||||||
child: Focus(
|
textDirection: TextDirection.ltr,
|
||||||
focusNode: focusNode,
|
child: Center(
|
||||||
child: SizedBox(
|
child: Focus(
|
||||||
width: 100,
|
focusNode: focusNode,
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: InkWell(
|
width: 100,
|
||||||
hoverColor: const Color(0xff00ff00),
|
height: 100,
|
||||||
splashColor: splashColor,
|
child: InkWell(
|
||||||
focusColor: const Color(0xff0000ff),
|
hoverColor: const Color(0xff00ff00),
|
||||||
highlightColor: const Color(0xf00fffff),
|
splashColor: splashColor,
|
||||||
onTap: () { },
|
focusColor: const Color(0xff0000ff),
|
||||||
onLongPress: () { },
|
highlightColor: const Color(0xf00fffff),
|
||||||
onHover: (bool hover) { },
|
onTap: () { },
|
||||||
|
onLongPress: () { },
|
||||||
|
onHover: (bool hover) { },
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -376,31 +379,34 @@ void main() {
|
|||||||
FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTouch;
|
FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTouch;
|
||||||
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
||||||
const Color splashColor = Color(0xffff0000);
|
const Color splashColor = Color(0xffff0000);
|
||||||
await tester.pumpWidget(Material(
|
await tester.pumpWidget(MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Center(
|
child: Directionality(
|
||||||
child: Focus(
|
textDirection: TextDirection.ltr,
|
||||||
focusNode: focusNode,
|
child: Center(
|
||||||
child: SizedBox(
|
child: Focus(
|
||||||
width: 100,
|
focusNode: focusNode,
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: InkWell(
|
width: 100,
|
||||||
overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) {
|
height: 100,
|
||||||
if (states.contains(MaterialState.hovered)) {
|
child: InkWell(
|
||||||
return const Color(0xff00ff00);
|
overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) {
|
||||||
}
|
if (states.contains(MaterialState.hovered)) {
|
||||||
if (states.contains(MaterialState.focused)) {
|
return const Color(0xff00ff00);
|
||||||
return const Color(0xff0000ff);
|
}
|
||||||
}
|
if (states.contains(MaterialState.focused)) {
|
||||||
if (states.contains(MaterialState.pressed)) {
|
return const Color(0xff0000ff);
|
||||||
return splashColor;
|
}
|
||||||
}
|
if (states.contains(MaterialState.pressed)) {
|
||||||
return const Color(0xffbadbad); // Shouldn't happen.
|
return splashColor;
|
||||||
}),
|
}
|
||||||
onTap: () { },
|
return const Color(0xffbadbad); // Shouldn't happen.
|
||||||
onLongPress: () { },
|
}),
|
||||||
onHover: (bool hover) { },
|
onTap: () { },
|
||||||
|
onLongPress: () { },
|
||||||
|
onHover: (bool hover) { },
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -820,19 +826,22 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
// Regression test for https://github.com/flutter/flutter/issues/121626.
|
// Regression test for https://github.com/flutter/flutter/issues/121626.
|
||||||
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
||||||
Widget boilerplate(BorderRadius borderRadius) {
|
Widget boilerplate(BorderRadius borderRadius) {
|
||||||
return Material(
|
return MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Align(
|
child: Directionality(
|
||||||
alignment: Alignment.topLeft,
|
textDirection: TextDirection.ltr,
|
||||||
child: SizedBox(
|
child: Align(
|
||||||
width: 100,
|
alignment: Alignment.topLeft,
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: MouseRegion(
|
width: 100,
|
||||||
child: InkWell(
|
height: 100,
|
||||||
focusNode: focusNode,
|
child: MouseRegion(
|
||||||
customBorder: RoundedRectangleBorder(borderRadius: borderRadius),
|
child: InkWell(
|
||||||
onTap: () { },
|
focusNode: focusNode,
|
||||||
|
customBorder: RoundedRectangleBorder(borderRadius: borderRadius),
|
||||||
|
onTap: () { },
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1108,9 +1117,9 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
testWidgets('splashing survives scrolling when keep-alive is enabled', (WidgetTester tester) async {
|
testWidgets('splashing survives scrolling when keep-alive is enabled', (WidgetTester tester) async {
|
||||||
Future<void> runTest(bool keepAlive) async {
|
Future<void> runTest(bool keepAlive) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: Material(
|
home: Material(
|
||||||
child: CompositedTransformFollower(
|
child: CompositedTransformFollower(
|
||||||
// forces a layer, which makes the paints easier to separate out
|
// forces a layer, which makes the paints easier to separate out
|
||||||
link: LayerLink(),
|
link: LayerLink(),
|
||||||
@ -1325,16 +1334,19 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Material(
|
MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Center(
|
child: Directionality(
|
||||||
child: paddedInkWell(
|
textDirection: TextDirection.ltr,
|
||||||
|
child: Center(
|
||||||
child: paddedInkWell(
|
child: paddedInkWell(
|
||||||
key: middleKey,
|
|
||||||
child: paddedInkWell(
|
child: paddedInkWell(
|
||||||
key: innerKey,
|
key: middleKey,
|
||||||
child: const SizedBox(width: 50, height: 50),
|
child: paddedInkWell(
|
||||||
|
key: innerKey,
|
||||||
|
child: const SizedBox(width: 50, height: 50),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1391,24 +1403,27 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Material(
|
MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Align(
|
child: Directionality(
|
||||||
alignment: Alignment.topLeft,
|
textDirection: TextDirection.ltr,
|
||||||
child: SizedBox(
|
child: Align(
|
||||||
width: 200,
|
alignment: Alignment.topLeft,
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: Row(
|
width: 200,
|
||||||
children: <Widget>[
|
height: 100,
|
||||||
paddedInkWell(
|
child: Row(
|
||||||
key: middleKey,
|
children: <Widget>[
|
||||||
child: paddedInkWell(
|
paddedInkWell(
|
||||||
key: innerKey,
|
key: middleKey,
|
||||||
|
child: paddedInkWell(
|
||||||
|
key: innerKey,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(),
|
||||||
const SizedBox(),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1424,23 +1439,26 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
|
|
||||||
// Reparent parent
|
// Reparent parent
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Material(
|
MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Align(
|
child: Directionality(
|
||||||
alignment: Alignment.topLeft,
|
textDirection: TextDirection.ltr,
|
||||||
child: SizedBox(
|
child: Align(
|
||||||
width: 200,
|
alignment: Alignment.topLeft,
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: Row(
|
width: 200,
|
||||||
children: <Widget>[
|
height: 100,
|
||||||
paddedInkWell(
|
child: Row(
|
||||||
key: innerKey,
|
children: <Widget>[
|
||||||
),
|
paddedInkWell(
|
||||||
paddedInkWell(
|
key: innerKey,
|
||||||
key: middleKey,
|
),
|
||||||
),
|
paddedInkWell(
|
||||||
],
|
key: middleKey,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1479,16 +1497,19 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Material(
|
MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Center(
|
child: Directionality(
|
||||||
child: paddedInkWell(
|
textDirection: TextDirection.ltr,
|
||||||
|
child: Center(
|
||||||
child: paddedInkWell(
|
child: paddedInkWell(
|
||||||
key: middleKey,
|
|
||||||
child: paddedInkWell(
|
child: paddedInkWell(
|
||||||
key: innerKey,
|
key: middleKey,
|
||||||
child: const SizedBox(width: 50, height: 50),
|
child: paddedInkWell(
|
||||||
|
key: innerKey,
|
||||||
|
child: const SizedBox(width: 50, height: 50),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1514,39 +1535,42 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
final GlobalKey leftKey = GlobalKey();
|
final GlobalKey leftKey = GlobalKey();
|
||||||
final GlobalKey rightKey = GlobalKey();
|
final GlobalKey rightKey = GlobalKey();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Material(
|
MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Center(
|
child: Directionality(
|
||||||
child: SizedBox(
|
textDirection: TextDirection.ltr,
|
||||||
width: 100,
|
child: Center(
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: InkWell(
|
width: 100,
|
||||||
key: parentKey,
|
height: 100,
|
||||||
onTap: () {},
|
child: InkWell(
|
||||||
child: Center(
|
key: parentKey,
|
||||||
child: SizedBox(
|
onTap: () {},
|
||||||
width: 100,
|
child: Center(
|
||||||
height: 50,
|
child: SizedBox(
|
||||||
child: Row(
|
width: 100,
|
||||||
children: <Widget>[
|
height: 50,
|
||||||
SizedBox(
|
child: Row(
|
||||||
width: 50,
|
children: <Widget>[
|
||||||
height: 50,
|
SizedBox(
|
||||||
child: InkWell(
|
width: 50,
|
||||||
key: leftKey,
|
height: 50,
|
||||||
onTap: () {},
|
child: InkWell(
|
||||||
|
key: leftKey,
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
width: 50,
|
||||||
width: 50,
|
height: 50,
|
||||||
height: 50,
|
child: InkWell(
|
||||||
child: InkWell(
|
key: rightKey,
|
||||||
key: rightKey,
|
onTap: () {},
|
||||||
onTap: () {},
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1610,47 +1634,50 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
Widget? leftChild,
|
Widget? leftChild,
|
||||||
Widget? rightChild,
|
Widget? rightChild,
|
||||||
}) {
|
}) {
|
||||||
return Material(
|
return MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: Align(
|
child: Directionality(
|
||||||
alignment: Alignment.topLeft,
|
textDirection: TextDirection.ltr,
|
||||||
child: SizedBox(
|
child: Align(
|
||||||
width: leftWidth+rightWidth,
|
alignment: Alignment.topLeft,
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: Row(
|
width: leftWidth+rightWidth,
|
||||||
children: <Widget>[
|
height: 100,
|
||||||
SizedBox(
|
child: Row(
|
||||||
width: leftWidth,
|
children: <Widget>[
|
||||||
height: 100,
|
SizedBox(
|
||||||
child: InkWell(
|
width: leftWidth,
|
||||||
key: leftKey,
|
height: 100,
|
||||||
onTap: () {},
|
child: InkWell(
|
||||||
child: Center(
|
key: leftKey,
|
||||||
child: SizedBox(
|
onTap: () {},
|
||||||
width: leftWidth,
|
child: Center(
|
||||||
height: 50,
|
child: SizedBox(
|
||||||
child: leftChild,
|
width: leftWidth,
|
||||||
|
height: 50,
|
||||||
|
child: leftChild,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
width: rightWidth,
|
||||||
width: rightWidth,
|
height: 100,
|
||||||
height: 100,
|
child: InkWell(
|
||||||
child: InkWell(
|
key: rightKey,
|
||||||
key: rightKey,
|
onTap: () {},
|
||||||
onTap: () {},
|
child: Center(
|
||||||
child: Center(
|
child: SizedBox(
|
||||||
child: SizedBox(
|
width: leftWidth,
|
||||||
width: leftWidth,
|
height: 50,
|
||||||
height: 50,
|
child: rightChild,
|
||||||
child: rightChild,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1714,24 +1741,27 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
testWidgets("Ink wells's splash starts before tap is confirmed and disappear after tap is canceled", (WidgetTester tester) async {
|
testWidgets("Ink wells's splash starts before tap is confirmed and disappear after tap is canceled", (WidgetTester tester) async {
|
||||||
final GlobalKey innerKey = GlobalKey();
|
final GlobalKey innerKey = GlobalKey();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Material(
|
MaterialApp(
|
||||||
child: Directionality(
|
theme: ThemeData(useMaterial3: false),
|
||||||
textDirection: TextDirection.ltr,
|
home: Material(
|
||||||
child: GestureDetector(
|
child: Directionality(
|
||||||
onHorizontalDragStart: (_) {},
|
textDirection: TextDirection.ltr,
|
||||||
child: Center(
|
child: GestureDetector(
|
||||||
child: SizedBox(
|
onHorizontalDragStart: (_) {},
|
||||||
width: 100,
|
child: Center(
|
||||||
height: 100,
|
child: SizedBox(
|
||||||
child: InkWell(
|
width: 100,
|
||||||
onTap: () {},
|
height: 100,
|
||||||
child: Center(
|
child: InkWell(
|
||||||
child: SizedBox(
|
onTap: () {},
|
||||||
width: 50,
|
child: Center(
|
||||||
height: 50,
|
child: SizedBox(
|
||||||
child: InkWell(
|
width: 50,
|
||||||
key: innerKey,
|
height: 50,
|
||||||
onTap: () {},
|
child: InkWell(
|
||||||
|
key: innerKey,
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -36,6 +36,7 @@ Widget buildInputDecorator({
|
|||||||
),
|
),
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -787,6 +788,7 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
Widget buildFrame(bool alignLabelWithHint) {
|
Widget buildFrame(bool alignLabelWithHint) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
@ -837,6 +839,7 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
Widget buildFrame(bool alignLabelWithHint) {
|
Widget buildFrame(bool alignLabelWithHint) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
@ -888,6 +891,7 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
Widget buildFrame(bool alignLabelWithHint) {
|
Widget buildFrame(bool alignLabelWithHint) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
@ -939,6 +943,7 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
Widget buildFrame(bool alignLabelWithHint) {
|
Widget buildFrame(bool alignLabelWithHint) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
@ -5714,6 +5719,7 @@ void main() {
|
|||||||
late StateSetter setState;
|
late StateSetter setState;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: StatefulBuilder(
|
home: StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setter) {
|
builder: (BuildContext context, StateSetter setter) {
|
||||||
setState = setter;
|
setState = setter;
|
||||||
|
@ -991,6 +991,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('ListTile can be splashed and has correct splash color', (WidgetTester tester) async {
|
testWidgets('ListTile can be splashed and has correct splash color', (WidgetTester tester) async {
|
||||||
final Widget buildApp = MaterialApp(
|
final Widget buildApp = MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -1279,6 +1280,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
@ -1807,6 +1809,7 @@ void main() {
|
|||||||
bool selected = false,
|
bool selected = false,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
@ -3571,6 +3574,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('ListTile text color', (WidgetTester tester) async {
|
testWidgets('ListTile text color', (WidgetTester tester) async {
|
||||||
|
final ThemeData theme = ThemeData(useMaterial3: false);
|
||||||
Widget buildFrame({
|
Widget buildFrame({
|
||||||
bool dense = false,
|
bool dense = false,
|
||||||
bool enabled = true,
|
bool enabled = true,
|
||||||
@ -3578,7 +3582,7 @@ void main() {
|
|||||||
ListTileStyle? style,
|
ListTileStyle? style,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(useMaterial3: false),
|
theme: theme,
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
@ -3600,8 +3604,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ThemeData theme = ThemeData();
|
|
||||||
|
|
||||||
// ListTile - ListTileStyle.list (default).
|
// ListTile - ListTileStyle.list (default).
|
||||||
await tester.pumpWidget(buildFrame());
|
await tester.pumpWidget(buildFrame());
|
||||||
RenderParagraph leading = _getTextRenderObject(tester, 'leading');
|
RenderParagraph leading = _getTextRenderObject(tester, 'leading');
|
||||||
|
@ -215,6 +215,7 @@ void main() {
|
|||||||
Color? textColor,
|
Color? textColor,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ListTileTheme(
|
child: ListTileTheme(
|
||||||
|
@ -82,6 +82,7 @@ void main() {
|
|||||||
}) {
|
}) {
|
||||||
final FocusNode focusNode = FocusNode();
|
final FocusNode focusNode = FocusNode();
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
@ -145,7 +146,7 @@ void main() {
|
|||||||
testWidgets('Menu responds to density changes', (WidgetTester tester) async {
|
testWidgets('Menu responds to density changes', (WidgetTester tester) async {
|
||||||
Widget buildMenu({VisualDensity? visualDensity = VisualDensity.standard}) {
|
Widget buildMenu({VisualDensity? visualDensity = VisualDensity.standard}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(visualDensity: visualDensity),
|
theme: ThemeData(visualDensity: visualDensity, useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -542,6 +543,7 @@ void main() {
|
|||||||
testWidgets('geometry', (WidgetTester tester) async {
|
testWidgets('geometry', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -606,6 +608,7 @@ void main() {
|
|||||||
testWidgets('geometry with RTL direction', (WidgetTester tester) async {
|
testWidgets('geometry with RTL direction', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
@ -815,6 +818,7 @@ void main() {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -867,6 +871,7 @@ void main() {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
@ -2295,6 +2300,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(800, 600));
|
await changeSurfaceSize(tester, const Size(800, 600));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -2338,6 +2344,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(800, 600));
|
await changeSurfaceSize(tester, const Size(800, 600));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
child: Material(
|
child: Material(
|
||||||
@ -2384,6 +2391,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(300, 300));
|
await changeSurfaceSize(tester, const Size(300, 300));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Directionality(
|
return Directionality(
|
||||||
@ -2428,6 +2436,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(300, 300));
|
await changeSurfaceSize(tester, const Size(300, 300));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Directionality(
|
return Directionality(
|
||||||
@ -2472,6 +2481,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(800, 600));
|
await changeSurfaceSize(tester, const Size(800, 600));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Directionality(
|
return Directionality(
|
||||||
@ -2548,6 +2558,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(800, 600));
|
await changeSurfaceSize(tester, const Size(800, 600));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Directionality(
|
return Directionality(
|
||||||
@ -2624,6 +2635,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(800, 600));
|
await changeSurfaceSize(tester, const Size(800, 600));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Directionality(
|
return Directionality(
|
||||||
@ -2675,6 +2687,7 @@ void main() {
|
|||||||
await changeSurfaceSize(tester, const Size(800, 600));
|
await changeSurfaceSize(tester, const Size(800, 600));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Directionality(
|
return Directionality(
|
||||||
@ -2730,7 +2743,7 @@ void main() {
|
|||||||
}) async {
|
}) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(visualDensity: visualDensity),
|
theme: ThemeData.light(useMaterial3: false).copyWith(visualDensity: visualDensity),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
child: Material(
|
child: Material(
|
||||||
|
@ -55,6 +55,7 @@ void main() {
|
|||||||
testWidgets('theme is honored', (WidgetTester tester) async {
|
testWidgets('theme is honored', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Builder(builder: (BuildContext context) {
|
child: Builder(builder: (BuildContext context) {
|
||||||
return MenuTheme(
|
return MenuTheme(
|
||||||
@ -107,6 +108,7 @@ void main() {
|
|||||||
testWidgets('Constructor parameters override theme parameters', (WidgetTester tester) async {
|
testWidgets('Constructor parameters override theme parameters', (WidgetTester tester) async {
|
||||||
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) {
|
||||||
|
@ -239,6 +239,7 @@ void main() {
|
|||||||
testWidgets('visual density', (WidgetTester tester) async {
|
testWidgets('visual density', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -55,6 +55,7 @@ void main() {
|
|||||||
testWidgets('theme is honored', (WidgetTester tester) async {
|
testWidgets('theme is honored', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Builder(builder: (BuildContext context) {
|
child: Builder(builder: (BuildContext context) {
|
||||||
return MenuBarTheme(
|
return MenuBarTheme(
|
||||||
@ -107,6 +108,7 @@ void main() {
|
|||||||
testWidgets('Constructor parameters override theme parameters', (WidgetTester tester) async {
|
testWidgets('Constructor parameters override theme parameters', (WidgetTester tester) async {
|
||||||
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) {
|
||||||
|
@ -202,8 +202,9 @@ void main() {
|
|||||||
testWidgets('MergeableMaterial paints shadows', (WidgetTester tester) async {
|
testWidgets('MergeableMaterial paints shadows', (WidgetTester tester) async {
|
||||||
debugDisableShadows = false;
|
debugDisableShadows = false;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: MergeableMaterial(
|
child: MergeableMaterial(
|
||||||
children: <MergeableMaterialItem>[
|
children: <MergeableMaterialItem>[
|
||||||
@ -1100,8 +1101,9 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('MergeableMaterial dividers', (WidgetTester tester) async {
|
testWidgets('MergeableMaterial dividers', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: MergeableMaterial(
|
child: MergeableMaterial(
|
||||||
hasDividers: true,
|
hasDividers: true,
|
||||||
@ -1157,8 +1159,9 @@ void main() {
|
|||||||
expect(isDivider(boxes[offset + 3], true, false), isTrue);
|
expect(isDivider(boxes[offset + 3], true, false), isTrue);
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: MergeableMaterial(
|
child: MergeableMaterial(
|
||||||
hasDividers: true,
|
hasDividers: true,
|
||||||
|
@ -534,6 +534,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: const Placeholder(),
|
body: const Placeholder(),
|
||||||
bottomSheet: Container(
|
bottomSheet: Container(
|
||||||
|
@ -1560,6 +1560,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: PopupMenuButton<String>(
|
child: PopupMenuButton<String>(
|
||||||
@ -1774,6 +1775,7 @@ void main() {
|
|||||||
double fontSize = 24,
|
double fontSize = 24,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
builder: (BuildContext context, Widget? child) {
|
builder: (BuildContext context, Widget? child) {
|
||||||
return Directionality(
|
return Directionality(
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
@ -2363,6 +2365,7 @@ void main() {
|
|||||||
|
|
||||||
Widget buildFrame(double width, double height) {
|
Widget buildFrame(double width, double height) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
builder: (BuildContext context, Widget? child) {
|
builder: (BuildContext context, Widget? child) {
|
||||||
return MediaQuery(
|
return MediaQuery(
|
||||||
data: const MediaQueryData(
|
data: const MediaQueryData(
|
||||||
@ -2422,6 +2425,7 @@ void main() {
|
|||||||
|
|
||||||
Widget buildFrame(double width, double height) {
|
Widget buildFrame(double width, double height) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
builder: (BuildContext context, Widget? child) {
|
builder: (BuildContext context, Widget? child) {
|
||||||
return MediaQuery(
|
return MediaQuery(
|
||||||
data: const MediaQueryData(
|
data: const MediaQueryData(
|
||||||
@ -2710,6 +2714,7 @@ void main() {
|
|||||||
Future<void> buildFrameWithoutChild({double? splashRadius}) {
|
Future<void> buildFrameWithoutChild({double? splashRadius}) {
|
||||||
return tester.pumpWidget(
|
return tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: PopupMenuButton<String>(
|
child: PopupMenuButton<String>(
|
||||||
|
@ -409,7 +409,7 @@ void main() {
|
|||||||
final Key popupButtonApp = UniqueKey();
|
final Key popupButtonApp = UniqueKey();
|
||||||
final Key enabledPopupItemKey = UniqueKey();
|
final Key enabledPopupItemKey = UniqueKey();
|
||||||
final Key disabledPopupItemKey = UniqueKey();
|
final Key disabledPopupItemKey = UniqueKey();
|
||||||
final ThemeData theme = ThemeData();
|
final ThemeData theme = ThemeData(useMaterial3: false);
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
@ -511,7 +511,7 @@ void main() {
|
|||||||
final Key disabledPopupItemKey = UniqueKey();
|
final Key disabledPopupItemKey = UniqueKey();
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(popupMenuTheme: popupMenuTheme),
|
theme: ThemeData(popupMenuTheme: popupMenuTheme, useMaterial3: false),
|
||||||
key: popupButtonApp,
|
key: popupButtonApp,
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -1407,6 +1407,7 @@ void main() {
|
|||||||
values = newValues;
|
values = newValues;
|
||||||
}
|
}
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
// The builder is used to pass the context from the MaterialApp widget
|
// The builder is used to pass the context from the MaterialApp widget
|
||||||
// to the [Navigator]. This context is required in order for the
|
// to the [Navigator]. This context is required in order for the
|
||||||
|
@ -959,6 +959,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: RefreshIndicator(
|
home: RefreshIndicator(
|
||||||
onRefresh: refresh,
|
onRefresh: refresh,
|
||||||
child: Builder(
|
child: Builder(
|
||||||
|
@ -581,7 +581,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Title'),
|
title: const Text('Title'),
|
||||||
@ -746,6 +746,7 @@ void main() {
|
|||||||
// Regression test for https://github.com/flutter/flutter/pull/92039
|
// Regression test for https://github.com/flutter/flutter/pull/92039
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: MediaQuery(
|
home: MediaQuery(
|
||||||
data: const MediaQueryData(
|
data: const MediaQueryData(
|
||||||
// Representing a navigational notch at the bottom of the screen
|
// Representing a navigational notch at the bottom of the screen
|
||||||
@ -991,9 +992,9 @@ void main() {
|
|||||||
late double mediaQueryBottom;
|
late double mediaQueryBottom;
|
||||||
|
|
||||||
Widget buildFrame({ required bool extendBody, bool? resizeToAvoidBottomInset, double viewInsetBottom = 0.0 }) {
|
Widget buildFrame({ required bool extendBody, bool? resizeToAvoidBottomInset, double viewInsetBottom = 0.0 }) {
|
||||||
return Directionality(
|
return MaterialApp(
|
||||||
textDirection: TextDirection.ltr,
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: MediaQuery(
|
home: MediaQuery(
|
||||||
data: MediaQueryData(
|
data: MediaQueryData(
|
||||||
viewInsets: EdgeInsets.only(bottom: viewInsetBottom),
|
viewInsets: EdgeInsets.only(bottom: viewInsetBottom),
|
||||||
),
|
),
|
||||||
|
@ -851,6 +851,7 @@ void main() {
|
|||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: PrimaryScrollController(
|
home: PrimaryScrollController(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
child: Scrollbar(
|
child: Scrollbar(
|
||||||
@ -942,6 +943,7 @@ void main() {
|
|||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
scrollbarTheme: ScrollbarThemeData(thumbVisibility: MaterialStateProperty.all(true)),
|
scrollbarTheme: ScrollbarThemeData(thumbVisibility: MaterialStateProperty.all(true)),
|
||||||
),
|
),
|
||||||
home: const SingleChildScrollView(
|
home: const SingleChildScrollView(
|
||||||
@ -988,10 +990,13 @@ void main() {
|
|||||||
testWidgets('Hover animation is not triggered by tap gestures', (WidgetTester tester) async {
|
testWidgets('Hover animation is not triggered by tap gestures', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(scrollbarTheme: ScrollbarThemeData(
|
theme: ThemeData(
|
||||||
thumbVisibility: MaterialStateProperty.all(true),
|
useMaterial3: false,
|
||||||
showTrackOnHover: true,
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
)),
|
thumbVisibility: MaterialStateProperty.all(true),
|
||||||
|
showTrackOnHover: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
home: const SingleChildScrollView(
|
home: const SingleChildScrollView(
|
||||||
child: SizedBox(width: 4000.0, height: 4000.0),
|
child: SizedBox(width: 4000.0, height: 4000.0),
|
||||||
),
|
),
|
||||||
@ -1060,19 +1065,22 @@ void main() {
|
|||||||
testWidgets('ScrollbarThemeData.thickness replaces hoverThickness', (WidgetTester tester) async {
|
testWidgets('ScrollbarThemeData.thickness replaces hoverThickness', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(scrollbarTheme: ScrollbarThemeData(
|
theme: ThemeData(
|
||||||
thumbVisibility: MaterialStateProperty.resolveWith((Set<MaterialState> states) => true),
|
useMaterial3: false,
|
||||||
trackVisibility: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
return states.contains(MaterialState.hovered);
|
thumbVisibility: MaterialStateProperty.resolveWith((Set<MaterialState> states) => true),
|
||||||
}),
|
trackVisibility: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
|
||||||
thickness: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
|
return states.contains(MaterialState.hovered);
|
||||||
if (states.contains(MaterialState.hovered)) {
|
}),
|
||||||
return 40.0;
|
thickness: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
|
||||||
}
|
if (states.contains(MaterialState.hovered)) {
|
||||||
// Default thickness
|
return 40.0;
|
||||||
return 8.0;
|
}
|
||||||
}),
|
// Default thickness
|
||||||
)),
|
return 8.0;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
home: const SingleChildScrollView(
|
home: const SingleChildScrollView(
|
||||||
child: SizedBox(width: 4000.0, height: 4000.0),
|
child: SizedBox(width: 4000.0, height: 4000.0),
|
||||||
),
|
),
|
||||||
@ -1129,15 +1137,18 @@ void main() {
|
|||||||
testWidgets('ScrollbarThemeData.trackVisibility replaces showTrackOnHover', (WidgetTester tester) async {
|
testWidgets('ScrollbarThemeData.trackVisibility replaces showTrackOnHover', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(scrollbarTheme: ScrollbarThemeData(
|
theme: ThemeData(
|
||||||
thumbVisibility: MaterialStateProperty.all(true),
|
useMaterial3: false,
|
||||||
trackVisibility: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
if (states.contains(MaterialState.hovered)) {
|
thumbVisibility: MaterialStateProperty.all(true),
|
||||||
return true;
|
trackVisibility: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
|
||||||
}
|
if (states.contains(MaterialState.hovered)) {
|
||||||
return false;
|
return true;
|
||||||
}),
|
}
|
||||||
)),
|
return false;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
home: const SingleChildScrollView(
|
home: const SingleChildScrollView(
|
||||||
child: SizedBox(width: 4000.0, height: 4000.0),
|
child: SizedBox(width: 4000.0, height: 4000.0),
|
||||||
),
|
),
|
||||||
@ -1194,10 +1205,13 @@ void main() {
|
|||||||
testWidgets('Scrollbar showTrackOnHover', (WidgetTester tester) async {
|
testWidgets('Scrollbar showTrackOnHover', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(scrollbarTheme: ScrollbarThemeData(
|
theme: ThemeData(
|
||||||
thumbVisibility: MaterialStateProperty.all(true),
|
useMaterial3: false,
|
||||||
showTrackOnHover: true,
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
)),
|
thumbVisibility: MaterialStateProperty.all(true),
|
||||||
|
showTrackOnHover: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
home: const SingleChildScrollView(
|
home: const SingleChildScrollView(
|
||||||
child: SizedBox(width: 4000.0, height: 4000.0),
|
child: SizedBox(width: 4000.0, height: 4000.0),
|
||||||
),
|
),
|
||||||
@ -1387,6 +1401,7 @@ void main() {
|
|||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: PrimaryScrollController(
|
home: PrimaryScrollController(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
child: Scrollbar(
|
child: Scrollbar(
|
||||||
@ -1550,6 +1565,7 @@ void main() {
|
|||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: PrimaryScrollController(
|
home: PrimaryScrollController(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
child: Scrollbar(
|
child: Scrollbar(
|
||||||
|
@ -35,6 +35,7 @@ void main() {
|
|||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: ScrollConfiguration(
|
home: ScrollConfiguration(
|
||||||
behavior: const NoScrollbarBehavior(),
|
behavior: const NoScrollbarBehavior(),
|
||||||
child: Scrollbar(
|
child: Scrollbar(
|
||||||
@ -259,7 +260,7 @@ void main() {
|
|||||||
testWidgets('ScrollbarTheme can disable gestures', (WidgetTester tester) async {
|
testWidgets('ScrollbarTheme can disable gestures', (WidgetTester tester) async {
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(scrollbarTheme: const ScrollbarThemeData(interactive: false)),
|
theme: ThemeData(useMaterial3: false, scrollbarTheme: const ScrollbarThemeData(interactive: false)),
|
||||||
home: Scrollbar(
|
home: Scrollbar(
|
||||||
thumbVisibility: true,
|
thumbVisibility: true,
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
@ -306,7 +307,7 @@ void main() {
|
|||||||
testWidgets('Scrollbar.interactive takes priority over ScrollbarTheme', (WidgetTester tester) async {
|
testWidgets('Scrollbar.interactive takes priority over ScrollbarTheme', (WidgetTester tester) async {
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(scrollbarTheme: const ScrollbarThemeData(interactive: false)),
|
theme: ThemeData(useMaterial3: false, scrollbarTheme: const ScrollbarThemeData(interactive: false)),
|
||||||
home: Scrollbar(
|
home: Scrollbar(
|
||||||
interactive: true,
|
interactive: true,
|
||||||
thumbVisibility: true,
|
thumbVisibility: true,
|
||||||
@ -625,7 +626,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData().copyWith(
|
theme: ThemeData(useMaterial3: false).copyWith(
|
||||||
scrollbarTheme: _scrollbarTheme(
|
scrollbarTheme: _scrollbarTheme(
|
||||||
trackVisibility: MaterialStateProperty.resolveWith(getTrackVisibility),
|
trackVisibility: MaterialStateProperty.resolveWith(getTrackVisibility),
|
||||||
),
|
),
|
||||||
|
@ -734,7 +734,7 @@ void main() {
|
|||||||
|
|
||||||
// Regression test for: https://github.com/flutter/flutter/issues/66781
|
// Regression test for: https://github.com/flutter/flutter/issues/66781
|
||||||
testWidgets('text in search bar contrasts background (light mode)', (WidgetTester tester) async {
|
testWidgets('text in search bar contrasts background (light mode)', (WidgetTester tester) async {
|
||||||
final ThemeData themeData = ThemeData.light();
|
final ThemeData themeData = ThemeData(useMaterial3: false);
|
||||||
final _TestSearchDelegate delegate = _TestSearchDelegate(
|
final _TestSearchDelegate delegate = _TestSearchDelegate(
|
||||||
defaultAppBarTheme: true,
|
defaultAppBarTheme: true,
|
||||||
);
|
);
|
||||||
@ -762,7 +762,7 @@ void main() {
|
|||||||
|
|
||||||
// Regression test for: https://github.com/flutter/flutter/issues/66781
|
// Regression test for: https://github.com/flutter/flutter/issues/66781
|
||||||
testWidgets('text in search bar contrasts background (dark mode)', (WidgetTester tester) async {
|
testWidgets('text in search bar contrasts background (dark mode)', (WidgetTester tester) async {
|
||||||
final ThemeData themeData = ThemeData.dark();
|
final ThemeData themeData = ThemeData.dark(useMaterial3: false);
|
||||||
final _TestSearchDelegate delegate = _TestSearchDelegate(
|
final _TestSearchDelegate delegate = _TestSearchDelegate(
|
||||||
defaultAppBarTheme: true,
|
defaultAppBarTheme: true,
|
||||||
);
|
);
|
||||||
|
@ -167,6 +167,7 @@ void main() {
|
|||||||
// Regression test for https://github.com/flutter/flutter/issues/119314
|
// Regression test for https://github.com/flutter/flutter/issues/119314
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.only(top: 64),
|
padding: const EdgeInsets.only(top: 64),
|
||||||
|
@ -829,6 +829,7 @@ void main() {
|
|||||||
ShowValueIndicator show = ShowValueIndicator.onlyForDiscrete,
|
ShowValueIndicator show = ShowValueIndicator.onlyForDiscrete,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: StatefulBuilder(
|
child: StatefulBuilder(
|
||||||
@ -2670,6 +2671,7 @@ void main() {
|
|||||||
bool enabled = true,
|
bool enabled = true,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Builder(
|
body: Builder(
|
||||||
// The builder is used to pass the context from the MaterialApp widget
|
// The builder is used to pass the context from the MaterialApp widget
|
||||||
@ -3638,10 +3640,11 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Slider can be hovered and has correct hover color', (WidgetTester tester) async {
|
testWidgets('Slider can be hovered and has correct hover color', (WidgetTester tester) async {
|
||||||
tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;
|
tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;
|
||||||
final ThemeData theme = ThemeData();
|
final ThemeData theme = ThemeData(useMaterial3: false);
|
||||||
double value = 0.5;
|
double value = 0.5;
|
||||||
Widget buildApp({bool enabled = true}) {
|
Widget buildApp({bool enabled = true}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: theme,
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
child: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||||
|
@ -242,6 +242,7 @@ void main() {
|
|||||||
const Color customColor2 = Color(0xdeadbeef);
|
const Color customColor2 = Color(0xdeadbeef);
|
||||||
const Color customColor3 = Color(0xdecaface);
|
const Color customColor3 = Color(0xdecaface);
|
||||||
final ThemeData theme = ThemeData(
|
final ThemeData theme = ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
platform: TargetPlatform.android,
|
platform: TargetPlatform.android,
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
sliderTheme: const SliderThemeData(
|
sliderTheme: const SliderThemeData(
|
||||||
@ -276,6 +277,7 @@ void main() {
|
|||||||
value = d;
|
value = d;
|
||||||
};
|
};
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: theme,
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: Material(
|
child: Material(
|
||||||
@ -894,6 +896,7 @@ void main() {
|
|||||||
debugDisableShadows = false;
|
debugDisableShadows = false;
|
||||||
try {
|
try {
|
||||||
final ThemeData theme = ThemeData(
|
final ThemeData theme = ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
platform: TargetPlatform.android,
|
platform: TargetPlatform.android,
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
);
|
);
|
||||||
@ -904,6 +907,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
Widget buildApp(String value, { double sliderValue = 0.5, double textScale = 1.0 }) {
|
Widget buildApp(String value, { double sliderValue = 0.5, double textScale = 1.0 }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: theme,
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
@ -1076,6 +1080,7 @@ void main() {
|
|||||||
debugDisableShadows = false;
|
debugDisableShadows = false;
|
||||||
try {
|
try {
|
||||||
final ThemeData theme = ThemeData(
|
final ThemeData theme = ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
platform: TargetPlatform.android,
|
platform: TargetPlatform.android,
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
);
|
);
|
||||||
@ -1086,6 +1091,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
Widget buildApp(String value, { double sliderValue = 0.5, double textScale = 1.0 }) {
|
Widget buildApp(String value, { double sliderValue = 0.5, double textScale = 1.0 }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: theme,
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
@ -2081,7 +2087,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Slider defaults', (WidgetTester tester) async {
|
testWidgets('Slider defaults', (WidgetTester tester) async {
|
||||||
debugDisableShadows = false;
|
debugDisableShadows = false;
|
||||||
final ThemeData theme = ThemeData();
|
final ThemeData theme = ThemeData(useMaterial3: false);
|
||||||
const double trackHeight = 4.0;
|
const double trackHeight = 4.0;
|
||||||
final ColorScheme colorScheme = theme.colorScheme;
|
final ColorScheme colorScheme = theme.colorScheme;
|
||||||
final Color activeTrackColor = Color(colorScheme.primary.value);
|
final Color activeTrackColor = Color(colorScheme.primary.value);
|
||||||
@ -2111,6 +2117,7 @@ void main() {
|
|||||||
value = d;
|
value = d;
|
||||||
};
|
};
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: theme,
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: Material(
|
child: Material(
|
||||||
@ -2232,6 +2239,7 @@ void main() {
|
|||||||
debugDisableShadows = false;
|
debugDisableShadows = false;
|
||||||
try {
|
try {
|
||||||
final ThemeData theme = ThemeData(
|
final ThemeData theme = ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
platform: TargetPlatform.android,
|
platform: TargetPlatform.android,
|
||||||
);
|
);
|
||||||
Widget buildApp(String value, { double sliderValue = 0.5, double textScale = 1.0 }) {
|
Widget buildApp(String value, { double sliderValue = 0.5, double textScale = 1.0 }) {
|
||||||
|
@ -302,7 +302,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Light theme SnackBar has dark background', (WidgetTester tester) async {
|
testWidgets('Light theme SnackBar has dark background', (WidgetTester tester) async {
|
||||||
final ThemeData lightTheme = ThemeData.light();
|
final ThemeData lightTheme = ThemeData.light(useMaterial3: false);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: lightTheme,
|
theme: lightTheme,
|
||||||
@ -383,7 +383,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Dark theme SnackBar has primary text buttons', (WidgetTester tester) async {
|
testWidgets('Dark theme SnackBar has primary text buttons', (WidgetTester tester) async {
|
||||||
final ThemeData darkTheme = ThemeData.dark();
|
final ThemeData darkTheme = ThemeData.dark(useMaterial3: false);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: darkTheme,
|
theme: darkTheme,
|
||||||
@ -961,6 +961,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('SnackBar button text alignment', (WidgetTester tester) async {
|
testWidgets('SnackBar button text alignment', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: MediaQuery(
|
home: MediaQuery(
|
||||||
data: const MediaQueryData(
|
data: const MediaQueryData(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
@ -1010,6 +1011,7 @@ void main() {
|
|||||||
'Custom padding between SnackBar and its contents when set to SnackBarBehavior.fixed',
|
'Custom padding between SnackBar and its contents when set to SnackBarBehavior.fixed',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: MediaQuery(
|
home: MediaQuery(
|
||||||
data: const MediaQueryData(
|
data: const MediaQueryData(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
@ -1120,6 +1122,7 @@ void main() {
|
|||||||
testWidgets('Floating SnackBar button text alignment', (WidgetTester tester) async {
|
testWidgets('Floating SnackBar button text alignment', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
snackBarTheme: const SnackBarThemeData(behavior: SnackBarBehavior.floating),
|
snackBarTheme: const SnackBarThemeData(behavior: SnackBarBehavior.floating),
|
||||||
),
|
),
|
||||||
home: MediaQuery(
|
home: MediaQuery(
|
||||||
@ -1172,6 +1175,7 @@ void main() {
|
|||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
snackBarTheme: const SnackBarThemeData(behavior: SnackBarBehavior.floating),
|
snackBarTheme: const SnackBarThemeData(behavior: SnackBarBehavior.floating),
|
||||||
),
|
),
|
||||||
home: MediaQuery(
|
home: MediaQuery(
|
||||||
@ -1902,8 +1906,9 @@ void main() {
|
|||||||
testWidgets('Snackbar with SnackBarBehavior.floating will assert when offset too high by a large Scaffold.persistentFooterButtons', (WidgetTester tester) async {
|
testWidgets('Snackbar with SnackBarBehavior.floating will assert when offset too high by a large Scaffold.persistentFooterButtons', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/84263
|
// Regression test for https://github.com/flutter/flutter/issues/84263
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
persistentFooterButtons: <Widget>[SizedBox(height: 1000)],
|
persistentFooterButtons: <Widget>[SizedBox(height: 1000)],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1917,8 +1922,9 @@ void main() {
|
|||||||
testWidgets('Snackbar with SnackBarBehavior.floating will assert when offset too high by a large Scaffold.bottomNavigationBar', (WidgetTester tester) async {
|
testWidgets('Snackbar with SnackBarBehavior.floating will assert when offset too high by a large Scaffold.bottomNavigationBar', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/84263
|
// Regression test for https://github.com/flutter/flutter/issues/84263
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
bottomNavigationBar: SizedBox(height: 1000),
|
bottomNavigationBar: SizedBox(height: 1000),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -13,17 +13,20 @@ import '../rendering/recording_canvas.dart';
|
|||||||
import '../widgets/semantics_tester.dart';
|
import '../widgets/semantics_tester.dart';
|
||||||
import 'feedback_tester.dart';
|
import 'feedback_tester.dart';
|
||||||
|
|
||||||
Widget boilerplate({ Widget? child, TextDirection textDirection = TextDirection.ltr }) {
|
Widget boilerplate({ Widget? child, TextDirection textDirection = TextDirection.ltr, bool? useMaterial3, TabBarTheme? tabBarTheme }) {
|
||||||
return Localizations(
|
return Theme(
|
||||||
locale: const Locale('en', 'US'),
|
data: ThemeData(useMaterial3: useMaterial3, tabBarTheme: tabBarTheme),
|
||||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
child: Localizations(
|
||||||
DefaultMaterialLocalizations.delegate,
|
locale: const Locale('en', 'US'),
|
||||||
DefaultWidgetsLocalizations.delegate,
|
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||||
],
|
DefaultMaterialLocalizations.delegate,
|
||||||
child: Directionality(
|
DefaultWidgetsLocalizations.delegate,
|
||||||
textDirection: textDirection,
|
],
|
||||||
child: Material(
|
child: Directionality(
|
||||||
child: child,
|
textDirection: textDirection,
|
||||||
|
child: Material(
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -115,9 +118,13 @@ Widget buildFrame({
|
|||||||
EdgeInsetsGeometry? padding,
|
EdgeInsetsGeometry? padding,
|
||||||
TextDirection textDirection = TextDirection.ltr,
|
TextDirection textDirection = TextDirection.ltr,
|
||||||
TabAlignment? tabAlignment,
|
TabAlignment? tabAlignment,
|
||||||
|
TabBarTheme? tabBarTheme,
|
||||||
|
bool? useMaterial3,
|
||||||
}) {
|
}) {
|
||||||
if (secondaryTabBar) {
|
if (secondaryTabBar) {
|
||||||
return boilerplate(
|
return boilerplate(
|
||||||
|
useMaterial3: useMaterial3,
|
||||||
|
tabBarTheme: tabBarTheme,
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
animationDuration: animationDuration,
|
animationDuration: animationDuration,
|
||||||
@ -136,6 +143,8 @@ Widget buildFrame({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return boilerplate(
|
return boilerplate(
|
||||||
|
useMaterial3: useMaterial3,
|
||||||
|
tabBarTheme: tabBarTheme,
|
||||||
textDirection: textDirection,
|
textDirection: textDirection,
|
||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
animationDuration: animationDuration,
|
animationDuration: animationDuration,
|
||||||
@ -196,9 +205,9 @@ class TabControllerFrameState extends State<TabControllerFrame> with SingleTicke
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildLeftRightApp({required List<String> tabs, required String value, bool automaticIndicatorColorAdjustment = true}) {
|
Widget buildLeftRightApp({required List<String> tabs, required String value, bool automaticIndicatorColorAdjustment = true, ThemeData? themeData}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: themeData ?? ThemeData(platform: TargetPlatform.android),
|
||||||
home: DefaultTabController(
|
home: DefaultTabController(
|
||||||
initialIndex: tabs.indexOf(value),
|
initialIndex: tabs.indexOf(value),
|
||||||
length: tabs.length,
|
length: tabs.length,
|
||||||
@ -313,19 +322,23 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab sizing - text', (WidgetTester tester) async {
|
testWidgets('Tab sizing - text', (WidgetTester tester) async {
|
||||||
|
final ThemeData theme = ThemeData(fontFamily: 'FlutterTest');
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(theme: ThemeData(fontFamily: 'FlutterTest'), home: const Center(child: Material(child: Tab(text: 'x')))),
|
MaterialApp(theme: theme, home: const Center(child: Material(child: Tab(text: 'x')))),
|
||||||
);
|
);
|
||||||
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
|
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
|
||||||
expect(tester.getSize(find.byType(Tab)), const Size(14.0, 46.0));
|
expect(tester.getSize(find.byType(Tab)), material3 ? const Size(15.0, 46.0) : const Size(14.0, 46.0));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab sizing - icon and text', (WidgetTester tester) async {
|
testWidgets('Tab sizing - icon and text', (WidgetTester tester) async {
|
||||||
|
final ThemeData theme = ThemeData(fontFamily: 'FlutterTest');
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(theme: ThemeData(fontFamily: 'FlutterTest'), home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), text: 'x')))),
|
MaterialApp(theme: theme, home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), text: 'x')))),
|
||||||
);
|
);
|
||||||
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
|
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
|
||||||
expect(tester.getSize(find.byType(Tab)), const Size(14.0, 72.0));
|
expect(tester.getSize(find.byType(Tab)), material3 ? const Size(15.0, 72.0) : const Size(14.0, 72.0));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab sizing - icon, iconMargin and text', (WidgetTester tester) async {
|
testWidgets('Tab sizing - icon, iconMargin and text', (WidgetTester tester) async {
|
||||||
@ -353,35 +366,43 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab sizing - icon and child', (WidgetTester tester) async {
|
testWidgets('Tab sizing - icon and child', (WidgetTester tester) async {
|
||||||
|
final ThemeData theme = ThemeData(fontFamily: 'FlutterTest');
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(theme: ThemeData(fontFamily: 'FlutterTest'), home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), child: Text('x'))))),
|
MaterialApp(theme: theme, home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), child: Text('x'))))),
|
||||||
);
|
);
|
||||||
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
|
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
|
||||||
expect(tester.getSize(find.byType(Tab)), const Size(14.0, 72.0));
|
expect(tester.getSize(find.byType(Tab)), material3 ? const Size(15.0, 72.0) : const Size(14.0, 72.0));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab color - normal', (WidgetTester tester) async {
|
testWidgets('Tab color - normal', (WidgetTester tester) async {
|
||||||
|
final ThemeData theme = ThemeData(fontFamily: 'FlutterTest');
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
final Widget tabBar = TabBar(tabs: const <Widget>[SizedBox.shrink()], controller: TabController(length: 1, vsync: tester));
|
final Widget tabBar = TabBar(tabs: const <Widget>[SizedBox.shrink()], controller: TabController(length: 1, vsync: tester));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(home: Material(child: tabBar)),
|
MaterialApp(theme: theme, home: Material(child: tabBar)),
|
||||||
);
|
);
|
||||||
expect(find.byType(TabBar), paints..line(color: Colors.blue[500]));
|
expect(find.byType(TabBar), paints..line(color: material3 ? theme.colorScheme.surfaceVariant : Colors.blue[500]));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab color - match', (WidgetTester tester) async {
|
testWidgets('Tab color - match', (WidgetTester tester) async {
|
||||||
|
final ThemeData theme = ThemeData();
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
final Widget tabBar = TabBar(tabs: const <Widget>[SizedBox.shrink()], controller: TabController(length: 1, vsync: tester));
|
final Widget tabBar = TabBar(tabs: const <Widget>[SizedBox.shrink()], controller: TabController(length: 1, vsync: tester));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(home: Material(color: const Color(0xff2196f3), child: tabBar)),
|
MaterialApp(theme: theme, home: Material(color: const Color(0xff2196f3), child: tabBar)),
|
||||||
);
|
);
|
||||||
expect(find.byType(TabBar), paints..line(color: Colors.white));
|
expect(find.byType(TabBar), paints..line(color: material3 ? theme.colorScheme.surfaceVariant : Colors.white));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab color - transparency', (WidgetTester tester) async {
|
testWidgets('Tab color - transparency', (WidgetTester tester) async {
|
||||||
|
final ThemeData theme = ThemeData();
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
final Widget tabBar = TabBar(tabs: const <Widget>[SizedBox.shrink()], controller: TabController(length: 1, vsync: tester));
|
final Widget tabBar = TabBar(tabs: const <Widget>[SizedBox.shrink()], controller: TabController(length: 1, vsync: tester));
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(home: Material(type: MaterialType.transparency, child: tabBar)),
|
MaterialApp(theme: theme, home: Material(type: MaterialType.transparency, child: tabBar)),
|
||||||
);
|
);
|
||||||
expect(find.byType(TabBar), paints..line(color: Colors.blue[500]));
|
expect(find.byType(TabBar), paints..line(color: material3 ? theme.colorScheme.surfaceVariant : Colors.blue[500]));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('TabBar default selected/unselected label style (primary)', (WidgetTester tester) async {
|
testWidgets('TabBar default selected/unselected label style (primary)', (WidgetTester tester) async {
|
||||||
@ -391,10 +412,7 @@ void main() {
|
|||||||
const String selectedValue = 'A';
|
const String selectedValue = 'A';
|
||||||
const String unselectedValue = 'C';
|
const String unselectedValue = 'C';
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Theme(
|
buildFrame(tabs: tabs, value: selectedValue, useMaterial3: theme.useMaterial3),
|
||||||
data: theme,
|
|
||||||
child: buildFrame(tabs: tabs, value: selectedValue),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
expect(find.text('A'), findsOneWidget);
|
expect(find.text('A'), findsOneWidget);
|
||||||
expect(find.text('B'), findsOneWidget);
|
expect(find.text('B'), findsOneWidget);
|
||||||
@ -420,10 +438,7 @@ void main() {
|
|||||||
const String selectedValue = 'A';
|
const String selectedValue = 'A';
|
||||||
const String unselectedValue = 'C';
|
const String unselectedValue = 'C';
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Theme(
|
buildFrame(tabs: tabs, value: selectedValue, secondaryTabBar: true, useMaterial3: theme.useMaterial3),
|
||||||
data: theme,
|
|
||||||
child: buildFrame(tabs: tabs, value: selectedValue, secondaryTabBar: true),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
expect(find.text('A'), findsOneWidget);
|
expect(find.text('A'), findsOneWidget);
|
||||||
expect(find.text('B'), findsOneWidget);
|
expect(find.text('B'), findsOneWidget);
|
||||||
@ -455,8 +470,8 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: theme,
|
|
||||||
home: boilerplate(
|
home: boilerplate(
|
||||||
|
useMaterial3: theme.useMaterial3,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -514,8 +529,8 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: theme,
|
|
||||||
home: boilerplate(
|
home: boilerplate(
|
||||||
|
useMaterial3: theme.useMaterial3,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar.secondary(
|
child: TabBar.secondary(
|
||||||
@ -559,10 +574,7 @@ void main() {
|
|||||||
const String selectedValue = 'A';
|
const String selectedValue = 'A';
|
||||||
const String unselectedValue = 'B';
|
const String unselectedValue = 'B';
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Theme(
|
buildFrame(tabs: tabs, value: selectedValue, useMaterial3: theme.useMaterial3),
|
||||||
data: theme,
|
|
||||||
child: buildFrame(tabs: tabs, value: selectedValue),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
RenderObject overlayColor() {
|
RenderObject overlayColor() {
|
||||||
@ -599,10 +611,7 @@ void main() {
|
|||||||
const String selectedValue = 'A';
|
const String selectedValue = 'A';
|
||||||
const String unselectedValue = 'B';
|
const String unselectedValue = 'B';
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Theme(
|
buildFrame(tabs: tabs, value: selectedValue, secondaryTabBar: true, useMaterial3: theme.useMaterial3),
|
||||||
data: theme,
|
|
||||||
child: buildFrame(tabs: tabs, value: selectedValue, secondaryTabBar: true),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
RenderObject overlayColor() {
|
RenderObject overlayColor() {
|
||||||
@ -1548,7 +1557,7 @@ void main() {
|
|||||||
final List<String> tabs = <String>['A', 'B'];
|
final List<String> tabs = <String>['A', 'B'];
|
||||||
|
|
||||||
const Color indicatorColor = Color(0xFFFF0000);
|
const Color indicatorColor = Color(0xFFFF0000);
|
||||||
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'A', indicatorColor: indicatorColor, animationDuration: Duration.zero));
|
await tester.pumpWidget(buildFrame(useMaterial3: false, tabs: tabs, value: 'A', indicatorColor: indicatorColor, animationDuration: Duration.zero));
|
||||||
|
|
||||||
final RenderBox box = tester.renderObject(find.byType(TabBar));
|
final RenderBox box = tester.renderObject(find.byType(TabBar));
|
||||||
final TabIndicatorRecordingCanvas canvas = TabIndicatorRecordingCanvas(indicatorColor);
|
final TabIndicatorRecordingCanvas canvas = TabIndicatorRecordingCanvas(indicatorColor);
|
||||||
@ -1882,7 +1891,7 @@ void main() {
|
|||||||
final List<String> tabs = <String>['A', 'B'];
|
final List<String> tabs = <String>['A', 'B'];
|
||||||
|
|
||||||
const Color indicatorColor = Color(0xFFFF0000);
|
const Color indicatorColor = Color(0xFFFF0000);
|
||||||
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'A', indicatorColor: indicatorColor));
|
await tester.pumpWidget(buildFrame(useMaterial3: false, tabs: tabs, value: 'A', indicatorColor: indicatorColor));
|
||||||
|
|
||||||
final RenderBox box = tester.renderObject(find.byType(TabBar));
|
final RenderBox box = tester.renderObject(find.byType(TabBar));
|
||||||
final TabIndicatorRecordingCanvas canvas = TabIndicatorRecordingCanvas(indicatorColor);
|
final TabIndicatorRecordingCanvas canvas = TabIndicatorRecordingCanvas(indicatorColor);
|
||||||
@ -2301,6 +2310,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -2360,6 +2370,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
@ -2421,6 +2432,7 @@ void main() {
|
|||||||
|
|
||||||
Widget buildFrame() {
|
Widget buildFrame() {
|
||||||
return boilerplate(
|
return boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -2487,6 +2499,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -2556,6 +2569,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
@ -2627,6 +2641,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -2697,6 +2712,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
@ -2769,6 +2785,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -2847,6 +2864,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
@ -3041,6 +3059,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -3111,6 +3130,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -3180,6 +3200,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
@ -3242,6 +3263,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -3318,6 +3340,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
container: true,
|
container: true,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -3584,6 +3607,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
container: true,
|
container: true,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -3772,6 +3796,7 @@ void main() {
|
|||||||
|
|
||||||
Widget buildFrame(TabController controller) {
|
Widget buildFrame(TabController controller) {
|
||||||
return boilerplate(
|
return boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -3975,23 +4000,27 @@ void main() {
|
|||||||
expect(tester.takeException(), null);
|
expect(tester.takeException(), null);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Default tab indicator color is white', (WidgetTester tester) async {
|
testWidgets('Default tab indicator color is white in M2 and surfaceVariant in M3', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/15958
|
// Regression test for https://github.com/flutter/flutter/issues/15958
|
||||||
final List<String> tabs = <String>['LEFT', 'RIGHT'];
|
final List<String> tabs = <String>['LEFT', 'RIGHT'];
|
||||||
await tester.pumpWidget(buildLeftRightApp(tabs: tabs, value: 'LEFT'));
|
final ThemeData theme = ThemeData(platform: TargetPlatform.android);
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
|
await tester.pumpWidget(buildLeftRightApp(themeData: theme, tabs: tabs, value: 'LEFT'));
|
||||||
final RenderBox tabBarBox = tester.firstRenderObject<RenderBox>(find.byType(TabBar));
|
final RenderBox tabBarBox = tester.firstRenderObject<RenderBox>(find.byType(TabBar));
|
||||||
expect(tabBarBox, paints..line(
|
expect(tabBarBox, paints..line(
|
||||||
color: Colors.white,
|
color: material3 ? theme.colorScheme.surfaceVariant : Colors.white,
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Tab indicator color should not be adjusted when disable [automaticIndicatorColorAdjustment]', (WidgetTester tester) async {
|
testWidgets('Tab indicator color should not be adjusted when disable [automaticIndicatorColorAdjustment]', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/68077
|
// Regression test for https://github.com/flutter/flutter/issues/68077
|
||||||
final List<String> tabs = <String>['LEFT', 'RIGHT'];
|
final List<String> tabs = <String>['LEFT', 'RIGHT'];
|
||||||
await tester.pumpWidget(buildLeftRightApp(tabs: tabs, value: 'LEFT', automaticIndicatorColorAdjustment: false));
|
final ThemeData theme = ThemeData(platform: TargetPlatform.android);
|
||||||
|
final bool material3 = theme.useMaterial3;
|
||||||
|
await tester.pumpWidget(buildLeftRightApp(themeData: theme, tabs: tabs, value: 'LEFT', automaticIndicatorColorAdjustment: false));
|
||||||
final RenderBox tabBarBox = tester.firstRenderObject<RenderBox>(find.byType(TabBar));
|
final RenderBox tabBarBox = tester.firstRenderObject<RenderBox>(find.byType(TabBar));
|
||||||
expect(tabBarBox, paints..line(
|
expect(tabBarBox, paints..line(
|
||||||
color: const Color(0xff2196f3),
|
color: material3 ? theme.colorScheme.surfaceVariant : const Color(0xff2196f3),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -4095,6 +4124,7 @@ void main() {
|
|||||||
const Color splashColor = Color(0xf00fffff);
|
const Color splashColor = Color(0xf00fffff);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
boilerplate(
|
boilerplate(
|
||||||
|
useMaterial3: false,
|
||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
length: 1,
|
length: 1,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -4360,12 +4390,12 @@ void main() {
|
|||||||
testWidgets('TabBar colors labels correctly', (WidgetTester tester) async {
|
testWidgets('TabBar colors labels correctly', (WidgetTester tester) async {
|
||||||
MaterialStateColor buildMSC(Color selectedColor, Color unselectedColor) {
|
MaterialStateColor buildMSC(Color selectedColor, Color unselectedColor) {
|
||||||
return MaterialStateColor
|
return MaterialStateColor
|
||||||
.resolveWith((Set<MaterialState> states) {
|
.resolveWith((Set<MaterialState> states) {
|
||||||
if (states.contains(MaterialState.selected)) {
|
if (states.contains(MaterialState.selected)) {
|
||||||
return selectedColor;
|
return selectedColor;
|
||||||
}
|
}
|
||||||
return unselectedColor;
|
return unselectedColor;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final Color materialLabelColor = buildMSC(const Color(0x00000000), const Color(0x00000001));
|
final Color materialLabelColor = buildMSC(const Color(0x00000000), const Color(0x00000001));
|
||||||
@ -4394,7 +4424,7 @@ void main() {
|
|||||||
labelStyle: TextStyle(color: Color(0x00000017)),
|
labelStyle: TextStyle(color: Color(0x00000017)),
|
||||||
unselectedLabelStyle: TextStyle(color: Color(0x00000018)),
|
unselectedLabelStyle: TextStyle(color: Color(0x00000018)),
|
||||||
);
|
);
|
||||||
|
final ThemeData theme = ThemeData(useMaterial3: false);
|
||||||
Widget buildTabBar({
|
Widget buildTabBar({
|
||||||
bool isLabelColorMSC = false,
|
bool isLabelColorMSC = false,
|
||||||
bool isLabelColorNull = false,
|
bool isLabelColorNull = false,
|
||||||
@ -4411,7 +4441,7 @@ void main() {
|
|||||||
: tabBarTheme;
|
: tabBarTheme;
|
||||||
return boilerplate(
|
return boilerplate(
|
||||||
child: Theme(
|
child: Theme(
|
||||||
data: ThemeData(tabBarTheme: effectiveTheme),
|
data: theme.copyWith(tabBarTheme: effectiveTheme),
|
||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
length: 2,
|
length: 2,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -4488,8 +4518,8 @@ void main() {
|
|||||||
isUnselectedLabelColorNull: true,
|
isUnselectedLabelColorNull: true,
|
||||||
isTabBarThemeNull: true,
|
isTabBarThemeNull: true,
|
||||||
));
|
));
|
||||||
expect(getTab1Color(), equals(ThemeData().primaryTextTheme.bodyText1!.color!.value));
|
expect(getTab1Color(), equals(theme.primaryTextTheme.bodyText1!.color!.value));
|
||||||
expect(getTab2Color(), equals(ThemeData().primaryTextTheme.bodyText1!.color!.withAlpha(0xB2).value));
|
expect(getTab2Color(), equals(theme.primaryTextTheme.bodyText1!.color!.withAlpha(0xB2).value));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Replacing the tabController after disposing the old one', (WidgetTester tester) async {
|
testWidgets('Replacing the tabController after disposing the old one', (WidgetTester tester) async {
|
||||||
@ -4779,6 +4809,7 @@ void main() {
|
|||||||
Widget buildTabControllerFrame(BuildContext context, TabController controller) {
|
Widget buildTabControllerFrame(BuildContext context, TabController controller) {
|
||||||
tabController = controller;
|
tabController = controller;
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
bottom: TabBar(
|
bottom: TabBar(
|
||||||
@ -5263,6 +5294,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Change tab bar height', (WidgetTester tester) async {
|
testWidgets('Change tab bar height', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: DefaultTabController(
|
home: DefaultTabController(
|
||||||
length: 4,
|
length: 4,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@ -5775,9 +5807,7 @@ void main() {
|
|||||||
final ThemeData theme = ThemeData(useMaterial3: true);
|
final ThemeData theme = ThemeData(useMaterial3: true);
|
||||||
final List<String> tabs = <String>['A', 'B', 'C'];
|
final List<String> tabs = <String>['A', 'B', 'C'];
|
||||||
|
|
||||||
await tester.pumpWidget(Theme(
|
await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C', useMaterial3: theme.useMaterial3),
|
||||||
data: theme,
|
|
||||||
child: buildFrame(tabs: tabs, value: 'C')),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@ -5828,8 +5858,7 @@ void main() {
|
|||||||
final List<String> tabs = <String>['A', 'B', 'C'];
|
final List<String> tabs = <String>['A', 'B', 'C'];
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: theme,
|
home: buildFrame(tabs: tabs, value: 'B', useMaterial3: theme.useMaterial3),
|
||||||
home: buildFrame(tabs: tabs, value: 'B'),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -5878,8 +5907,7 @@ void main() {
|
|||||||
final List<String> tabs = <String>['A', 'B', 'C'];
|
final List<String> tabs = <String>['A', 'B', 'C'];
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: theme,
|
home: buildFrame(tabs: tabs, value: 'B', useMaterial3: theme.useMaterial3),
|
||||||
home: buildFrame(tabs: tabs, value: 'B'),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -6025,7 +6053,7 @@ void main() {
|
|||||||
|
|
||||||
const String selectedValue = 'A';
|
const String selectedValue = 'A';
|
||||||
const String unSelectedValue = 'C';
|
const String unSelectedValue = 'C';
|
||||||
await tester.pumpWidget(buildFrame(tabs: tabs, value: selectedValue));
|
await tester.pumpWidget(buildFrame(useMaterial3: false, tabs: tabs, value: selectedValue));
|
||||||
expect(find.text('A'), findsOneWidget);
|
expect(find.text('A'), findsOneWidget);
|
||||||
expect(find.text('B'), findsOneWidget);
|
expect(find.text('B'), findsOneWidget);
|
||||||
expect(find.text('C'), findsOneWidget);
|
expect(find.text('C'), findsOneWidget);
|
||||||
@ -6055,13 +6083,7 @@ void main() {
|
|||||||
const String unSelectedValue = 'C';
|
const String unSelectedValue = 'C';
|
||||||
const Color labelColor = Color(0xff0000ff);
|
const Color labelColor = Color(0xff0000ff);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Theme(
|
buildFrame(tabs: tabs, value: selectedValue, useMaterial3: false, tabBarTheme: const TabBarTheme(labelColor: labelColor)),
|
||||||
data: ThemeData(
|
|
||||||
tabBarTheme: const TabBarTheme(labelColor: labelColor),
|
|
||||||
useMaterial3: false,
|
|
||||||
),
|
|
||||||
child: buildFrame(tabs: tabs, value: selectedValue),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
expect(find.text('A'), findsOneWidget);
|
expect(find.text('A'), findsOneWidget);
|
||||||
expect(find.text('B'), findsOneWidget);
|
expect(find.text('B'), findsOneWidget);
|
||||||
@ -6159,8 +6181,8 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: theme,
|
|
||||||
home: boilerplate(
|
home: boilerplate(
|
||||||
|
useMaterial3: theme.useMaterial3,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
@ -6205,8 +6227,8 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: theme,
|
|
||||||
home: boilerplate(
|
home: boilerplate(
|
||||||
|
useMaterial3: theme.useMaterial3,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TabBar.secondary(
|
child: TabBar.secondary(
|
||||||
|
@ -34,6 +34,18 @@ typedef FormatEditUpdateCallback = void Function(TextEditingValue, TextEditingVa
|
|||||||
// On web, key events in text fields are handled by the browser.
|
// On web, key events in text fields are handled by the browser.
|
||||||
const bool areKeyEventsHandledByPlatform = isBrowser;
|
const bool areKeyEventsHandledByPlatform = isBrowser;
|
||||||
|
|
||||||
|
class CupertinoLocalizationsDelegate extends LocalizationsDelegate<CupertinoLocalizations> {
|
||||||
|
@override
|
||||||
|
bool isSupported(Locale locale) => true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<CupertinoLocalizations> load(Locale locale) =>
|
||||||
|
DefaultCupertinoLocalizations.load(locale);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldReload(CupertinoLocalizationsDelegate old) => false;
|
||||||
|
}
|
||||||
|
|
||||||
class MaterialLocalizationsDelegate extends LocalizationsDelegate<MaterialLocalizations> {
|
class MaterialLocalizationsDelegate extends LocalizationsDelegate<MaterialLocalizations> {
|
||||||
@override
|
@override
|
||||||
bool isSupported(Locale locale) => true;
|
bool isSupported(Locale locale) => true;
|
||||||
@ -75,6 +87,7 @@ Widget overlayWithEntry(OverlayEntry entry) {
|
|||||||
delegates: <LocalizationsDelegate<dynamic>>[
|
delegates: <LocalizationsDelegate<dynamic>>[
|
||||||
WidgetsLocalizationsDelegate(),
|
WidgetsLocalizationsDelegate(),
|
||||||
MaterialLocalizationsDelegate(),
|
MaterialLocalizationsDelegate(),
|
||||||
|
CupertinoLocalizationsDelegate(),
|
||||||
],
|
],
|
||||||
child: DefaultTextEditingShortcuts(
|
child: DefaultTextEditingShortcuts(
|
||||||
child: Directionality(
|
child: Directionality(
|
||||||
@ -839,19 +852,22 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Overflow clipBehavior none golden', (WidgetTester tester) async {
|
testWidgets('Overflow clipBehavior none golden', (WidgetTester tester) async {
|
||||||
final Widget widget = overlay(
|
final Widget widget = Theme(
|
||||||
child: RepaintBoundary(
|
data: ThemeData(useMaterial3: false),
|
||||||
key: const ValueKey<int>(1),
|
child: overlay(
|
||||||
child: SizedBox(
|
child: RepaintBoundary(
|
||||||
height: 200,
|
key: const ValueKey<int>(1),
|
||||||
width: 200,
|
child: SizedBox(
|
||||||
child: Center(
|
height: 200,
|
||||||
child: SizedBox(
|
width: 200,
|
||||||
// Make sure the input field is not high enough for the WidgetSpan.
|
child: Center(
|
||||||
height: 50,
|
child: SizedBox(
|
||||||
child: TextField(
|
// Make sure the input field is not high enough for the WidgetSpan.
|
||||||
controller: OverflowWidgetTextEditingController(),
|
height: 50,
|
||||||
clipBehavior: Clip.none,
|
child: TextField(
|
||||||
|
controller: OverflowWidgetTextEditingController(),
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -873,13 +889,16 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Material cursor android golden', (WidgetTester tester) async {
|
testWidgets('Material cursor android golden', (WidgetTester tester) async {
|
||||||
final Widget widget = overlay(
|
final Widget widget = Theme(
|
||||||
child: const RepaintBoundary(
|
data: ThemeData(useMaterial3: false),
|
||||||
key: ValueKey<int>(1),
|
child: overlay(
|
||||||
child: TextField(
|
child: const RepaintBoundary(
|
||||||
cursorColor: Colors.blue,
|
key: ValueKey<int>(1),
|
||||||
cursorWidth: 15,
|
child: TextField(
|
||||||
cursorRadius: Radius.circular(3.0),
|
cursorColor: Colors.blue,
|
||||||
|
cursorWidth: 15,
|
||||||
|
cursorRadius: Radius.circular(3.0),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -969,8 +988,9 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('text field selection toolbar renders correctly inside opacity', (WidgetTester tester) async {
|
testWidgets('text field selection toolbar renders correctly inside opacity', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
@ -1230,12 +1250,15 @@ void main() {
|
|||||||
final FocusNode focusNode = FocusNode();
|
final FocusNode focusNode = FocusNode();
|
||||||
EditableText.debugDeterministicCursor = true;
|
EditableText.debugDeterministicCursor = true;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: RepaintBoundary(
|
data: ThemeData(useMaterial3: false),
|
||||||
child: TextField(
|
child: overlay(
|
||||||
cursorWidth: 15.0,
|
child: RepaintBoundary(
|
||||||
controller: controller,
|
child: TextField(
|
||||||
focusNode: focusNode,
|
cursorWidth: 15.0,
|
||||||
|
controller: controller,
|
||||||
|
focusNode: focusNode,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1257,13 +1280,16 @@ void main() {
|
|||||||
final FocusNode focusNode = FocusNode();
|
final FocusNode focusNode = FocusNode();
|
||||||
EditableText.debugDeterministicCursor = true;
|
EditableText.debugDeterministicCursor = true;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: RepaintBoundary(
|
data: ThemeData(useMaterial3: false),
|
||||||
child: TextField(
|
child: overlay(
|
||||||
cursorWidth: 15.0,
|
child: RepaintBoundary(
|
||||||
cursorRadius: const Radius.circular(3.0),
|
child: TextField(
|
||||||
controller: controller,
|
cursorWidth: 15.0,
|
||||||
focusNode: focusNode,
|
cursorRadius: const Radius.circular(3.0),
|
||||||
|
controller: controller,
|
||||||
|
focusNode: focusNode,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1285,13 +1311,16 @@ void main() {
|
|||||||
final FocusNode focusNode = FocusNode();
|
final FocusNode focusNode = FocusNode();
|
||||||
EditableText.debugDeterministicCursor = true;
|
EditableText.debugDeterministicCursor = true;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: RepaintBoundary(
|
data: ThemeData(useMaterial3: false),
|
||||||
child: TextField(
|
child: overlay(
|
||||||
cursorWidth: 15.0,
|
child: RepaintBoundary(
|
||||||
cursorHeight: 30.0,
|
child: TextField(
|
||||||
controller: controller,
|
cursorWidth: 15.0,
|
||||||
focusNode: focusNode,
|
cursorHeight: 30.0,
|
||||||
|
controller: controller,
|
||||||
|
focusNode: focusNode,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1310,11 +1339,14 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: TextField(
|
data: ThemeData(useMaterial3: false),
|
||||||
key: textFieldKey,
|
child: overlay(
|
||||||
controller: controller,
|
child: TextField(
|
||||||
maxLines: null,
|
key: textFieldKey,
|
||||||
|
controller: controller,
|
||||||
|
maxLines: null,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -3379,12 +3411,15 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: TextField(
|
data: ThemeData(useMaterial3: false),
|
||||||
dragStartBehavior: DragStartBehavior.down,
|
child: overlay(
|
||||||
controller: controller,
|
child: TextField(
|
||||||
maxLines: 3,
|
dragStartBehavior: DragStartBehavior.down,
|
||||||
minLines: 3,
|
controller: controller,
|
||||||
|
maxLines: 3,
|
||||||
|
minLines: 3,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -3861,6 +3896,7 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(30.0),
|
padding: const EdgeInsets.all(30.0),
|
||||||
@ -4410,6 +4446,7 @@ void main() {
|
|||||||
Widget? prefix,
|
Widget? prefix,
|
||||||
}) {
|
}) {
|
||||||
return boilerplate(
|
return boilerplate(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: height,
|
height: height,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -4548,12 +4585,15 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: TextField(
|
data: ThemeData(useMaterial3: false),
|
||||||
dragStartBehavior: DragStartBehavior.down,
|
child: overlay(
|
||||||
controller: controller,
|
child: TextField(
|
||||||
style: const TextStyle(color: Colors.black, fontSize: 34.0),
|
dragStartBehavior: DragStartBehavior.down,
|
||||||
maxLines: 3,
|
controller: controller,
|
||||||
|
style: const TextStyle(color: Colors.black, fontSize: 34.0),
|
||||||
|
maxLines: 3,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -4796,11 +4836,14 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('TextField errorText trumps helperText', (WidgetTester tester) async {
|
testWidgets('TextField errorText trumps helperText', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: const TextField(
|
data: ThemeData(useMaterial3: false),
|
||||||
decoration: InputDecoration(
|
child: overlay(
|
||||||
errorText: 'error text',
|
child: const TextField(
|
||||||
helperText: 'helper text',
|
decoration: InputDecoration(
|
||||||
|
errorText: 'error text',
|
||||||
|
helperText: 'helper text',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -4810,7 +4853,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('TextField with default helperStyle', (WidgetTester tester) async {
|
testWidgets('TextField with default helperStyle', (WidgetTester tester) async {
|
||||||
final ThemeData themeData = ThemeData(hintColor: Colors.blue[500]);
|
final ThemeData themeData = ThemeData(hintColor: Colors.blue[500], useMaterial3: false);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
overlay(
|
||||||
child: Theme(
|
child: Theme(
|
||||||
@ -5214,12 +5257,15 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Collapsed hint text placement', (WidgetTester tester) async {
|
testWidgets('Collapsed hint text placement', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: const TextField(
|
data: ThemeData(useMaterial3: false),
|
||||||
decoration: InputDecoration.collapsed(
|
child: overlay(
|
||||||
hintText: 'hint',
|
child: const TextField(
|
||||||
|
decoration: InputDecoration.collapsed(
|
||||||
|
hintText: 'hint',
|
||||||
|
),
|
||||||
|
strutStyle: StrutStyle.disabled,
|
||||||
),
|
),
|
||||||
strutStyle: StrutStyle.disabled,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -5585,11 +5631,14 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: SizedBox(
|
data: ThemeData(useMaterial3: false),
|
||||||
width: 100.0,
|
child: overlay(
|
||||||
child: TextField(
|
child: SizedBox(
|
||||||
controller: controller,
|
width: 100.0,
|
||||||
|
child: TextField(
|
||||||
|
controller: controller,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -6358,6 +6407,7 @@ void main() {
|
|||||||
const String errorText = 'error text';
|
const String errorText = 'error text';
|
||||||
Widget buildFrame(bool enabled, bool hasError) {
|
Widget buildFrame(bool enabled, bool hasError) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -6405,6 +6455,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -7251,40 +7302,43 @@ void main() {
|
|||||||
final Key keyB = UniqueKey();
|
final Key keyB = UniqueKey();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: Row(
|
data: ThemeData(useMaterial3: false),
|
||||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
child: overlay(
|
||||||
textBaseline: TextBaseline.alphabetic,
|
child: Row(
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||||
Expanded(
|
textBaseline: TextBaseline.alphabetic,
|
||||||
child: TextField(
|
children: <Widget>[
|
||||||
key: keyA,
|
Expanded(
|
||||||
decoration: null,
|
child: TextField(
|
||||||
controller: controllerA,
|
key: keyA,
|
||||||
|
decoration: null,
|
||||||
|
controller: controllerA,
|
||||||
|
// The point size of the font must be a multiple of 4 until
|
||||||
|
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
||||||
|
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 12.0),
|
||||||
|
strutStyle: StrutStyle.disabled,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
'abc',
|
||||||
// The point size of the font must be a multiple of 4 until
|
// The point size of the font must be a multiple of 4 until
|
||||||
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
||||||
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 12.0),
|
style: TextStyle(fontFamily: 'FlutterTest', fontSize: 24.0),
|
||||||
strutStyle: StrutStyle.disabled,
|
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
const Text(
|
child: TextField(
|
||||||
'abc',
|
key: keyB,
|
||||||
// The point size of the font must be a multiple of 4 until
|
decoration: null,
|
||||||
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
controller: controllerB,
|
||||||
style: TextStyle(fontFamily: 'FlutterTest', fontSize: 24.0),
|
// The point size of the font must be a multiple of 4 until
|
||||||
),
|
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
||||||
Expanded(
|
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 36.0),
|
||||||
child: TextField(
|
strutStyle: StrutStyle.disabled,
|
||||||
key: keyB,
|
),
|
||||||
decoration: null,
|
|
||||||
controller: controllerB,
|
|
||||||
// The point size of the font must be a multiple of 4 until
|
|
||||||
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
|
||||||
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 36.0),
|
|
||||||
strutStyle: StrutStyle.disabled,
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -7310,38 +7364,41 @@ void main() {
|
|||||||
final Key keyB = UniqueKey();
|
final Key keyB = UniqueKey();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
Theme(
|
||||||
child: Row(
|
data: ThemeData(useMaterial3: false),
|
||||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
child: overlay(
|
||||||
textBaseline: TextBaseline.alphabetic,
|
child: Row(
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||||
Expanded(
|
textBaseline: TextBaseline.alphabetic,
|
||||||
child: TextField(
|
children: <Widget>[
|
||||||
key: keyA,
|
Expanded(
|
||||||
decoration: null,
|
child: TextField(
|
||||||
controller: controllerA,
|
key: keyA,
|
||||||
|
decoration: null,
|
||||||
|
controller: controllerA,
|
||||||
|
// The point size of the font must be a multiple of 4 until
|
||||||
|
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
||||||
|
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 12.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
'abc',
|
||||||
// The point size of the font must be a multiple of 4 until
|
// The point size of the font must be a multiple of 4 until
|
||||||
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
||||||
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 12.0),
|
style: TextStyle(fontFamily: 'FlutterTest', fontSize: 24.0),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
const Text(
|
child: TextField(
|
||||||
'abc',
|
key: keyB,
|
||||||
// The point size of the font must be a multiple of 4 until
|
decoration: null,
|
||||||
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
controller: controllerB,
|
||||||
style: TextStyle(fontFamily: 'FlutterTest', fontSize: 24.0),
|
// The point size of the font must be a multiple of 4 until
|
||||||
),
|
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
||||||
Expanded(
|
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 36.0),
|
||||||
child: TextField(
|
),
|
||||||
key: keyB,
|
|
||||||
decoration: null,
|
|
||||||
controller: controllerB,
|
|
||||||
// The point size of the font must be a multiple of 4 until
|
|
||||||
// https://github.com/flutter/flutter/issues/122066 is resolved.
|
|
||||||
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 36.0),
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -8138,8 +8195,9 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('TextField displays text with text direction', (WidgetTester tester) async {
|
testWidgets('TextField displays text with text direction', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Material(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Material(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
),
|
),
|
||||||
@ -8158,8 +8216,9 @@ void main() {
|
|||||||
expect(topLeft.dx, equals(701));
|
expect(topLeft.dx, equals(701));
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
MaterialApp(
|
||||||
home: Material(
|
theme: ThemeData(useMaterial3: false),
|
||||||
|
home: const Material(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
@ -8366,6 +8425,7 @@ void main() {
|
|||||||
final TextEditingController controller = TextEditingController(text: 'Just some text');
|
final TextEditingController controller = TextEditingController(text: 'Just some text');
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: MediaQuery(
|
body: MediaQuery(
|
||||||
data: const MediaQueryData(textScaleFactor: 4.0),
|
data: const MediaQueryData(textScaleFactor: 4.0),
|
||||||
@ -8582,6 +8642,7 @@ void main() {
|
|||||||
required TextAlign textAlign,
|
required TextAlign textAlign,
|
||||||
}) {
|
}) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -8652,6 +8713,7 @@ void main() {
|
|||||||
// Regression test for https://github.com/flutter/flutter/issues/23994
|
// Regression test for https://github.com/flutter/flutter/issues/23994
|
||||||
|
|
||||||
final ThemeData themeData = ThemeData(
|
final ThemeData themeData = ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
textTheme: TextTheme(
|
textTheme: TextTheme(
|
||||||
titleMedium: TextStyle(
|
titleMedium: TextStyle(
|
||||||
color: Colors.blue[500],
|
color: Colors.blue[500],
|
||||||
@ -9471,6 +9533,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
dragStartBehavior: DragStartBehavior.down,
|
dragStartBehavior: DragStartBehavior.down,
|
||||||
@ -9583,6 +9646,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -9673,6 +9737,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -10185,6 +10250,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
dragStartBehavior: DragStartBehavior.down,
|
dragStartBehavior: DragStartBehavior.down,
|
||||||
@ -10285,6 +10351,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
dragStartBehavior: DragStartBehavior.down,
|
dragStartBehavior: DragStartBehavior.down,
|
||||||
@ -11418,6 +11485,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -11506,6 +11574,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -11594,6 +11663,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -11759,6 +11829,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -12119,6 +12190,7 @@ void main() {
|
|||||||
final bool isTargetPlatformMobile = defaultTargetPlatform == TargetPlatform.iOS;
|
final bool isTargetPlatformMobile = defaultTargetPlatform == TargetPlatform.iOS;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -12232,6 +12304,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -12878,7 +12951,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: TextField(
|
child: TextField(
|
||||||
@ -12923,7 +12996,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: TextField(
|
child: TextField(
|
||||||
@ -12947,7 +13020,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: TextField(
|
child: TextField(
|
||||||
@ -12978,7 +13051,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: TextField(
|
child: TextField(
|
||||||
@ -13007,7 +13080,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: TextField(
|
child: TextField(
|
||||||
@ -13036,7 +13109,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: TextField(
|
child: TextField(
|
||||||
@ -13065,11 +13138,14 @@ void main() {
|
|||||||
testWidgets('Caret center position', (WidgetTester tester) async {
|
testWidgets('Caret center position', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
overlay(
|
||||||
child: const SizedBox(
|
child: Theme(
|
||||||
width: 300.0,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: TextField(
|
child: const SizedBox(
|
||||||
textAlign: TextAlign.center,
|
width: 300.0,
|
||||||
decoration: null,
|
child: TextField(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: null,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -13105,11 +13181,14 @@ void main() {
|
|||||||
testWidgets('Caret indexes into trailing whitespace center align', (WidgetTester tester) async {
|
testWidgets('Caret indexes into trailing whitespace center align', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
overlay(
|
overlay(
|
||||||
child: const SizedBox(
|
child: Theme(
|
||||||
width: 300.0,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: TextField(
|
child: const SizedBox(
|
||||||
textAlign: TextAlign.center,
|
width: 300.0,
|
||||||
decoration: null,
|
child: TextField(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: null,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -13573,7 +13652,7 @@ void main() {
|
|||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(),
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
@ -13604,7 +13683,7 @@ void main() {
|
|||||||
final ScrollController textFieldScrollController = ScrollController();
|
final ScrollController textFieldScrollController = ScrollController();
|
||||||
|
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(),
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
@ -14291,6 +14370,7 @@ void main() {
|
|||||||
Widget textFieldBuilder({ FloatingLabelBehavior behavior = FloatingLabelBehavior.auto }) {
|
Widget textFieldBuilder({ FloatingLabelBehavior behavior = FloatingLabelBehavior.auto }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
floatingLabelBehavior: behavior,
|
floatingLabelBehavior: behavior,
|
||||||
),
|
),
|
||||||
@ -14872,6 +14952,7 @@ void main() {
|
|||||||
final bool isTargetPlatformMobile = defaultTargetPlatform == TargetPlatform.iOS;
|
final bool isTargetPlatformMobile = defaultTargetPlatform == TargetPlatform.iOS;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(controller: controller),
|
child: TextField(controller: controller),
|
||||||
@ -14977,6 +15058,7 @@ void main() {
|
|||||||
|| defaultTargetPlatform == TargetPlatform.fuchsia;
|
|| defaultTargetPlatform == TargetPlatform.fuchsia;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(controller: controller),
|
child: TextField(controller: controller),
|
||||||
@ -15083,6 +15165,7 @@ void main() {
|
|||||||
final bool isTargetPlatformMobile = defaultTargetPlatform == TargetPlatform.iOS;
|
final bool isTargetPlatformMobile = defaultTargetPlatform == TargetPlatform.iOS;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(controller: controller),
|
child: TextField(controller: controller),
|
||||||
@ -15187,6 +15270,7 @@ void main() {
|
|||||||
|| defaultTargetPlatform == TargetPlatform.fuchsia;
|
|| defaultTargetPlatform == TargetPlatform.fuchsia;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextField(controller: controller),
|
child: TextField(controller: controller),
|
||||||
|
@ -591,12 +591,13 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
testWidgets('Disabled field hides helper and counter', (WidgetTester tester) async {
|
testWidgets('Disabled field hides helper and counter in M2', (WidgetTester tester) async {
|
||||||
const String helperText = 'helper text';
|
const String helperText = 'helper text';
|
||||||
const String counterText = 'counter text';
|
const String counterText = 'counter text';
|
||||||
const String errorText = 'error text';
|
const String errorText = 'error text';
|
||||||
Widget buildFrame(bool enabled, bool hasError) {
|
Widget buildFrame(bool enabled, bool hasError) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Material(
|
home: Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
|
@ -376,7 +376,7 @@ void main() {
|
|||||||
|
|
||||||
final TextEditingController controller = TextEditingController(text: 'abc def ghi');
|
final TextEditingController controller = TextEditingController(text: 'abc def ghi');
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android, useMaterial3: false),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
|
@ -23,7 +23,7 @@ void main() {
|
|||||||
|
|
||||||
test('Defaults to the default typography for the platform', () {
|
test('Defaults to the default typography for the platform', () {
|
||||||
for (final TargetPlatform platform in TargetPlatform.values) {
|
for (final TargetPlatform platform in TargetPlatform.values) {
|
||||||
final ThemeData theme = ThemeData(platform: platform);
|
final ThemeData theme = ThemeData(platform: platform, useMaterial3: false);
|
||||||
final Typography typography = Typography.material2018(platform: platform);
|
final Typography typography = Typography.material2018(platform: platform);
|
||||||
expect(
|
expect(
|
||||||
theme.textTheme,
|
theme.textTheme,
|
||||||
@ -34,8 +34,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Default text theme contrasts with brightness', () {
|
test('Default text theme contrasts with brightness', () {
|
||||||
final ThemeData lightTheme = ThemeData(brightness: Brightness.light);
|
final ThemeData lightTheme = ThemeData(brightness: Brightness.light, useMaterial3: false);
|
||||||
final ThemeData darkTheme = ThemeData(brightness: Brightness.dark);
|
final ThemeData darkTheme = ThemeData(brightness: Brightness.dark, useMaterial3: false);
|
||||||
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
||||||
|
|
||||||
expect(lightTheme.textTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
expect(lightTheme.textTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
||||||
@ -43,8 +43,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Default primary text theme contrasts with primary brightness', () {
|
test('Default primary text theme contrasts with primary brightness', () {
|
||||||
final ThemeData lightTheme = ThemeData(primaryColor: Colors.white);
|
final ThemeData lightTheme = ThemeData(primaryColor: Colors.white, useMaterial3: false);
|
||||||
final ThemeData darkTheme = ThemeData(primaryColor: Colors.black);
|
final ThemeData darkTheme = ThemeData(primaryColor: Colors.black, useMaterial3: false);
|
||||||
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
||||||
|
|
||||||
expect(lightTheme.primaryTextTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
expect(lightTheme.primaryTextTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
||||||
@ -52,8 +52,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Default icon theme contrasts with brightness', () {
|
test('Default icon theme contrasts with brightness', () {
|
||||||
final ThemeData lightTheme = ThemeData(brightness: Brightness.light);
|
final ThemeData lightTheme = ThemeData(brightness: Brightness.light, useMaterial3: false);
|
||||||
final ThemeData darkTheme = ThemeData(brightness: Brightness.dark);
|
final ThemeData darkTheme = ThemeData(brightness: Brightness.dark, useMaterial3: false);
|
||||||
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
||||||
|
|
||||||
expect(lightTheme.textTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
expect(lightTheme.textTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
||||||
@ -61,8 +61,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Default primary icon theme contrasts with primary brightness', () {
|
test('Default primary icon theme contrasts with primary brightness', () {
|
||||||
final ThemeData lightTheme = ThemeData(primaryColor: Colors.white);
|
final ThemeData lightTheme = ThemeData(primaryColor: Colors.white, useMaterial3: false);
|
||||||
final ThemeData darkTheme = ThemeData(primaryColor: Colors.black);
|
final ThemeData darkTheme = ThemeData(primaryColor: Colors.black, useMaterial3: false);
|
||||||
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
final Typography typography = Typography.material2018(platform: lightTheme.platform);
|
||||||
|
|
||||||
expect(lightTheme.primaryTextTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
expect(lightTheme.primaryTextTheme.titleLarge!.color, typography.black.titleLarge!.color);
|
||||||
|
@ -142,32 +142,35 @@ void main() {
|
|||||||
testWidgetsWithLeakTracking('Does tooltip end up in the right place - top left', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Does tooltip end up in the right place - top left', (WidgetTester tester) async {
|
||||||
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
Theme(
|
||||||
textDirection: TextDirection.ltr,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: Overlay(
|
child: Directionality(
|
||||||
initialEntries: <OverlayEntry>[
|
textDirection: TextDirection.ltr,
|
||||||
OverlayEntry(
|
child: Overlay(
|
||||||
builder: (BuildContext context) {
|
initialEntries: <OverlayEntry>[
|
||||||
return Stack(
|
OverlayEntry(
|
||||||
children: <Widget>[
|
builder: (BuildContext context) {
|
||||||
Positioned(
|
return Stack(
|
||||||
left: 0.0,
|
children: <Widget>[
|
||||||
top: 0.0,
|
Positioned(
|
||||||
child: Tooltip(
|
left: 0.0,
|
||||||
key: tooltipKey,
|
top: 0.0,
|
||||||
message: tooltipText,
|
child: Tooltip(
|
||||||
height: 20.0,
|
key: tooltipKey,
|
||||||
padding: const EdgeInsets.all(5.0),
|
message: tooltipText,
|
||||||
verticalOffset: 20.0,
|
height: 20.0,
|
||||||
preferBelow: false,
|
padding: const EdgeInsets.all(5.0),
|
||||||
child: const SizedBox.shrink(),
|
verticalOffset: 20.0,
|
||||||
|
preferBelow: false,
|
||||||
|
child: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -362,32 +365,35 @@ void main() {
|
|||||||
testWidgetsWithLeakTracking('Does tooltip end up in the right place - way off to the right', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Does tooltip end up in the right place - way off to the right', (WidgetTester tester) async {
|
||||||
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
Theme(
|
||||||
textDirection: TextDirection.ltr,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: Overlay(
|
child: Directionality(
|
||||||
initialEntries: <OverlayEntry>[
|
textDirection: TextDirection.ltr,
|
||||||
OverlayEntry(
|
child: Overlay(
|
||||||
builder: (BuildContext context) {
|
initialEntries: <OverlayEntry>[
|
||||||
return Stack(
|
OverlayEntry(
|
||||||
children: <Widget>[
|
builder: (BuildContext context) {
|
||||||
Positioned(
|
return Stack(
|
||||||
left: 1600.0,
|
children: <Widget>[
|
||||||
top: 300.0,
|
Positioned(
|
||||||
child: Tooltip(
|
left: 1600.0,
|
||||||
key: tooltipKey,
|
top: 300.0,
|
||||||
message: tooltipText,
|
child: Tooltip(
|
||||||
height: 10.0,
|
key: tooltipKey,
|
||||||
padding: EdgeInsets.zero,
|
message: tooltipText,
|
||||||
verticalOffset: 10.0,
|
height: 10.0,
|
||||||
preferBelow: true,
|
padding: EdgeInsets.zero,
|
||||||
child: const SizedBox.shrink(),
|
verticalOffset: 10.0,
|
||||||
|
preferBelow: true,
|
||||||
|
child: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -416,32 +422,35 @@ void main() {
|
|||||||
testWidgetsWithLeakTracking('Does tooltip end up in the right place - near the edge', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Does tooltip end up in the right place - near the edge', (WidgetTester tester) async {
|
||||||
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
Theme(
|
||||||
textDirection: TextDirection.ltr,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: Overlay(
|
child: Directionality(
|
||||||
initialEntries: <OverlayEntry>[
|
textDirection: TextDirection.ltr,
|
||||||
OverlayEntry(
|
child: Overlay(
|
||||||
builder: (BuildContext context) {
|
initialEntries: <OverlayEntry>[
|
||||||
return Stack(
|
OverlayEntry(
|
||||||
children: <Widget>[
|
builder: (BuildContext context) {
|
||||||
Positioned(
|
return Stack(
|
||||||
left: 780.0,
|
children: <Widget>[
|
||||||
top: 300.0,
|
Positioned(
|
||||||
child: Tooltip(
|
left: 780.0,
|
||||||
key: tooltipKey,
|
top: 300.0,
|
||||||
message: tooltipText,
|
child: Tooltip(
|
||||||
height: 10.0,
|
key: tooltipKey,
|
||||||
padding: EdgeInsets.zero,
|
message: tooltipText,
|
||||||
verticalOffset: 10.0,
|
height: 10.0,
|
||||||
preferBelow: true,
|
padding: EdgeInsets.zero,
|
||||||
child: const SizedBox.shrink(),
|
verticalOffset: 10.0,
|
||||||
|
preferBelow: true,
|
||||||
|
child: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -580,6 +589,7 @@ void main() {
|
|||||||
testWidgetsWithLeakTracking('Default tooltip message textStyle - light', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Default tooltip message textStyle - light', (WidgetTester tester) async {
|
||||||
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Tooltip(
|
home: Tooltip(
|
||||||
key: tooltipKey,
|
key: tooltipKey,
|
||||||
message: tooltipText,
|
message: tooltipText,
|
||||||
@ -604,6 +614,7 @@ void main() {
|
|||||||
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
||||||
await tester.pumpWidget(MaterialApp(
|
await tester.pumpWidget(MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
),
|
),
|
||||||
home: Tooltip(
|
home: Tooltip(
|
||||||
@ -760,20 +771,23 @@ void main() {
|
|||||||
testWidgetsWithLeakTracking('Does tooltip end up with the right default size, shape, and color', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Does tooltip end up with the right default size, shape, and color', (WidgetTester tester) async {
|
||||||
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
Theme(
|
||||||
textDirection: TextDirection.ltr,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: Overlay(
|
child: Directionality(
|
||||||
initialEntries: <OverlayEntry>[
|
textDirection: TextDirection.ltr,
|
||||||
OverlayEntry(
|
child: Overlay(
|
||||||
builder: (BuildContext context) {
|
initialEntries: <OverlayEntry>[
|
||||||
return Tooltip(
|
OverlayEntry(
|
||||||
key: tooltipKey,
|
builder: (BuildContext context) {
|
||||||
message: tooltipText,
|
return Tooltip(
|
||||||
child: const SizedBox.shrink(),
|
key: tooltipKey,
|
||||||
);
|
message: tooltipText,
|
||||||
},
|
child: const SizedBox.shrink(),
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -797,6 +811,7 @@ void main() {
|
|||||||
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
final GlobalKey<TooltipState> tooltipKey = GlobalKey<TooltipState>();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
theme: ThemeData(useMaterial3: false),
|
||||||
home: Tooltip(
|
home: Tooltip(
|
||||||
key: tooltipKey,
|
key: tooltipKey,
|
||||||
message: tooltipText,
|
message: tooltipText,
|
||||||
@ -828,21 +843,24 @@ void main() {
|
|||||||
color: Color(0x80800000),
|
color: Color(0x80800000),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
Theme(
|
||||||
textDirection: TextDirection.ltr,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: Overlay(
|
child: Directionality(
|
||||||
initialEntries: <OverlayEntry>[
|
textDirection: TextDirection.ltr,
|
||||||
OverlayEntry(
|
child: Overlay(
|
||||||
builder: (BuildContext context) {
|
initialEntries: <OverlayEntry>[
|
||||||
return Tooltip(
|
OverlayEntry(
|
||||||
key: tooltipKey,
|
builder: (BuildContext context) {
|
||||||
decoration: customDecoration,
|
return Tooltip(
|
||||||
message: tooltipText,
|
key: tooltipKey,
|
||||||
child: const SizedBox.shrink(),
|
decoration: customDecoration,
|
||||||
);
|
message: tooltipText,
|
||||||
},
|
child: const SizedBox.shrink(),
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -1431,27 +1449,30 @@ void main() {
|
|||||||
|
|
||||||
testWidgetsWithLeakTracking('Tooltip text scales with textScaleFactor', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Tooltip text scales with textScaleFactor', (WidgetTester tester) async {
|
||||||
Widget buildApp(String text, { required double textScaleFactor }) {
|
Widget buildApp(String text, { required double textScaleFactor }) {
|
||||||
return MediaQuery(
|
return Theme(
|
||||||
data: MediaQueryData(textScaleFactor: textScaleFactor),
|
data: ThemeData(useMaterial3: false),
|
||||||
child: Directionality(
|
child: MediaQuery(
|
||||||
textDirection: TextDirection.ltr,
|
data: MediaQueryData(textScaleFactor: textScaleFactor),
|
||||||
child: Navigator(
|
child: Directionality(
|
||||||
onGenerateRoute: (RouteSettings settings) {
|
textDirection: TextDirection.ltr,
|
||||||
return MaterialPageRoute<void>(
|
child: Navigator(
|
||||||
builder: (BuildContext context) {
|
onGenerateRoute: (RouteSettings settings) {
|
||||||
return Center(
|
return MaterialPageRoute<void>(
|
||||||
child: Tooltip(
|
builder: (BuildContext context) {
|
||||||
message: text,
|
return Center(
|
||||||
child: Container(
|
child: Tooltip(
|
||||||
width: 100.0,
|
message: text,
|
||||||
height: 100.0,
|
child: Container(
|
||||||
color: Colors.green[500],
|
width: 100.0,
|
||||||
|
height: 100.0,
|
||||||
|
color: Colors.green[500],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -686,6 +686,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: Theme(
|
child: Theme(
|
||||||
data: ThemeData(
|
data: ThemeData(
|
||||||
|
useMaterial3: false,
|
||||||
tooltipTheme: const TooltipThemeData(
|
tooltipTheme: const TooltipThemeData(
|
||||||
decoration: customDecoration,
|
decoration: customDecoration,
|
||||||
),
|
),
|
||||||
@ -723,22 +724,25 @@ void main() {
|
|||||||
color: Color(0x80800000),
|
color: Color(0x80800000),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
Theme(
|
||||||
textDirection: TextDirection.ltr,
|
data: ThemeData(useMaterial3: false),
|
||||||
child: TooltipTheme(
|
child: Directionality(
|
||||||
data: const TooltipThemeData(decoration: customDecoration),
|
textDirection: TextDirection.ltr,
|
||||||
child: Overlay(
|
child: TooltipTheme(
|
||||||
initialEntries: <OverlayEntry>[
|
data: const TooltipThemeData(decoration: customDecoration),
|
||||||
OverlayEntry(
|
child: Overlay(
|
||||||
builder: (BuildContext context) {
|
initialEntries: <OverlayEntry>[
|
||||||
return Tooltip(
|
OverlayEntry(
|
||||||
key: key,
|
builder: (BuildContext context) {
|
||||||
message: tooltipText,
|
return Tooltip(
|
||||||
child: const SizedBox.shrink(),
|
key: key,
|
||||||
);
|
message: tooltipText,
|
||||||
},
|
child: const SizedBox.shrink(),
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user