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
fa8c4515
Commit
fa8c4515
authored
Oct 02, 2015
by
Hixie
Committed by
Ian Hickson
Oct 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Heroes
parent
8414b4c1
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
615 additions
and
31 deletions
+615
-31
stock_home.dart
examples/stocks/lib/stock_home.dart
+5
-3
stock_row.dart
examples/stocks/lib/stock_row.dart
+10
-7
stock_symbol_viewer.dart
examples/stocks/lib/stock_symbol_viewer.dart
+7
-2
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+389
-0
navigator.dart
packages/flutter/lib/src/widgets/navigator.dart
+203
-19
widgets.dart
packages/flutter/lib/widgets.dart
+1
-0
No files found.
examples/stocks/lib/stock_home.dart
View file @
fa8c4515
...
...
@@ -186,14 +186,16 @@ class StockHomeState extends State<StockHome> {
Widget
buildStockList
(
BuildContext
context
,
Iterable
<
Stock
>
stocks
)
{
return
new
StockList
(
stocks:
stocks
.
toList
(),
onAction:
(
Stock
stock
,
Global
Key
arrowKey
)
{
onAction:
(
Stock
stock
,
Key
arrowKey
)
{
setState
(()
{
stock
.
percentChange
=
100.0
*
(
1.0
/
stock
.
lastSale
);
stock
.
lastSale
+=
1.0
;
});
},
onOpen:
(
Stock
stock
,
GlobalKey
arrowKey
)
{
config
.
navigator
.
pushNamed
(
'/stock/
${stock.symbol}
'
);
onOpen:
(
Stock
stock
,
Key
arrowKey
)
{
Set
<
Key
>
mostValuableKeys
=
new
Set
<
Key
>();
mostValuableKeys
.
add
(
arrowKey
);
config
.
navigator
.
pushNamed
(
'/stock/
${stock.symbol}
'
,
mostValuableKeys:
mostValuableKeys
);
}
);
}
...
...
examples/stocks/lib/stock_row.dart
View file @
fa8c4515
...
...
@@ -6,7 +6,7 @@ part of stocks;
enum
StockRowPartKind
{
arrow
}
class
StockRowPartKey
extends
Global
Key
{
class
StockRowPartKey
extends
Key
{
const
StockRowPartKey
(
this
.
stock
,
this
.
part
)
:
super
.
constructor
();
final
Stock
stock
;
final
StockRowPartKind
part
;
...
...
@@ -21,7 +21,7 @@ class StockRowPartKey extends GlobalKey {
String
toString
()
=>
'[StockRowPartKey
${stock.symbol}
:
${part.toString().split(".")[1]}
)]'
;
}
typedef
void
StockRowActionCallback
(
Stock
stock
,
Global
Key
arrowKey
);
typedef
void
StockRowActionCallback
(
Stock
stock
,
Key
arrowKey
);
class
StockRow
extends
StatelessComponent
{
StockRow
({
...
...
@@ -30,7 +30,7 @@ class StockRow extends StatelessComponent {
this
.
onLongPressed
})
:
this
.
stock
=
stock
,
_arrowKey
=
new
StockRowPartKey
(
stock
,
StockRowPartKind
.
arrow
),
super
(
key:
new
Global
ObjectKey
(
stock
));
super
(
key:
new
ObjectKey
(
stock
));
final
Stock
stock
;
final
StockRowActionCallback
onPressed
;
...
...
@@ -53,7 +53,7 @@ class StockRow extends StatelessComponent {
}
Widget
build
(
BuildContext
context
)
{
String
lastSale
=
"
\$
${stock.lastSale.toStringAsFixed(2)}
"
;
final
String
lastSale
=
"
\$
${stock.lastSale.toStringAsFixed(2)}
"
;
String
changeInPrice
=
"
${stock.percentChange.toStringAsFixed(2)}
%"
;
if
(
stock
.
percentChange
>
0
)
changeInPrice
=
"+"
+
changeInPrice
;
...
...
@@ -69,9 +69,12 @@ class StockRow extends StatelessComponent {
),
child:
new
Row
(<
Widget
>[
new
Container
(
key:
_arrowKey
,
child:
new
StockArrow
(
percentChange:
stock
.
percentChange
),
margin:
const
EdgeDims
.
only
(
right:
5.0
)
margin:
const
EdgeDims
.
only
(
right:
5.0
),
child:
new
Hero
(
tag:
StockRowPartKind
.
arrow
,
key:
_arrowKey
,
child:
new
StockArrow
(
percentChange:
stock
.
percentChange
)
)
),
new
Flexible
(
child:
new
Row
(<
Widget
>[
...
...
examples/stocks/lib/stock_symbol_viewer.dart
View file @
fa8c4515
...
...
@@ -36,7 +36,11 @@ class StockSymbolViewer extends StatelessComponent {
'
${stock.symbol}
'
,
style:
Theme
.
of
(
context
).
text
.
display2
),
new
StockArrow
(
percentChange:
stock
.
percentChange
)
new
Hero
(
tag:
StockRowPartKind
.
arrow
,
turns:
2
,
child:
new
StockArrow
(
percentChange:
stock
.
percentChange
)
),
],
justifyContent:
FlexJustifyContent
.
spaceBetween
),
...
...
@@ -51,7 +55,8 @@ class StockSymbolViewer extends StatelessComponent {
)
)
)
])
]
)
);
}
...
...
packages/flutter/lib/src/widgets/heroes.dart
0 → 100644
View file @
fa8c4515
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/navigator.dart
View file @
fa8c4515
This diff is collapsed.
Click to expand it.
packages/flutter/lib/widgets.dart
View file @
fa8c4515
...
...
@@ -16,6 +16,7 @@ export 'src/widgets/focus.dart';
export
'src/widgets/framework.dart'
;
export
'src/widgets/gesture_detector.dart'
;
export
'src/widgets/gridpaper.dart'
;
export
'src/widgets/heroes.dart'
;
export
'src/widgets/homogeneous_viewport.dart'
;
export
'src/widgets/mimic.dart'
;
export
'src/widgets/mixed_viewport.dart'
;
...
...
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