Commit e249c0ab authored by Hixie's avatar Hixie

Add menu items to stocks to control timeDilation

parent 884b2cf5
...@@ -13,6 +13,7 @@ import 'package:flutter/gestures.dart'; ...@@ -13,6 +13,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'stock_data.dart'; import 'stock_data.dart';
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
part of stocks; part of stocks;
enum _MenuItems { autorefresh, autorefreshCheckbox, add, remove } enum _MenuItems { autorefresh, autorefreshCheckbox, refresh, speedUp, speedDown }
const double _kMenuMargin = 16.0; // 24.0 on tablet const double _kMenuMargin = 16.0; // 24.0 on tablet
...@@ -32,12 +32,16 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool> ...@@ -32,12 +32,16 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
) )
), ),
new PopupMenuItem( new PopupMenuItem(
value: _MenuItems.add, value: _MenuItems.refresh,
child: new Text('Add stock') child: new Text('Refresh')
), ),
new PopupMenuItem( new PopupMenuItem(
value: _MenuItems.remove, value: _MenuItems.speedUp,
child: new Text('Remove stock') child: new Text('Increase animation speed')
),
new PopupMenuItem(
value: _MenuItems.speedDown,
child: new Text('Decrease animation speed')
), ),
] ]
)) { )) {
...@@ -49,8 +53,13 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool> ...@@ -49,8 +53,13 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
case _MenuItems.autorefreshCheckbox: case _MenuItems.autorefreshCheckbox:
onAutorefreshChanged(autorefresh); onAutorefreshChanged(autorefresh);
break; break;
case _MenuItems.add: case _MenuItems.speedUp:
case _MenuItems.remove: timeDilation /= 5.0;
break;
case _MenuItems.speedDown:
timeDilation *= 5.0;
break;
case _MenuItems.refresh:
await showDialog( await showDialog(
context: context, context: context,
child: new Dialog( child: new Dialog(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment