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
6ea83f11
Commit
6ea83f11
authored
Sep 27, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1367 from abarth/update_navigation_example
Update navigation example
parents
fb58141d
1424f351
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
79 deletions
+55
-79
feed.dart
examples/fitness/lib/feed.dart
+4
-7
navigation.dart
examples/widgets/navigation.dart
+50
-72
fn3.dart
packages/flutter/lib/src/fn3.dart
+1
-0
No files found.
examples/fitness/lib/feed.dart
View file @
6ea83f11
...
...
@@ -244,13 +244,11 @@ class FeedFragment extends StatefulComponent {
});
}
Anchor
_snackBarAnchor
=
new
Anchor
();
Widget
buildSnackBar
()
{
if
(
_snackBarStatus
==
AnimationStatus
.
dismissed
)
return
null
;
return
new
SnackBar
(
showing:
_isShowingSnackBar
,
anchor:
_snackBarAnchor
,
content:
new
Text
(
"Item deleted."
),
actions:
[
new
SnackBarAction
(
label:
"UNDO"
,
onPressed:
_handleUndo
)],
onDismissed:
()
{
setState
(()
{
_snackBarStatus
=
AnimationStatus
.
dismissed
;
});
}
...
...
@@ -267,11 +265,10 @@ class FeedFragment extends StatefulComponent {
Widget
buildFloatingActionButton
()
{
switch
(
_fitnessMode
)
{
case
FitnessMode
.
feed
:
return
_snackBarAnchor
.
build
(
new
FloatingActionButton
(
child:
new
Icon
(
type:
'content/add'
,
size:
24
),
onPressed:
_handleActionButtonPressed
));
return
new
FloatingActionButton
(
child:
new
Icon
(
type:
'content/add'
,
size:
24
),
onPressed:
_handleActionButtonPressed
);
case
FitnessMode
.
chart
:
return
null
;
}
...
...
examples/widgets/navigation.dart
View file @
6ea83f11
...
...
@@ -2,87 +2,65 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/material.dart'
;
import
'package:sky/src/fn3.dart'
;
List
<
Route
>
routes
=
[
new
Route
(
name:
'home'
,
builder:
(
navigator
,
route
)
=>
new
Container
(
padding:
const
EdgeDims
.
all
(
30.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFCCCCCC
)),
child:
new
Column
([
new
Text
(
"You are at home"
),
new
RaisedButton
(
child:
new
Text
(
'GO SHOPPING'
),
onPressed:
()
=>
navigator
.
pushNamed
(
'shopping'
)
),
new
RaisedButton
(
child:
new
Text
(
'START ADVENTURE'
),
onPressed:
()
=>
navigator
.
pushNamed
(
'adventure'
)
)],
justifyContent:
FlexJustifyContent
.
center
)
final
Map
<
String
,
RouteBuilder
>
routes
=
<
String
,
RouteBuilder
>{
'/'
:
(
NavigatorState
navigator
,
Route
route
)
=>
new
Container
(
padding:
const
EdgeDims
.
all
(
30.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFCCCCCC
)),
child:
new
Column
([
new
Text
(
"You are at home"
),
new
RaisedButton
(
child:
new
Text
(
'GO SHOPPING'
),
onPressed:
()
=>
navigator
.
pushNamed
(
'/shopping'
)
),
new
RaisedButton
(
child:
new
Text
(
'START ADVENTURE'
),
onPressed:
()
=>
navigator
.
pushNamed
(
'/adventure'
)
)],
justifyContent:
FlexJustifyContent
.
center
)
),
new
Route
(
name:
'shopping'
,
builder:
(
navigator
,
route
)
=>
new
Container
(
padding:
const
EdgeDims
.
all
(
20.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFBF5FFF
)),
child:
new
Column
([
new
Text
(
"Village Shop"
),
new
RaisedButton
(
child:
new
Text
(
'RETURN HOME'
),
onPressed:
()
=>
navigator
.
pop
()
),
new
RaisedButton
(
child:
new
Text
(
'GO TO DUNGEON'
),
onPressed:
()
=>
navigator
.
push
(
routes
[
2
])
)],
justifyContent:
FlexJustifyContent
.
center
)
'/shopping'
:
(
NavigatorState
navigator
,
Route
route
)
=>
new
Container
(
padding:
const
EdgeDims
.
all
(
20.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFBF5FFF
)),
child:
new
Column
([
new
Text
(
"Village Shop"
),
new
RaisedButton
(
child:
new
Text
(
'RETURN HOME'
),
onPressed:
()
=>
navigator
.
pop
()
),
new
RaisedButton
(
child:
new
Text
(
'GO TO DUNGEON'
),
onPressed:
()
=>
navigator
.
pushNamed
(
'/adventure'
)
)],
justifyContent:
FlexJustifyContent
.
center
)
),
new
Route
(
name:
'adventure'
,
builder:
(
navigator
,
route
)
=>
new
Container
(
padding:
const
EdgeDims
.
all
(
20.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFDC143C
)),
child:
new
Column
([
new
Text
(
"Monster's Lair"
),
new
RaisedButton
(
child:
new
Text
(
'RUN!!!'
),
onPressed:
()
=>
navigator
.
pop
()
)],
justifyContent:
FlexJustifyContent
.
center
)
'/adventure'
:
(
NavigatorState
navigator
,
Route
route
)
=>
new
Container
(
padding:
const
EdgeDims
.
all
(
20.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFDC143C
)),
child:
new
Column
([
new
Text
(
"Monster's Lair"
),
new
RaisedButton
(
child:
new
Text
(
'RUN!!!'
),
onPressed:
()
=>
navigator
.
pop
()
)],
justifyContent:
FlexJustifyContent
.
center
)
)
]
;
}
;
class
NavigationExampleApp
extends
StatefulComponent
{
NavigationExampleAppState
createState
()
=>
new
NavigationExampleAppState
();
}
class
NavigationExampleAppState
extends
State
<
NavigationExampleApp
>
{
NavigatorHistory
_history
=
new
NavigatorHistory
(
routes
);
void
onBack
()
{
if
(
_history
.
hasPrevious
())
{
setState
(()
{
_history
.
pop
();
});
}
else
{
// TODO(abarth): Integrate with the system navigator.
// super.onBack();
}
}
Widget
build
(
BuildContext
context
)
{
return
new
Row
([
new
Navigator
(
_history
)]);
}
}
final
ThemeData
theme
=
new
ThemeData
(
brightness:
ThemeBrightness
.
light
,
primarySwatch:
Colors
.
purple
);
void
main
(
)
{
runApp
(
new
NavigationExampleApp
());
runApp
(
new
App
(
title:
'Navigation Example'
,
theme:
theme
,
routes:
routes
));
}
packages/flutter/lib/src/fn3.dart
View file @
6ea83f11
...
...
@@ -32,6 +32,7 @@ export 'fn3/ink_well.dart';
export
'fn3/input.dart'
;
export
'fn3/material.dart'
;
export
'fn3/material_button.dart'
;
export
'fn3/mimic.dart'
;
export
'fn3/mixed_viewport.dart'
;
export
'fn3/navigator.dart'
;
export
'fn3/popup_menu.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