Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2ef0b569
Commit
2ef0b569
authored
Dec 03, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #706 from Hixie/speed-control
Add menu items to stocks to control timeDilation
parents
884b2cf5
e249c0ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
main.dart
examples/stocks/lib/main.dart
+1
-0
stock_menu.dart
examples/stocks/lib/stock_menu.dart
+16
-7
No files found.
examples/stocks/lib/main.dart
View file @
2ef0b569
...
...
@@ -13,6 +13,7 @@ import 'package:flutter/gestures.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'stock_data.dart'
;
...
...
examples/stocks/lib/stock_menu.dart
View file @
2ef0b569
...
...
@@ -4,7 +4,7 @@
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
...
...
@@ -32,12 +32,16 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
)
),
new
PopupMenuItem
(
value:
_MenuItems
.
add
,
child:
new
Text
(
'
Add stock
'
)
value:
_MenuItems
.
refresh
,
child:
new
Text
(
'
Refresh
'
)
),
new
PopupMenuItem
(
value:
_MenuItems
.
remove
,
child:
new
Text
(
'Remove stock'
)
value:
_MenuItems
.
speedUp
,
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>
case
_MenuItems
.
autorefreshCheckbox
:
onAutorefreshChanged
(
autorefresh
);
break
;
case
_MenuItems
.
add
:
case
_MenuItems
.
remove
:
case
_MenuItems
.
speedUp
:
timeDilation
/=
5.0
;
break
;
case
_MenuItems
.
speedDown
:
timeDilation
*=
5.0
;
break
;
case
_MenuItems
.
refresh
:
await
showDialog
(
context:
context
,
child:
new
Dialog
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment