diff --git a/lib/common/utils/common_utils.dart b/lib/common/utils/common_utils.dart index 3695ca67..cb8c70bc 100644 --- a/lib/common/utils/common_utils.dart +++ b/lib/common/utils/common_utils.dart @@ -199,21 +199,47 @@ class CommonUtils { static getThemeData(Color color) { return ThemeData( - useMaterial3: false, - primaryColor: color, + ///用来适配 Theme.of(context).primaryColorLight 和 primaryColorDark 的颜色变化,不设置可能会是默认蓝色 + primarySwatch: color as MaterialColor, + + /// Card 在 M3 下,会有 apply Overlay + colorScheme: ColorScheme.fromSeed( seedColor: color, primary: color, + + brightness: Brightness.light, + + ///影响 card 的表色,因为 M3 下是 applySurfaceTint ,在 Material 里 + surfaceTint: Colors.transparent, ), + + /// 受到 iconThemeData.isConcrete 的印象,需要全参数才不会进入 fallback + iconTheme: IconThemeData( + size: 24.0, + fill: 0.0, + weight: 400.0, + grade: 0.0, + opticalSize: 48.0, + color: Colors.white, + opacity: 0.8, + ), + + ///修改 FloatingActionButton的默认主题行为 + floatingActionButtonTheme: FloatingActionButtonThemeData( + foregroundColor: Colors.white, + backgroundColor: color, + shape: CircleBorder()), appBarTheme: AppBarTheme( - systemOverlayStyle: SystemUiOverlayStyle.light.copyWith( - systemNavigationBarContrastEnforced: true, - systemStatusBarContrastEnforced: true, - systemNavigationBarColor: color, - statusBarColor: color, - systemNavigationBarDividerColor: color.withAlpha(199), + iconTheme: IconThemeData( + color: Colors.white, + size: 24.0, ), + backgroundColor: color, + titleTextStyle: Typography.dense2021.titleLarge, + systemOverlayStyle: SystemUiOverlayStyle.light, ), + // 如果需要去除对应的水波纹效果 // splashFactory: NoSplash.splashFactory, // textButtonTheme: TextButtonThemeData( diff --git a/lib/page/trend/trend_page.dart b/lib/page/trend/trend_page.dart index fdec50e9..030ec663 100644 --- a/lib/page/trend/trend_page.dart +++ b/lib/page/trend/trend_page.dart @@ -302,7 +302,7 @@ class TrendPageState extends State Radius.circular(size / 2), ), ), - closedColor: Theme.of(context).colorScheme.secondary, + closedColor: Theme.of(context).primaryColor, closedBuilder: (BuildContext context, VoidCallback openContainer) { return SizedBox( width: size,