颤动:更改默认图标文本颜色

flutter: change default Icon text color

我在我的应用程序上修改了 textTheme 主题数据:

  ThemeData get lightTheme => ThemeData(
        disabledColor: AppColors.disabled,
        scaffoldBackgroundColor: AppColors.paper,
        textTheme: TextTheme(
          button: AppTextStyles.button,
          overline: AppTextStyles.overline,
        ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ButtonStyle(
        shape: MaterialStateProperty.all<RoundedRectangleBorder>(
          RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(AppSize.s32),
          ),
        ),
        backgroundColor: MaterialStateProperty.resolveWith(
          (final states) => states.contains(MaterialState.disabled)
              ? 50.gray
              : 500.primary,
        ),
 
      ),
    ),

我也用过这段代码,但没有用:

elevatedButtonTheme: ElevatedButtonThemeData(
  style: ButtonStyle(
    shape: MaterialStateProperty.all<RoundedRectangleBorder>(
      RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(AppSize.s32),
      ),
    ),
    backgroundColor: MaterialStateProperty.resolveWith(
      (final states) => states.contains(MaterialState.disabled)
          ? 50.gray
          : 500.primary,
    ),
    textStyle: MaterialStateProperty.resolveWith(
      (final states) {
        return const TextStyle(color: Color(0xFF661F1F));
      },
    ),
  ),
),

这是AppTextStyles.button,:

  static final TextStyle _base = GoogleFonts.inder(
    color: Colors.black,
    fontWeight: FontWeight.w600,
  );
  static final button = _base.copyWith(
      fontSize: 16.sp, fontWeight: FontWeight.w700, color: Colors.black);

但是当我添加 ElevatedButton 时,文本颜色仍然是白色?

      ElevatedButton.icon(
          onPressed: () {},
          icon: Icon(Icons.access_alarm),
          label: Text("Sign in")),

这是我的 material:

GetMaterialApp(
          theme: AppThemes().lightTheme,

尝试在 ButtonStyle 内的 foregroundColor 中更改颜色。

foregroundColor: MaterialStateProperty.resolveWith(
            (final states) => states.contains(MaterialState.disabled)
                ? Colors.grey
                : Color(0xFF661F1F),

使用 ButtonStyle 的 foregroundColor 属性。
foregroundColor: MaterialStateProperty.all(Colors.black)