Pārlūkot izejas kodu

指定的错误,页面显示修复

liukai 2 nedēļas atpakaļ
vecāks
revīzija
bed73b9e86

+ 18 - 3
packages/cpt_main/lib/modules/home/home_page.dart

@@ -59,7 +59,12 @@ class HomePage extends HookConsumerWidget {
               alignment: Alignment.topLeft,
               children: <Widget>[
                 // 通知图标
-                const MyAssetImage(Assets.mainHomeNotificationIcon, width: 19, height: 20),
+                MyAssetImage(
+                  Assets.mainHomeNotificationIcon,
+                  width: 19,
+                  height: 20,
+                  color: context.appColors.imageDarkModelWhite,
+                ),
 
                 //未读消息
                 Positioned(
@@ -169,7 +174,12 @@ class HomePage extends HookConsumerWidget {
                   mainAxisSize: MainAxisSize.max,
                   mainAxisAlignment: MainAxisAlignment.center,
                   children: [
-                    const MyAssetImage(Assets.mainHomePaymentIcon, width: 16.5, height: 18).marginOnly(left: 20),
+                    MyAssetImage(
+                      Assets.mainHomePaymentIcon,
+                      width: 16.5,
+                      height: 18,
+                      color: context.appColors.imageDarkModelWhite,
+                    ).marginOnly(left: 20),
                     MyTextView(
                       S.current.payment,
                       textColor: context.appColors.textBlack,
@@ -184,7 +194,12 @@ class HomePage extends HookConsumerWidget {
                   mainAxisSize: MainAxisSize.max,
                   mainAxisAlignment: MainAxisAlignment.center,
                   children: [
-                    const MyAssetImage(Assets.mainHomeRewardsIcon, width: 16.5, height: 17).marginOnly(left: 20),
+                    MyAssetImage(
+                      Assets.mainHomeRewardsIcon,
+                      width: 16.5,
+                      height: 17,
+                      color: context.appColors.imageDarkModelWhite,
+                    ).marginOnly(left: 20),
                     MyTextView(
                       S.current.rewards,
                       textColor: context.appColors.textBlack,

+ 5 - 0
packages/cs_resources/lib/theme/app_colors_theme.dart

@@ -81,6 +81,7 @@ class AppColorsTheme extends ThemeExtension<AppColorsTheme> {
   final Color authFiledHintDark; //文本Hint的深蓝色
   final Color greenBG; //按钮的绿色背景
   final Color textGreen; //按钮的绿色背景
+  final Color imageDarkModelWhite; //黑暗模式是白色,亮色模式为null,用于图片 Image 的着色
 
   // 私有的构造函数
   const AppColorsTheme._internal({
@@ -120,6 +121,7 @@ class AppColorsTheme extends ThemeExtension<AppColorsTheme> {
     required this.authFiledHintDark,
     required this.greenBG,
     required this.textGreen,
+    required this.imageDarkModelWhite,
   });
 
   // 浅色主题工厂方法
@@ -161,6 +163,7 @@ class AppColorsTheme extends ThemeExtension<AppColorsTheme> {
       authFiledHintDark: _color99A8CA,
       greenBG: _color0DBE1E,
       textGreen: _color05CC67,
+      imageDarkModelWhite: Colors.transparent,
     );
   }
 
@@ -203,6 +206,7 @@ class AppColorsTheme extends ThemeExtension<AppColorsTheme> {
       authFiledHintDark: _color99A8CA,
       greenBG: _darkBlackItemLight,
       textGreen: Colors.white,
+      imageDarkModelWhite: Colors.white,
     );
   }
 
@@ -254,6 +258,7 @@ class AppColorsTheme extends ThemeExtension<AppColorsTheme> {
       authFiledHintDark: Color.lerp(authFiledHintDark, other.authFiledHintDark, t)!,
       greenBG: Color.lerp(greenBG, other.greenBG, t)!,
       textGreen: Color.lerp(textGreen, other.textGreen, t)!,
+      imageDarkModelWhite: Color.lerp(imageDarkModelWhite, other.imageDarkModelWhite, t)!,
     );
   }
 }

+ 1 - 1
packages/cs_widgets/lib/my_load_image.dart

@@ -264,7 +264,7 @@ class MyAssetImage extends StatelessWidget {
       cacheWidth: cacheWidth,
       cacheHeight: cacheHeight,
       fit: fit,
-      color: color,
+      color: color == Colors.transparent ? null : color,  //不允许图片的透明色值着色
 
       /// 忽略图片语义
       excludeFromSemantics: true,