class BMICalculator extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primaryColor: Colors.red,
),
home: InputPage(),
);
Run Code Online (Sandbox Code Playgroud)
我正在学习这门课程:https://www.udemy.com/course/flutter-bootcamp-with-dart/
在主题部分,她使用这个确切的代码将她的 appBar 变成红色。我的代码没有显示任何错误,但我的 appBar 仍然是默认主题。
原色的描述在这里:https://api.flutter.dev/flutter/material/ThemeData-class.html
它没有说它已经折旧,也没有表明最近有任何变化。
我的问题不是“如何使我的应用程序栏变为红色”,而是“为什么此代码不能按预期执行?”