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
db261ff8
Commit
db261ff8
authored
Mar 13, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2648 from abarth/rename_fixit2
Execute rename fixit (Part 2)
parents
f1331486
d5b2e2a0
Changes
94
Hide whitespace changes
Inline
Side-by-side
Showing
94 changed files
with
588 additions
and
583 deletions
+588
-583
card_collection.dart
dev/manual_tests/card_collection.dart
+16
-14
drag_and_drop.dart
dev/manual_tests/drag_and_drop.dart
+7
-7
mozart.dart
dev/manual_tests/mozart.dart
+2
-2
overlay_geometry.dart
dev/manual_tests/overlay_geometry.dart
+3
-3
pageable_list.dart
dev/manual_tests/pageable_list.dart
+7
-7
raw_keyboard.dart
dev/manual_tests/raw_keyboard.dart
+5
-5
flex_layout.dart
examples/layers/rendering/flex_layout.dart
+16
-16
gestures.dart
examples/layers/widgets/gestures.dart
+5
-5
media_query.dart
examples/layers/widgets/media_query.dart
+4
-4
sectors.dart
examples/layers/widgets/sectors.dart
+6
-6
spinning_mixed.dart
examples/layers/widgets/spinning_mixed.dart
+2
-2
styled_text.dart
examples/layers/widgets/styled_text.dart
+6
-6
buttons_demo.dart
examples/material_gallery/lib/demo/buttons_demo.dart
+3
-3
cards_demo.dart
examples/material_gallery/lib/demo/cards_demo.dart
+6
-6
chip_demo.dart
examples/material_gallery/lib/demo/chip_demo.dart
+1
-1
colors_demo.dart
examples/material_gallery/lib/demo/colors_demo.dart
+4
-4
date_picker_demo.dart
examples/material_gallery/lib/demo/date_picker_demo.dart
+2
-2
dialog_demo.dart
examples/material_gallery/lib/demo/dialog_demo.dart
+4
-4
drop_down_demo.dart
examples/material_gallery/lib/demo/drop_down_demo.dart
+1
-1
fitness_demo.dart
examples/material_gallery/lib/demo/fitness_demo.dart
+4
-4
flexible_space_demo.dart
examples/material_gallery/lib/demo/flexible_space_demo.dart
+4
-4
full_screen_dialog_demo.dart
...es/material_gallery/lib/demo/full_screen_dialog_demo.dart
+11
-11
grid_list_demo.dart
examples/material_gallery/lib/demo/grid_list_demo.dart
+8
-8
icons_demo.dart
examples/material_gallery/lib/demo/icons_demo.dart
+8
-8
leave_behind_demo.dart
examples/material_gallery/lib/demo/leave_behind_demo.dart
+12
-12
list_demo.dart
examples/material_gallery/lib/demo/list_demo.dart
+23
-23
menu_demo.dart
examples/material_gallery/lib/demo/menu_demo.dart
+21
-21
modal_bottom_sheet_demo.dart
...es/material_gallery/lib/demo/modal_bottom_sheet_demo.dart
+1
-1
page_selector_demo.dart
examples/material_gallery/lib/demo/page_selector_demo.dart
+2
-2
persistent_bottom_sheet_demo.dart
...terial_gallery/lib/demo/persistent_bottom_sheet_demo.dart
+1
-1
progress_indicator_demo.dart
...es/material_gallery/lib/demo/progress_indicator_demo.dart
+2
-2
scrolling_techniques_demo.dart
.../material_gallery/lib/demo/scrolling_techniques_demo.dart
+8
-8
slider_demo.dart
examples/material_gallery/lib/demo/slider_demo.dart
+3
-3
snack_bar_demo.dart
examples/material_gallery/lib/demo/snack_bar_demo.dart
+2
-2
tabs_demo.dart
examples/material_gallery/lib/demo/tabs_demo.dart
+2
-2
tabs_fab_demo.dart
examples/material_gallery/lib/demo/tabs_fab_demo.dart
+2
-2
text_field_demo.dart
examples/material_gallery/lib/demo/text_field_demo.dart
+3
-3
time_picker_demo.dart
examples/material_gallery/lib/demo/time_picker_demo.dart
+2
-2
toggle_controls_demo.dart
examples/material_gallery/lib/demo/toggle_controls_demo.dart
+6
-6
tooltip_demo.dart
examples/material_gallery/lib/demo/tooltip_demo.dart
+3
-3
two_level_list_demo.dart
examples/material_gallery/lib/demo/two_level_list_demo.dart
+7
-7
typography_demo.dart
examples/material_gallery/lib/demo/typography_demo.dart
+2
-2
weather_demo.dart
examples/material_gallery/lib/demo/weather_demo.dart
+5
-5
app.dart
examples/material_gallery/lib/gallery/app.dart
+1
-1
home.dart
examples/material_gallery/lib/gallery/home.dart
+1
-1
section.dart
examples/material_gallery/lib/gallery/section.dart
+2
-2
main.dart
examples/stocks/lib/main.dart
+3
-3
stock_home.dart
examples/stocks/lib/stock_home.dart
+8
-8
stock_row.dart
examples/stocks/lib/stock_row.dart
+1
-1
stock_settings.dart
examples/stocks/lib/stock_settings.dart
+4
-4
stock_symbol_viewer.dart
examples/stocks/lib/stock_symbol_viewer.dart
+4
-4
material.dart
packages/flutter/lib/material.dart
+1
-1
app.dart
packages/flutter/lib/src/material/app.dart
+3
-5
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+20
-20
chip.dart
packages/flutter/lib/src/material/chip.dart
+1
-1
constants.dart
packages/flutter/lib/src/material/constants.dart
+2
-2
date_picker.dart
packages/flutter/lib/src/material/date_picker.dart
+2
-2
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+1
-1
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+1
-1
flexible_space_bar.dart
packages/flutter/lib/src/material/flexible_space_bar.dart
+2
-2
grid_tile_bar.dart
packages/flutter/lib/src/material/grid_tile_bar.dart
+26
-19
input.dart
packages/flutter/lib/src/material/input.dart
+1
-1
list_item.dart
packages/flutter/lib/src/material/list_item.dart
+22
-22
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+2
-2
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+39
-39
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+1
-1
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+3
-3
time_picker.dart
packages/flutter/lib/src/material/time_picker.dart
+3
-3
two_level_list.dart
packages/flutter/lib/src/material/two_level_list.dart
+13
-13
flex.dart
packages/flutter/lib/src/rendering/flex.dart
+38
-38
app.dart
packages/flutter/lib/src/widgets/app.dart
+2
-8
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+19
-19
dismissable.dart
packages/flutter/lib/src/widgets/dismissable.dart
+13
-11
pageable_list.dart
packages/flutter/lib/src/widgets/pageable_list.dart
+13
-11
box_test.dart
packages/flutter/test/rendering/box_test.dart
+1
-1
flex_test.dart
packages/flutter/test/rendering/flex_test.dart
+2
-2
bottom_sheet_rebuild_test.dart
packages/flutter/test/widget/bottom_sheet_rebuild_test.dart
+2
-2
bottom_sheet_test.dart
packages/flutter/test/widget/bottom_sheet_test.dart
+5
-5
dismissable_test.dart
packages/flutter/test/widget/dismissable_test.dart
+16
-16
draggable_test.dart
packages/flutter/test/widget/draggable_test.dart
+14
-14
drawer_test.dart
packages/flutter/test/widget/drawer_test.dart
+5
-5
flex_test.dart
packages/flutter/test/widget/flex_test.dart
+8
-8
heroes_test.dart
packages/flutter/test/widget/heroes_test.dart
+5
-5
modal_barrier_test.dart
packages/flutter/test/widget/modal_barrier_test.dart
+3
-3
navigator_test.dart
packages/flutter/test/widget/navigator_test.dart
+3
-3
page_transitions_test.dart
packages/flutter/test/widget/page_transitions_test.dart
+1
-1
rotated_box_test.dart
packages/flutter/test/widget/rotated_box_test.dart
+1
-1
semantics_1_test.dart
packages/flutter/test/widget/semantics_1_test.dart
+4
-4
semantics_2_test.dart
packages/flutter/test/widget/semantics_2_test.dart
+3
-3
snack_bar_test.dart
packages/flutter/test/widget/snack_bar_test.dart
+6
-6
two_level_list_test.dart
packages/flutter/test/widget/two_level_list_test.dart
+5
-5
demo.dart
packages/flutter_markdown/example/demo.dart
+3
-3
markdown_raw.dart
packages/flutter_markdown/lib/src/markdown_raw.dart
+3
-3
main.dart.tmpl
packages/flutter_tools/templates/create/lib/main.dart.tmpl
+4
-4
No files found.
dev/manual_tests/card_collection.dart
View file @
db261ff8
...
...
@@ -135,8 +135,8 @@ class CardCollectionState extends State<CardCollection> {
buildDrawerColorRadioItem
(
"Teal"
,
Colors
.
teal
,
_primaryColor
,
_selectColor
),
new
Divider
(),
buildDrawerDirectionRadioItem
(
"Dismiss horizontally"
,
DismissDirection
.
horizontal
,
_dismissDirection
,
_changeDismissDirection
,
icon:
Icons
.
code
),
buildDrawerDirectionRadioItem
(
"Dismiss left"
,
DismissDirection
.
lef
t
,
_dismissDirection
,
_changeDismissDirection
,
icon:
Icons
.
arrow_back
),
buildDrawerDirectionRadioItem
(
"Dismiss right"
,
DismissDirection
.
right
,
_dismissDirection
,
_changeDismissDirection
,
icon:
Icons
.
arrow_forward
),
buildDrawerDirectionRadioItem
(
"Dismiss left"
,
DismissDirection
.
endToStar
t
,
_dismissDirection
,
_changeDismissDirection
,
icon:
Icons
.
arrow_back
),
buildDrawerDirectionRadioItem
(
"Dismiss right"
,
DismissDirection
.
startToEnd
,
_dismissDirection
,
_changeDismissDirection
,
icon:
Icons
.
arrow_forward
),
new
Divider
(),
buildFontRadioItem
(
"Left-align text"
,
new
TextStyle
(
textAlign:
TextAlign
.
left
),
_textStyle
,
_changeTextStyle
,
icon:
Icons
.
format_align_left
,
enabled:
!
_editable
),
buildFontRadioItem
(
"Center-align text"
,
new
TextStyle
(
textAlign:
TextAlign
.
center
),
_textStyle
,
_changeTextStyle
,
icon:
Icons
.
format_align_center
,
enabled:
!
_editable
),
...
...
@@ -272,9 +272,9 @@ class CardCollectionState extends State<CardCollection> {
);
}
Widget
_build
Tool
Bar
(
BuildContext
context
)
{
return
new
Tool
Bar
(
right
:
<
Widget
>[
Widget
_build
App
Bar
(
BuildContext
context
)
{
return
new
App
Bar
(
actions
:
<
Widget
>[
new
Text
(
_dismissDirectionText
(
_dismissDirection
))
],
flexibleSpace:
(
_
)
{
...
...
@@ -325,8 +325,8 @@ class CardCollectionState extends State<CardCollection> {
children:
<
Widget
>[
new
Text
(
cardModel
.
inputValue
.
text
)
],
alignItems:
FlexAlignItems
.
stretch
,
justifyContent:
FlexJustifyCont
ent
.
center
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
mainAxisAlignment:
MainAxisAlignm
ent
.
center
)
)
)
...
...
@@ -338,22 +338,24 @@ class CardCollectionState extends State<CardCollection> {
case
DismissDirection
.
horizontal
:
backgroundMessage
=
"Swipe in either direction"
;
break
;
case
DismissDirection
.
lef
t
:
case
DismissDirection
.
endToStar
t
:
backgroundMessage
=
"Swipe left to dismiss"
;
break
;
case
DismissDirection
.
right
:
case
DismissDirection
.
startToEnd
:
backgroundMessage
=
"Swipe right to dismiss"
;
break
;
default
:
backgroundMessage
=
"Unsupported dismissDirection"
;
}
// TODO(abarth): This icon is wrong in RTL.
Widget
leftArrowIcon
=
new
Icon
(
icon:
Icons
.
arrow_back
,
size:
36.0
);
if
(
_dismissDirection
==
DismissDirection
.
right
)
if
(
_dismissDirection
==
DismissDirection
.
startToEnd
)
leftArrowIcon
=
new
Opacity
(
opacity:
0.1
,
child:
leftArrowIcon
);
// TODO(abarth): This icon is wrong in RTL.
Widget
rightArrowIcon
=
new
Icon
(
icon:
Icons
.
arrow_forward
,
size:
36.0
);
if
(
_dismissDirection
==
DismissDirection
.
lef
t
)
if
(
_dismissDirection
==
DismissDirection
.
endToStar
t
)
rightArrowIcon
=
new
Opacity
(
opacity:
0.1
,
child:
rightArrowIcon
);
// The background Widget appears behind the Dismissable card when the card
...
...
@@ -451,7 +453,7 @@ class CardCollectionState extends State<CardCollection> {
primarySwatch:
_primaryColor
),
child:
new
Scaffold
(
toolBar:
_buildTool
Bar
(
context
),
appBar:
_buildApp
Bar
(
context
),
drawer:
_buildDrawer
(),
body:
body
)
...
...
@@ -462,8 +464,8 @@ class CardCollectionState extends State<CardCollection> {
void
main
(
)
{
runApp
(
new
MaterialApp
(
title:
'Cards'
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
CardCollection
(),
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
CardCollection
(),
}
));
}
dev/manual_tests/drag_and_drop.dart
View file @
db261ff8
...
...
@@ -223,8 +223,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
}
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Drag and Drop Flutter Demo'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'Drag and Drop Flutter Demo'
)
),
body:
new
Column
(
children:
<
Widget
>[
...
...
@@ -250,8 +250,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
child:
new
Text
(
'above'
)
),
],
alignItems:
FlexAlignItems
.
center
,
justifyContent:
FlexJustifyCont
ent
.
spaceAround
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
)
),
new
Flexible
(
...
...
@@ -271,7 +271,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
new
MovableBall
(
2
,
position
,
moveBall
),
new
MovableBall
(
3
,
position
,
moveBall
),
],
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
)
),
]
...
...
@@ -283,8 +283,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
void
main
(
)
{
runApp
(
new
MaterialApp
(
title:
'Drag and Drop Flutter Demo'
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
DragAndDropApp
()
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
DragAndDropApp
()
}
));
}
dev/manual_tests/mozart.dart
View file @
db261ff8
...
...
@@ -182,7 +182,7 @@ class Launcher extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
center
,
children:
items
);
}
...
...
@@ -238,6 +238,6 @@ class _WindowManagerState extends State<WindowManager> {
void
main
(
)
{
runApp
(
new
MaterialApp
(
title:
'Mozart'
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
_
)
=>
new
WindowManager
()
}
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
_
)
=>
new
WindowManager
()
}
));
}
dev/manual_tests/overlay_geometry.dart
View file @
db261ff8
...
...
@@ -154,7 +154,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
Widget
build
(
BuildContext
context
)
{
List
<
Widget
>
layers
=
<
Widget
>[
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
'Tap a Card'
)),
appBar:
new
AppBar
(
title
:
new
Text
(
'Tap a Card'
)),
body:
new
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
12.0
,
horizontal:
8.0
),
child:
new
ScrollableMixedWidgetList
(
...
...
@@ -179,8 +179,8 @@ void main() {
accentColor:
Colors
.
redAccent
[
200
]
),
title:
'Cards'
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
OverlayGeometryApp
()
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
OverlayGeometryApp
()
}
));
}
dev/manual_tests/pageable_list.dart
View file @
db261ff8
...
...
@@ -105,10 +105,10 @@ class PageableListAppState extends State<PageableListApp> {
);
}
Widget
_build
Tool
Bar
()
{
return
new
Tool
Bar
(
center
:
new
Text
(
'PageableList'
),
right
:
<
Widget
>[
Widget
_build
App
Bar
()
{
return
new
App
Bar
(
title
:
new
Text
(
'PageableList'
),
actions
:
<
Widget
>[
new
Text
(
scrollDirection
==
Axis
.
horizontal
?
"horizontal"
:
"vertical"
)
]
);
...
...
@@ -126,7 +126,7 @@ class PageableListAppState extends State<PageableListApp> {
return
new
IconTheme
(
data:
const
IconThemeData
(
color:
Colors
.
white
),
child:
new
Scaffold
(
toolBar:
_buildTool
Bar
(),
appBar:
_buildApp
Bar
(),
drawer:
_buildDrawer
(),
body:
_buildBody
(
context
)
)
...
...
@@ -142,8 +142,8 @@ void main() {
primarySwatch:
Colors
.
blue
,
accentColor:
Colors
.
redAccent
[
200
]
),
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
PageableListApp
(),
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
PageableListApp
(),
}
));
}
dev/manual_tests/raw_keyboard.dart
View file @
db261ff8
...
...
@@ -12,11 +12,11 @@ void main() {
runApp
(
new
MaterialApp
(
title:
"Hardware Key Demo"
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"Hardware Key Demo"
)
appBar:
new
App
Bar
(
title
:
new
Text
(
"Hardware Key Demo"
)
),
body:
new
Material
(
child:
new
RawKeyboardDemo
(
...
...
@@ -67,7 +67,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
new
Text
(
'
${_event.type}
'
,
style:
Typography
.
black
.
body2
),
new
Text
(
'
${_event.keyData.keyCode}
'
,
style:
Typography
.
black
.
display4
)
],
justifyContent:
FlexJustifyCont
ent
.
center
mainAxisAlignment:
MainAxisAlignm
ent
.
center
);
}
return
new
RawKeyboardListener
(
...
...
examples/layers/rendering/flex_layout.dart
View file @
db261ff8
...
...
@@ -12,11 +12,11 @@ import 'src/solid_color_box.dart';
void
main
(
)
{
RenderFlex
table
=
new
RenderFlex
(
direction:
FlexDirection
.
vertical
);
void
addAlignmentRow
(
FlexAlignItems
alignItems
)
{
void
addAlignmentRow
(
CrossAxisAlignment
crossAxisAlignment
)
{
TextStyle
style
=
const
TextStyle
(
color:
const
Color
(
0xFF000000
));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$
alignItems
'
));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$
crossAxisAlignment
'
));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
new
EdgeInsets
.
only
(
top:
20.0
)));
RenderFlex
row
=
new
RenderFlex
(
alignItems:
alignItems
,
textBaseline:
TextBaseline
.
alphabetic
);
RenderFlex
row
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
style
=
new
TextStyle
(
fontSize:
15.0
,
color:
const
Color
(
0xFF000000
));
row
.
add
(
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FFFCCCC
)),
...
...
@@ -27,7 +27,7 @@ void main() {
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCFFCC
)),
child:
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'foo foo foo'
))
));
RenderFlex
subrow
=
new
RenderFlex
(
alignItems:
alignItems
,
textBaseline:
TextBaseline
.
alphabetic
);
RenderFlex
subrow
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
style
=
new
TextStyle
(
fontSize:
25.0
,
color:
const
Color
(
0xFF000000
));
subrow
.
add
(
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCCCFF
)),
...
...
@@ -40,13 +40,13 @@ void main() {
rowParentData
.
flex
=
1
;
}
addAlignmentRow
(
FlexAlignItems
.
start
);
addAlignmentRow
(
FlexAlignItems
.
end
);
addAlignmentRow
(
FlexAlignItems
.
center
);
addAlignmentRow
(
FlexAlignItems
.
stretch
);
addAlignmentRow
(
FlexAlignItems
.
baseline
);
addAlignmentRow
(
CrossAxisAlignment
.
start
);
addAlignmentRow
(
CrossAxisAlignment
.
end
);
addAlignmentRow
(
CrossAxisAlignment
.
center
);
addAlignmentRow
(
CrossAxisAlignment
.
stretch
);
addAlignmentRow
(
CrossAxisAlignment
.
baseline
);
void
addJustificationRow
(
FlexJustifyCont
ent
justify
)
{
void
addJustificationRow
(
MainAxisAlignm
ent
justify
)
{
const
TextStyle
style
=
const
TextStyle
(
color:
const
Color
(
0xFF000000
));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$justify
'
));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
new
EdgeInsets
.
only
(
top:
20.0
)));
...
...
@@ -54,17 +54,17 @@ void main() {
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFFFCCCC
),
desiredSize:
new
Size
(
80.0
,
60.0
)));
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFCCFFCC
),
desiredSize:
new
Size
(
64.0
,
60.0
)));
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFCCCCFF
),
desiredSize:
new
Size
(
160.0
,
60.0
)));
row
.
justifyCont
ent
=
justify
;
row
.
mainAxisAlignm
ent
=
justify
;
table
.
add
(
row
);
final
FlexParentData
rowParentData
=
row
.
parentData
;
rowParentData
.
flex
=
1
;
}
addJustificationRow
(
FlexJustifyCont
ent
.
start
);
addJustificationRow
(
FlexJustifyCont
ent
.
end
);
addJustificationRow
(
FlexJustifyCont
ent
.
center
);
addJustificationRow
(
FlexJustifyCont
ent
.
spaceBetween
);
addJustificationRow
(
FlexJustifyCont
ent
.
spaceAround
);
addJustificationRow
(
MainAxisAlignm
ent
.
start
);
addJustificationRow
(
MainAxisAlignm
ent
.
end
);
addJustificationRow
(
MainAxisAlignm
ent
.
center
);
addJustificationRow
(
MainAxisAlignm
ent
.
spaceBetween
);
addJustificationRow
(
MainAxisAlignm
ent
.
spaceAround
);
RenderDecoratedBox
root
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFFFFFF
)),
...
...
examples/layers/widgets/gestures.dart
View file @
db261ff8
...
...
@@ -201,7 +201,7 @@ class _GestureDemoState extends State<GestureDemo> {
]
),
],
alignItems:
FlexAlignItems
.
start
crossAxisAlignment:
CrossAxisAlignment
.
start
)
)
)
...
...
@@ -214,11 +214,11 @@ class _GestureDemoState extends State<GestureDemo> {
void
main
(
)
{
runApp
(
new
MaterialApp
(
theme:
new
ThemeData
.
dark
(),
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Gestures Demo'
)),
appBar:
new
App
Bar
(
title
:
new
Text
(
'Gestures Demo'
)),
body:
new
GestureDemo
()
);
}
...
...
examples/layers/widgets/media_query.dart
View file @
db261ff8
...
...
@@ -97,11 +97,11 @@ final List<String> _kNames = _initNames();
void
main
(
)
{
runApp
(
new
MaterialApp
(
title:
'Media Query Example'
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Media Query Example'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'Media Query Example'
)
),
body:
new
Material
(
child:
new
AdaptiveContainer
(
names:
_kNames
))
);
...
...
examples/layers/widgets/sectors.dart
View file @
db261ff8
...
...
@@ -126,7 +126,7 @@ class SectorAppState extends State<SectorApp> {
)
),
],
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
)
),
new
Flexible
(
...
...
@@ -143,7 +143,7 @@ class SectorAppState extends State<SectorApp> {
)
),
],
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
);
}
...
...
@@ -151,11 +151,11 @@ class SectorAppState extends State<SectorApp> {
return
new
MaterialApp
(
theme:
new
ThemeData
.
light
(),
title:
'Sector Layout'
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Sector Layout in a Widget Tree'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'Sector Layout in a Widget Tree'
)
),
body:
buildBody
()
);
...
...
examples/layers/widgets/spinning_mixed.dart
View file @
db261ff8
...
...
@@ -58,13 +58,13 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
),
new
CircularProgressIndicator
(
value:
value
),
],
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
)
)
),
new
Rectangle
(
const
Color
(
0xFFFFFF00
)),
],
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
)
)
).
attachToRenderTree
(
element
);
...
...
examples/layers/widgets/styled_text.dart
View file @
db261ff8
...
...
@@ -107,8 +107,8 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
padding:
new
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
child:
new
Column
(
children:
children
,
justifyContent:
FlexJustifyCont
ent
.
center
,
alignItems:
FlexAlignItems
.
start
mainAxisAlignment:
MainAxisAlignm
ent
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
start
)
)
);
...
...
@@ -118,11 +118,11 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
void
main
(
)
{
runApp
(
new
MaterialApp
(
theme:
new
ThemeData
.
light
(),
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Hal and Dave'
)),
appBar:
new
App
Bar
(
title
:
new
Text
(
'Hal and Dave'
)),
body:
new
Material
(
color:
Colors
.
grey
[
50
],
child:
new
StyledTextDemo
()
...
...
examples/material_gallery/lib/demo/buttons_demo.dart
View file @
db261ff8
...
...
@@ -179,7 +179,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
builder:
(
BuildContext
context
)
{
final
TextStyle
textStyle
=
Theme
.
of
(
context
).
textTheme
.
caption
.
copyWith
(
fontSize:
16.0
);
return
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
demo
.
builder
(
context
),
new
Padding
(
...
...
@@ -196,8 +196,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
return
new
TabBarSelection
<
_ButtonDemo
>(
values:
demos
,
child:
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"Buttons"
),
appBar:
new
App
Bar
(
title
:
new
Text
(
"Buttons"
),
tabBar:
new
TabBar
<
_ButtonDemo
>(
isScrollable:
true
,
labels:
new
Map
<
_ButtonDemo
,
TabLabel
>.
fromIterable
(
demos
,
value:
(
_ButtonDemo
demo
)
=>
demo
.
tabLabel
)
...
...
examples/material_gallery/lib/demo/cards_demo.dart
View file @
db261ff8
...
...
@@ -82,8 +82,8 @@ class TravelDestinationItem extends StatelessWidget {
child:
new
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
new
Column
(
justifyContent:
FlexJustifyCont
ent
.
start
,
alignItems:
FlexAlignItems
.
start
,
mainAxisAlignment:
MainAxisAlignm
ent
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
// three line description
new
Text
(
destination
.
description
[
0
],
style:
descriptionStyle
),
...
...
@@ -92,8 +92,8 @@ class TravelDestinationItem extends StatelessWidget {
// share, explore buttons
new
Flexible
(
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
start
,
alignItems:
FlexAlignItems
.
end
,
mainAxisAlignment:
MainAxisAlignm
ent
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
end
,
children:
<
Widget
>[
new
Padding
(
padding:
const
EdgeInsets
.
only
(
right:
16.0
),
...
...
@@ -117,8 +117,8 @@ class TravelDestinationItem extends StatelessWidget {
class
CardsDemo
extends
StatelessWidget
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"Travel Stream"
)
appBar:
new
App
Bar
(
title
:
new
Text
(
"Travel Stream"
)
),
body:
new
Block
(
padding:
const
EdgeInsets
.
only
(
top:
8.0
,
left:
8.0
,
right:
8.0
),
...
...
examples/material_gallery/lib/demo/chip_demo.dart
View file @
db261ff8
...
...
@@ -36,7 +36,7 @@ class _ChipDemoState extends State<ChipDemo> {
}
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Chips"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Chips"
)),
body:
new
Block
(
children:
chips
.
map
((
Widget
widget
)
{
return
new
Container
(
...
...
examples/material_gallery/lib/demo/colors_demo.dart
View file @
db261ff8
...
...
@@ -60,8 +60,8 @@ class ColorItem extends StatelessWidget {
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
),
decoration:
new
BoxDecoration
(
backgroundColor:
color
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
,
alignItems:
FlexAlignItems
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
new
Text
(
'
$prefix$index
'
),
new
Text
(
colorString
())
...
...
@@ -111,9 +111,9 @@ class ColorsDemo extends StatelessWidget {
return
new
TabBarSelection
<
ColorSwatch
>(
values:
colorSwatches
,
child:
new
Scaffold
(
toolBar:
new
Tool
Bar
(
appBar:
new
App
Bar
(
elevation:
0
,
center
:
new
Text
(
"Colors"
),
title
:
new
Text
(
"Colors"
),
tabBar:
new
TabBar
<
ColorSwatch
>(
isScrollable:
true
,
labels:
new
Map
<
ColorSwatch
,
TabLabel
>.
fromIterable
(
colorSwatches
,
value:
(
ColorSwatch
swatch
)
{
...
...
examples/material_gallery/lib/demo/date_picker_demo.dart
View file @
db261ff8
...
...
@@ -31,7 +31,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Date Picker"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Date Picker"
)),
body:
new
Column
(
children:
<
Widget
>[
new
Text
(
new
DateFormat
.
yMMMd
().
format
(
_selectedDate
)),
...
...
@@ -40,7 +40,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
child:
new
Text
(
'SELECT DATE'
)
),
],
justifyContent:
FlexJustifyCont
ent
.
center
mainAxisAlignment:
MainAxisAlignm
ent
.
center
)
);
}
...
...
examples/material_gallery/lib/demo/dialog_demo.dart
View file @
db261ff8
...
...
@@ -34,8 +34,8 @@ class DialogDemoItem extends StatelessWidget {
child:
new
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
start
,
alignItems:
FlexAlignItems
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
new
Icon
(
size:
36.0
,
...
...
@@ -80,8 +80,8 @@ class DialogDemoState extends State<DialogDemo> {
return
new
Scaffold
(
key:
scaffoldKey
,
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Dialogs'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'Dialogs'
)
),
body:
new
Block
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
24.0
,
horizontal:
72.0
),
...
...
examples/material_gallery/lib/demo/drop_down_demo.dart
View file @
db261ff8
...
...
@@ -20,7 +20,7 @@ class _DropDownDemoState extends State<DropDownDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Dropdown Button"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Dropdown Button"
)),
body:
new
Center
(
child:
new
DropDownButton
<
String
>(
items:
buildItems
(),
...
...
examples/material_gallery/lib/demo/fitness_demo.dart
View file @
db261ff8
...
...
@@ -18,8 +18,8 @@ class FitnessDemo extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"Fitness"
)
appBar:
new
App
Bar
(
title
:
new
Text
(
"Fitness"
)
),
body:
new
_FitnessDemoContents
()
);
...
...
@@ -93,7 +93,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
return
new
Material
(
child:
new
Column
(
justifyContent:
FlexJustifyCont
ent
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
center
,
children:
<
Widget
>[
new
Flexible
(
child:
new
Container
(
...
...
@@ -108,7 +108,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
new
Padding
(
padding:
new
EdgeInsets
.
only
(
top:
20.0
,
bottom:
20.0
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
center
,
children:
<
Widget
>[
_createInfoPanelCell
(
Icons
.
accessibility
,
'
$count
'
,
'COUNT'
),
_createInfoPanelCell
(
Icons
.
timer
,
_formatSeconds
(
time
),
'TIME'
),
...
...
examples/material_gallery/lib/demo/flexible_space_demo.dart
View file @
db261ff8
...
...
@@ -47,7 +47,7 @@ class _ContactItem extends StatelessWidget {
List
<
Widget
>
rowChildren
=
<
Widget
>[
new
Column
(
alignItems:
FlexAlignItems
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
columnChildren
)
];
...
...
@@ -60,7 +60,7 @@ class _ContactItem extends StatelessWidget {
return
new
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.0
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
,
children:
rowChildren
)
);
...
...
@@ -85,8 +85,8 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
appBarHeight:
appBarHeight
,
scrollableKey:
scrollableKey
,
appBarBehavior:
AppBarBehavior
.
scroll
,
toolBar:
new
Tool
Bar
(
right
:
<
Widget
>[
appBar:
new
App
Bar
(
actions
:
<
Widget
>[
new
IconButton
(
icon:
Icons
.
create
,
tooltip:
'Search'
...
...
examples/material_gallery/lib/demo/full_screen_dialog_demo.dart
View file @
db261ff8
...
...
@@ -53,7 +53,7 @@ class DateTimeItem extends StatelessWidget {
});
},
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
,
children:
<
Widget
>[
new
Text
(
new
DateFormat
(
'EEE, MMM d yyyy'
).
format
(
date
)),
new
Icon
(
icon:
Icons
.
arrow_drop_down
,
color:
Colors
.
black54
),
...
...
@@ -141,13 +141,13 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
final
ThemeData
theme
=
Theme
.
of
(
context
);
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
le
ft
:
new
IconButton
(
appBar:
new
App
Bar
(
le
ading
:
new
IconButton
(
icon:
Icons
.
clear
,
onPressed:
()
{
handleDismissButton
(
context
);
}
),
center
:
new
Text
(
'New Event'
),
right
:
<
Widget
>
[
title
:
new
Text
(
'New Event'
),
actions
:
<
Widget
>
[
new
FlatButton
(
child:
new
Text
(
'SAVE'
,
style:
theme
.
textTheme
.
body1
.
copyWith
(
color:
Colors
.
white
)),
onPressed:
()
{
...
...
@@ -160,8 +160,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
new
ScrollableViewport
(
child:
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
justifyContent:
FlexJustifyCont
ent
.
collapse
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
,
children:
<
Widget
>[
new
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
...
...
@@ -184,8 +184,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
)
),
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
justifyContent:
FlexJustifyCont
ent
.
end
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
mainAxisAlignment:
MainAxisAlignm
ent
.
end
,
children:
<
Widget
>[
new
Text
(
'From'
,
style:
theme
.
textTheme
.
caption
),
new
DateTimeItem
(
...
...
@@ -200,8 +200,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
]
),
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
justifyContent:
FlexJustifyCont
ent
.
end
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
mainAxisAlignment:
MainAxisAlignm
ent
.
end
,
children:
<
Widget
>[
new
Text
(
'To'
,
style:
theme
.
textTheme
.
caption
),
new
DateTimeItem
(
...
...
examples/material_gallery/lib/demo/grid_list_demo.dart
View file @
db261ff8
...
...
@@ -41,8 +41,8 @@ class GridDemoPhotoItem extends StatelessWidget {
Navigator
.
push
(
context
,
new
MaterialPageRoute
<
Null
>(
builder:
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
photo
.
title
)
appBar:
new
App
Bar
(
title
:
new
Text
(
photo
.
title
)
),
body:
new
Material
(
child:
new
AssetImage
(
...
...
@@ -72,7 +72,7 @@ class GridDemoPhotoItem extends StatelessWidget {
return
new
GridTile
(
header:
new
GridTileBar
(
backgroundColor:
Colors
.
black
.
withAlpha
(
0x08
),
le
ft
:
new
Icon
(
icon:
Icons
.
info
,
color:
Colors
.
white70
),
le
ading
:
new
Icon
(
icon:
Icons
.
info
,
color:
Colors
.
white70
),
title:
new
Text
(
photo
.
title
)
),
child:
image
...
...
@@ -83,8 +83,8 @@ class GridDemoPhotoItem extends StatelessWidget {
footer:
new
GridTileBar
(
backgroundColor:
Colors
.
black
.
withAlpha
(
0x08
),
title:
new
Text
(
photo
.
title
),
caption
:
new
Text
(
photo
.
caption
),
right
:
new
Icon
(
icon:
Icons
.
info
,
color:
Colors
.
white70
)
subtitle
:
new
Text
(
photo
.
caption
),
trailing
:
new
Icon
(
icon:
Icons
.
info
,
color:
Colors
.
white70
)
),
child:
image
);
...
...
@@ -172,9 +172,9 @@ class GridListDemoState extends State<GridListDemo> {
Widget
build
(
BuildContext
context
)
{
final
Orientation
orientation
=
MediaQuery
.
of
(
context
).
orientation
;
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Grid List'
),
right
:
<
Widget
>[
appBar:
new
App
Bar
(
title
:
new
Text
(
'Grid List'
),
actions
:
<
Widget
>[
new
IconButton
(
icon:
Icons
.
more_vert
,
onPressed:
()
{
showTileStyleMenu
(
context
);
},
...
...
examples/material_gallery/lib/demo/icons_demo.dart
View file @
db261ff8
...
...
@@ -66,8 +66,8 @@ class IconsDemoState extends State<IconsDemo> {
final
TextStyle
textStyle
=
theme
.
textTheme
.
subhead
.
copyWith
(
color:
theme
.
textTheme
.
caption
.
color
);
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Icons'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'Icons'
)
),
body:
new
IconTheme
(
data:
new
IconThemeData
(
opacity:
iconOpacity
),
...
...
@@ -76,13 +76,13 @@ class IconsDemoState extends State<IconsDemo> {
child:
new
Column
(
children:
<
Widget
>[
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
,
alignItems:
FlexAlignItems
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
new
Flexible
(
flex:
0
,
child:
new
Column
(
alignItems:
FlexAlignItems
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
new
Text
(
'Size'
,
style:
textStyle
),
buildSizeLabel
(
18
,
textStyle
),
...
...
@@ -94,7 +94,7 @@ class IconsDemoState extends State<IconsDemo> {
),
new
Flexible
(
child:
new
Column
(
alignItems:
FlexAlignItems
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
new
Text
(
'Enabled'
,
style:
textStyle
),
buildIconButton
(
18.0
,
Icons
.
face
,
true
),
...
...
@@ -106,7 +106,7 @@ class IconsDemoState extends State<IconsDemo> {
),
new
Flexible
(
child:
new
Column
(
alignItems:
FlexAlignItems
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
new
Text
(
'Disabled'
,
style:
textStyle
),
buildIconButton
(
18.0
,
Icons
.
face
,
false
),
...
...
@@ -123,7 +123,7 @@ class IconsDemoState extends State<IconsDemo> {
child:
new
IconTheme
(
data:
new
IconThemeData
(
opacity:
1.0
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
center
,
children:
<
Widget
>[
new
Icon
(
icon:
Icons
.
brightness_7
,
...
...
examples/material_gallery/lib/demo/leave_behind_demo.dart
View file @
db261ff8
...
...
@@ -61,10 +61,10 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
_dismissDirection
=
DismissDirection
.
horizontal
;
break
;
case
LeaveBehindDemoAction
.
leftSwipe
:
_dismissDirection
=
DismissDirection
.
lef
t
;
_dismissDirection
=
DismissDirection
.
endToStar
t
;
break
;
case
LeaveBehindDemoAction
.
rightSwipe
:
_dismissDirection
=
DismissDirection
.
right
;
_dismissDirection
=
DismissDirection
.
startToEnd
;
break
;
}
}
...
...
@@ -87,7 +87,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
setState
(()
{
leaveBehindItems
.
remove
(
item
);
});
final
String
action
=
(
direction
==
DismissDirection
.
lef
t
)
?
'archived'
:
'deleted'
;
final
String
action
=
(
direction
==
DismissDirection
.
endToStar
t
)
?
'archived'
:
'deleted'
;
_scaffoldKey
.
currentState
.
showSnackBar
(
new
SnackBar
(
content:
new
Text
(
'You
$action
item
${item.index}
'
),
action:
new
SnackBarAction
(
...
...
@@ -99,13 +99,13 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
background:
new
Container
(
decoration:
new
BoxDecoration
(
backgroundColor:
theme
.
primaryColor
),
child:
new
ListItem
(
le
ft
:
new
Icon
(
icon:
Icons
.
delete
,
color:
Colors
.
white
,
size:
36.0
)
le
ading
:
new
Icon
(
icon:
Icons
.
delete
,
color:
Colors
.
white
,
size:
36.0
)
)
),
secondaryBackground:
new
Container
(
decoration:
new
BoxDecoration
(
backgroundColor:
theme
.
primaryColor
),
child:
new
ListItem
(
right
:
new
Icon
(
icon:
Icons
.
archive
,
color:
Colors
.
white
,
size:
36.0
)
trailing
:
new
Icon
(
icon:
Icons
.
archive
,
color:
Colors
.
white
,
size:
36.0
)
)
),
child:
new
Container
(
...
...
@@ -114,8 +114,8 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
),
child:
new
ListItem
(
primary
:
new
Text
(
item
.
name
),
s
econdary
:
new
Text
(
'
${item.subject}
\n
${item.body}
'
),
title
:
new
Text
(
item
.
name
),
s
ubtitle
:
new
Text
(
'
${item.subject}
\n
${item.body}
'
),
isThreeLine:
true
)
)
...
...
@@ -125,9 +125,9 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
_scaffoldKey
,
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Swipe Items to Dismiss'
),
right
:
<
Widget
>[
appBar:
new
App
Bar
(
title
:
new
Text
(
'Swipe Items to Dismiss'
),
actions
:
<
Widget
>[
new
PopupMenuButton
<
LeaveBehindDemoAction
>(
onSelected:
handleDemoAction
,
items:
<
PopupMenuEntry
<
LeaveBehindDemoAction
>>[
...
...
@@ -143,12 +143,12 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
),
new
CheckedPopupMenuItem
<
LeaveBehindDemoAction
>(
value:
LeaveBehindDemoAction
.
leftSwipe
,
checked:
_dismissDirection
==
DismissDirection
.
lef
t
,
checked:
_dismissDirection
==
DismissDirection
.
endToStar
t
,
child:
new
Text
(
'Only swipe left'
)
),
new
CheckedPopupMenuItem
<
LeaveBehindDemoAction
>(
value:
LeaveBehindDemoAction
.
rightSwipe
,
checked:
_dismissDirection
==
DismissDirection
.
right
,
checked:
_dismissDirection
==
DismissDirection
.
startToEnd
,
child:
new
Text
(
'Only swipe right'
)
)
]
...
...
examples/material_gallery/lib/demo/list_demo.dart
View file @
db261ff8
...
...
@@ -44,13 +44,13 @@ class ListDemoState extends State<ListDemo> {
border:
new
Border
(
top:
new
BorderSide
(
color:
Colors
.
black26
,
width:
1.0
))
),
child:
new
Column
(
justifyContent:
FlexJustifyCont
ent
.
collapse
,
alignItems:
FlexAlignItems
.
stretch
,
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
new
ListItem
(
dense:
true
,
primary
:
new
Text
(
'One-line'
),
right
:
new
Radio
<
ListDemoItemSize
>(
title
:
new
Text
(
'One-line'
),
trailing
:
new
Radio
<
ListDemoItemSize
>(
value:
ListDemoItemSize
.
oneLine
,
groupValue:
_itemSize
,
onChanged:
changeItemSize
...
...
@@ -58,8 +58,8 @@ class ListDemoState extends State<ListDemo> {
),
new
ListItem
(
dense:
true
,
primary
:
new
Text
(
'Two-line'
),
right
:
new
Radio
<
ListDemoItemSize
>(
title
:
new
Text
(
'Two-line'
),
trailing
:
new
Radio
<
ListDemoItemSize
>(
value:
ListDemoItemSize
.
twoLine
,
groupValue:
_itemSize
,
onChanged:
changeItemSize
...
...
@@ -67,8 +67,8 @@ class ListDemoState extends State<ListDemo> {
),
new
ListItem
(
dense:
true
,
primary
:
new
Text
(
'Three-line'
),
right
:
new
Radio
<
ListDemoItemSize
>(
title
:
new
Text
(
'Three-line'
),
trailing
:
new
Radio
<
ListDemoItemSize
>(
value:
ListDemoItemSize
.
threeLine
,
groupValue:
_itemSize
,
onChanged:
changeItemSize
...
...
@@ -76,8 +76,8 @@ class ListDemoState extends State<ListDemo> {
),
new
ListItem
(
dense:
true
,
primary
:
new
Text
(
'Show Avatar'
),
right
:
new
Checkbox
(
title
:
new
Text
(
'Show Avatar'
),
trailing
:
new
Checkbox
(
value:
_showAvatars
,
onChanged:
(
bool
value
)
{
setState
(()
{
...
...
@@ -89,8 +89,8 @@ class ListDemoState extends State<ListDemo> {
),
new
ListItem
(
dense:
true
,
primary
:
new
Text
(
'Show Icon'
),
right
:
new
Checkbox
(
title
:
new
Text
(
'Show Icon'
),
trailing
:
new
Checkbox
(
value:
_showIcons
,
onChanged:
(
bool
value
)
{
setState
(()
{
...
...
@@ -102,8 +102,8 @@ class ListDemoState extends State<ListDemo> {
),
new
ListItem
(
dense:
true
,
primary
:
new
Text
(
'Show Dividers'
),
right
:
new
Checkbox
(
title
:
new
Text
(
'Show Dividers'
),
trailing
:
new
Checkbox
(
value:
_showDividers
,
onChanged:
(
bool
value
)
{
setState
(()
{
...
...
@@ -115,8 +115,8 @@ class ListDemoState extends State<ListDemo> {
),
new
ListItem
(
dense:
true
,
primary
:
new
Text
(
'Dense Layout'
),
right
:
new
Checkbox
(
title
:
new
Text
(
'Dense Layout'
),
trailing
:
new
Checkbox
(
value:
_dense
,
onChanged:
(
bool
value
)
{
setState
(()
{
...
...
@@ -146,10 +146,10 @@ class ListDemoState extends State<ListDemo> {
return
new
ListItem
(
isThreeLine:
_itemSize
==
ListDemoItemSize
.
threeLine
,
dense:
_dense
,
le
ft
:
_showAvatars
?
new
CircleAvatar
(
child:
new
Text
(
item
))
:
null
,
primary
:
new
Text
(
'This item represents
$item
'
),
s
econdary
:
secondary
,
right
:
_showIcons
?
new
Icon
(
icon:
Icons
.
info
,
color:
Theme
.
of
(
context
).
disabledColor
)
:
null
le
ading
:
_showAvatars
?
new
CircleAvatar
(
child:
new
Text
(
item
))
:
null
,
title
:
new
Text
(
'This item represents
$item
'
),
s
ubtitle
:
secondary
,
trailing
:
_showIcons
?
new
Icon
(
icon:
Icons
.
info
,
color:
Theme
.
of
(
context
).
disabledColor
)
:
null
);
}
...
...
@@ -174,9 +174,9 @@ class ListDemoState extends State<ListDemo> {
return
new
Scaffold
(
key:
scaffoldKey
,
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Scrolling List
\n
$itemSizeText$layoutText
'
),
right
:
<
Widget
>[
appBar:
new
App
Bar
(
title
:
new
Text
(
'Scrolling List
\n
$itemSizeText$layoutText
'
),
actions
:
<
Widget
>[
new
IconButton
(
icon:
Icons
.
sort_by_alpha
,
tooltip:
'Sort'
,
...
...
examples/material_gallery/lib/demo/menu_demo.dart
View file @
db261ff8
...
...
@@ -56,15 +56,15 @@ class MenuDemoState extends State<MenuDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
_scaffoldKey
,
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Menus'
),
right
:
<
Widget
>[
appBar:
new
App
Bar
(
title
:
new
Text
(
'Menus'
),
actions
:
<
Widget
>[
new
PopupMenuButton
<
String
>(
onSelected:
showMenuSelection
,
items:
<
PopupMenuItem
<
String
>>[
new
PopupMenuItem
<
String
>(
value:
'
Tool
Bar Menu'
,
child:
new
Text
(
'
Tool
Bar Menu'
)
value:
'
App
Bar Menu'
,
child:
new
Text
(
'
App
Bar Menu'
)
),
new
PopupMenuItem
<
String
>(
value:
'Right Here'
,
...
...
@@ -85,8 +85,8 @@ class MenuDemoState extends State<MenuDemo> {
// a simple menu with one disabled item. Typically the contents
// of this "contextual menu" would reflect the app's state.
new
ListItem
(
primary
:
new
Text
(
'An item with a context menu button'
),
right
:
new
PopupMenuButton
<
String
>(
title
:
new
Text
(
'An item with a context menu button'
),
trailing
:
new
PopupMenuButton
<
String
>(
onSelected:
showMenuSelection
,
items:
<
PopupMenuItem
<
String
>>[
new
PopupMenuItem
<
String
>(
...
...
@@ -108,37 +108,37 @@ class MenuDemoState extends State<MenuDemo> {
// a menu whose items have text labels and icons and a divider
// That separates the first three items from the last one.
new
ListItem
(
primary
:
new
Text
(
'An item with a sectioned menu'
),
right
:
new
PopupMenuButton
<
String
>(
title
:
new
Text
(
'An item with a sectioned menu'
),
trailing
:
new
PopupMenuButton
<
String
>(
onSelected:
showMenuSelection
,
items:
<
PopupMenuEntry
<
String
>>[
new
PopupMenuItem
<
String
>(
value:
'Preview'
,
child:
new
ListItem
(
le
ft
:
new
Icon
(
icon:
Icons
.
visibility
),
primary
:
new
Text
(
'Preview'
)
le
ading
:
new
Icon
(
icon:
Icons
.
visibility
),
title
:
new
Text
(
'Preview'
)
)
),
new
PopupMenuItem
<
String
>(
value:
'Share'
,
child:
new
ListItem
(
le
ft
:
new
Icon
(
icon:
Icons
.
person_add
),
primary
:
new
Text
(
'Share'
)
le
ading
:
new
Icon
(
icon:
Icons
.
person_add
),
title
:
new
Text
(
'Share'
)
)
),
new
PopupMenuItem
<
String
>(
value:
'Get Link'
,
child:
new
ListItem
(
le
ft
:
new
Icon
(
icon:
Icons
.
link
),
primary
:
new
Text
(
'Get Link'
)
le
ading
:
new
Icon
(
icon:
Icons
.
link
),
title
:
new
Text
(
'Get Link'
)
)
),
new
PopupMenuDivider
(),
new
PopupMenuItem
<
String
>(
value:
'Remove'
,
child:
new
ListItem
(
le
ft
:
new
Icon
(
icon:
Icons
.
delete
),
primary
:
new
Text
(
'Remove'
)
le
ading
:
new
Icon
(
icon:
Icons
.
delete
),
title
:
new
Text
(
'Remove'
)
)
)
]
...
...
@@ -151,8 +151,8 @@ class MenuDemoState extends State<MenuDemo> {
initialValue:
_simpleValue
,
onSelected:
showMenuSelection
,
child:
new
ListItem
(
primary
:
new
Text
(
'An item with a simple menu'
),
s
econdary
:
new
Text
(
_simpleValue
)
title
:
new
Text
(
'An item with a simple menu'
),
s
ubtitle
:
new
Text
(
_simpleValue
)
),
items:
<
PopupMenuItem
<
String
>>[
new
PopupMenuItem
<
String
>(
...
...
@@ -172,8 +172,8 @@ class MenuDemoState extends State<MenuDemo> {
// Pressing the PopupMenuButton on the right of this item shows a menu
// whose items have checked icons that reflect this app's state.
new
ListItem
(
primary
:
new
Text
(
'An item with a checklist menu'
),
right
:
new
PopupMenuButton
<
String
>(
title
:
new
Text
(
'An item with a checklist menu'
),
trailing
:
new
PopupMenuButton
<
String
>(
onSelected:
showCheckedMenuSelections
,
items:
<
PopupMenuItem
<
String
>>[
new
CheckedPopupMenuItem
<
String
>(
...
...
examples/material_gallery/lib/demo/modal_bottom_sheet_demo.dart
View file @
db261ff8
...
...
@@ -13,7 +13,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Modal Bottom Sheet"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Modal Bottom Sheet"
)),
body:
new
Center
(
child:
new
Container
(
width:
200.0
,
...
...
examples/material_gallery/lib/demo/page_selector_demo.dart
View file @
db261ff8
...
...
@@ -23,7 +23,7 @@ class PageSelectorDemo extends StatelessWidget {
];
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
'Page Selector'
)),
appBar:
new
AppBar
(
title
:
new
Text
(
'Page Selector'
)),
body:
new
TabBarSelection
<
IconData
>(
values:
icons
,
child:
new
Builder
(
...
...
@@ -49,7 +49,7 @@ class PageSelectorDemo extends StatelessWidget {
tooltip:
'Forward'
)
],
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
)
),
new
Flexible
(
...
...
examples/material_gallery/lib/demo/persistent_bottom_sheet_demo.dart
View file @
db261ff8
...
...
@@ -28,7 +28,7 @@ class PersistentBottomSheetDemo extends StatelessWidget {
Widget
build
(
BuildContext
notUsed
)
{
// Can't find the Scaffold from this context.
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Persistent Bottom Sheet"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Persistent Bottom Sheet"
)),
floatingActionButton:
new
FloatingActionButton
(
child:
new
Icon
(
icon:
Icons
.
add
),
backgroundColor:
Colors
.
redAccent
[
200
]
...
...
examples/material_gallery/lib/demo/progress_indicator_demo.dart
View file @
db261ff8
...
...
@@ -77,13 +77,13 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
children:
indicators
.
map
((
Widget
c
)
=>
new
Container
(
child:
c
,
margin:
const
EdgeInsets
.
symmetric
(
vertical:
15.0
,
horizontal:
20.0
)))
.
toList
(),
justifyContent:
FlexJustifyCont
ent
.
center
mainAxisAlignment:
MainAxisAlignm
ent
.
center
);
}
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
'Progress Indicators'
)),
appBar:
new
AppBar
(
title
:
new
Text
(
'Progress Indicators'
)),
body:
new
DefaultTextStyle
(
style:
Theme
.
of
(
context
).
textTheme
.
title
,
child:
new
GestureDetector
(
...
...
examples/material_gallery/lib/demo/scrolling_techniques_demo.dart
View file @
db261ff8
...
...
@@ -28,7 +28,7 @@ class _BarGraphic extends StatelessWidget {
child:
new
DefaultTextStyle
(
style:
Theme
.
of
(
context
).
textTheme
.
body1
.
copyWith
(
color:
Colors
.
white
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
,
children:
<
Widget
>[
new
Text
(
leftText
),
new
Text
(
rightText
)
...
...
@@ -48,8 +48,8 @@ class _StatusBarGraphic extends _BarGraphic {
);
}
class
_
Tool
BarGraphic
extends
_BarGraphic
{
_
Tool
BarGraphic
()
:
super
(
class
_
App
BarGraphic
extends
_BarGraphic
{
_
App
BarGraphic
()
:
super
(
height:
48.0
,
color:
Colors
.
blue
[
400
],
leftText:
'Tool Bar'
,
...
...
@@ -92,7 +92,7 @@ class _TechniqueItem extends StatelessWidget {
child:
new
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
,
children
:<
Widget
>[
new
Text
(
titleText
),
new
Column
(
children:
barGraphics
)
...
...
@@ -113,7 +113,7 @@ const String _introText =
class
ScrollingTechniquesDemo
extends
StatelessWidget
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
'Scrolling Techniques'
)),
appBar:
new
AppBar
(
title
:
new
Text
(
'Scrolling Techniques'
)),
body:
new
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
),
child:
new
Block
(
...
...
@@ -127,7 +127,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
titleText:
'Standard'
,
barGraphics:
<
Widget
>[
new
_StatusBarGraphic
(),
new
_
Tool
BarGraphic
()
new
_
App
BarGraphic
()
]
),
new
_TechniqueItem
(
...
...
@@ -135,7 +135,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
builder:
(
BuildContext
context
)
=>
new
FlexibleSpaceDemo
(),
barGraphics:
<
Widget
>[
new
_StatusBarGraphic
(),
new
_
Tool
BarGraphic
(),
new
_
App
BarGraphic
(),
new
_TabBarGraphic
()
]
),
...
...
@@ -144,7 +144,7 @@ class ScrollingTechniquesDemo extends StatelessWidget {
builder:
(
BuildContext
context
)
=>
new
FlexibleSpaceDemo
(),
barGraphics:
<
Widget
>[
new
_StatusBarGraphic
(),
new
_
Tool
BarGraphic
(),
new
_
App
BarGraphic
(),
new
_FlexibleSpaceGraphic
()
]
)
...
...
examples/material_gallery/lib/demo/slider_demo.dart
View file @
db261ff8
...
...
@@ -13,7 +13,7 @@ class _SliderDemoState extends State<SliderDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Sliders"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Sliders"
)),
body:
new
Block
(
children:
<
Widget
>[
new
Container
(
height:
100.0
,
...
...
@@ -35,7 +35,7 @@ class _SliderDemoState extends State<SliderDemo> {
child:
new
Text
(
_value
.
round
().
toString
().
padLeft
(
3
,
'0'
))
),
],
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
)
),
...
...
@@ -51,7 +51,7 @@ class _SliderDemoState extends State<SliderDemo> {
child:
new
Text
((
_value
/
100.0
).
toStringAsFixed
(
2
))
),
],
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
)
)
...
...
examples/material_gallery/lib/demo/snack_bar_demo.dart
View file @
db261ff8
...
...
@@ -58,8 +58,8 @@ class SnackBarDemo extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'SnackBar'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'SnackBar'
)
),
body:
new
Builder
(
// Create an inner BuildContext so that the snackBar onPressed methods
...
...
examples/material_gallery/lib/demo/tabs_demo.dart
View file @
db261ff8
...
...
@@ -28,8 +28,8 @@ class TabsDemo extends StatelessWidget {
return
new
TabBarSelection
<
IconData
>(
values:
icons
,
child:
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"Scrollable Tabs"
),
appBar:
new
App
Bar
(
title
:
new
Text
(
"Scrollable Tabs"
),
tabBar:
new
TabBar
<
IconData
>(
isScrollable:
true
,
labels:
new
Map
<
IconData
,
TabLabel
>.
fromIterable
(
...
...
examples/material_gallery/lib/demo/tabs_fab_demo.dart
View file @
db261ff8
...
...
@@ -94,8 +94,8 @@ class _TabsFabDemoState extends State<TabsFabDemo> {
onChanged:
_handleTabSelection
,
child:
new
Scaffold
(
key:
scaffoldKey
,
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"FAB per Tab"
),
appBar:
new
App
Bar
(
title
:
new
Text
(
"FAB per Tab"
),
tabBar:
new
TabBar
<
_Page
>(
labels:
new
Map
<
_Page
,
TabLabel
>.
fromIterable
(
pages
,
value:
(
_Page
page
)
=>
page
.
tabLabel
)
)
...
...
examples/material_gallery/lib/demo/text_field_demo.dart
View file @
db261ff8
...
...
@@ -62,8 +62,8 @@ class TextFieldDemoState extends State<TextFieldDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
_scaffoldKey
,
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Text Fields'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'Text Fields'
)
),
body:
new
Block
(
padding:
const
EdgeInsets
.
all
(
8.0
),
...
...
@@ -85,7 +85,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
onSubmitted:
_handleInputSubmitted
),
new
Row
(
alignItems:
FlexAlignItems
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
new
Flexible
(
child:
new
Input
(
...
...
examples/material_gallery/lib/demo/time_picker_demo.dart
View file @
db261ff8
...
...
@@ -27,7 +27,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Time Picker"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Time Picker"
)),
body:
new
Column
(
children:
<
Widget
>[
new
Text
(
'
$_selectedTime
'
),
...
...
@@ -36,7 +36,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
child:
new
Text
(
'SELECT TIME'
)
),
],
justifyContent:
FlexJustifyCont
ent
.
center
mainAxisAlignment:
MainAxisAlignm
ent
.
center
)
);
}
...
...
examples/material_gallery/lib/demo/toggle_controls_demo.dart
View file @
db261ff8
...
...
@@ -33,7 +33,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Selection Controls"
)),
appBar:
new
AppBar
(
title
:
new
Text
(
"Selection Controls"
)),
body:
new
Column
(
children:
<
Widget
>[
new
Row
(
...
...
@@ -42,7 +42,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
new
Checkbox
(
value:
false
),
// Disabled
new
Checkbox
(
value:
true
),
// Disabled
],
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
),
new
Row
(
children:
<
int
>[
0
,
1
,
2
].
map
((
int
i
)
{
...
...
@@ -52,13 +52,13 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
onChanged:
_setRadioValue
);
}).
toList
(),
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
),
new
Row
(
children:
<
int
>[
0
,
1
].
map
((
int
i
)
{
return
new
Radio
<
int
>(
value:
i
,
groupValue:
0
);
// Disabled
}).
toList
(),
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
),
new
Row
(
children:
<
Widget
>[
...
...
@@ -66,10 +66,10 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
new
Switch
(
value:
false
),
// Disabled
new
Switch
(
value:
true
),
// Disabled
],
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
),
],
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
)
);
}
...
...
examples/material_gallery/lib/demo/tooltip_demo.dart
View file @
db261ff8
...
...
@@ -13,13 +13,13 @@ class TooltipDemo extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
'Tooltip'
)
appBar:
new
App
Bar
(
title
:
new
Text
(
'Tooltip'
)
),
body:
new
Builder
(
builder:
(
BuildContext
context
)
{
return
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
new
Text
(
_introText
,
style:
theme
.
textTheme
.
subhead
),
new
Row
(
...
...
examples/material_gallery/lib/demo/two_level_list_demo.dart
View file @
db261ff8
...
...
@@ -7,23 +7,23 @@ import 'package:flutter/material.dart';
class
TwoLevelListDemo
extends
StatelessWidget
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
'Expand/Collapse List Control'
)),
appBar:
new
AppBar
(
title
:
new
Text
(
'Expand/Collapse List Control'
)),
body:
new
Padding
(
padding:
const
EdgeInsets
.
all
(
0.0
),
child:
new
TwoLevelList
(
type:
MaterialListType
.
oneLine
,
items:
<
Widget
>[
new
TwoLevelListItem
(
center
:
new
Text
(
'Top'
)),
new
TwoLevelListItem
(
title
:
new
Text
(
'Top'
)),
new
TwoLevelSublist
(
center:
new
Text
(
'Sublist'
),
children:
<
Widget
>[
new
TwoLevelListItem
(
center
:
new
Text
(
'One'
)),
new
TwoLevelListItem
(
center
:
new
Text
(
'Two'
)),
new
TwoLevelListItem
(
center
:
new
Text
(
'Free'
)),
new
TwoLevelListItem
(
center
:
new
Text
(
'Four'
))
new
TwoLevelListItem
(
title
:
new
Text
(
'One'
)),
new
TwoLevelListItem
(
title
:
new
Text
(
'Two'
)),
new
TwoLevelListItem
(
title
:
new
Text
(
'Free'
)),
new
TwoLevelListItem
(
title
:
new
Text
(
'Four'
))
]
),
new
TwoLevelListItem
(
center
:
new
Text
(
'Bottom'
))
new
TwoLevelListItem
(
title
:
new
Text
(
'Bottom'
))
]
)
)
...
...
examples/material_gallery/lib/demo/typography_demo.dart
View file @
db261ff8
...
...
@@ -22,7 +22,7 @@ class TextStyleItem extends StatelessWidget {
return
new
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
,
vertical:
16.0
),
child:
new
Row
(
alignItems:
FlexAlignItems
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
new
SizedBox
(
width:
64.0
,
...
...
@@ -62,7 +62,7 @@ class TypographyDemo extends StatelessWidget {
}
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
'Typography'
)),
appBar:
new
AppBar
(
title
:
new
Text
(
'Typography'
)),
body:
new
Block
(
children:
styleItems
)
);
}
...
...
examples/material_gallery/lib/demo/weather_demo.dart
View file @
db261ff8
...
...
@@ -61,8 +61,8 @@ class _WeatherDemoState extends State<WeatherDemo> {
Widget
build
(
BuildContext
context
)
{
if
(!
assetsLoaded
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"Weather"
)
appBar:
new
App
Bar
(
title
:
new
Text
(
"Weather"
)
),
body:
new
Container
(
decoration:
new
BoxDecoration
(
...
...
@@ -73,8 +73,8 @@ class _WeatherDemoState extends State<WeatherDemo> {
}
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
"Weather"
)
appBar:
new
App
Bar
(
title
:
new
Text
(
"Weather"
)
),
body:
new
Material
(
child:
new
Stack
(
...
...
@@ -83,7 +83,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.8
),
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
center
,
mainAxisAlignment:
MainAxisAlignm
ent
.
center
,
children:
<
Widget
>[
new
WeatherButton
(
onPressed:
()
{
...
...
examples/material_gallery/lib/gallery/app.dart
View file @
db261ff8
...
...
@@ -28,7 +28,7 @@ class GalleryAppState extends State<GalleryApp> {
title:
'Flutter Material Gallery'
,
theme:
lightTheme
?
new
ThemeData
.
light
()
:
new
ThemeData
.
dark
(),
routes:
{
'/'
:
(
RouteArguments
args
)
=>
new
GalleryHome
()
'/'
:
(
BuildContext
context
)
=>
new
GalleryHome
()
}
);
}
...
...
examples/material_gallery/lib/gallery/home.dart
View file @
db261ff8
...
...
@@ -50,7 +50,7 @@ class GalleryHomeState extends State<GalleryHome> {
return
new
Scaffold
(
appBarHeight:
128.0
,
drawer:
new
GalleryDrawer
(),
toolBar:
new
Tool
Bar
(
appBar:
new
App
Bar
(
flexibleSpace:
(
BuildContext
context
)
{
return
new
Container
(
padding:
const
EdgeInsets
.
only
(
left:
16.0
,
bottom:
24.0
),
...
...
examples/material_gallery/lib/gallery/section.dart
View file @
db261ff8
...
...
@@ -39,7 +39,7 @@ class GallerySection extends StatelessWidget {
appBarHeight:
appBarHeight
,
appBarBehavior:
AppBarBehavior
.
scroll
,
scrollableKey:
scrollableKey
,
toolBar:
new
Tool
Bar
(
appBar:
new
App
Bar
(
flexibleSpace:
(
BuildContext
context
)
=>
new
FlexibleSpaceBar
(
title:
new
Text
(
title
))
),
body:
new
Material
(
...
...
@@ -49,7 +49,7 @@ class GallerySection extends StatelessWidget {
type:
MaterialListType
.
oneLine
,
children:
(
demos
??
const
<
GalleryDemo
>[]).
map
((
GalleryDemo
demo
)
{
return
new
ListItem
(
primary
:
new
Text
(
demo
.
title
),
title
:
new
Text
(
demo
.
title
),
onTap:
()
{
showDemo
(
demo
,
context
,
theme
);
}
);
})
...
...
examples/stocks/lib/main.dart
View file @
db261ff8
...
...
@@ -114,9 +114,9 @@ class StocksAppState extends State<StocksApp> {
debugShowMaterialGrid:
_configuration
.
debugShowGrid
,
showPerformanceOverlay:
_configuration
.
showPerformanceOverlay
,
showSemanticsDebugger:
_configuration
.
showSemanticsDebugger
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
StockHome
(
_stocks
,
_symbols
,
_configuration
,
configurationUpdater
),
'/settings'
:
(
RouteArguments
args
)
=>
new
StockSettings
(
_configuration
,
configurationUpdater
)
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
StockHome
(
_stocks
,
_symbols
,
_configuration
,
configurationUpdater
),
'/settings'
:
(
BuildContext
context
)
=>
new
StockSettings
(
_configuration
,
configurationUpdater
)
},
onGenerateRoute:
_getRoute
,
onLocaleChanged:
_onLocaleChanged
...
...
examples/stocks/lib/stock_home.dart
View file @
db261ff8
...
...
@@ -206,11 +206,11 @@ class StockHomeState extends State<StockHome> {
Navigator
.
popAndPushNamed
(
context
,
'/settings'
);
}
Widget
build
Tool
Bar
()
{
return
new
Tool
Bar
(
Widget
build
App
Bar
()
{
return
new
App
Bar
(
elevation:
0
,
center
:
new
Text
(
StockStrings
.
of
(
context
).
title
()),
right
:
<
Widget
>[
title
:
new
Text
(
StockStrings
.
of
(
context
).
title
()),
actions
:
<
Widget
>[
new
IconButton
(
icon:
Icons
.
search
,
onPressed:
_handleSearchBegin
,
...
...
@@ -303,14 +303,14 @@ class StockHomeState extends State<StockHome> {
// TODO(abarth): Should we factor this into a SearchBar in the framework?
Widget
buildSearchBar
()
{
return
new
Tool
Bar
(
le
ft
:
new
IconButton
(
return
new
App
Bar
(
le
ading
:
new
IconButton
(
icon:
Icons
.
arrow_back
,
color:
Theme
.
of
(
context
).
accentColor
,
onPressed:
_handleSearchEnd
,
tooltip:
'Back'
),
center
:
new
Input
(
title
:
new
Input
(
value:
_searchQuery
,
autofocus:
true
,
hintText:
'Search stocks'
,
...
...
@@ -341,7 +341,7 @@ class StockHomeState extends State<StockHome> {
values:
<
StockHomeTab
>[
StockHomeTab
.
market
,
StockHomeTab
.
portfolio
],
child:
new
Scaffold
(
key:
_scaffoldKey
,
toolBar:
_isSearching
?
buildSearchBar
()
:
buildTool
Bar
(),
appBar:
_isSearching
?
buildSearchBar
()
:
buildApp
Bar
(),
floatingActionButton:
buildFloatingActionButton
(),
drawer:
_buildDrawer
(
context
),
body:
new
TabBarView
<
StockHomeTab
>(
...
...
examples/stocks/lib/stock_row.dart
View file @
db261ff8
...
...
@@ -102,7 +102,7 @@ class StockRow extends StatelessWidget {
)
),
],
alignItems:
FlexAlignItems
.
baseline
,
crossAxisAlignment:
CrossAxisAlignment
.
baseline
,
textBaseline:
DefaultTextStyle
.
of
(
context
).
textBaseline
)
),
...
...
examples/stocks/lib/stock_settings.dart
View file @
db261ff8
...
...
@@ -94,9 +94,9 @@ class StockSettingsState extends State<StockSettings> {
config
.
updater
(
value
);
}
Widget
build
Tool
Bar
(
BuildContext
context
)
{
return
new
Tool
Bar
(
center
:
new
Text
(
'Settings'
)
Widget
build
App
Bar
(
BuildContext
context
)
{
return
new
App
Bar
(
title
:
new
Text
(
'Settings'
)
);
}
...
...
@@ -247,7 +247,7 @@ class StockSettingsState extends State<StockSettings> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
buildTool
Bar
(
context
),
appBar:
buildApp
Bar
(
context
),
body:
buildSettingsPane
(
context
)
);
}
...
...
examples/stocks/lib/stock_symbol_viewer.dart
View file @
db261ff8
...
...
@@ -37,7 +37,7 @@ class StockSymbolView extends StatelessWidget {
child:
new
StockArrow
(
percentChange:
stock
.
percentChange
)
),
],
justifyContent:
FlexJustifyCont
ent
.
spaceBetween
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceBetween
),
new
Text
(
'Last Sale'
,
style:
headings
),
new
Text
(
'
$lastSale
(
$changeInPrice
)'
),
...
...
@@ -60,7 +60,7 @@ class StockSymbolView extends StatelessWidget {
)
),
],
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
);
}
...
...
@@ -73,8 +73,8 @@ class StockSymbolPage extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
Tool
Bar
(
center
:
new
Text
(
stock
.
name
)
appBar:
new
App
Bar
(
title
:
new
Text
(
stock
.
name
)
),
body:
new
Block
(
children:
<
Widget
>[
...
...
packages/flutter/lib/material.dart
View file @
db261ff8
...
...
@@ -8,6 +8,7 @@
library
material
;
export
'src/material/app.dart'
;
export
'src/material/app_bar.dart'
;
export
'src/material/bottom_sheet.dart'
;
export
'src/material/button.dart'
;
export
'src/material/card.dart'
;
...
...
@@ -56,7 +57,6 @@ export 'src/material/theme_data.dart';
export
'src/material/time_picker.dart'
;
export
'src/material/time_picker_dialog.dart'
;
export
'src/material/toggleable.dart'
;
export
'src/material/tool_bar.dart'
;
export
'src/material/tooltip.dart'
;
export
'src/material/two_level_list.dart'
;
export
'src/material/typography.dart'
;
...
...
packages/flutter/lib/src/material/app.dart
View file @
db261ff8
...
...
@@ -28,7 +28,7 @@ class MaterialApp extends WidgetsApp {
Key
key
,
String
title
,
ThemeData
theme
,
Map
<
String
,
RouteBuilder
>
routes:
const
<
String
,
Route
Builder
>{},
Map
<
String
,
WidgetBuilder
>
routes:
const
<
String
,
Widget
Builder
>{},
RouteFactory
onGenerateRoute
,
LocaleChangedCallback
onLocaleChanged
,
this
.
debugShowMaterialGrid
:
false
,
...
...
@@ -43,12 +43,10 @@ class MaterialApp extends WidgetsApp {
color:
theme
?.
primaryColor
??
Colors
.
blue
[
500
],
// blue[500] is the primary color of the default theme
routes:
routes
,
onGenerateRoute:
(
RouteSettings
settings
)
{
Route
Builder
builder
=
routes
[
settings
.
name
];
Widget
Builder
builder
=
routes
[
settings
.
name
];
if
(
builder
!=
null
)
{
return
new
MaterialPageRoute
<
Null
>(
builder:
(
BuildContext
context
)
{
return
builder
(
new
RouteArguments
(
context:
context
));
},
builder:
builder
,
settings:
settings
);
}
...
...
packages/flutter/lib/src/material/
tool
_bar.dart
→
packages/flutter/lib/src/material/
app
_bar.dart
View file @
db261ff8
...
...
@@ -11,12 +11,12 @@ import 'material.dart';
import
'theme.dart'
;
import
'typography.dart'
;
class
Tool
Bar
extends
StatelessWidget
{
Tool
Bar
({
class
App
Bar
extends
StatelessWidget
{
App
Bar
({
Key
key
,
this
.
le
ft
,
this
.
center
,
this
.
right
,
this
.
le
ading
,
this
.
title
,
this
.
actions
,
this
.
flexibleSpace
,
this
.
foregroundOpacity
:
1.0
,
this
.
tabBar
,
...
...
@@ -29,9 +29,9 @@ class ToolBar extends StatelessWidget {
assert
((
tabBar
!=
null
)
?
flexibleSpace
==
null
:
true
);
}
final
Widget
le
ft
;
final
Widget
center
;
final
List
<
Widget
>
right
;
final
Widget
le
ading
;
final
Widget
title
;
final
List
<
Widget
>
actions
;
final
WidgetBuilder
flexibleSpace
;
final
double
foregroundOpacity
;
final
Widget
tabBar
;
...
...
@@ -40,7 +40,7 @@ class ToolBar extends StatelessWidget {
final
TextTheme
textTheme
;
final
EdgeInsets
padding
;
Tool
Bar
copyWith
({
App
Bar
copyWith
({
Key
key
,
Widget
left
,
Widget
center
,
...
...
@@ -52,11 +52,11 @@ class ToolBar extends StatelessWidget {
TextTheme
textTheme
,
EdgeInsets
padding
})
{
return
new
Tool
Bar
(
return
new
App
Bar
(
key:
key
??
this
.
key
,
le
ft:
left
??
this
.
left
,
center:
center
??
this
.
center
,
right:
right
??
this
.
right
,
le
ading:
left
??
this
.
leading
,
title:
center
??
this
.
title
,
actions:
right
??
this
.
actions
,
flexibleSpace:
flexibleSpace
??
this
.
flexibleSpace
,
foregroundOpacity:
foregroundOpacity
??
this
.
foregroundOpacity
,
tabBar:
tabBar
??
this
.
tabBar
,
...
...
@@ -98,18 +98,18 @@ class ToolBar extends StatelessWidget {
}
final
List
<
Widget
>
toolBarRow
=
<
Widget
>[];
if
(
le
ft
!=
null
)
toolBarRow
.
add
(
le
ft
);
if
(
le
ading
!=
null
)
toolBarRow
.
add
(
le
ading
);
toolBarRow
.
add
(
new
Flexible
(
child:
new
Padding
(
padding:
new
EdgeInsets
.
only
(
left:
24.0
),
child:
center
!=
null
?
new
DefaultTextStyle
(
style:
centerStyle
,
child:
center
)
:
null
child:
title
!=
null
?
new
DefaultTextStyle
(
style:
centerStyle
,
child:
title
)
:
null
)
)
);
if
(
right
!=
null
)
toolBarRow
.
addAll
(
right
);
if
(
actions
!=
null
)
toolBarRow
.
addAll
(
actions
);
EdgeInsets
combinedPadding
=
new
EdgeInsets
.
symmetric
(
horizontal:
8.0
);
if
(
padding
!=
null
)
...
...
@@ -117,7 +117,7 @@ class ToolBar extends StatelessWidget {
// If the toolBar's height shrinks below toolBarHeight, it will be clipped and bottom
// justified. This is so that the toolbar appears to move upwards as its height is reduced.
final
double
toolBarHeight
=
k
Tool
BarHeight
+
combinedPadding
.
top
+
combinedPadding
.
bottom
;
final
double
toolBarHeight
=
k
App
BarHeight
+
combinedPadding
.
top
+
combinedPadding
.
bottom
;
final
Widget
toolBar
=
new
ConstrainedBox
(
constraints:
new
BoxConstraints
(
maxHeight:
toolBarHeight
),
child:
new
Padding
(
...
...
@@ -142,7 +142,7 @@ class ToolBar extends StatelessWidget {
Widget
appBar
=
toolBar
;
if
(
tabBar
!=
null
)
{
appBar
=
new
Column
(
justifyContent:
FlexJustifyCont
ent
.
collapse
,
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
,
children:
<
Widget
>[
toolBar
,
tabBar
]
);
}
else
if
(
flexibleSpace
!=
null
)
{
...
...
packages/flutter/lib/src/material/chip.dart
View file @
db261ff8
...
...
@@ -87,7 +87,7 @@ class Chip extends StatelessWidget {
),
child:
new
Row
(
children:
children
,
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
)
);
...
...
packages/flutter/lib/src/material/constants.dart
View file @
db261ff8
...
...
@@ -9,8 +9,8 @@ import 'package:flutter/widgets.dart';
// Mobile Landscape: 48dp
// Mobile Portrait: 56dp
// Tablet/Desktop: 64dp
const
double
k
Tool
BarHeight
=
56.0
;
const
double
kExtended
Tool
BarHeight
=
128.0
;
const
double
k
App
BarHeight
=
56.0
;
const
double
kExtended
App
BarHeight
=
128.0
;
const
double
kTextTabBarHeight
=
48.0
;
const
double
kIconTabBarHeight
=
48.0
;
...
...
packages/flutter/lib/src/material/date_picker.dart
View file @
db261ff8
...
...
@@ -98,7 +98,7 @@ class _DatePickerState extends State<DatePicker> {
child:
picker
)
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
);
}
...
...
@@ -197,7 +197,7 @@ class DayPicker extends StatelessWidget {
new
Text
(
new
DateFormat
(
"MMMM y"
).
format
(
displayedMonth
),
style:
monthStyle
),
new
Flex
(
children:
headers
,
justifyContent:
FlexJustifyCont
ent
.
spaceAround
mainAxisAlignment:
MainAxisAlignm
ent
.
spaceAround
)
];
int
year
=
displayedMonth
.
year
;
...
...
packages/flutter/lib/src/material/dialog.dart
View file @
db261ff8
...
...
@@ -90,7 +90,7 @@ class Dialog extends StatelessWidget {
child:
new
Container
(
child:
new
Row
(
children:
actions
,
justifyContent:
FlexJustifyCont
ent
.
end
mainAxisAlignment:
MainAxisAlignm
ent
.
end
)
)
));
...
...
packages/flutter/lib/src/material/dropdown.dart
View file @
db261ff8
...
...
@@ -304,7 +304,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
padding:
const
EdgeInsets
.
only
(
top:
6.0
)
)
],
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
)
);
...
...
packages/flutter/lib/src/material/flexible_space_bar.dart
View file @
db261ff8
...
...
@@ -27,7 +27,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
final
double
appBarHeight
=
Scaffold
.
of
(
context
).
appBarHeight
;
final
Animation
<
double
>
animation
=
Scaffold
.
of
(
context
).
appBarAnimation
;
final
EdgeInsets
toolBarPadding
=
MediaQuery
.
of
(
context
)?.
padding
??
EdgeInsets
.
zero
;
final
double
toolBarHeight
=
k
Tool
BarHeight
+
toolBarPadding
.
top
;
final
double
toolBarHeight
=
k
App
BarHeight
+
toolBarPadding
.
top
;
final
List
<
Widget
>
children
=
<
Widget
>[];
// background image
...
...
@@ -63,7 +63,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
color:
titleStyle
.
color
.
withAlpha
(
new
Tween
<
double
>(
begin:
255.0
,
end:
0.0
).
evaluate
(
opacityCurve
).
toInt
())
);
final
double
yAlignStart
=
1.0
;
final
double
yAlignEnd
=
(
toolBarPadding
.
top
+
k
Tool
BarHeight
/
2.0
)
/
toolBarHeight
;
final
double
yAlignEnd
=
(
toolBarPadding
.
top
+
k
App
BarHeight
/
2.0
)
/
toolBarHeight
;
final
double
scaleAndAlignEnd
=
(
appBarHeight
-
toolBarHeight
)
/
appBarHeight
;
final
CurvedAnimation
scaleAndAlignCurve
=
new
CurvedAnimation
(
parent:
animation
,
...
...
packages/flutter/lib/src/material/grid_tile_bar.dart
View file @
db261ff8
...
...
@@ -13,16 +13,23 @@ import 'typography.dart';
/// Typically used to stack a one or two line header or footer on a Grid tile.
/// The layout is based on the "Grid Lists" section of the Material Design spec:
/// https://www.google.com/design/spec/components/grid-lists.html#grid-lists-specs
/// For a one-line header specify
title and to add a second line specify caption
.
/// Use
left or right
to add an icon.
/// For a one-line header specify
[title] and to add a second line specify [subtitle]
.
/// Use
[leading] or [trailing]
to add an icon.
class
GridTileBar
extends
StatelessWidget
{
GridTileBar
({
Key
key
,
this
.
backgroundColor
,
this
.
left
,
this
.
right
,
this
.
title
,
this
.
caption
})
:
super
(
key:
key
);
GridTileBar
({
Key
key
,
this
.
backgroundColor
,
this
.
leading
,
this
.
title
,
this
.
subtitle
,
this
.
trailing
})
:
super
(
key:
key
);
final
Color
backgroundColor
;
final
Widget
left
;
final
Widget
right
;
final
Widget
leading
;
final
Widget
title
;
final
Widget
caption
;
final
Widget
subtitle
;
final
Widget
trailing
;
Widget
build
(
BuildContext
context
)
{
BoxDecoration
decoration
;
...
...
@@ -30,23 +37,23 @@ class GridTileBar extends StatelessWidget {
decoration
=
new
BoxDecoration
(
backgroundColor:
backgroundColor
);
EdgeInsets
padding
;
if
(
le
ft
!=
null
&&
right
!=
null
)
if
(
le
ading
!=
null
&&
trailing
!=
null
)
padding
=
const
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
8.0
);
else
if
(
le
ft
!=
null
)
else
if
(
le
ading
!=
null
)
padding
=
const
EdgeInsets
.
only
(
left:
8.0
,
right:
16.0
,
top:
16.0
,
bottom:
16.0
);
else
//
right != null || (left == null && right
== null)
else
//
trailing != null || (leading == null && trailing
== null)
padding
=
const
EdgeInsets
.
only
(
left:
16.0
,
right:
8.0
,
top:
16.0
,
bottom:
16.0
);
final
List
<
Widget
>
children
=
<
Widget
>[];
if
(
le
ft
!=
null
)
children
.
add
(
new
Padding
(
padding:
const
EdgeInsets
.
only
(
right:
8.0
),
child:
le
ft
));
if
(
le
ading
!=
null
)
children
.
add
(
new
Padding
(
padding:
const
EdgeInsets
.
only
(
right:
8.0
),
child:
le
ading
));
if
(
title
!=
null
&&
caption
!=
null
)
{
if
(
title
!=
null
&&
subtitle
!=
null
)
{
children
.
add
(
new
Flexible
(
child:
new
Column
(
alignItems:
FlexAlignItems
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
new
DefaultTextStyle
(
style:
Typography
.
white
.
subhead
,
...
...
@@ -54,25 +61,25 @@ class GridTileBar extends StatelessWidget {
),
new
DefaultTextStyle
(
style:
Typography
.
white
.
caption
,
child:
caption
child:
subtitle
)
]
)
)
);
}
else
if
(
title
!=
null
||
caption
!=
null
)
{
}
else
if
(
title
!=
null
||
subtitle
!=
null
)
{
children
.
add
(
new
Flexible
(
child:
new
DefaultTextStyle
(
style:
Typography
.
white
.
subhead
,
child:
title
??
caption
child:
title
??
subtitle
)
)
);
}
if
(
right
!=
null
)
children
.
add
(
new
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
8.0
),
child:
right
));
if
(
trailing
!=
null
)
children
.
add
(
new
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
8.0
),
child:
trailing
));
return
new
Container
(
padding:
padding
,
...
...
@@ -80,7 +87,7 @@ class GridTileBar extends StatelessWidget {
child:
new
IconTheme
(
data:
new
IconThemeData
(
color:
Colors
.
white
),
child:
new
Row
(
alignItems:
FlexAlignItems
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
children
)
)
...
...
packages/flutter/lib/src/material/input.dart
View file @
db261ff8
...
...
@@ -188,7 +188,7 @@ class _InputState extends State<Input> {
double
iconSize
=
config
.
isDense
?
18.0
:
24.0
;
double
iconTop
=
topPadding
+
(
textStyle
.
fontSize
-
iconSize
)
/
2.0
;
child
=
new
Row
(
alignItems:
FlexAlignItems
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
new
Container
(
margin:
new
EdgeInsets
.
only
(
right:
16.0
,
top:
iconTop
),
...
...
packages/flutter/lib/src/material/list_item.dart
View file @
db261ff8
...
...
@@ -9,32 +9,32 @@ import 'ink_well.dart';
import
'theme.dart'
;
/// Material List items are one to three lines of text optionally flanked by icons.
/// Icons are defined with the [le
ft] and [right
] parameters. The first line of text
/// is not optional and is specified with [
primary]. The value of [secondary
] will
/// Icons are defined with the [le
ading] and [trailing
] parameters. The first line of text
/// is not optional and is specified with [
title]. The value of [subtitle
] will
/// occupy the space allocated for an aditional line of text, or two lines if
/// isThreeLine: true is specified. If dense: true is specified then the overall
/// height of this list item and the size of the DefaultTextStyles that wrap
/// the [
primary] and [secondary
] widget are reduced.
/// the [
title] and [subtitle
] widget are reduced.
class
ListItem
extends
StatelessWidget
{
ListItem
({
Key
key
,
this
.
le
ft
,
this
.
primary
,
this
.
s
econdary
,
this
.
right
,
this
.
le
ading
,
this
.
title
,
this
.
s
ubtitle
,
this
.
trailing
,
this
.
isThreeLine
:
false
,
this
.
dense
:
false
,
this
.
enabled
:
true
,
this
.
onTap
,
this
.
onLongPress
})
:
super
(
key:
key
)
{
assert
(
isThreeLine
?
s
econdary
!=
null
:
true
);
assert
(
isThreeLine
?
s
ubtitle
!=
null
:
true
);
}
final
Widget
le
ft
;
final
Widget
primary
;
final
Widget
s
econdary
;
final
Widget
right
;
final
Widget
le
ading
;
final
Widget
title
;
final
Widget
s
ubtitle
;
final
Widget
trailing
;
final
bool
isThreeLine
;
final
bool
dense
;
final
bool
enabled
;
...
...
@@ -86,7 +86,7 @@ class ListItem extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterial
(
context
));
final
bool
isTwoLine
=
!
isThreeLine
&&
s
econdary
!=
null
;
final
bool
isTwoLine
=
!
isThreeLine
&&
s
ubtitle
!=
null
;
final
bool
isOneLine
=
!
isThreeLine
&&
!
isTwoLine
;
double
itemHeight
;
if
(
isOneLine
)
...
...
@@ -103,31 +103,31 @@ class ListItem extends StatelessWidget {
// Overall, the list item is a Row() with these children.
final
List
<
Widget
>
children
=
<
Widget
>[];
if
(
le
ft
!=
null
)
{
if
(
le
ading
!=
null
)
{
children
.
add
(
new
Container
(
margin:
new
EdgeInsets
.
only
(
right:
16.0
,
top:
iconMarginTop
),
width:
40.0
,
child:
new
Align
(
alignment:
new
FractionalOffset
(
0.0
,
isThreeLine
?
0.0
:
0.5
),
child:
le
ft
child:
le
ading
)
));
}
final
Widget
primaryLine
=
new
DefaultTextStyle
(
style:
primaryTextStyle
(
context
),
child:
primary
??
new
Container
()
child:
title
??
new
Container
()
);
Widget
center
=
primaryLine
;
if
(
isTwoLine
||
isThreeLine
)
{
center
=
new
Column
(
justifyContent:
FlexJustifyCont
ent
.
collapse
,
alignItems:
FlexAlignItems
.
start
,
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
primaryLine
,
new
DefaultTextStyle
(
style:
secondaryTextStyle
(
context
),
child:
s
econdary
child:
s
ubtitle
)
]
);
...
...
@@ -136,12 +136,12 @@ class ListItem extends StatelessWidget {
child:
center
));
if
(
right
!=
null
)
{
if
(
trailing
!=
null
)
{
children
.
add
(
new
Container
(
margin:
new
EdgeInsets
.
only
(
left:
16.0
,
top:
iconMarginTop
),
child:
new
Align
(
alignment:
new
FractionalOffset
(
1.0
,
isThreeLine
?
0.0
:
0.5
),
child:
right
child:
trailing
)
));
}
...
...
@@ -153,7 +153,7 @@ class ListItem extends StatelessWidget {
height:
itemHeight
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
),
child:
new
Row
(
alignItems:
FlexAlignItems
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
children
)
)
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
db261ff8
...
...
@@ -150,11 +150,11 @@ class _CheckedPopupMenuItemState<T> extends _PopupMenuItemState<CheckedPopupMenu
Widget
buildChild
()
{
return
new
ListItem
(
enabled:
config
.
enabled
,
le
ft
:
new
FadeTransition
(
le
ading
:
new
FadeTransition
(
opacity:
_opacity
,
child:
new
Icon
(
icon:
_controller
.
isDismissed
?
null
:
Icons
.
done
)
),
primary
:
config
.
child
title
:
config
.
child
);
}
}
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
db261ff8
...
...
@@ -8,6 +8,7 @@ import 'dart:math' as math;
import
'package:flutter/widgets.dart'
;
import
'app_bar.dart'
;
import
'bottom_sheet.dart'
;
import
'constants.dart'
;
import
'drawer.dart'
;
...
...
@@ -15,7 +16,6 @@ import 'icons.dart';
import
'icon_button.dart'
;
import
'material.dart'
;
import
'snack_bar.dart'
;
import
'tool_bar.dart'
;
const
double
_kFloatingActionButtonMargin
=
16.0
;
// TODO(hmuller): should be device dependent
const
Duration
_kFloatingActionButtonSegue
=
const
Duration
(
milliseconds:
400
);
...
...
@@ -27,7 +27,7 @@ enum AppBarBehavior {
enum
_ScaffoldSlot
{
body
,
tool
Bar
,
app
Bar
,
bottomSheet
,
snackBar
,
floatingActionButton
,
...
...
@@ -42,18 +42,18 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
void
performLayout
(
Size
size
)
{
BoxConstraints
looseConstraints
=
new
BoxConstraints
.
loose
(
size
);
// This part of the layout has the same effect as putting the
tool
bar and
// This part of the layout has the same effect as putting the
app
bar and
// body in a column and making the body flexible. What's different is that
// in this case the
tool
bar appears -after- the body in the stacking order,
// so the
tool
bar's shadow is drawn on top of the body.
// in this case the
app
bar appears -after- the body in the stacking order,
// so the
app
bar's shadow is drawn on top of the body.
final
BoxConstraints
fullWidthConstraints
=
looseConstraints
.
tighten
(
width:
size
.
width
);
double
contentTop
=
padding
.
top
;
double
contentBottom
=
size
.
height
-
padding
.
bottom
;
if
(
hasChild
(
_ScaffoldSlot
.
tool
Bar
))
{
contentTop
=
layoutChild
(
_ScaffoldSlot
.
tool
Bar
,
fullWidthConstraints
).
height
;
positionChild
(
_ScaffoldSlot
.
tool
Bar
,
Offset
.
zero
);
if
(
hasChild
(
_ScaffoldSlot
.
app
Bar
))
{
contentTop
=
layoutChild
(
_ScaffoldSlot
.
app
Bar
,
fullWidthConstraints
).
height
;
positionChild
(
_ScaffoldSlot
.
app
Bar
,
Offset
.
zero
);
}
if
(
hasChild
(
_ScaffoldSlot
.
body
))
{
...
...
@@ -183,7 +183,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
class
Scaffold
extends
StatefulWidget
{
Scaffold
({
Key
key
,
this
.
tool
Bar
,
this
.
app
Bar
,
this
.
body
,
this
.
floatingActionButton
,
this
.
drawer
,
...
...
@@ -192,10 +192,10 @@ class Scaffold extends StatefulWidget {
this
.
appBarHeight
})
:
super
(
key:
key
)
{
assert
((
appBarBehavior
==
AppBarBehavior
.
scroll
)
?
scrollableKey
!=
null
:
true
);
assert
((
appBarBehavior
==
AppBarBehavior
.
scroll
)
?
appBarHeight
!=
null
&&
appBarHeight
>
k
Tool
BarHeight
:
true
);
assert
((
appBarBehavior
==
AppBarBehavior
.
scroll
)
?
appBarHeight
!=
null
&&
appBarHeight
>
k
App
BarHeight
:
true
);
}
final
ToolBar
tool
Bar
;
final
AppBar
app
Bar
;
final
Widget
body
;
final
Widget
floatingActionButton
;
final
Widget
drawer
;
...
...
@@ -375,12 +375,12 @@ class ScaffoldState extends State<Scaffold> {
bool
_shouldShowBackArrow
;
Widget
_getModified
Tool
Bar
({
EdgeInsets
padding
,
double
foregroundOpacity:
1.0
,
int
elevation
})
{
ToolBar
toolBar
=
config
.
tool
Bar
;
if
(
tool
Bar
==
null
)
Widget
_getModified
App
Bar
({
EdgeInsets
padding
,
double
foregroundOpacity:
1.0
,
int
elevation
})
{
AppBar
appBar
=
config
.
app
Bar
;
if
(
app
Bar
==
null
)
return
null
;
EdgeInsets
tool
BarPadding
=
new
EdgeInsets
.
only
(
top:
padding
.
top
);
Widget
left
=
toolBar
.
left
;
EdgeInsets
app
BarPadding
=
new
EdgeInsets
.
only
(
top:
padding
.
top
);
Widget
left
=
appBar
.
leading
;
if
(
left
==
null
)
{
if
(
config
.
drawer
!=
null
)
{
left
=
new
IconButton
(
...
...
@@ -399,9 +399,9 @@ class ScaffoldState extends State<Scaffold> {
}
}
}
return
tool
Bar
.
copyWith
(
elevation:
elevation
??
tool
Bar
.
elevation
??
4
,
padding:
tool
BarPadding
,
return
app
Bar
.
copyWith
(
elevation:
elevation
??
app
Bar
.
elevation
??
4
,
padding:
app
BarPadding
,
foregroundOpacity:
foregroundOpacity
,
left:
left
);
...
...
@@ -421,9 +421,9 @@ class ScaffoldState extends State<Scaffold> {
return
false
;
}
double
_
tool
BarOpacity
(
double
progress
)
{
// The value of progress is 1.0 if the entire (padded)
tool
bar is visible, 0.0
// if the
tool
bar's height is zero.
double
_
app
BarOpacity
(
double
progress
)
{
// The value of progress is 1.0 if the entire (padded)
app
bar is visible, 0.0
// if the
app
bar's height is zero.
return
new
Tween
<
double
>(
begin:
0.0
,
end:
1.0
).
evaluate
(
new
CurvedAnimation
(
parent:
new
AnimationController
()..
value
=
progress
.
clamp
(
0.0
,
1.0
),
curve:
new
Interval
(
0.50
,
1.0
)
...
...
@@ -431,35 +431,35 @@ class ScaffoldState extends State<Scaffold> {
}
Widget
_buildScrollableAppBar
(
BuildContext
context
)
{
final
EdgeInsets
tool
BarPadding
=
MediaQuery
.
of
(
context
)?.
padding
??
EdgeInsets
.
zero
;
final
double
toolBarHeight
=
kToolBarHeight
+
tool
BarPadding
.
top
;
final
EdgeInsets
app
BarPadding
=
MediaQuery
.
of
(
context
)?.
padding
??
EdgeInsets
.
zero
;
final
double
appBarHeight
=
kAppBarHeight
+
app
BarPadding
.
top
;
Widget
appBar
;
if
(
_scrollOffset
<=
appBarHeight
&&
_scrollOffset
>=
appBarHeight
-
tool
BarHeight
)
{
// scrolled to the top, only the
tool
bar is (partially) visible
if
(
_scrollOffset
<=
appBarHeight
&&
_scrollOffset
>=
appBarHeight
-
app
BarHeight
)
{
// scrolled to the top, only the
app
bar is (partially) visible
final
double
height
=
math
.
max
(
_floatingAppBarHeight
,
appBarHeight
-
_scrollOffset
);
final
double
opacity
=
_
toolBarOpacity
(
1.0
-
((
toolBarHeight
-
height
)
/
tool
BarHeight
));
final
double
opacity
=
_
appBarOpacity
(
1.0
-
((
appBarHeight
-
height
)
/
app
BarHeight
));
_appBarController
.
value
=
(
appBarHeight
-
height
)
/
appBarHeight
;
appBar
=
new
SizedBox
(
height:
height
,
child:
_getModified
ToolBar
(
padding:
tool
BarPadding
,
foregroundOpacity:
opacity
)
child:
_getModified
AppBar
(
padding:
app
BarPadding
,
foregroundOpacity:
opacity
)
);
}
else
if
(
_scrollOffset
>
appBarHeight
)
{
// scrolled down, show the "floating"
tool
bar
_floatingAppBarHeight
=
(
_floatingAppBarHeight
+
_scrollOffsetDelta
).
clamp
(
0.0
,
tool
BarHeight
);
final
double
toolBarOpacity
=
_toolBarOpacity
(
_floatingAppBarHeight
/
tool
BarHeight
);
// scrolled down, show the "floating"
app
bar
_floatingAppBarHeight
=
(
_floatingAppBarHeight
+
_scrollOffsetDelta
).
clamp
(
0.0
,
app
BarHeight
);
final
double
appBarOpacity
=
_appBarOpacity
(
_floatingAppBarHeight
/
app
BarHeight
);
_appBarController
.
value
=
(
appBarHeight
-
_floatingAppBarHeight
)
/
appBarHeight
;
appBar
=
new
SizedBox
(
height:
_floatingAppBarHeight
,
child:
_getModified
ToolBar
(
padding:
toolBarPadding
,
foregroundOpacity:
tool
BarOpacity
)
child:
_getModified
AppBar
(
padding:
appBarPadding
,
foregroundOpacity:
app
BarOpacity
)
);
}
else
{
// _scrollOffset < appBarHeight -
tool
BarHeight, scrolled to the top, flexible space is visible
// _scrollOffset < appBarHeight -
app
BarHeight, scrolled to the top, flexible space is visible
final
double
height
=
appBarHeight
-
_scrollOffset
.
clamp
(
0.0
,
appBarHeight
);
_appBarController
.
value
=
(
appBarHeight
-
height
)
/
appBarHeight
;
appBar
=
new
SizedBox
(
height:
height
,
child:
_getModified
ToolBar
(
padding:
tool
BarPadding
,
elevation:
0
)
child:
_getModified
AppBar
(
padding:
app
BarPadding
,
elevation:
0
)
);
_floatingAppBarHeight
=
0.0
;
}
...
...
@@ -484,13 +484,13 @@ class ScaffoldState extends State<Scaffold> {
final
List
<
LayoutId
>
children
=
new
List
<
LayoutId
>();
_addIfNonNull
(
children
,
config
.
body
,
_ScaffoldSlot
.
body
);
if
(
config
.
appBarBehavior
==
AppBarBehavior
.
anchor
)
{
Widget
tool
Bar
=
new
ConstrainedBox
(
child:
_getModified
Tool
Bar
(
padding:
padding
),
constraints:
new
BoxConstraints
(
maxHeight:
config
.
appBarHeight
??
kExtended
Tool
BarHeight
+
padding
.
top
)
Widget
app
Bar
=
new
ConstrainedBox
(
child:
_getModified
App
Bar
(
padding:
padding
),
constraints:
new
BoxConstraints
(
maxHeight:
config
.
appBarHeight
??
kExtended
App
BarHeight
+
padding
.
top
)
);
_addIfNonNull
(
children
,
toolBar
,
_ScaffoldSlot
.
tool
Bar
);
_addIfNonNull
(
children
,
appBar
,
_ScaffoldSlot
.
app
Bar
);
}
// Otherwise the
ToolBar will be part of a [tool
bar, body] Stack. See AppBarBehavior.scroll below.
// Otherwise the
AppBar will be part of a [app
bar, body] Stack. See AppBarBehavior.scroll below.
if
(
_currentBottomSheet
!=
null
||
(
_dismissedBottomSheets
!=
null
&&
_dismissedBottomSheets
.
isNotEmpty
))
{
...
...
packages/flutter/lib/src/material/snack_bar.dart
View file @
db261ff8
...
...
@@ -132,7 +132,7 @@ class SnackBar extends StatelessWidget {
opacity:
fadeAnimation
,
child:
new
Row
(
children:
children
,
alignItems:
FlexAlignItems
.
center
crossAxisAlignment:
CrossAxisAlignment
.
center
)
)
)
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
db261ff8
...
...
@@ -346,8 +346,8 @@ class _Tab extends StatelessWidget {
),
_buildLabelText
()
],
justifyContent:
FlexJustifyCont
ent
.
center
,
alignItems:
FlexAlignItems
.
center
mainAxisAlignment:
MainAxisAlignm
ent
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
);
}
...
...
@@ -1010,7 +1010,7 @@ class TabPageSelector<T> extends StatelessWidget {
label:
'Page
${selection.index + 1}
of
${selection.values.length}
'
,
child:
new
Row
(
children:
selection
.
values
.
map
((
T
tab
)
=>
_buildTabIndicator
(
selection
,
tab
,
animation
,
selectedColor
,
previousColor
)).
toList
(),
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
);
}
...
...
packages/flutter/lib/src/material/time_picker.dart
View file @
db261ff8
...
...
@@ -135,7 +135,7 @@ class _TimePickerState extends State<TimePicker> {
)
)
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
);
}
}
...
...
@@ -223,12 +223,12 @@ class _TimePickerHeader extends StatelessWidget {
child:
new
Text
(
'PM'
,
style:
pmStyle
)
),
],
justifyContent:
FlexJustifyCont
ent
.
end
mainAxisAlignment:
MainAxisAlignm
ent
.
end
)
)
)
],
justifyContent:
FlexJustifyCont
ent
.
end
mainAxisAlignment:
MainAxisAlignm
ent
.
end
)
);
}
...
...
packages/flutter/lib/src/material/two_level_list.dart
View file @
db261ff8
...
...
@@ -17,18 +17,18 @@ const Duration _kExpand = const Duration(milliseconds: 200);
class
TwoLevelListItem
extends
StatelessWidget
{
TwoLevelListItem
({
Key
key
,
this
.
le
ft
,
this
.
center
,
this
.
right
,
this
.
le
ading
,
this
.
title
,
this
.
trailing
,
this
.
onTap
,
this
.
onLongPress
})
:
super
(
key:
key
)
{
assert
(
center
!=
null
);
assert
(
title
!=
null
);
}
final
Widget
le
ft
;
final
Widget
center
;
final
Widget
right
;
final
Widget
le
ading
;
final
Widget
title
;
final
Widget
trailing
;
final
GestureTapCallback
onTap
;
final
GestureLongPressCallback
onLongPress
;
...
...
@@ -39,9 +39,9 @@ class TwoLevelListItem extends StatelessWidget {
return
new
SizedBox
(
height:
kListItemExtent
[
parentList
.
type
],
child:
new
ListItem
(
le
ft:
left
,
primary:
center
,
right:
right
,
le
ading:
leading
,
title:
title
,
trailing:
trailing
,
onTap:
onTap
,
onLongPress:
onLongPress
)
...
...
@@ -108,12 +108,12 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> {
children:
<
Widget
>[
new
TwoLevelListItem
(
onTap:
_handleOnTap
,
le
ft
:
config
.
left
,
center
:
new
DefaultTextStyle
(
le
ading
:
config
.
left
,
title
:
new
DefaultTextStyle
(
style:
Theme
.
of
(
context
).
textTheme
.
subhead
.
copyWith
(
color:
_headerColor
.
evaluate
(
_easeInAnimation
)),
child:
config
.
center
),
right
:
new
RotationTransition
(
trailing
:
new
RotationTransition
(
turns:
_iconTurns
,
child:
new
Icon
(
icon:
Icons
.
expand_more
,
...
...
packages/flutter/lib/src/rendering/flex.dart
View file @
db261ff8
...
...
@@ -29,7 +29,7 @@ enum FlexDirection {
}
/// How the children should be placed along the main axis in a flex layout
enum
FlexJustifyCont
ent
{
enum
MainAxisAlignm
ent
{
/// Place the children as close to the start of the main axis as possible
start
,
/// Place the children as close to the end of the main axis as possible
...
...
@@ -45,7 +45,7 @@ enum FlexJustifyContent {
}
/// How the children should be placed along the cross axis in a flex layout
enum
FlexAlignItems
{
enum
CrossAxisAlignment
{
/// Place the children as close to the start of the cross axis as possible
start
,
/// Place the children as close to the end of the cross axis as possible
...
...
@@ -70,23 +70,23 @@ typedef double _ChildSizingFunction(RenderBox child, BoxConstraints constraints)
/// children. Otherwise, the flex expands to the maximum max-axis size and the
/// remaining space along is divided among the flexible children according to
/// their flex factors. Any remaining free space (i.e., if there aren't any
/// flexible children) is allocated according to the [
justifyCont
ent] property.
/// flexible children) is allocated according to the [
mainAxisAlignm
ent] property.
///
/// In the cross axis, children determine their own size. The flex then sizes
/// its cross axis to fix the largest of its children. The children are then
/// positioned along the cross axis according to the [
alignItems
] property.
/// positioned along the cross axis according to the [
crossAxisAlignment
] property.
class
RenderFlex
extends
RenderBox
with
ContainerRenderObjectMixin
<
RenderBox
,
FlexParentData
>,
RenderBoxContainerDefaultsMixin
<
RenderBox
,
FlexParentData
>
{
RenderFlex
({
List
<
RenderBox
>
children
,
FlexDirection
direction:
FlexDirection
.
horizontal
,
FlexJustifyContent
justifyContent:
FlexJustifyCont
ent
.
start
,
FlexAlignItems
alignItems:
FlexAlignItems
.
center
,
MainAxisAlignment
mainAxisAlignment:
MainAxisAlignm
ent
.
start
,
CrossAxisAlignment
crossAxisAlignment:
CrossAxisAlignment
.
center
,
TextBaseline
textBaseline
})
:
_direction
=
direction
,
_
justifyContent
=
justifyCont
ent
,
_
alignItems
=
alignItems
,
_
mainAxisAlignment
=
mainAxisAlignm
ent
,
_
crossAxisAlignment
=
crossAxisAlignment
,
_textBaseline
=
textBaseline
{
addAll
(
children
);
}
...
...
@@ -102,21 +102,21 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
/// How the children should be placed along the main axis
FlexJustifyContent
get
justifyContent
=>
_justifyCont
ent
;
FlexJustifyContent
_justifyCont
ent
;
void
set
justifyContent
(
FlexJustifyCont
ent
value
)
{
if
(
_
justifyCont
ent
!=
value
)
{
_
justifyCont
ent
=
value
;
MainAxisAlignment
get
mainAxisAlignment
=>
_mainAxisAlignm
ent
;
MainAxisAlignment
_mainAxisAlignm
ent
;
void
set
mainAxisAlignment
(
MainAxisAlignm
ent
value
)
{
if
(
_
mainAxisAlignm
ent
!=
value
)
{
_
mainAxisAlignm
ent
=
value
;
markNeedsLayout
();
}
}
/// How the children should be placed along the cross axis
FlexAlignItems
get
alignItems
=>
_alignItems
;
FlexAlignItems
_alignItems
;
void
set
alignItems
(
FlexAlignItems
value
)
{
if
(
_
alignItems
!=
value
)
{
_
alignItems
=
value
;
CrossAxisAlignment
get
crossAxisAlignment
=>
_crossAxisAlignment
;
CrossAxisAlignment
_crossAxisAlignment
;
void
set
crossAxisAlignment
(
CrossAxisAlignment
value
)
{
if
(
_
crossAxisAlignment
!=
value
)
{
_
crossAxisAlignment
=
value
;
markNeedsLayout
();
}
}
...
...
@@ -336,7 +336,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
int
totalChildren
=
0
;
assert
(
constraints
!=
null
);
final
double
mainSize
=
(
_direction
==
FlexDirection
.
horizontal
)
?
constraints
.
constrainWidth
()
:
constraints
.
constrainHeight
();
final
bool
canFlex
=
mainSize
<
double
.
INFINITY
&&
justifyContent
!=
FlexJustifyCont
ent
.
collapse
;
final
bool
canFlex
=
mainSize
<
double
.
INFINITY
&&
mainAxisAlignment
!=
MainAxisAlignm
ent
.
collapse
;
double
crossSize
=
0.0
;
// This is determined as we lay out the children
double
freeSpace
=
canFlex
?
mainSize
:
0.0
;
RenderBox
child
=
firstChild
;
...
...
@@ -352,7 +352,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
totalFlex
+=
childParentData
.
flex
;
}
else
{
BoxConstraints
innerConstraints
;
if
(
alignItems
==
FlexAlignItems
.
stretch
)
{
if
(
crossAxisAlignment
==
CrossAxisAlignment
.
stretch
)
{
switch
(
_direction
)
{
case
FlexDirection
.
horizontal
:
innerConstraints
=
new
BoxConstraints
(
minHeight:
constraints
.
maxHeight
,
...
...
@@ -386,7 +386,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
// Distribute remaining space to flexible children, and determine baseline.
double
maxBaselineDistance
=
0.0
;
double
usedSpace
=
0.0
;
if
(
totalFlex
>
0
||
alignItems
==
FlexAlignItems
.
baseline
)
{
if
(
totalFlex
>
0
||
crossAxisAlignment
==
CrossAxisAlignment
.
baseline
)
{
double
spacePerFlex
=
totalFlex
>
0
?
(
freeSpace
/
totalFlex
)
:
0.0
;
child
=
firstChild
;
while
(
child
!=
null
)
{
...
...
@@ -394,7 +394,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if
(
flex
>
0
)
{
double
spaceForChild
=
spacePerFlex
*
flex
;
BoxConstraints
innerConstraints
;
if
(
alignItems
==
FlexAlignItems
.
stretch
)
{
if
(
crossAxisAlignment
==
CrossAxisAlignment
.
stretch
)
{
switch
(
_direction
)
{
case
FlexDirection
.
horizontal
:
innerConstraints
=
new
BoxConstraints
(
minWidth:
spaceForChild
,
...
...
@@ -427,7 +427,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
usedSpace
+=
_getMainSize
(
child
);
crossSize
=
math
.
max
(
crossSize
,
_getCrossSize
(
child
));
}
if
(
alignItems
==
FlexAlignItems
.
baseline
)
{
if
(
crossAxisAlignment
==
CrossAxisAlignment
.
baseline
)
{
assert
(
textBaseline
!=
null
&&
'To use FlexAlignItems.baseline, you must also specify which baseline to use using the "baseline" argument.'
is
String
);
double
distance
=
child
.
getDistanceToBaseline
(
textBaseline
,
onlyReal:
true
);
if
(
distance
!=
null
)
...
...
@@ -473,25 +473,25 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
_overflow
=
0.0
;
}
switch
(
_
justifyCont
ent
)
{
case
FlexJustifyCont
ent
.
start
:
case
FlexJustifyCont
ent
.
collapse
:
switch
(
_
mainAxisAlignm
ent
)
{
case
MainAxisAlignm
ent
.
start
:
case
MainAxisAlignm
ent
.
collapse
:
leadingSpace
=
0.0
;
betweenSpace
=
0.0
;
break
;
case
FlexJustifyCont
ent
.
end
:
case
MainAxisAlignm
ent
.
end
:
leadingSpace
=
remainingSpace
;
betweenSpace
=
0.0
;
break
;
case
FlexJustifyCont
ent
.
center
:
case
MainAxisAlignm
ent
.
center
:
leadingSpace
=
remainingSpace
/
2.0
;
betweenSpace
=
0.0
;
break
;
case
FlexJustifyCont
ent
.
spaceBetween
:
case
MainAxisAlignm
ent
.
spaceBetween
:
leadingSpace
=
0.0
;
betweenSpace
=
totalChildren
>
1
?
remainingSpace
/
(
totalChildren
-
1
)
:
0.0
;
break
;
case
FlexJustifyCont
ent
.
spaceAround
:
case
MainAxisAlignm
ent
.
spaceAround
:
betweenSpace
=
totalChildren
>
0
?
remainingSpace
/
totalChildren
:
0.0
;
leadingSpace
=
betweenSpace
/
2.0
;
break
;
...
...
@@ -503,18 +503,18 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
while
(
child
!=
null
)
{
final
FlexParentData
childParentData
=
child
.
parentData
;
double
childCrossPosition
;
switch
(
_
alignItems
)
{
case
FlexAlignItems
.
stretch
:
case
FlexAlignItems
.
start
:
switch
(
_
crossAxisAlignment
)
{
case
CrossAxisAlignment
.
stretch
:
case
CrossAxisAlignment
.
start
:
childCrossPosition
=
0.0
;
break
;
case
FlexAlignItems
.
end
:
case
CrossAxisAlignment
.
end
:
childCrossPosition
=
crossSize
-
_getCrossSize
(
child
);
break
;
case
FlexAlignItems
.
center
:
case
CrossAxisAlignment
.
center
:
childCrossPosition
=
crossSize
/
2.0
-
_getCrossSize
(
child
)
/
2.0
;
break
;
case
FlexAlignItems
.
baseline
:
case
CrossAxisAlignment
.
baseline
:
childCrossPosition
=
0.0
;
if
(
_direction
==
FlexDirection
.
horizontal
)
{
assert
(
textBaseline
!=
null
);
...
...
@@ -595,8 +595,8 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
void
debugFillDescription
(
List
<
String
>
description
)
{
super
.
debugFillDescription
(
description
);
description
.
add
(
'direction:
$_direction
'
);
description
.
add
(
'
justifyContent:
$_justifyCont
ent
'
);
description
.
add
(
'
alignItems:
$_alignItems
'
);
description
.
add
(
'
mainAxisAlignment:
$_mainAxisAlignm
ent
'
);
description
.
add
(
'
crossAxisAlignment:
$_crossAxisAlignment
'
);
description
.
add
(
'textBaseline:
$_textBaseline
'
);
}
...
...
packages/flutter/lib/src/widgets/app.dart
View file @
db261ff8
...
...
@@ -28,12 +28,6 @@ AssetBundle _initDefaultBundle() {
final
AssetBundle
_defaultBundle
=
_initDefaultBundle
();
class
RouteArguments
{
const
RouteArguments
({
this
.
context
});
final
BuildContext
context
;
}
typedef
Widget
RouteBuilder
(
RouteArguments
args
);
typedef
Future
<
LocaleQueryData
>
LocaleChangedCallback
(
Locale
locale
);
class
WidgetsApp
extends
StatefulWidget
{
...
...
@@ -42,7 +36,7 @@ class WidgetsApp extends StatefulWidget {
this
.
title
,
this
.
textStyle
,
this
.
color
,
this
.
routes
:
const
<
String
,
Route
Builder
>{},
this
.
routes
:
const
<
String
,
Widget
Builder
>{},
this
.
onGenerateRoute
,
this
.
onLocaleChanged
,
this
.
showPerformanceOverlay
:
false
,
...
...
@@ -72,7 +66,7 @@ class WidgetsApp extends StatefulWidget {
/// [Navigator] is given a named route, the name will be looked up
/// in this table first. If the name is not available, then
/// [onGenerateRoute] will be called instead.
final
Map
<
String
,
Route
Builder
>
routes
;
final
Map
<
String
,
Widget
Builder
>
routes
;
/// The route generator callback used when the app is navigated to a
/// named route but the name is not in the [routes] table.
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
db261ff8
...
...
@@ -17,9 +17,9 @@ export 'package:flutter/rendering.dart' show
CustomClipper
,
CustomPainter
,
FixedColumnCountGridDelegate
,
FlexAlignItems
,
CrossAxisAlignment
,
FlexDirection
,
FlexJustifyCont
ent
,
MainAxisAlignm
ent
,
FractionalOffsetTween
,
GridDelegate
,
GridDelegateWithInOrderChildPlacement
,
...
...
@@ -1355,27 +1355,27 @@ class Flex extends MultiChildRenderObjectWidget {
Key
key
,
List
<
Widget
>
children:
_emptyWidgetList
,
this
.
direction
:
FlexDirection
.
horizontal
,
this
.
justifyContent
:
FlexJustifyCont
ent
.
start
,
this
.
alignItems
:
FlexAlignItems
.
center
,
this
.
mainAxisAlignment
:
MainAxisAlignm
ent
.
start
,
this
.
crossAxisAlignment
:
CrossAxisAlignment
.
center
,
this
.
textBaseline
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
direction
!=
null
);
assert
(
justifyCont
ent
!=
null
);
assert
(
alignItems
!=
null
);
assert
(
mainAxisAlignm
ent
!=
null
);
assert
(
crossAxisAlignment
!=
null
);
}
final
FlexDirection
direction
;
final
FlexJustifyContent
justifyCont
ent
;
final
FlexAlignItems
alignItems
;
final
MainAxisAlignment
mainAxisAlignm
ent
;
final
CrossAxisAlignment
crossAxisAlignment
;
final
TextBaseline
textBaseline
;
RenderFlex
createRenderObject
(
BuildContext
context
)
=>
new
RenderFlex
(
direction:
direction
,
justifyContent:
justifyContent
,
alignItems:
alignItems
,
textBaseline:
textBaseline
);
RenderFlex
createRenderObject
(
BuildContext
context
)
=>
new
RenderFlex
(
direction:
direction
,
mainAxisAlignment:
mainAxisAlignment
,
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
textBaseline
);
void
updateRenderObject
(
BuildContext
context
,
RenderFlex
renderObject
)
{
renderObject
..
direction
=
direction
..
justifyContent
=
justifyCont
ent
..
alignItems
=
alignItems
..
mainAxisAlignment
=
mainAxisAlignm
ent
..
crossAxisAlignment
=
crossAxisAlignment
..
textBaseline
=
textBaseline
;
}
}
...
...
@@ -1388,15 +1388,15 @@ class Row extends Flex {
Row
({
Key
key
,
List
<
Widget
>
children:
_emptyWidgetList
,
FlexJustifyContent
justifyContent:
FlexJustifyCont
ent
.
start
,
FlexAlignItems
alignItems:
FlexAlignItems
.
center
,
MainAxisAlignment
mainAxisAlignment:
MainAxisAlignm
ent
.
start
,
CrossAxisAlignment
crossAxisAlignment:
CrossAxisAlignment
.
center
,
TextBaseline
textBaseline
})
:
super
(
children:
children
,
key:
key
,
direction:
FlexDirection
.
horizontal
,
justifyContent:
justifyCont
ent
,
alignItems:
alignItems
,
mainAxisAlignment:
mainAxisAlignm
ent
,
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
textBaseline
);
}
...
...
@@ -1409,15 +1409,15 @@ class Column extends Flex {
Column
({
Key
key
,
List
<
Widget
>
children:
_emptyWidgetList
,
FlexJustifyContent
justifyContent:
FlexJustifyCont
ent
.
start
,
FlexAlignItems
alignItems:
FlexAlignItems
.
center
,
MainAxisAlignment
mainAxisAlignment:
MainAxisAlignm
ent
.
start
,
CrossAxisAlignment
crossAxisAlignment:
CrossAxisAlignment
.
center
,
TextBaseline
textBaseline
})
:
super
(
children:
children
,
key:
key
,
direction:
FlexDirection
.
vertical
,
justifyContent:
justifyCont
ent
,
alignItems:
alignItems
,
mainAxisAlignment:
mainAxisAlignm
ent
,
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
textBaseline
);
}
...
...
packages/flutter/lib/src/widgets/dismissable.dart
View file @
db261ff8
...
...
@@ -25,11 +25,13 @@ enum DismissDirection {
/// The [Dismissable] can be dismissed by dragging either left or right.
horizontal
,
/// The [Dismissable] can be dismissed by dragging left only.
left
,
/// The [Dismissable] can be dismissed by dragging in the reverse of the
/// reading direction (e.g., from right to left in left-to-right languages).
endToStart
,
/// The [Dismissable] can be dismissed by dragging right only.
right
,
/// The [Dismissable] can be dismissed by dragging in the reading direction
/// (e.g., from left to right in left-to-right languages).
startToEnd
,
/// The [Dismissable] can be dismissed by dragging up only.
up
,
...
...
@@ -115,13 +117,13 @@ class _DismissableState extends State<Dismissable> {
bool
get
_directionIsXAxis
{
return
config
.
direction
==
DismissDirection
.
horizontal
||
config
.
direction
==
DismissDirection
.
lef
t
||
config
.
direction
==
DismissDirection
.
right
;
||
config
.
direction
==
DismissDirection
.
endToStar
t
||
config
.
direction
==
DismissDirection
.
startToEnd
;
}
DismissDirection
get
_dismissDirection
{
if
(
_directionIsXAxis
)
return
_dragExtent
>
0
?
DismissDirection
.
right
:
DismissDirection
.
lef
t
;
return
_dragExtent
>
0
?
DismissDirection
.
startToEnd
:
DismissDirection
.
endToStar
t
;
return
_dragExtent
>
0
?
DismissDirection
.
down
:
DismissDirection
.
up
;
}
...
...
@@ -162,13 +164,13 @@ class _DismissableState extends State<Dismissable> {
break
;
case
DismissDirection
.
up
:
case
DismissDirection
.
lef
t
:
case
DismissDirection
.
endToStar
t
:
if
(
_dragExtent
+
delta
<
0
)
_dragExtent
+=
delta
;
break
;
case
DismissDirection
.
down
:
case
DismissDirection
.
right
:
case
DismissDirection
.
startToEnd
:
if
(
_dragExtent
+
delta
>
0
)
_dragExtent
+=
delta
;
break
;
...
...
@@ -201,7 +203,7 @@ class _DismissableState extends State<Dismissable> {
switch
(
config
.
direction
)
{
case
DismissDirection
.
horizontal
:
return
vx
.
abs
()
>
_kMinFlingVelocity
;
case
DismissDirection
.
lef
t
:
case
DismissDirection
.
endToStar
t
:
return
-
vx
>
_kMinFlingVelocity
;
default
:
return
vx
>
_kMinFlingVelocity
;
...
...
@@ -275,7 +277,7 @@ class _DismissableState extends State<Dismissable> {
Widget
background
=
config
.
background
;
if
(
config
.
secondaryBackground
!=
null
)
{
final
DismissDirection
direction
=
_dismissDirection
;
if
(
direction
==
DismissDirection
.
lef
t
||
direction
==
DismissDirection
.
up
)
if
(
direction
==
DismissDirection
.
endToStar
t
||
direction
==
DismissDirection
.
up
)
background
=
config
.
secondaryBackground
;
}
...
...
packages/flutter/lib/src/widgets/pageable_list.dart
View file @
db261ff8
...
...
@@ -12,10 +12,10 @@ import 'scroll_behavior.dart';
import
'scrollable.dart'
;
import
'virtual_viewport.dart'
;
/// Controls
what alignment items use when sett
ling.
enum
ItemsSnapAlignment
{
item
,
adjacentItem
/// Controls
how a pageable list should behave during a f
ling.
enum
PageableListFlingBehavior
{
canFlingAcrossMultiplePages
,
stopAtNextPage
}
/// Scrollable widget that scrolls one "page" at a time.
...
...
@@ -33,7 +33,7 @@ class PageableList extends Scrollable {
ScrollListener
onScrollEnd
,
SnapOffsetCallback
snapOffsetCallback
,
this
.
itemsWrap
:
false
,
this
.
itemsSnapAlignment
:
ItemsSnapAlignment
.
adjacentItem
,
this
.
itemsSnapAlignment
:
PageableListFlingBehavior
.
stopAtNextPage
,
this
.
onPageChanged
,
this
.
scrollableListPainter
,
this
.
duration
:
const
Duration
(
milliseconds:
200
),
...
...
@@ -48,13 +48,15 @@ class PageableList extends Scrollable {
onScroll:
onScroll
,
onScrollEnd:
onScrollEnd
,
snapOffsetCallback:
snapOffsetCallback
);
)
{
assert
(
itemsSnapAlignment
!=
null
);
}
/// Whether the first item should be revealed after scrolling past the last item.
final
bool
itemsWrap
;
/// Controls whether a fling always reveals the adjacent item or whether flings can traverse many items.
final
ItemsSnapAlignment
itemsSnapAlignment
;
final
PageableListFlingBehavior
itemsSnapAlignment
;
/// Called when the currently visible page changes.
final
ValueChanged
<
int
>
onPageChanged
;
...
...
@@ -187,7 +189,7 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
ScrollBehavior
<
double
,
double
>
createScrollBehavior
()
=>
scrollBehavior
;
bool
get
shouldSnapScrollOffset
=>
config
.
itemsSnapAlignment
==
ItemsSnapAlignment
.
item
;
bool
get
shouldSnapScrollOffset
=>
config
.
itemsSnapAlignment
==
PageableListFlingBehavior
.
canFlingAcrossMultiplePages
;
double
snapScrollOffset
(
double
newScrollOffset
)
{
final
double
previousItemOffset
=
newScrollOffset
.
floorToDouble
();
...
...
@@ -205,10 +207,10 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
Future
<
Null
>
fling
(
double
scrollVelocity
)
{
switch
(
config
.
itemsSnapAlignment
)
{
case
ItemsSnapAlignment
.
adjacentItem
:
return
_flingToAdjacentItem
(
scrollVelocity
);
default
:
case
PageableListFlingBehavior
.
canFlingAcrossMultiplePages
:
return
super
.
fling
(
scrollVelocity
).
then
(
_notifyPageChanged
);
case
PageableListFlingBehavior
.
stopAtNextPage
:
return
_flingToAdjacentItem
(
scrollVelocity
);
}
}
...
...
packages/flutter/test/rendering/box_test.dart
View file @
db261ff8
...
...
@@ -40,7 +40,7 @@ void main() {
RenderBox
flex
=
new
RenderFlex
(
children:
<
RenderBox
>[
padding
],
direction:
FlexDirection
.
vertical
,
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
);
RenderBox
outer
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
...
...
packages/flutter/test/rendering/flex_test.dart
View file @
db261ff8
...
...
@@ -80,7 +80,7 @@ void main() {
test
(
'Defaults'
,
()
{
RenderFlex
flex
=
new
RenderFlex
();
expect
(
flex
.
alignItems
,
equals
(
FlexAlignItems
.
center
));
expect
(
flex
.
crossAxisAlignment
,
equals
(
CrossAxisAlignment
.
center
));
expect
(
flex
.
direction
,
equals
(
FlexDirection
.
horizontal
));
});
...
...
@@ -122,7 +122,7 @@ void main() {
expect
(
box2
.
size
.
width
,
equals
(
100.0
));
expect
(
box2
.
size
.
height
,
equals
(
0.0
));
flex
.
alignItems
=
FlexAlignItems
.
stretch
;
flex
.
crossAxisAlignment
=
CrossAxisAlignment
.
stretch
;
pumpFrame
();
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
100.0
));
...
...
packages/flutter/test/widget/bottom_sheet_rebuild_test.dart
View file @
db261ff8
...
...
@@ -14,8 +14,8 @@ void main() {
int
buildCount
=
0
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
scaffoldKey
,
body:
new
Center
(
child:
new
Text
(
'body'
))
...
...
packages/flutter/test/widget/bottom_sheet_test.dart
View file @
db261ff8
...
...
@@ -14,9 +14,9 @@ void main() {
bool
showBottomSheetThenCalled
=
false
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
context
=
args
.
context
;
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
ctx
)
{
context
=
ctx
;
return
new
Container
();
}
}
...
...
@@ -66,8 +66,8 @@ void main() {
bool
showBottomSheetThenCalled
=
false
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
scaffoldKey
,
body:
new
Center
(
child:
new
Text
(
'body'
))
...
...
packages/flutter/test/widget/dismissable_test.dart
View file @
db261ff8
...
...
@@ -58,13 +58,13 @@ void dismissElement(WidgetTester tester, Element itemElement, { DismissDirection
Point
downLocation
;
Point
upLocation
;
switch
(
gestureDirection
)
{
case
DismissDirection
.
lef
t
:
case
DismissDirection
.
endToStar
t
:
// getTopRight() returns a point that's just beyond itemWidget's right
// edge and outside the Dismissable event listener's bounds.
downLocation
=
tester
.
getTopRight
(
itemElement
)
+
const
Offset
(-
0.1
,
0.0
);
upLocation
=
tester
.
getTopLeft
(
itemElement
);
break
;
case
DismissDirection
.
right
:
case
DismissDirection
.
startToEnd
:
// we do the same thing here to keep the test symmetric
downLocation
=
tester
.
getTopLeft
(
itemElement
)
+
const
Offset
(
0.1
,
0.0
);
upLocation
=
tester
.
getTopRight
(
itemElement
);
...
...
@@ -129,15 +129,15 @@ void main() {
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
right
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
startToEnd
);
expect
(
tester
.
findText
(
'0'
),
isNull
);
expect
(
dismissedItems
,
equals
([
0
]));
expect
(
reportedDismissDirection
,
DismissDirection
.
right
);
expect
(
reportedDismissDirection
,
DismissDirection
.
startToEnd
);
dismissItem
(
tester
,
1
,
gestureDirection:
DismissDirection
.
lef
t
);
dismissItem
(
tester
,
1
,
gestureDirection:
DismissDirection
.
endToStar
t
);
expect
(
tester
.
findText
(
'1'
),
isNull
);
expect
(
dismissedItems
,
equals
([
0
,
1
]));
expect
(
reportedDismissDirection
,
DismissDirection
.
lef
t
);
expect
(
reportedDismissDirection
,
DismissDirection
.
endToStar
t
);
});
});
...
...
@@ -165,38 +165,38 @@ void main() {
test
(
'drag-left with DismissDirection.left triggers dismiss'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
Axis
.
vertical
;
dismissDirection
=
DismissDirection
.
lef
t
;
dismissDirection
=
DismissDirection
.
endToStar
t
;
dismissedItems
=
<
int
>[];
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
right
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
startToEnd
);
expect
(
tester
.
findText
(
'0'
),
isNotNull
);
expect
(
dismissedItems
,
isEmpty
);
dismissItem
(
tester
,
1
,
gestureDirection:
DismissDirection
.
right
);
dismissItem
(
tester
,
1
,
gestureDirection:
DismissDirection
.
startToEnd
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
lef
t
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
endToStar
t
);
expect
(
tester
.
findText
(
'0'
),
isNull
);
expect
(
dismissedItems
,
equals
([
0
]));
dismissItem
(
tester
,
1
,
gestureDirection:
DismissDirection
.
lef
t
);
dismissItem
(
tester
,
1
,
gestureDirection:
DismissDirection
.
endToStar
t
);
});
});
test
(
'drag-right with DismissDirection.right triggers dismiss'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
Axis
.
vertical
;
dismissDirection
=
DismissDirection
.
right
;
dismissDirection
=
DismissDirection
.
startToEnd
;
dismissedItems
=
<
int
>[];
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
lef
t
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
endToStar
t
);
expect
(
tester
.
findText
(
'0'
),
isNotNull
);
expect
(
dismissedItems
,
isEmpty
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
right
);
dismissItem
(
tester
,
0
,
gestureDirection:
DismissDirection
.
startToEnd
);
expect
(
tester
.
findText
(
'0'
),
isNull
);
expect
(
dismissedItems
,
equals
([
0
]));
});
...
...
@@ -292,12 +292,12 @@ void main() {
));
expect
(
tester
.
findText
(
'1'
),
isNotNull
);
expect
(
tester
.
findText
(
'2'
),
isNotNull
);
dismissElement
(
tester
,
tester
.
findText
(
'2'
),
gestureDirection:
DismissDirection
.
right
);
dismissElement
(
tester
,
tester
.
findText
(
'2'
),
gestureDirection:
DismissDirection
.
startToEnd
);
tester
.
pump
();
// start the slide away
tester
.
pump
(
new
Duration
(
seconds:
1
));
// finish the slide away
expect
(
tester
.
findText
(
'1'
),
isNotNull
);
expect
(
tester
.
findText
(
'2'
),
isNull
);
dismissElement
(
tester
,
tester
.
findText
(
'1'
),
gestureDirection:
DismissDirection
.
right
);
dismissElement
(
tester
,
tester
.
findText
(
'1'
),
gestureDirection:
DismissDirection
.
startToEnd
);
tester
.
pump
();
// start the slide away
tester
.
pump
(
new
Duration
(
seconds:
1
));
// finish the slide away (at which point the child is no longer included in the tree)
expect
(
tester
.
findText
(
'1'
),
isNull
);
...
...
packages/flutter/test/widget/draggable_test.dart
View file @
db261ff8
...
...
@@ -12,8 +12,8 @@ void main() {
List
<
dynamic
>
accepted
=
<
dynamic
>[];
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
return
new
Column
(
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Column
(
children:
<
Widget
>[
new
Draggable
<
int
>(
data:
1
,
...
...
@@ -75,8 +75,8 @@ void main() {
Point
firstLocation
,
secondLocation
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
return
new
Column
(
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Column
(
children:
<
Widget
>[
new
Draggable
<
int
>(
data:
1
,
...
...
@@ -173,8 +173,8 @@ void main() {
Point
firstLocation
,
secondLocation
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
return
new
Column
(
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Column
(
children:
<
Widget
>[
new
Draggable
<
int
>(
data:
1
,
...
...
@@ -234,8 +234,8 @@ void main() {
Point
firstLocation
,
secondLocation
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
return
new
Column
(
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Column
(
children:
<
Widget
>[
new
LongPressDraggable
<
int
>(
data:
1
,
...
...
@@ -285,8 +285,8 @@ void main() {
Point
firstLocation
,
secondLocation
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
return
new
Column
(
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Column
(
children:
<
Widget
>[
new
Draggable
<
int
>(
data:
1
,
...
...
@@ -337,8 +337,8 @@ void main() {
Point
firstLocation
,
secondLocation
,
thirdLocation
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Block
(
children:
<
Widget
>[
new
DragTarget
<
int
>(
...
...
@@ -448,8 +448,8 @@ void main() {
Point
firstLocation
,
secondLocation
,
thirdLocation
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Block
(
scrollDirection:
Axis
.
horizontal
,
children:
<
Widget
>[
...
...
packages/flutter/test/widget/drawer_test.dart
View file @
db261ff8
...
...
@@ -15,9 +15,9 @@ void main() {
BuildContext
context
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
context
=
args
.
context
;
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
ctx
)
{
context
=
ctx
;
return
new
Scaffold
(
key:
scaffoldKey
,
drawer:
new
Text
(
'drawer'
),
...
...
@@ -48,8 +48,8 @@ void main() {
tester
.
pumpWidget
(
new
Container
());
// throw away the old App and its Navigator
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
scaffoldKey
,
drawer:
new
Text
(
'drawer'
),
...
...
packages/flutter/test/widget/flex_test.dart
View file @
db261ff8
...
...
@@ -54,7 +54,7 @@ void main() {
test
(
'Row, Column and FlexJustifyContent.collapse'
,
()
{
final
Key
flexKey
=
new
Key
(
'flexKey'
);
// Row without
justifyCont
ent: FlexJustifyContent.collapse
// Row without
mainAxisAlignm
ent: FlexJustifyContent.collapse
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Center
(
child:
new
Row
(
...
...
@@ -69,7 +69,7 @@ void main() {
expect
(
renderBox
.
size
.
width
,
equals
(
800.0
));
expect
(
renderBox
.
size
.
height
,
equals
(
100.0
));
// Row with
justifyCont
ent: FlexJustifyContent.collapse
// Row with
mainAxisAlignm
ent: FlexJustifyContent.collapse
tester
.
pumpWidget
(
new
Center
(
child:
new
Row
(
children:
<
Widget
>[
...
...
@@ -77,7 +77,7 @@ void main() {
new
Container
(
width:
30.0
,
height:
100.0
)
],
key:
flexKey
,
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
));
renderBox
=
tester
.
findElementByKey
(
flexKey
).
renderObject
;
...
...
@@ -85,7 +85,7 @@ void main() {
expect
(
renderBox
.
size
.
height
,
equals
(
100.0
));
});
// Column without
justifyCont
ent: FlexJustifyContent.collapse
// Column without
mainAxisAlignm
ent: FlexJustifyContent.collapse
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Center
(
child:
new
Column
(
...
...
@@ -100,7 +100,7 @@ void main() {
expect
(
renderBox
.
size
.
width
,
equals
(
100.0
));
expect
(
renderBox
.
size
.
height
,
equals
(
600.0
));
// Column with
justifyCont
ent: FlexJustifyContent.collapse
// Column with
mainAxisAlignm
ent: FlexJustifyContent.collapse
tester
.
pumpWidget
(
new
Center
(
child:
new
Column
(
children:
<
Widget
>[
...
...
@@ -108,7 +108,7 @@ void main() {
new
Container
(
width:
100.0
,
height:
150.0
)
],
key:
flexKey
,
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
));
renderBox
=
tester
.
findElementByKey
(
flexKey
).
renderObject
;
...
...
@@ -133,7 +133,7 @@ void main() {
height:
100.0
)
],
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
)
));
...
...
@@ -154,7 +154,7 @@ void main() {
height:
100.0
)
],
justifyContent:
FlexJustifyCont
ent
.
collapse
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
)
)
));
...
...
packages/flutter/test/widget/heroes_test.dart
View file @
db261ff8
...
...
@@ -12,21 +12,21 @@ Key firstKey = new Key('first');
Key
secondKey
=
new
Key
(
'second'
);
Key
thirdKey
=
new
Key
(
'third'
);
final
Map
<
String
,
RouteBuilder
>
routes
=
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
Material
(
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
Material
(
child:
new
Block
(
children:
<
Widget
>[
new
Container
(
height:
100.0
,
width:
100.0
),
new
Card
(
child:
new
Hero
(
tag:
'a'
,
child:
new
Container
(
height:
100.0
,
width:
100.0
,
key:
firstKey
))),
new
Container
(
height:
100.0
,
width:
100.0
),
new
FlatButton
(
child:
new
Text
(
'two'
),
onPressed:
()
=>
Navigator
.
pushNamed
(
args
.
context
,
'/two'
)),
new
FlatButton
(
child:
new
Text
(
'two'
),
onPressed:
()
=>
Navigator
.
pushNamed
(
context
,
'/two'
)),
])
),
'/two'
:
(
RouteArguments
args
)
=>
new
Material
(
'/two'
:
(
BuildContext
context
)
=>
new
Material
(
child:
new
Block
(
children:
<
Widget
>[
new
Container
(
height:
150.0
,
width:
150.0
),
new
Card
(
child:
new
Hero
(
tag:
'a'
,
child:
new
Container
(
height:
150.0
,
width:
150.0
,
key:
secondKey
))),
new
Container
(
height:
150.0
,
width:
150.0
),
new
FlatButton
(
child:
new
Text
(
'three'
),
onPressed:
()
=>
Navigator
.
push
(
args
.
context
,
new
ThreeRoute
())),
new
FlatButton
(
child:
new
Text
(
'three'
),
onPressed:
()
=>
Navigator
.
push
(
context
,
new
ThreeRoute
())),
])
),
};
...
...
packages/flutter/test/widget/modal_barrier_test.dart
View file @
db261ff8
...
...
@@ -61,9 +61,9 @@ void main() {
test
(
'ModalBarrier pops the Navigator when dismissed'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
final
Map
<
String
,
RouteBuilder
>
routes
=
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
FirstWidget
(),
'/modal'
:
(
RouteArguments
args
)
=>
new
SecondWidget
(),
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
FirstWidget
(),
'/modal'
:
(
BuildContext
context
)
=>
new
SecondWidget
(),
};
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
routes
));
...
...
packages/flutter/test/widget/navigator_test.dart
View file @
db261ff8
...
...
@@ -66,9 +66,9 @@ class ThirdWidget extends StatelessWidget {
void
main
(
)
{
test
(
'Can navigator navigate to and from a stateful widget'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
final
Map
<
String
,
RouteBuilder
>
routes
=
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
FirstWidget
(),
'/second'
:
(
RouteArguments
args
)
=>
new
SecondWidget
(),
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
FirstWidget
(),
'/second'
:
(
BuildContext
context
)
=>
new
SecondWidget
(),
};
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
routes
));
...
...
packages/flutter/test/widget/page_transitions_test.dart
View file @
db261ff8
...
...
@@ -18,7 +18,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
GlobalKey
containerKey1
=
new
GlobalKey
();
GlobalKey
containerKey2
=
new
GlobalKey
();
final
Map
<
String
,
RouteBuilder
>
routes
=
<
String
,
Route
Builder
>{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
Widget
Builder
>{
'/'
:
(
_
)
=>
new
Container
(
key:
containerKey1
,
child:
new
Text
(
'Home'
)),
'/settings'
:
(
_
)
=>
new
Container
(
key:
containerKey2
,
child:
new
Text
(
'Settings'
)),
};
...
...
packages/flutter/test/widget/rotated_box_test.dart
View file @
db261ff8
...
...
@@ -18,7 +18,7 @@ void main() {
key:
rotatedBoxKey
,
quarterTurns:
1
,
child:
new
Row
(
justifyContent:
FlexJustifyCont
ent
.
collapse
,
mainAxisAlignment:
MainAxisAlignm
ent
.
collapse
,
children:
<
Widget
>[
new
GestureDetector
(
onTap:
()
{
log
.
add
(
'left'
);
},
...
...
packages/flutter/test/widget/semantics_1_test.dart
View file @
db261ff8
...
...
@@ -58,7 +58,7 @@ void main() {
)
),
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
)
);
expect
(
client
.
updates
.
length
,
equals
(
2
));
...
...
@@ -95,7 +95,7 @@ void main() {
)
),
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
)
);
expect
(
client
.
updates
.
length
,
equals
(
2
));
...
...
@@ -160,7 +160,7 @@ void main() {
)
),
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
)
);
expect
(
client
.
updates
.
length
,
equals
(
2
));
...
...
@@ -197,7 +197,7 @@ void main() {
)
),
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
)
);
expect
(
client
.
updates
.
length
,
equals
(
2
));
...
...
packages/flutter/test/widget/semantics_2_test.dart
View file @
db261ff8
...
...
@@ -35,7 +35,7 @@ void main() {
)
),
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
)
);
expect
(
client
.
updates
.
length
,
equals
(
2
));
...
...
@@ -100,7 +100,7 @@ void main() {
)
),
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
)
);
expect
(
client
.
updates
.
length
,
equals
(
2
));
...
...
@@ -137,7 +137,7 @@ void main() {
)
),
],
alignItems:
FlexAlignItems
.
stretch
crossAxisAlignment:
CrossAxisAlignment
.
stretch
)
);
expect
(
client
.
updates
.
length
,
equals
(
2
));
...
...
packages/flutter/test/widget/snack_bar_test.dart
View file @
db261ff8
...
...
@@ -12,8 +12,8 @@ void main() {
String
helloSnackBar
=
'Hello SnackBar'
;
Key
tapTarget
=
new
Key
(
'tap-target'
);
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
body:
new
Builder
(
builder:
(
BuildContext
context
)
{
...
...
@@ -63,8 +63,8 @@ void main() {
int
snackBarCount
=
0
;
Key
tapTarget
=
new
Key
(
'tap-target'
);
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
body:
new
Builder
(
builder:
(
BuildContext
context
)
{
...
...
@@ -146,8 +146,8 @@ void main() {
int
time
;
ScaffoldFeatureController
<
SnackBar
,
Null
>
lastController
;
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
{
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
{
return
new
Scaffold
(
body:
new
Builder
(
builder:
(
BuildContext
context
)
{
...
...
packages/flutter/test/widget/two_level_list_test.dart
View file @
db261ff8
...
...
@@ -13,22 +13,22 @@ void main() {
final
Key
sublistKey
=
new
UniqueKey
();
final
Key
bottomKey
=
new
UniqueKey
();
final
Map
<
String
,
RouteBuilder
>
routes
=
<
String
,
Route
Builder
>{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
Widget
Builder
>{
'/'
:
(
_
)
{
return
new
Material
(
child:
new
Viewport
(
child:
new
TwoLevelList
(
items:
<
Widget
>[
new
TwoLevelListItem
(
center
:
new
Text
(
'Top'
),
key:
topKey
),
new
TwoLevelListItem
(
title
:
new
Text
(
'Top'
),
key:
topKey
),
new
TwoLevelSublist
(
key:
sublistKey
,
center:
new
Text
(
'Sublist'
),
children:
<
Widget
>[
new
TwoLevelListItem
(
center
:
new
Text
(
'0'
)),
new
TwoLevelListItem
(
center
:
new
Text
(
'1'
))
new
TwoLevelListItem
(
title
:
new
Text
(
'0'
)),
new
TwoLevelListItem
(
title
:
new
Text
(
'1'
))
]
),
new
TwoLevelListItem
(
center
:
new
Text
(
'Bottom'
),
key:
bottomKey
)
new
TwoLevelListItem
(
title
:
new
Text
(
'Bottom'
),
key:
bottomKey
)
]
)
)
...
...
packages/flutter_markdown/example/demo.dart
View file @
db261ff8
...
...
@@ -29,9 +29,9 @@ Enjoy!
void
main
(
)
{
runApp
(
new
MaterialApp
(
title:
"Markdown Demo"
,
routes:
<
String
,
Route
Builder
>{
'/'
:
(
RouteArguments
args
)
=>
new
Scaffold
(
toolBar:
new
ToolBar
(
center
:
new
Text
(
"Markdown Demo"
)),
routes:
<
String
,
Widget
Builder
>{
'/'
:
(
BuildContext
context
)
=>
new
Scaffold
(
appBar:
new
AppBar
(
title
:
new
Text
(
"Markdown Demo"
)),
body:
new
Markdown
(
data:
_kMarkdownData
)
)
}
...
...
packages/flutter_markdown/lib/src/markdown_raw.dart
View file @
db261ff8
...
...
@@ -172,7 +172,7 @@ class _MarkdownBodyRawState extends State<MarkdownBodyRaw> {
}
return
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
blocks
);
}
...
...
@@ -365,7 +365,7 @@ class _Block {
}
contents
=
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
subWidgets
);
}
else
{
...
...
@@ -391,7 +391,7 @@ class _Block {
}
contents
=
new
Row
(
alignItems:
FlexAlignItems
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
new
SizedBox
(
width:
listIndents
.
length
*
markdownStyle
.
listIndent
,
...
...
packages/flutter_tools/templates/create/lib/main.dart.tmpl
View file @
db261ff8
...
...
@@ -12,8 +12,8 @@ void main() {
runApp(
new MaterialApp(
title: 'Flutter Demo',
routes: <String,
Route
Builder>{
'/': (
RouteArguments args
) => new FlutterDemo()
routes: <String,
Widget
Builder>{
'/': (
BuildContext context
) => new FlutterDemo()
}
)
);
...
...
@@ -34,8 +34,8 @@ class _FlutterDemoState extends State<FlutterDemo> {
Widget build(BuildContext context) {
return new Scaffold(
toolBar: new Tool
Bar(
center
: new Text('Flutter Demo')
appBar: new App
Bar(
title
: new Text('Flutter Demo')
),
body: new Center(
child: new Text('Button tapped $_counter time${ _counter == 1 ? '' : 's' }.')
...
...
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