NavigatorTransaction

To make it easier to avoid pushing twice in one frame, provide a
transaction mechanism for the navigator.
This commit is contained in:
Hixie
2015-11-30 13:41:31 -08:00
parent 97cca4d47b
commit f9ea1ce815
29 changed files with 263 additions and 156 deletions

View File

@@ -15,11 +15,11 @@ class Home extends StatelessComponent {
),
new RaisedButton(
child: new Text('GO SHOPPING'),
onPressed: () => Navigator.of(context).pushNamed('/shopping')
onPressed: () => Navigator.pushNamed(context, '/shopping')
),
new RaisedButton(
child: new Text('START ADVENTURE'),
onPressed: () => Navigator.of(context).pushNamed('/adventure')
onPressed: () => Navigator.pushNamed(context, '/adventure')
)
],
padding: const EdgeDims.all(30.0)
@@ -41,11 +41,11 @@ class Shopping extends StatelessComponent {
),
new RaisedButton(
child: new Text('RETURN HOME'),
onPressed: () => Navigator.of(context).pop()
onPressed: () => Navigator.pop(context)
),
new RaisedButton(
child: new Text('GO TO DUNGEON'),
onPressed: () => Navigator.of(context).pushNamed('/adventure')
onPressed: () => Navigator.pushNamed(context, '/adventure')
)
],
padding: const EdgeDims.all(30.0)
@@ -67,7 +67,7 @@ class Adventure extends StatelessComponent {
),
new RaisedButton(
child: new Text('RUN!!!'),
onPressed: () => Navigator.of(context).pop()
onPressed: () => Navigator.pop(context)
)
],
padding: const EdgeDims.all(30.0)