Unverified Commit 6006c237 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Step 2 of 2: Remove Flutter's FloatingActionButton dependency on ThemeData...

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

parent 667c38d5
...@@ -444,7 +444,6 @@ class FloatingActionButton extends StatelessWidget { ...@@ -444,7 +444,6 @@ class FloatingActionButton extends StatelessWidget {
final Color foregroundColor = this.foregroundColor final Color foregroundColor = this.foregroundColor
?? floatingActionButtonTheme.foregroundColor ?? floatingActionButtonTheme.foregroundColor
?? theme.accentIconTheme.color
?? theme.colorScheme.onSecondary; ?? theme.colorScheme.onSecondary;
final Color backgroundColor = this.backgroundColor final Color backgroundColor = this.backgroundColor
?? floatingActionButtonTheme.backgroundColor ?? floatingActionButtonTheme.backgroundColor
...@@ -475,7 +474,7 @@ class FloatingActionButton extends StatelessWidget { ...@@ -475,7 +474,7 @@ class FloatingActionButton extends StatelessWidget {
?? _defaultHighlightElevation; ?? _defaultHighlightElevation;
final MaterialTapTargetSize materialTapTargetSize = this.materialTapTargetSize final MaterialTapTargetSize materialTapTargetSize = this.materialTapTargetSize
?? theme.materialTapTargetSize; ?? theme.materialTapTargetSize;
final TextStyle textStyle = theme.accentTextTheme.button.copyWith( final TextStyle textStyle = theme.textTheme.button.copyWith(
color: foregroundColor, color: foregroundColor,
letterSpacing: 1.2, letterSpacing: 1.2,
); );
......
...@@ -118,38 +118,6 @@ void main() { ...@@ -118,38 +118,6 @@ void main() {
expect(_getRawMaterialButton(tester).splashColor, splashColor); 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 { testWidgets('FloatingActionButton uses a custom shape when specified in the theme', (WidgetTester tester) async {
const ShapeBorder customShape = BeveledRectangleBorder(); const ShapeBorder customShape = BeveledRectangleBorder();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment