第一个Flutter页面里的main函数
笔者左右无法肉眼识别哪些是系统生成的,哪些是需要开发者手写的,只有在最初的阶段通过加强多写页面来形成肌肉记忆了。下述是main函数的
import 'package:exercise_home_page/app_center.dart';
import 'package:flutter/material.dart';
import 'home_page.dart';
import 'message_center.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MessageCenter(),
);
}
}
import 'package:flutter/material.dart';
class MessageCenter extends StatefulWidget
{
const MessageCenter({super.key});
@override
State<StatefulWidget> createState() {
return _State();
}
}
class _State extends State<MessageCenter>
{
@override
Widget build(BuildContext context) {
return Container(
color: Colors.orange,
);
}
}
原文地址:https://blog.csdn.net/cola_wh/article/details/140494066
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!