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:
@@ -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
|
||||
}
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user