Logo
Section 1 / 6

创建一个 Flutter 应用

了解如何在不同文件中使用无状态组件来创建各种视图。

导入

创建一个 Flutter 应用

了解如何在不同文件中使用无状态组件来创建各种视图。

No configuration found for ID: b01eebb4955bc96c06be87d9aa19c8ad551deb8c372bfe31b1b6f9ccd61f97e8

1import 'package:flutter/material.dart'; 2 3class Home extends StatelessWidget { 4 const Home({super.key}); 5 6 7 Widget build(BuildContext context) { 8 return Scaffold( 9 appBar: AppBar( 10 title: const Text("主页"), 11 ), 12 body: Container(child: const Center(child: Text("首页"),),), 13 ); 14 } 15}
1import 'package:flutter/material.dart'; 2 3class Profile extends StatelessWidget { 4 const Profile({super.key}); 5 6 7 Widget build(BuildContext context) { 8 return Scaffold( 9 appBar: AppBar( 10 title: const Text("个人资料页"), 11 ), 12 body: Container(child: const Center(child: Text("个人资料"),),), 13 ); 14 } 15}

No configuration found for ID: dbabfffd914652ef0c23c5891de25cfd4a7866e57824c3367f9ec569feed6109

入门

Flutter 中的依赖项