Step 2 of 2: Remove Flutter's FloatingActionButton dependency on ThemeData accent properties (#46923)

This commit is contained in:
Hans Muller
2020-01-16 07:21:25 -08:00
committed by GitHub
parent 667c38d551
commit 6006c23757
2 changed files with 1 additions and 34 deletions

View File

@@ -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,
);

View File

@@ -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<String> log = <String>[];
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();