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
67254ef6
Commit
67254ef6
authored
Oct 11, 2016
by
Todd Volkert
Committed by
GitHub
Oct 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run `dartfmt` on a few of the gallery example files (#6260)
parent
3161d1a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
63 deletions
+64
-63
bottom_navigation_demo.dart
...ples/flutter_gallery/lib/demo/bottom_navigation_demo.dart
+16
-14
buttons_demo.dart
examples/flutter_gallery/lib/demo/buttons_demo.dart
+48
-49
No files found.
examples/flutter_gallery/lib/demo/bottom_navigation_demo.dart
View file @
67254ef6
...
...
@@ -15,7 +15,7 @@ class NavigationIconView {
destinationLabel
=
new
DestinationLabel
(
icon:
icon
,
title:
title
,
backgroundColor:
color
backgroundColor:
color
,
),
controller
=
new
AnimationController
(
duration:
kThemeAnimationDuration
,
...
...
@@ -23,7 +23,7 @@ class NavigationIconView {
)
{
_animation
=
new
CurvedAnimation
(
parent:
controller
,
curve:
new
Interval
(
0.5
,
1.0
,
curve:
Curves
.
fastOutSlowIn
)
curve:
new
Interval
(
0.5
,
1.0
,
curve:
Curves
.
fastOutSlowIn
)
,
);
}
...
...
@@ -39,8 +39,9 @@ class NavigationIconView {
iconColor
=
_color
;
}
else
{
final
ThemeData
themeData
=
Theme
.
of
(
context
);
iconColor
=
themeData
.
brightness
==
Brightness
.
light
?
themeData
.
primaryColor
:
themeData
.
accentColor
;
iconColor
=
themeData
.
brightness
==
Brightness
.
light
?
themeData
.
primaryColor
:
themeData
.
accentColor
;
}
return
new
FadeTransition
(
...
...
@@ -48,10 +49,10 @@ class NavigationIconView {
child:
new
SlideTransition
(
position:
new
Tween
<
FractionalOffset
>(
begin:
const
FractionalOffset
(
0.0
,
0.02
),
// Small offset from the top.
end:
FractionalOffset
.
topLeft
end:
FractionalOffset
.
topLeft
,
).
animate
(
_animation
),
child:
new
Icon
(
_icon
.
icon
,
color:
iconColor
,
size:
120.0
)
)
child:
new
Icon
(
_icon
.
icon
,
color:
iconColor
,
size:
120.0
)
,
)
,
);
}
}
...
...
@@ -63,7 +64,8 @@ class BottomNavigationDemo extends StatefulWidget {
_BottomNavigationDemoState
createState
()
=>
new
_BottomNavigationDemoState
();
}
class
_BottomNavigationDemoState
extends
State
<
BottomNavigationDemo
>
with
TickerProviderStateMixin
{
class
_BottomNavigationDemoState
extends
State
<
BottomNavigationDemo
>
with
TickerProviderStateMixin
{
int
_currentIndex
=
0
;
BottomNavigationBarType
_type
=
BottomNavigationBarType
.
shifting
;
List
<
NavigationIconView
>
_navigationViews
;
...
...
@@ -136,9 +138,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker
@override
Widget
build
(
BuildContext
context
)
{
final
BottomNavigationBar
botNavBar
=
new
BottomNavigationBar
(
labels:
_navigationViews
.
map
(
(
NavigationIconView
navigationView
)
=>
navigationView
.
destinationLabel
)
.
toList
(),
labels:
_navigationViews
.
map
((
NavigationIconView
navigationView
)
=>
navigationView
.
destinationLabel
)
.
toList
(),
currentIndex:
_currentIndex
,
type:
_type
,
onTap:
(
int
index
)
{
...
...
@@ -147,7 +149,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker
_currentIndex
=
index
;
_navigationViews
[
_currentIndex
].
controller
.
forward
();
});
}
}
,
);
return
new
Scaffold
(
...
...
@@ -169,9 +171,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> with Ticker
value:
BottomNavigationBarType
.
shifting
,
child:
new
Text
(
'Shifting'
),
)
]
]
,
)
]
]
,
),
body:
_buildBody
(),
bottomNavigationBar:
botNavBar
,
...
...
examples/flutter_gallery/lib/demo/buttons_demo.dart
View file @
67254ef6
...
...
@@ -7,36 +7,35 @@ import 'package:flutter/material.dart';
import
'../gallery/demo.dart'
;
const
String
_raisedText
=
"Raised buttons add dimension to mostly flat layouts. They emphasize "
"functions on busy or wide spaces."
;
"Raised buttons add dimension to mostly flat layouts. They emphasize "
"functions on busy or wide spaces."
;
const
String
_raisedCode
=
'buttons_raised'
;
const
String
_flatText
=
"A flat button displays an ink splash on press "
"but does not lift. Use flat buttons on toolbars, in dialogs and "
"inline with padding"
;
const
String
_flatText
=
"A flat button displays an ink splash on press "
"but does not lift. Use flat buttons on toolbars, in dialogs and "
"inline with padding"
;
const
String
_flatCode
=
'buttons_flat'
;
const
String
_dropdownText
=
"A dropdown button displays a menu that's used to select a value from a "
"small set of values. The button displays the current value and a down "
"arrow."
;
"A dropdown button displays a menu that's used to select a value from a "
"small set of values. The button displays the current value and a down "
"arrow."
;
const
String
_dropdownCode
=
'buttons_dropdown'
;
const
String
_iconText
=
"IconButtons are appropriate for toggle buttons that allow a single choice to b
e "
"
selected or deselected, such as adding or removing an item's star."
;
"IconButtons are appropriate for toggle buttons that allow a single choic
e "
"to be
selected or deselected, such as adding or removing an item's star."
;
const
String
_iconCode
=
'buttons_icon'
;
const
String
_actionText
=
"Floating action buttons are used for a promoted action. They are "
"distinguished by a circled icon floating above the UI and can have motion "
"behaviors that include morphing, launching, and a transferring anchor "
"point."
;
"Floating action buttons are used for a promoted action. They are "
"distinguished by a circled icon floating above the UI and can have motion "
"behaviors that include morphing, launching, and a transferring anchor "
"point."
;
const
String
_actionCode
=
'buttons_action'
;
...
...
@@ -55,37 +54,37 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
tabName:
'RAISED'
,
description:
_raisedText
,
widget:
buildRaisedButton
(),
exampleCodeTag:
_raisedCode
exampleCodeTag:
_raisedCode
,
),
new
ComponentDemoTabData
(
tabName:
'FLAT'
,
description:
_flatText
,
widget:
buildFlatButton
(),
exampleCodeTag:
_flatCode
exampleCodeTag:
_flatCode
,
),
new
ComponentDemoTabData
(
tabName:
'DROPDOWN'
,
description:
_dropdownText
,
widget:
buildDropdownButton
(),
exampleCodeTag:
_dropdownCode
exampleCodeTag:
_dropdownCode
,
),
new
ComponentDemoTabData
(
tabName:
'ICON'
,
description:
_iconText
,
widget:
buildIconButton
(),
exampleCodeTag:
_iconCode
exampleCodeTag:
_iconCode
,
),
new
ComponentDemoTabData
(
tabName:
'ACTION'
,
description:
_actionText
,
widget:
buildActionButton
(),
exampleCodeTag:
_actionCode
exampleCodeTag:
_actionCode
,
),
];
return
new
TabbedComponentDemoScaffold
(
title:
'Buttons'
,
demos:
demos
demos:
demos
,
);
}
...
...
@@ -99,14 +98,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child:
new
Text
(
'RAISED BUTTON'
),
onPressed:
()
{
// Perform some action
}
}
,
),
new
RaisedButton
(
child:
new
Text
(
'DISABLED'
),
onPressed:
null
onPressed:
null
,
)
]
)
]
,
)
,
);
}
...
...
@@ -120,14 +119,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child:
new
Text
(
'FLAT BUTTON'
),
onPressed:
()
{
// Perform some action
}
}
,
),
new
FlatButton
(
child:
new
Text
(
'DISABLED'
),
onPressed:
null
onPressed:
null
,
)
]
)
]
,
)
,
);
}
...
...
@@ -158,13 +157,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
.
map
((
String
value
)
{
return
new
DropdownMenuItem
<
String
>(
value:
value
,
child:
new
Text
(
value
));
child:
new
Text
(
value
),
);
})
.
toList
()
)
.
toList
()
,
)
,
),
new
SizedBox
(
height:
24.0
height:
24.0
,
),
new
ListItem
(
title:
new
Text
(
'Simple dropdown:'
),
...
...
@@ -176,17 +176,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
dropdown2Value
=
newValue
;
});
},
items:
<
String
>[
'One'
,
'Two'
,
'Free'
,
'Four'
]
.
map
((
String
value
)
{
return
new
DropdownMenuItem
<
String
>(
value:
value
,
child:
new
Text
(
value
));
})
.
toList
()
)
items:
<
String
>[
'One'
,
'Two'
,
'Free'
,
'Four'
].
map
((
String
value
)
{
return
new
DropdownMenuItem
<
String
>(
value:
value
,
child:
new
Text
(
value
),
);
}).
toList
(),
),
)
]
)
]
,
)
,
);
}
...
...
@@ -203,16 +202,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
onPressed:
()
{
setState
(()
=>
iconButtonToggle
=
!
iconButtonToggle
);
},
color:
iconButtonToggle
?
Theme
.
of
(
context
).
primaryColor
:
null
color:
iconButtonToggle
?
Theme
.
of
(
context
).
primaryColor
:
null
,
),
new
IconButton
(
icon:
new
Icon
(
Icons
.
thumb_up
),
onPressed:
null
onPressed:
null
,
)
]
.
map
((
Widget
button
)
=>
new
SizedBox
(
width:
64.0
,
height:
64.0
,
child:
button
))
.
toList
()
)
.
toList
()
,
)
,
);
}
...
...
@@ -223,8 +222,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child:
new
Icon
(
Icons
.
add
),
onPressed:
()
{
// Perform some action
}
)
}
,
)
,
);
}
}
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