Change how navigator prevents redundant operations (#4769)

* Change how navigator prevents redundant operations

Instead of requiring transactions, we now cancel all active pointers that are
interacting with the navigator and absorb future pointers until we get a chance
to build. This approach isn't perfect (e.g., events that trigger off the
cancelled pointers could still interact with the navigator), but it should be
better than the current transaction-based approach.

Fixes #4716

* Remove openTransaction

* test

* fixup
This commit is contained in:
Adam Barth
2016-06-27 13:07:47 -07:00
committed by GitHub
parent 08bf1b6bce
commit 2af668f832
15 changed files with 389 additions and 284 deletions

View File

@@ -128,10 +128,9 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
new FlatButton(
child: new Text('DISCARD'),
onPressed: () {
Navigator.openTransaction(context, (NavigatorTransaction transaction) {
transaction.pop(DismissDialogAction.discard); // pop the cancel/discard dialog
transaction.pop(null); // pop this route
});
Navigator.of(context)
..pop(DismissDialogAction.discard) // pop the cancel/discard dialog
..pop(); // pop this route
}
)
]

View File

@@ -158,10 +158,9 @@ class _PestoDemoState extends State<PestoDemo> {
new DrawerItem(
child: new Text('Return to Gallery'),
onPressed: () {
Navigator.openTransaction(context, (NavigatorTransaction transaction) {
transaction.pop(); // Close the Drawer
transaction.pop(); // Go back to the gallery
});
Navigator.of(context)
..pop() // Close the drawer.
..pop(); // Go back to the gallery.
}
),
]