【发布时间】:2021-08-25 00:21:28
【问题描述】:
这是我的主题:
final ThemeData theme = ThemeData();
return MaterialApp(
title: 'Notes',
home: SignInPage(),
debugShowCheckedModeBanner: false,
theme: theme.copyWith(
primaryColor: Colors.green[800],
colorScheme: theme.colorScheme
.copyWith(secondary: Colors.green, secondaryVariant: Colors.green),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: Colors.blue[900],
),
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
);
在过去的 Flutter 时代,如果您将原色设为绿色,则焦点文本字段的边框也会变为绿色。现在,我希望我的所有文本字段在聚焦时都有一个绿色边框、绿色前缀图标和绿色标签文本,所有这些都来自根主题。但这是我使用上面的代码得到的结果:
我希望锁定、“密码”标签和边框在聚焦时全部为绿色,而在未聚焦时为灰色。如何从应用程序的根主题执行此操作。我将 primaryColor 设置为绿色,甚至将 colorScheme 辅助颜色设置为绿色,但仍然是蓝色,而不是绿色。
【问题讨论】:
标签: flutter dart flutter-layout material-design flutter-textinputfield