From 7c4c3419aee1168c5451bae0c6e073ea3c11cd87 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Wed, 17 Mar 2021 13:28:09 -0700 Subject: [PATCH] Remove accentColor et al. from tests (#78449) --- dev/benchmarks/test_apps/stocks/lib/stock_home.dart | 4 ++-- .../lib/demo/material/bottom_app_bar_demo.dart | 2 +- dev/manual_tests/lib/overlay_geometry.dart | 13 +++++-------- dev/manual_tests/lib/page_view.dart | 13 +++++-------- packages/flutter/test/material/scaffold_test.dart | 2 +- packages/flutter/test/material/snack_bar_test.dart | 6 +----- .../flutter/test/widgets/editable_text_test.dart | 7 +++++-- 7 files changed, 20 insertions(+), 27 deletions(-) diff --git a/dev/benchmarks/test_apps/stocks/lib/stock_home.dart b/dev/benchmarks/test_apps/stocks/lib/stock_home.dart index f5f150cdf7..8d6f6d5636 100644 --- a/dev/benchmarks/test_apps/stocks/lib/stock_home.dart +++ b/dev/benchmarks/test_apps/stocks/lib/stock_home.dart @@ -286,7 +286,7 @@ class StockHomeState extends State { AppBar buildSearchBar() { return AppBar( leading: BackButton( - color: Theme.of(context).accentColor, + color: Theme.of(context).colorScheme.secondary, ), title: TextField( controller: _searchQuery, @@ -310,7 +310,7 @@ class StockHomeState extends State { return FloatingActionButton( tooltip: 'Create company', child: const Icon(Icons.add), - backgroundColor: Theme.of(context).accentColor, + backgroundColor: Theme.of(context).colorScheme.secondary, onPressed: _handleCreateCompany, ); } diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart index 5aa7278d79..5525e8113d 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart @@ -437,7 +437,7 @@ class _DiamondFab extends StatelessWidget { width: 56.0, height: 56.0, child: IconTheme.merge( - data: IconThemeData(color: Theme.of(context).accentIconTheme.color), + data: IconThemeData(color: Theme.of(context).colorScheme.secondary), child: child!, ), ), diff --git a/dev/manual_tests/lib/overlay_geometry.dart b/dev/manual_tests/lib/overlay_geometry.dart index 8cff54d9bb..5ecf4e5673 100644 --- a/dev/manual_tests/lib/overlay_geometry.dart +++ b/dev/manual_tests/lib/overlay_geometry.dart @@ -204,13 +204,10 @@ class OverlayGeometryAppState extends State { } void main() { - runApp(MaterialApp( - theme: ThemeData( - brightness: Brightness.light, - primarySwatch: Colors.blue, - accentColor: Colors.redAccent, + runApp( + const MaterialApp( + title: 'Cards', + home: OverlayGeometryApp(), ), - title: 'Cards', - home: const OverlayGeometryApp(), - )); + ); } diff --git a/dev/manual_tests/lib/page_view.dart b/dev/manual_tests/lib/page_view.dart index 9fcc1ad1f9..af37a4e645 100644 --- a/dev/manual_tests/lib/page_view.dart +++ b/dev/manual_tests/lib/page_view.dart @@ -141,13 +141,10 @@ class PageViewAppState extends State { } void main() { - runApp(MaterialApp( - title: 'PageView', - theme: ThemeData( - brightness: Brightness.light, - primarySwatch: Colors.blue, - accentColor: Colors.redAccent, + runApp( + const MaterialApp( + title: 'PageView', + home: PageViewApp(), ), - home: const PageViewApp(), - )); + ); } diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index d2bd09baa9..3139ced1e0 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -1848,7 +1848,7 @@ void main() { child: Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.', textAlign: TextAlign.center, style: TextStyle( - color: themeData.accentColor, + color: themeData.colorScheme.secondary, fontSize: 24.0, ), ), diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 9e1323562a..91b9d56bab 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -690,14 +690,12 @@ void main() { }, ); - final ThemeData theme = ThemeData.raw( + final ThemeData theme = ThemeData.light().copyWith( visualDensity: VisualDensity.standard, primaryColor: Colors.black, primaryColorBrightness: Brightness.dark, primaryColorLight: Colors.black, primaryColorDark: Colors.black, - accentColor: Colors.black, - accentColorBrightness: Brightness.dark, canvasColor: Colors.black, shadowColor: Colors.black, scaffoldBackgroundColor: Colors.black, @@ -727,11 +725,9 @@ void main() { toggleableActiveColor: Colors.black, textTheme: ThemeData.dark().textTheme, primaryTextTheme: ThemeData.dark().textTheme, - accentTextTheme: ThemeData.dark().textTheme, inputDecorationTheme: ThemeData.dark().inputDecorationTheme.copyWith(border: const OutlineInputBorder()), iconTheme: ThemeData.dark().iconTheme, primaryIconTheme: ThemeData.dark().iconTheme, - accentIconTheme: ThemeData.dark().iconTheme, sliderTheme: sliderTheme, tabBarTheme: const TabBarTheme(labelColor: Colors.black), tooltipTheme: const TooltipThemeData(height: 100), diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart index 5b30540904..962187b1f7 100644 --- a/packages/flutter/test/widgets/editable_text_test.dart +++ b/packages/flutter/test/widgets/editable_text_test.dart @@ -5888,8 +5888,11 @@ void main() { testWidgets('TextEditingController.buildTextSpan receives build context', (WidgetTester tester) async { final _AccentColorTextEditingController controller = _AccentColorTextEditingController('a'); const Color color = Color.fromARGB(255, 1, 2, 3); + final ThemeData lightTheme = ThemeData.light(); await tester.pumpWidget(MaterialApp( - theme: ThemeData.light().copyWith(accentColor: color), + theme: lightTheme.copyWith( + colorScheme: lightTheme.colorScheme.copyWith(secondary: color), + ), home: EditableText( controller: controller, focusNode: FocusNode(), @@ -7559,7 +7562,7 @@ class _AccentColorTextEditingController extends TextEditingController { @override TextSpan buildTextSpan({required BuildContext context, TextStyle? style, required bool withComposing}) { - final Color color = Theme.of(context).accentColor; + final Color color = Theme.of(context).colorScheme.secondary; return super.buildTextSpan(context: context, style: TextStyle(color: color), withComposing: withComposing); } }