let the home widget load for itself (don't separate loading and saving)
This commit is contained in:
parent
0bd793e0e2
commit
9cc63a365b
|
@ -228,6 +228,20 @@ class Home extends StatefulWidget {
|
||||||
Home({Key key}) : super(key: key);
|
Home({Key key}) : super(key: key);
|
||||||
static const title = '$appName';
|
static const title = '$appName';
|
||||||
|
|
||||||
|
static void loadInitial(BuildContext context) async {
|
||||||
|
await Future.delayed(Duration.zero, () {});
|
||||||
|
// load some stuff here and await results
|
||||||
|
Navigator.pushReplacement(context,
|
||||||
|
MaterialPageRoute(builder: (context) => Home()));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void save(BuildContext context) async {
|
||||||
|
showDialog(context: context, barrierDismissible: false,
|
||||||
|
builder: (BuildContext context) { return AlertDialog(content: Text("Saving...")); });
|
||||||
|
await Future.delayed(Duration.zero, () {});
|
||||||
|
Navigator.of(context, rootNavigator: true).pop();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_HomeState createState() => _HomeState();
|
_HomeState createState() => _HomeState();
|
||||||
}
|
}
|
||||||
|
@ -293,17 +307,10 @@ class Loading extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LoadingState extends State<Loading> {
|
class _LoadingState extends State<Loading> {
|
||||||
void load() async {
|
|
||||||
await Future.delayed(Duration.zero, () {});
|
|
||||||
// load some stuff here and await results
|
|
||||||
Navigator.pushReplacement(context,
|
|
||||||
MaterialPageRoute(builder: (context) => Home()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
load();
|
Home.loadInitial(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user