我在 LinkedIn Learning 上关注 London App Brewery 的 BMI 计算器应用程序。当尝试将 PrimaryColor 设置为红色时,即使我覆盖了 Primary Color,我的模拟器仍然显示浅蓝色默认 AppBar。这是代码
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primaryColor: Colors.red,
),
home: const InputPage(),
);
}
}
class InputPage extends StatefulWidget {
const InputPage({Key? key}) : super(key: key);
@override
_InputPageState createState() => _InputPageState();
}
class _InputPageState …Run Code Online (Sandbox Code Playgroud)