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
1d3f734a
Commit
1d3f734a
authored
Nov 17, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #414 from Hixie/fix-demos
Fix some examples.
parents
70ab160e
5e221334
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
63 deletions
+86
-63
drag_and_drop.dart
examples/widgets/drag_and_drop.dart
+2
-2
navigation.dart
examples/widgets/navigation.dart
+52
-38
piano.dart
examples/widgets/piano.dart
+30
-23
dismissable.dart
packages/flutter/lib/src/widgets/dismissable.dart
+1
-0
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+1
-0
No files found.
examples/widgets/drag_and_drop.dart
View file @
1d3f734a
...
...
@@ -110,7 +110,7 @@ class ExampleDragSource extends StatelessComponent {
}
if
(
heavy
)
{
return
new
Draggable
<
Color
>(
return
new
LongPress
Draggable
<
Color
>(
data:
color
,
child:
contents
,
feedback:
feedback
,
...
...
@@ -118,7 +118,7 @@ class ExampleDragSource extends StatelessComponent {
dragAnchor:
anchor
);
}
else
{
return
new
LongPress
Draggable
<
Color
>(
return
new
Draggable
<
Color
>(
data:
color
,
child:
contents
,
feedback:
feedback
,
...
...
examples/widgets/navigation.dart
View file @
1d3f734a
...
...
@@ -6,11 +6,13 @@ import 'package:flutter/material.dart';
class
Home
extends
StatelessComponent
{
Widget
build
(
BuildContext
context
)
{
return
new
Container
(
padding:
const
EdgeDims
.
all
(
30.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFCCCCCC
)),
child:
new
Column
(<
Widget
>[
new
Text
(
"You are at home"
),
return
new
Material
(
child:
new
Center
(
child:
new
Block
(<
Widget
>[
new
Text
(
'You are at home.'
,
style:
Theme
.
of
(
context
).
text
.
display2
.
copyWith
(
textAlign:
TextAlign
.
center
)
),
new
RaisedButton
(
child:
new
Text
(
'GO SHOPPING'
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pushNamed
(
'/shopping'
)
...
...
@@ -18,8 +20,10 @@ class Home extends StatelessComponent {
new
RaisedButton
(
child:
new
Text
(
'START ADVENTURE'
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pushNamed
(
'/adventure'
)
)],
justifyContent:
FlexJustifyContent
.
center
)
],
padding:
const
EdgeDims
.
all
(
30.0
)
)
)
);
}
...
...
@@ -27,11 +31,14 @@ class Home extends StatelessComponent {
class
Shopping
extends
StatelessComponent
{
Widget
build
(
BuildContext
context
)
{
return
new
Container
(
padding:
const
EdgeDims
.
all
(
20.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFBF5FFF
)),
child:
new
Column
(<
Widget
>[
new
Text
(
"Village Shop"
),
return
new
Material
(
color:
Colors
.
deepPurple
[
300
],
child:
new
Center
(
child:
new
Block
(<
Widget
>[
new
Text
(
'Village Shop'
,
style:
Theme
.
of
(
context
).
text
.
display2
.
copyWith
(
textAlign:
TextAlign
.
center
)
),
new
RaisedButton
(
child:
new
Text
(
'RETURN HOME'
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
()
...
...
@@ -39,8 +46,10 @@ class Shopping extends StatelessComponent {
new
RaisedButton
(
child:
new
Text
(
'GO TO DUNGEON'
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pushNamed
(
'/adventure'
)
)],
justifyContent:
FlexJustifyContent
.
center
)
],
padding:
const
EdgeDims
.
all
(
30.0
)
)
)
);
}
...
...
@@ -48,16 +57,21 @@ class Shopping extends StatelessComponent {
class
Adventure
extends
StatelessComponent
{
Widget
build
(
BuildContext
context
)
{
return
new
Container
(
padding:
const
EdgeDims
.
all
(
20.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFDC143C
)),
child:
new
Column
(<
Widget
>[
new
Text
(
"Monster's Lair"
),
return
new
Material
(
color:
Colors
.
red
[
300
],
child:
new
Center
(
child:
new
Block
(<
Widget
>[
new
Text
(
'Monster
\'
s Lair'
,
style:
Theme
.
of
(
context
).
text
.
display2
.
copyWith
(
textAlign:
TextAlign
.
center
)
),
new
RaisedButton
(
child:
new
Text
(
'RUN!!!'
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
()
)],
justifyContent:
FlexJustifyContent
.
center
)
],
padding:
const
EdgeDims
.
all
(
30.0
)
)
)
);
}
...
...
examples/widgets/piano.dart
View file @
1d3f734a
...
...
@@ -61,11 +61,7 @@ class PianoApp extends StatelessComponent {
new
PianoKey
(
Colors
.
purple
[
500
],
iLoveYou
),
];
Future
connect
()
{
return
_loadSounds
();
}
Future
_loadSounds
()
async
{
Future
loadSounds
()
async
{
MediaServiceProxy
mediaService
=
new
MediaServiceProxy
.
unbound
();
try
{
shell
.
connectToService
(
null
,
mediaService
);
...
...
@@ -84,12 +80,14 @@ class PianoApp extends StatelessComponent {
children
.
add
(
new
Flexible
(
child:
new
Listener
(
child:
new
Container
(
decoration:
new
BoxDecoration
(
backgroundColor:
key
.
color
)),
decoration:
new
BoxDecoration
(
backgroundColor:
key
.
color
)
),
onPointerCancel:
(
_
)
=>
key
.
up
(),
onPointerDown:
(
_
)
=>
key
.
down
(),
onPointerUp:
(
_
)
=>
key
.
up
())));
onPointerUp:
(
_
)
=>
key
.
up
()
)
));
}
return
new
Column
(
children
);
}
}
...
...
@@ -99,19 +97,28 @@ Widget statusBox(Widget child) {
const
darkGray
=
const
Color
(
0xff222222
);
return
new
Center
(
child:
new
Container
(
decoration:
const
BoxDecoration
(
boxShadow:
const
<
BoxShadow
>[
decoration:
const
BoxDecoration
(
boxShadow:
const
<
BoxShadow
>[
const
BoxShadow
(
color:
mediumGray
,
offset:
const
Offset
(
6.0
,
6.0
),
blur:
5.0
)
],
backgroundColor:
darkGray
),
],
backgroundColor:
darkGray
),
height:
90.0
,
padding:
const
EdgeDims
.
all
(
8.0
),
margin:
const
EdgeDims
.
symmetric
(
horizontal:
50.0
),
child:
new
Center
(
child:
child
)));
child:
new
Center
(
child:
child
)
)
);
}
Widget
splashScreen
(
)
{
return
statusBox
(
new
Text
(
'Loading sound files!'
,
style:
new
TextStyle
(
fontSize:
18.0
)));
new
Text
(
'Loading sound files!'
,
style:
new
TextStyle
(
fontSize:
18.0
)
)
);
}
main
()
async
{
...
...
@@ -119,7 +126,7 @@ main() async {
PianoApp
app
=
new
PianoApp
();
// use "await" to make sure the sound files are loaded before we show the ui.
await
app
.
connect
();
await
app
.
loadSounds
();
runApp
(
app
);
// runApp() returns immediately so you can't put application cleanup code
// here. Android apps can be killed at any time, so there's also no way to
...
...
packages/flutter/lib/src/widgets/dismissable.dart
View file @
1d3f734a
...
...
@@ -247,6 +247,7 @@ class _DismissableState extends State<Dismissable> {
onVerticalDragStart:
_directionIsYAxis
?
_handleDragStart
:
null
,
onVerticalDragUpdate:
_directionIsYAxis
?
_handleDragUpdate
:
null
,
onVerticalDragEnd:
_directionIsYAxis
?
_handleDragEnd
:
null
,
behavior:
HitTestBehavior
.
opaque
,
child:
new
SizeObserver
(
onSizeChanged:
_handleSizeChanged
,
child:
new
FadeTransition
(
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
1d3f734a
...
...
@@ -104,6 +104,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
onHorizontalDragStart:
_getDragStartHandler
(
ScrollDirection
.
horizontal
),
onHorizontalDragUpdate:
_getDragUpdateHandler
(
ScrollDirection
.
horizontal
),
onHorizontalDragEnd:
_getDragEndHandler
(
ScrollDirection
.
horizontal
),
behavior:
HitTestBehavior
.
opaque
,
child:
new
Listener
(
child:
buildContent
(
context
),
onPointerDown:
_handlePointerDown
...
...
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