ref 0.0.3 ref: ^0.0.3 copied to clipboard
A Flutter mvvm plugin.
import 'package:flutter/material.dart';
import 'coding/coding.dart';
import 'mvvm.dart';
import 'store/index.dart';
late Store rootStore;
void main() {
rootStore = Store();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: '/index',
routes: {
'/mvvm': (BuildContext context) => Mvvm(),
'/index': (BuildContext context) => AppIndex(),
},
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
children: [
SizedBox(height: 80),
ElevatedButton(
onPressed: () => Navigator.pushNamed(context, '/mvvm'),
child: Text('测试响应式页面', style: TextStyle(fontSize: 16)),
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () => Navigator.pushNamed(context, '/index'),
child: Text('coding', style: TextStyle(fontSize: 16)),
),
],
),
),
),
);
}
}