From 6006c2375781c6d8b8ed01f0605e1339f8cb4c8b Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Thu, 16 Jan 2020 07:21:25 -0800 Subject: [PATCH] Step 2 of 2: Remove Flutter's FloatingActionButton dependency on ThemeData accent properties (#46923) --- .../src/material/floating_action_button.dart | 3 +- .../floating_action_button_theme_test.dart | 32 ------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/packages/flutter/lib/src/material/floating_action_button.dart b/packages/flutter/lib/src/material/floating_action_button.dart index eaa2d75bd7..c0522d7185 100644 --- a/packages/flutter/lib/src/material/floating_action_button.dart +++ b/packages/flutter/lib/src/material/floating_action_button.dart @@ -444,7 +444,6 @@ class FloatingActionButton extends StatelessWidget { final Color foregroundColor = this.foregroundColor ?? floatingActionButtonTheme.foregroundColor - ?? theme.accentIconTheme.color ?? theme.colorScheme.onSecondary; final Color backgroundColor = this.backgroundColor ?? floatingActionButtonTheme.backgroundColor @@ -475,7 +474,7 @@ class FloatingActionButton extends StatelessWidget { ?? _defaultHighlightElevation; final MaterialTapTargetSize materialTapTargetSize = this.materialTapTargetSize ?? theme.materialTapTargetSize; - final TextStyle textStyle = theme.accentTextTheme.button.copyWith( + final TextStyle textStyle = theme.textTheme.button.copyWith( color: foregroundColor, letterSpacing: 1.2, ); diff --git a/packages/flutter/test/material/floating_action_button_theme_test.dart b/packages/flutter/test/material/floating_action_button_theme_test.dart index ebd3fffbdc..394c4864c3 100644 --- a/packages/flutter/test/material/floating_action_button_theme_test.dart +++ b/packages/flutter/test/material/floating_action_button_theme_test.dart @@ -118,38 +118,6 @@ void main() { expect(_getRawMaterialButton(tester).splashColor, splashColor); }); - // The feature checked by this test has been deprecated, see - // https://flutter.dev/go/remove-fab-accent-theme-dependency. This test will be - // removed in the future. - testWidgets('FloatingActionButton foreground color uses iconAccentTheme if no widget or widget theme color is specified', (WidgetTester tester) async { - final DebugPrintCallback oldPrint = debugPrint; - final List log = []; - debugPrint = (String message, { int wrapWidth }) { - log.add(message); - }; - - await tester.pumpWidget(MaterialApp( - home: Scaffold( - floatingActionButton: Theme( - data: ThemeData().copyWith( - accentIconTheme: const IconThemeData(color: Color(0xFACEFACE)), - ), - child: FloatingActionButton( - onPressed: () { }, - child: const Icon(Icons.add), - ), - ), - ), - )); - - debugPrint = oldPrint; - - // Verify that a warning message is generated. - expect(log.first, contains('https://flutter.dev/docs/release/breaking-changes/fab_accent_dependency')); - - expect(_getRichText(tester).text.style.color, const Color(0xFACEFACE)); - }); - testWidgets('FloatingActionButton uses a custom shape when specified in the theme', (WidgetTester tester) async { const ShapeBorder customShape = BeveledRectangleBorder();