Flutter 2.5 颤振亮度已弃用
Flutter 2.5 flutter brightness is deprecated
flutter AppBarTheme 亮度已弃用,推荐使用 colorScheme
什么是 colorScheme 以及如何实现它
ColorScheme 是一组基于 Material 颜色系统的颜色,可用于配置大多数组件的颜色属性。
你可以这样使用它
static const ColorScheme colorSchemeLight = ColorScheme(
primary: primaryColor,
secondary: accentColor,
surface: background,
background: background,
brightness: Brightness.light,
error: failurRed,
onBackground: Colors.black,
onError: Colors.white,
onPrimary: Colors.white,
onSecondary: Colors.white,
onSurface: Colors.black,
primaryContainer: primaryColor,
secondaryContainer: accentColor,
);
mainTheme = ThemeData(
appBarTheme: appBarTheme,
brightness: Brightness.light,
primaryColor: primaryColor,
colorScheme: colorSchemeLight,
textTheme: viatoTextTheme,
backgroundColor: background,
scaffoldBackgroundColor: background);
flutter AppBarTheme 亮度已弃用,推荐使用 colorScheme 什么是 colorScheme 以及如何实现它
ColorScheme 是一组基于 Material 颜色系统的颜色,可用于配置大多数组件的颜色属性。
你可以这样使用它
static const ColorScheme colorSchemeLight = ColorScheme(
primary: primaryColor,
secondary: accentColor,
surface: background,
background: background,
brightness: Brightness.light,
error: failurRed,
onBackground: Colors.black,
onError: Colors.white,
onPrimary: Colors.white,
onSecondary: Colors.white,
onSurface: Colors.black,
primaryContainer: primaryColor,
secondaryContainer: accentColor,
);
mainTheme = ThemeData(
appBarTheme: appBarTheme,
brightness: Brightness.light,
primaryColor: primaryColor,
colorScheme: colorSchemeLight,
textTheme: viatoTextTheme,
backgroundColor: background,
scaffoldBackgroundColor: background);