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);
|
||||
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
|
||||
_HomeState createState() => _HomeState();
|
||||
}
|
||||
|
@ -293,17 +307,10 @@ class Loading extends StatefulWidget {
|
|||
}
|
||||
|
||||
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
|
||||
void initState() {
|
||||
super.initState();
|
||||
load();
|
||||
Home.loadInitial(context);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in New Issue
Block a user