这是我的主题:
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),
),
),
),
);
在过去的颤振时代,如果您将原色设置为绿色,则焦点文本字段的边框也会变为绿色。现在,我希望我的所有文本字段在聚焦时都有一个绿色边框、绿色前缀图标和绿色标签文本,所有这些都来自根主题。但这是我使用上面的代码得到的结果:
我希望锁定、“密码”标签和边框在聚焦时全部为绿色,而在未聚焦时为灰色。如何从应用程序的根主题执行此操作。我将primaryColor设置为绿色,甚至将colorScheme辅助颜色设置为绿色,但仍然一切都是蓝色,而不是绿色。