我正在使用 flutter2.8.0创建一个简单的应用程序。但是当我尝试更改应用程序的主颜色时,它对我不起作用。
这是我正在处理的代码:
class BMICalculator extends StatelessWidget {
const BMICalculator({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
primaryColor: const Color(0xFF0A0E21),
scaffoldBackgroundColor: const Color(0xFF0A0E21),
),
home: const InputPage(),
);
}
}
Run Code Online (Sandbox Code Playgroud)
使用主要Swatch
theme: ThemeData(
primarySwatch: Colors.red,
),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6556 次 |
| 最近记录: |