mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Removed the last vestiges of accent color from the FloatingActionButton. (#78296)
This commit is contained in:
parent
93fb258602
commit
5ab3474435
@ -9,7 +9,6 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'button.dart';
|
||||
import 'colors.dart';
|
||||
import 'floating_action_button_theme.dart';
|
||||
import 'scaffold.dart';
|
||||
import 'theme.dart';
|
||||
@ -242,11 +241,6 @@ class FloatingActionButton extends StatelessWidget {
|
||||
/// [ThemeData.floatingActionButtonTheme] is used. If that property is also
|
||||
/// null, then the [ColorScheme.onSecondary] color of [ThemeData.colorScheme]
|
||||
/// is used.
|
||||
///
|
||||
/// Although the color of theme's `accentIconTheme` currently provides a
|
||||
/// default that supersedes the `onSecondary` color, this dependency
|
||||
/// has been deprecated: https://flutter.dev/go/remove-fab-accent-theme-dependency.
|
||||
/// It will be removed in the future.
|
||||
final Color? foregroundColor;
|
||||
|
||||
/// The button's background color.
|
||||
@ -429,25 +423,6 @@ class FloatingActionButton extends StatelessWidget {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final FloatingActionButtonThemeData floatingActionButtonTheme = theme.floatingActionButtonTheme;
|
||||
|
||||
// Applications should no longer use accentIconTheme's color to configure
|
||||
// the foreground color of floating action buttons. For more information, see
|
||||
// https://flutter.dev/go/remove-fab-accent-theme-dependency.
|
||||
if (this.foregroundColor == null && floatingActionButtonTheme.foregroundColor == null) {
|
||||
final bool accentIsDark = theme.accentColorBrightness == Brightness.dark;
|
||||
final Color defaultAccentIconThemeColor = accentIsDark ? Colors.white : Colors.black;
|
||||
if (theme.accentIconTheme.color != defaultAccentIconThemeColor) {
|
||||
debugPrint(
|
||||
'Warning: '
|
||||
'The support for configuring the foreground color of '
|
||||
'FloatingActionButtons using ThemeData.accentIconTheme '
|
||||
'has been deprecated. Please use ThemeData.floatingActionButtonTheme '
|
||||
'instead. See '
|
||||
'https://flutter.dev/go/remove-fab-accent-theme-dependency. '
|
||||
'This feature was deprecated after v1.13.2.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final Color foregroundColor = this.foregroundColor
|
||||
?? floatingActionButtonTheme.foregroundColor
|
||||
?? theme.colorScheme.onSecondary;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user