Routes shouldn't be interactive when animating out
This patch introduces the notion of a ModalRoute that puts up a modal barrier and makes the route invisible to hit testing when its animating out. This patch also uses this mechanism in a number of places (including PageRoute). There are still a few more cases to convert, but that's work for a future patch. Fixes #1684
This commit is contained in:
@@ -248,9 +248,6 @@ class AddItemDialogState extends State<AddItemDialog> {
|
||||
return new Dialog(
|
||||
title: new Text("What are you doing?"),
|
||||
content: new Block(menuItems),
|
||||
onDismiss: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
child: new Text('CANCEL'),
|
||||
|
||||
@@ -70,9 +70,6 @@ class SettingsFragmentState extends State<SettingsFragment> {
|
||||
keyboardType: KeyboardType.NUMBER,
|
||||
onChanged: _handleGoalWeightChanged
|
||||
),
|
||||
onDismiss: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
child: new Text('CANCEL'),
|
||||
|
||||
@@ -11,7 +11,7 @@ const double _kMenuMargin = 16.0; // 24.0 on tablet
|
||||
Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool> onAutorefreshChanged }) async {
|
||||
switch (await showMenu(
|
||||
context: context,
|
||||
position: new MenuPosition(
|
||||
position: new ModalPosition(
|
||||
right: ui.window.padding.right + _kMenuMargin,
|
||||
top: ui.window.padding.top + _kMenuMargin
|
||||
),
|
||||
|
||||
@@ -21,6 +21,7 @@ class StockSettings extends StatefulComponent {
|
||||
|
||||
class StockSettingsState extends State<StockSettings> {
|
||||
void _handleOptimismChanged(bool value) {
|
||||
value ??= false;
|
||||
sendUpdates(value ? StockMode.optimistic : StockMode.pessimistic, config.backup);
|
||||
}
|
||||
|
||||
@@ -39,9 +40,6 @@ class StockSettingsState extends State<StockSettings> {
|
||||
child: new Dialog(
|
||||
title: new Text("Change mode?"),
|
||||
content: new Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"),
|
||||
onDismiss: () {
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
child: new Text('NO THANKS'),
|
||||
|
||||
Reference in New Issue
Block a user