Skip to content

编写你的第一个 Flutter App [2/2]-7 #1034

Open
@cuilanxin

Description

@cuilanxin

页面 URL

https://codelabs.flutter-io.cn/codelabs/first-flutter-app-pt2-cn/index.html#6

页面源地址

No response

描述问题

主题并没有发生改变

// 这是我的代码
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
  final wordPair = WordPair.random();
    return  MaterialApp(
      title: 'Welcome to Flutter', 
        theme: ThemeData(
        primaryColor: Colors.white,
      ), // 程序的主题
      home: Scaffold(
        appBar: AppBar(title: const Text('hello word')),
        body: Center(child: Text(wordPair.asPascalCase))
      )
    );
  }
}
// 这个是文档的代码
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Startup Name Generator',
      theme: new ThemeData(          // 新增代码开始... 
        primaryColor: Colors.white,
      ),                             // ... 代码新增结束
      home: new RandomWords(),
    );
  }
}

期望如何修复

希望知道这个问题是什么

附加信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    E: 页面问题页面内容有误或需要改进。

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions