LoginPage()是寫好的用戶登錄界面,但是想讓界面跑起來 需要runApp(),需要再寫個MyApp()裏面使用MaterialApp()包裹寫好的界面
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter_LoginPlugin',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: LoginPage(),
);
}
}
class LoginPage extends StatefulWidget{
@override
State<StatefulWidget> createState() {
return new _MyAppState();
}
}
class _MyAppState extends State<LoginPage> {
//佈局頁面
}