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
e9a775bf
Commit
e9a775bf
authored
Feb 21, 2017
by
Alexandre Ardhuin
Committed by
Adam Barth
Feb 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prefer const constructors (#8316)
parent
66386255
Changes
43
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
145 additions
and
145 deletions
+145
-145
main.dart
dev/benchmarks/complex_layout/lib/main.dart
+23
-23
scroll_perf_test.dart
...nchmarks/complex_layout/test_driver/scroll_perf_test.dart
+4
-4
build_bench.dart
dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart
+1
-1
layout_bench.dart
dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart
+1
-1
run.dart
dev/devicelab/bin/run.dart
+2
-2
runner.dart
dev/devicelab/lib/framework/runner.dart
+4
-4
utils.dart
dev/devicelab/lib/framework/utils.dart
+1
-1
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+2
-2
drag_and_drop.dart
dev/manual_tests/drag_and_drop.dart
+1
-1
overlay_geometry.dart
dev/manual_tests/overlay_geometry.dart
+1
-1
page_view.dart
dev/manual_tests/page_view.dart
+1
-1
buttons_demo.dart
examples/flutter_gallery/lib/demo/buttons_demo.dart
+6
-6
date_and_time_picker_demo.dart
...s/flutter_gallery/lib/demo/date_and_time_picker_demo.dart
+1
-1
icons_demo.dart
examples/flutter_gallery/lib/demo/icons_demo.dart
+1
-1
overscroll_demo.dart
examples/flutter_gallery/lib/demo/overscroll_demo.dart
+1
-1
pesto_demo.dart
examples/flutter_gallery/lib/demo/pesto_demo.dart
+5
-5
selection_controls_demo.dart
...les/flutter_gallery/lib/demo/selection_controls_demo.dart
+3
-3
shrine_home.dart
examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
+1
-1
shrine_order.dart
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
+8
-8
shrine_demo.dart
examples/flutter_gallery/lib/demo/shrine_demo.dart
+1
-1
text_field_demo.dart
examples/flutter_gallery/lib/demo/text_field_demo.dart
+1
-1
demo.dart
examples/flutter_gallery/lib/gallery/demo.dart
+2
-2
drawer.dart
examples/flutter_gallery/lib/gallery/drawer.dart
+2
-2
syntax_highlighter.dart
examples/flutter_gallery/lib/gallery/syntax_highlighter.dart
+16
-16
updates.dart
examples/flutter_gallery/lib/gallery/updates.dart
+1
-1
example_code_display_test.dart
examples/flutter_gallery/test/example_code_display_test.dart
+1
-1
memory_nav_test.dart
examples/flutter_gallery/test_driver/memory_nav_test.dart
+1
-1
scroll_perf_test.dart
examples/flutter_gallery/test_driver/scroll_perf_test.dart
+4
-4
transitions_perf_test.dart
...es/flutter_gallery/test_driver/transitions_perf_test.dart
+3
-3
canvas.dart
examples/layers/raw/canvas.dart
+2
-2
flex_layout.dart
examples/layers/rendering/flex_layout.dart
+14
-14
hello_world.dart
examples/layers/rendering/hello_world.dart
+1
-1
sector_layout.dart
examples/layers/rendering/src/sector_layout.dart
+1
-1
solid_color_box.dart
examples/layers/rendering/src/solid_color_box.dart
+1
-1
custom_render_box.dart
examples/layers/widgets/custom_render_box.dart
+2
-2
gestures.dart
examples/layers/widgets/gestures.dart
+1
-1
sectors.dart
examples/layers/widgets/sectors.dart
+7
-7
spinning_mixed.dart
examples/layers/widgets/spinning_mixed.dart
+3
-3
styled_text.dart
examples/layers/widgets/styled_text.dart
+2
-2
stock_data.dart
examples/stocks/lib/stock_data.dart
+1
-1
stock_symbol_viewer.dart
examples/stocks/lib/stock_symbol_viewer.dart
+6
-6
icon_color_test.dart
examples/stocks/test/icon_color_test.dart
+1
-1
scroll_perf_test.dart
examples/stocks/test_driver/scroll_perf_test.dart
+4
-4
No files found.
dev/benchmarks/complex_layout/lib/main.dart
View file @
e9a775bf
...
...
@@ -73,7 +73,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
children:
<
Widget
>[
new
Expanded
(
child:
new
ListView
.
builder
(
key:
new
Key
(
'main-scroll'
),
// this key is used by the driver test
key:
const
Key
(
'main-scroll'
),
// this key is used by the driver test
itemBuilder:
(
BuildContext
context
,
int
index
)
{
if
(
index
%
2
==
0
)
return
new
FancyImageItem
(
index
,
key:
new
ValueKey
<
int
>(
index
));
...
...
@@ -154,7 +154,7 @@ class MenuItemWithIcon extends StatelessWidget {
children:
<
Widget
>[
new
Icon
(
icon
),
new
Padding
(
padding:
new
EdgeInsets
.
only
(
left:
8.0
,
right:
8.0
),
padding:
const
EdgeInsets
.
only
(
left:
8.0
,
right:
8.0
),
child:
new
Text
(
title
)
),
new
Text
(
subtitle
,
style:
Theme
.
of
(
context
).
textTheme
.
caption
)
...
...
@@ -177,7 +177,7 @@ class FancyImageItem extends StatelessWidget {
new
ItemImageBox
(),
new
InfoBar
(),
new
Padding
(
padding:
new
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
child:
new
Divider
()
),
new
IconBar
(),
...
...
@@ -199,7 +199,7 @@ class FancyGalleryItem extends StatelessWidget {
new
ItemGalleryBox
(
index
),
new
InfoBar
(),
new
Padding
(
padding:
new
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
child:
new
Divider
()
),
new
IconBar
(),
...
...
@@ -213,7 +213,7 @@ class InfoBar extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
<
Widget
>[
...
...
@@ -229,7 +229,7 @@ class IconBar extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
new
Padding
(
padding:
new
EdgeInsets
.
only
(
left:
16.0
,
right:
16.0
),
padding:
const
EdgeInsets
.
only
(
left:
16.0
,
right:
16.0
),
child:
new
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
<
Widget
>[
...
...
@@ -275,7 +275,7 @@ class MiniIconWithText extends StatelessWidget {
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
new
Padding
(
padding:
new
EdgeInsets
.
only
(
right:
8.0
),
padding:
const
EdgeInsets
.
only
(
right:
8.0
),
child:
new
Container
(
width:
16.0
,
height:
16.0
,
...
...
@@ -312,12 +312,12 @@ class UserHeader extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
new
Padding
(
padding:
new
EdgeInsets
.
only
(
right:
8.0
),
padding:
const
EdgeInsets
.
only
(
right:
8.0
),
child:
new
Image
(
image:
new
AssetImage
(
'packages/flutter_gallery_assets/ali_connors_sml.png'
),
width:
32.0
,
...
...
@@ -332,9 +332,9 @@ class UserHeader extends StatelessWidget {
new
RichText
(
text:
new
TextSpan
(
style:
Theme
.
of
(
context
).
textTheme
.
body1
,
children:
<
TextSpan
>[
new
TextSpan
(
text:
userName
,
style:
new
TextStyle
(
fontWeight:
FontWeight
.
bold
)),
new
TextSpan
(
text:
' shared a new '
),
new
TextSpan
(
text:
'photo'
,
style:
new
TextStyle
(
fontWeight:
FontWeight
.
bold
))
new
TextSpan
(
text:
userName
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
)),
const
TextSpan
(
text:
' shared a new '
),
const
TextSpan
(
text:
'photo'
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
))
]
)),
new
Row
(
...
...
@@ -357,7 +357,7 @@ class ItemDescription extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Text
(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
)
);
}
...
...
@@ -367,7 +367,7 @@ class ItemImageBox extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Card
(
child:
new
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
...
...
@@ -404,16 +404,16 @@ class ItemImageBox extends StatelessWidget {
backgroundColor:
Colors
.
black54
,
borderRadius:
new
BorderRadius
.
circular
(
2.0
)
),
padding:
new
EdgeInsets
.
all
(
4.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
child:
new
RichText
(
text:
new
TextSpan
(
style:
new
TextStyle
(
color:
Colors
.
white
),
style:
const
TextStyle
(
color:
Colors
.
white
),
children:
<
TextSpan
>[
new
TextSpan
(
const
TextSpan
(
text:
'Photo by '
),
new
TextSpan
(
style:
new
TextStyle
(
fontWeight:
FontWeight
.
bold
),
const
TextSpan
(
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
),
text:
'Magic Mike'
)
]
...
...
@@ -425,7 +425,7 @@ class ItemImageBox extends StatelessWidget {
)
,
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
...
...
@@ -465,7 +465,7 @@ class ItemGalleryBox extends StatelessWidget {
return
new
Container
(
key:
new
Key
(
tabName
),
child:
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Card
(
child:
new
Column
(
children:
<
Widget
>[
...
...
@@ -491,7 +491,7 @@ class ItemGalleryBox extends StatelessWidget {
),
new
Expanded
(
child:
new
Padding
(
padding:
new
EdgeInsets
.
only
(
left:
8.0
),
padding:
const
EdgeInsets
.
only
(
left:
8.0
),
child:
new
Text
(
'This is item
$tabName
'
),
)
)
...
...
@@ -550,7 +550,7 @@ class BottomBarButton extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
Column
(
children:
<
Widget
>[
new
IconButton
(
...
...
dev/benchmarks/complex_layout/test_driver/scroll_perf_test.dart
View file @
e9a775bf
...
...
@@ -27,14 +27,14 @@ void main() {
// Scroll down
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
await
driver
.
scroll
(
stockList
,
0.0
,
-
300.0
,
new
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
500
));
await
driver
.
scroll
(
stockList
,
0.0
,
-
300.0
,
const
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
500
));
}
// Scroll up
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
await
driver
.
scroll
(
stockList
,
0.0
,
300.0
,
new
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
500
));
await
driver
.
scroll
(
stockList
,
0.0
,
300.0
,
const
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
500
));
}
});
...
...
dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart
View file @
e9a775bf
...
...
@@ -31,7 +31,7 @@ Future<Null> main() async {
stocks
.
main
();
await
tester
.
pump
();
// Start startup animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Complete startup animation
await
tester
.
tapAt
(
new
Point
(
20.0
,
40.0
));
// Open drawer
await
tester
.
tapAt
(
const
Point
(
20.0
,
40.0
));
// Open drawer
await
tester
.
pump
();
// Start drawer animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Complete drawer animation
...
...
dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart
View file @
e9a775bf
...
...
@@ -30,7 +30,7 @@ Future<Null> main() async {
stocks
.
main
();
await
tester
.
pump
();
// Start startup animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Complete startup animation
await
tester
.
tapAt
(
new
Point
(
20.0
,
40.0
));
// Open drawer
await
tester
.
tapAt
(
const
Point
(
20.0
,
40.0
));
// Open drawer
await
tester
.
pump
();
// Start drawer animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Complete drawer animation
...
...
dev/devicelab/bin/run.dart
View file @
e9a775bf
...
...
@@ -63,7 +63,7 @@ Future<Null> main(List<String> rawArgs) async {
exitCode
=
1
;
print
(
'Task result:'
);
print
(
new
JsonEncoder
.
withIndent
(
' '
).
convert
(
result
));
print
(
const
JsonEncoder
.
withIndent
(
' '
).
convert
(
result
));
section
(
'Finished task "
$taskName
"'
);
}
}
...
...
@@ -115,7 +115,7 @@ final ArgParser _argParser = new ArgParser()
splitCommas:
true
,
callback:
(
List
<
String
>
value
)
{
if
(
value
.
isNotEmpty
)
{
throw
new
FormatException
(
throw
const
FormatException
(
'Invalid option --test. Did you mean --task (-t)?'
,
);
}
...
...
dev/devicelab/lib/framework/runner.dart
View file @
e9a775bf
...
...
@@ -42,8 +42,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as
});
StreamSubscription
<
String
>
stdoutSub
=
runner
.
stdout
.
transform
(
new
Utf8Decoder
())
.
transform
(
new
LineSplitter
())
.
transform
(
const
Utf8Decoder
())
.
transform
(
const
LineSplitter
())
.
listen
((
String
line
)
{
if
(!
silent
)
{
stdout
.
writeln
(
'[
$taskName
] [STDOUT]
$line
'
);
...
...
@@ -51,8 +51,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as
});
StreamSubscription
<
String
>
stderrSub
=
runner
.
stderr
.
transform
(
new
Utf8Decoder
())
.
transform
(
new
LineSplitter
())
.
transform
(
const
Utf8Decoder
())
.
transform
(
const
LineSplitter
())
.
listen
((
String
line
)
{
stderr
.
writeln
(
'[
$taskName
] [STDERR]
$line
'
);
});
...
...
dev/devicelab/lib/framework/utils.dart
View file @
e9a775bf
...
...
@@ -318,7 +318,7 @@ T requireConfigProperty<T>(Map<String, dynamic> map, String propertyName) {
}
String
jsonEncode
(
dynamic
data
)
{
return
new
JsonEncoder
.
withIndent
(
' '
).
convert
(
data
)
+
'
\n
'
;
return
const
JsonEncoder
.
withIndent
(
' '
).
convert
(
data
)
+
'
\n
'
;
}
Future
<
Null
>
getFlutter
(
String
revision
)
async
{
...
...
dev/devicelab/lib/tasks/perf_tests.dart
View file @
e9a775bf
...
...
@@ -305,12 +305,12 @@ class AndroidBackButtonMemoryTest {
// Perform a series of back button suspend and resume cycles.
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
await
device
.
shellExec
(
'input'
,
<
String
>[
'keyevent'
,
'KEYCODE_BACK'
]);
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
1000
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
1000
));
String
output
=
await
device
.
shellEval
(
'am'
,
<
String
>[
'start'
,
'-n'
,
'io.flutter.examples.gallery/io.flutter.app.FlutterActivity'
]);
print
(
output
);
if
(
output
.
contains
(
'Error'
))
return
new
TaskResult
.
failure
(
'unable to launch activity'
);
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
1000
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
1000
));
}
Map
<
String
,
dynamic
>
endData
=
await
device
.
getMemoryStats
(
packageName
);
...
...
dev/manual_tests/drag_and_drop.dart
View file @
e9a775bf
...
...
@@ -27,7 +27,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
builder:
(
BuildContext
context
,
List
<
Color
>
data
,
List
<
dynamic
>
rejectedData
)
{
return
new
Container
(
height:
100.0
,
margin:
new
EdgeInsets
.
all
(
10.0
),
margin:
const
EdgeInsets
.
all
(
10.0
),
decoration:
new
BoxDecoration
(
border:
new
Border
.
all
(
width:
3.0
,
...
...
dev/manual_tests/overlay_geometry.dart
View file @
e9a775bf
...
...
@@ -169,7 +169,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
setState
(()
{
markers
[
MarkerType
.
touch
]
=
globalPosition
;
final
RenderBox
box
=
target
.
currentContext
.
findRenderObject
();
markers
[
MarkerType
.
topLeft
]
=
box
.
localToGlobal
(
new
Point
(
0.0
,
0.0
));
markers
[
MarkerType
.
topLeft
]
=
box
.
localToGlobal
(
const
Point
(
0.0
,
0.0
));
final
Size
size
=
box
.
size
;
markers
[
MarkerType
.
bottomRight
]
=
box
.
localToGlobal
(
new
Point
(
size
.
width
,
size
.
height
));
final
ScrollableState
scrollable
=
Scrollable
.
of
(
target
.
currentContext
);
...
...
dev/manual_tests/page_view.dart
View file @
e9a775bf
...
...
@@ -40,7 +40,7 @@ class PageViewAppState extends State<PageViewApp> {
const
TextStyle
(
color:
Colors
.
white
,
fontSize:
18.0
,
fontWeight:
FontWeight
.
bold
);
List
<
CardModel
>
cardModels
;
Size
pageSize
=
new
Size
(
200.0
,
200.0
);
Size
pageSize
=
const
Size
(
200.0
,
200.0
);
Axis
scrollDirection
=
Axis
.
horizontal
;
bool
itemsWrap
=
false
;
...
...
examples/flutter_gallery/lib/demo/buttons_demo.dart
View file @
e9a775bf
...
...
@@ -90,7 +90,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildRaisedButton
()
{
return
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
child:
new
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -111,7 +111,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildFlatButton
()
{
return
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
child:
new
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -158,7 +158,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
}).
toList
(),
),
),
new
SizedBox
(
const
SizedBox
(
height:
24.0
,
),
new
ListItem
(
...
...
@@ -179,7 +179,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
}).
toList
(),
),
),
new
SizedBox
(
const
SizedBox
(
height:
24.0
,
),
new
ListItem
(
...
...
@@ -213,7 +213,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildIconButton
()
{
return
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
child:
new
Row
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -237,7 +237,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget
buildActionButton
()
{
return
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
child:
new
FloatingActionButton
(
child:
new
Icon
(
Icons
.
add
),
onPressed:
()
{
...
...
examples/flutter_gallery/lib/demo/date_and_time_picker_demo.dart
View file @
e9a775bf
...
...
@@ -95,7 +95,7 @@ class _DateTimePicker extends StatelessWidget {
onPressed:
()
{
_selectDate
(
context
);
},
),
),
new
SizedBox
(
width:
12.0
),
const
SizedBox
(
width:
12.0
),
new
Expanded
(
flex:
3
,
child:
new
_InputDropdown
(
...
...
examples/flutter_gallery/lib/demo/icons_demo.dart
View file @
e9a775bf
...
...
@@ -122,7 +122,7 @@ class IconsDemoState extends State<IconsDemo> {
new
Expanded
(
child:
new
Center
(
child:
new
IconTheme
(
data:
new
IconThemeData
(
opacity:
1.0
),
data:
const
IconThemeData
(
opacity:
1.0
),
child:
new
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
...
...
examples/flutter_gallery/lib/demo/overscroll_demo.dart
View file @
e9a775bf
...
...
@@ -26,7 +26,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
Future
<
Null
>
_handleRefresh
()
{
Completer
<
Null
>
completer
=
new
Completer
<
Null
>();
new
Timer
(
new
Duration
(
seconds:
3
),
()
{
completer
.
complete
(
null
);
});
new
Timer
(
const
Duration
(
seconds:
3
),
()
{
completer
.
complete
(
null
);
});
return
completer
.
future
.
then
((
_
)
{
_scaffoldKey
.
currentState
?.
showSnackBar
(
new
SnackBar
(
content:
new
Text
(
"Refresh complete"
),
...
...
examples/flutter_gallery/lib/demo/pesto_demo.dart
View file @
e9a775bf
...
...
@@ -140,7 +140,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
return
new
SliverPadding
(
padding:
padding
,
child:
new
SliverGrid
(
gridDelegate:
new
SliverGridDelegateWithMaxCrossAxisExtent
(
gridDelegate:
const
SliverGridDelegateWithMaxCrossAxisExtent
(
maxCrossAxisExtent:
_kRecipePageMaxWidth
,
crossAxisSpacing:
8.0
,
mainAxisSpacing:
8.0
,
...
...
@@ -299,7 +299,7 @@ class RecipePage extends StatefulWidget {
class
_RecipePageState
extends
State
<
RecipePage
>
{
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
final
TextStyle
menuItemStyle
=
new
PestoStyle
(
fontSize:
15.0
,
color:
Colors
.
black54
,
height:
24.0
/
15.0
);
final
TextStyle
menuItemStyle
=
const
PestoStyle
(
fontSize:
15.0
,
color:
Colors
.
black54
,
height:
24.0
/
15.0
);
double
_getAppBarHeight
(
BuildContext
context
)
=>
MediaQuery
.
of
(
context
).
size
.
height
*
0.3
;
...
...
@@ -448,7 +448,7 @@ class RecipeSheet extends StatelessWidget {
),
new
TableRow
(
children:
<
Widget
>[
new
SizedBox
(),
const
SizedBox
(),
new
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
8.0
,
bottom:
4.0
),
child:
new
Text
(
recipe
.
description
,
style:
descriptionStyle
)
...
...
@@ -457,7 +457,7 @@ class RecipeSheet extends StatelessWidget {
),
new
TableRow
(
children:
<
Widget
>[
new
SizedBox
(),
const
SizedBox
(),
new
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
24.0
,
bottom:
4.0
),
child:
new
Text
(
'Ingredients'
,
style:
headingStyle
)
...
...
@@ -471,7 +471,7 @@ class RecipeSheet extends StatelessWidget {
))..
add
(
new
TableRow
(
children:
<
Widget
>[
new
SizedBox
(),
const
SizedBox
(),
new
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
24.0
,
bottom:
4.0
),
child:
new
Text
(
'Steps'
,
style:
headingStyle
)
...
...
examples/flutter_gallery/lib/demo/selection_controls_demo.dart
View file @
e9a775bf
...
...
@@ -75,7 +75,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget
buildCheckbox
()
{
return
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
child:
new
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -109,7 +109,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget
buildRadio
()
{
return
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
child:
new
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
@@ -161,7 +161,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget
buildSwitch
()
{
return
new
Align
(
alignment:
new
FractionalOffset
(
0.5
,
0.4
),
alignment:
const
FractionalOffset
(
0.5
,
0.4
),
child:
new
Row
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
View file @
e9a775bf
...
...
@@ -135,7 +135,7 @@ class VendorItem extends StatelessWidget {
child:
new
Image
.
asset
(
vendor
.
avatarAsset
,
fit:
ImageFit
.
cover
),
),
),
new
SizedBox
(
width:
8.0
),
const
SizedBox
(
width:
8.0
),
new
Expanded
(
child:
new
Text
(
vendor
.
name
,
style:
ShrineTheme
.
of
(
context
).
vendorItemStyle
),
),
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
View file @
e9a775bf
...
...
@@ -43,7 +43,7 @@ class OrderItem extends StatelessWidget {
),
),
),
new
SizedBox
(
height:
24.0
),
const
SizedBox
(
height:
24.0
),
new
Row
(
children:
<
Widget
>[
new
Padding
(
...
...
@@ -66,9 +66,9 @@ class OrderItem extends StatelessWidget {
child:
new
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
new
SizedBox
(
height:
24.0
),
const
SizedBox
(
height:
24.0
),
new
Text
(
product
.
description
,
style:
theme
.
featureStyle
),
new
SizedBox
(
height:
16.0
),
const
SizedBox
(
height:
16.0
),
new
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
8.0
,
bottom:
8.0
,
right:
88.0
),
child:
new
DropdownButtonHideUnderline
(
...
...
@@ -94,7 +94,7 @@ class OrderItem extends StatelessWidget {
),
),
),
new
SizedBox
(
height:
16.0
),
const
SizedBox
(
height:
16.0
),
new
SizedBox
(
height:
24.0
,
child:
new
Align
(
...
...
@@ -102,9 +102,9 @@ class OrderItem extends StatelessWidget {
child:
new
Text
(
product
.
vendor
.
name
,
style:
theme
.
vendorTitleStyle
),
),
),
new
SizedBox
(
height:
16.0
),
const
SizedBox
(
height:
16.0
),
new
Text
(
product
.
vendor
.
description
,
style:
theme
.
vendorStyle
),
new
SizedBox
(
height:
24.0
),
const
SizedBox
(
height:
24.0
),
],
),
),
...
...
@@ -186,13 +186,13 @@ class _OrderPageState extends State<OrderPage> {
quantity:
currentOrder
.
quantity
,
quantityChanged:
(
int
value
)
{
updateOrder
(
quantity:
value
);
},
),
new
SizedBox
(
height:
24.0
),
const
SizedBox
(
height:
24.0
),
]),
),
new
SliverPadding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
SliverGrid
(
gridDelegate:
new
SliverGridDelegateWithFixedCrossAxisCount
(
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
2
,
mainAxisSpacing:
8.0
,
crossAxisSpacing:
8.0
,
...
...
examples/flutter_gallery/lib/demo/shrine_demo.dart
View file @
e9a775bf
...
...
@@ -14,7 +14,7 @@ Widget buildShrine(BuildContext context, Widget child) {
return
new
Theme
(
data:
new
ThemeData
(
primarySwatch:
Colors
.
grey
,
iconTheme:
new
IconThemeData
(
color:
const
Color
(
0xFF707070
)),
iconTheme:
const
IconThemeData
(
color:
const
Color
(
0xFF707070
)),
platform:
Theme
.
of
(
context
).
platform
,
),
child:
new
ShrineTheme
(
child:
child
)
...
...
examples/flutter_gallery/lib/demo/text_field_demo.dart
View file @
e9a775bf
...
...
@@ -145,7 +145,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
onSaved:
(
InputValue
val
)
{
person
.
password
=
val
.
text
;
}
)
),
new
SizedBox
(
width:
16.0
),
const
SizedBox
(
width:
16.0
),
new
Expanded
(
child:
new
TextField
(
hintText:
'How do you log in?'
,
...
...
examples/flutter_gallery/lib/gallery/demo.dart
View file @
e9a775bf
...
...
@@ -134,10 +134,10 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
}
else
{
body
=
new
SingleChildScrollView
(
child:
new
Padding
(
padding:
new
EdgeInsets
.
all
(
16.0
),
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
new
RichText
(
text:
new
TextSpan
(
style:
new
TextStyle
(
fontFamily:
'monospace'
,
fontSize:
10.0
),
style:
const
TextStyle
(
fontFamily:
'monospace'
,
fontSize:
10.0
),
children:
<
TextSpan
>[
new
DartSyntaxHighlighter
(
style
).
format
(
_exampleCode
)
]
...
...
examples/flutter_gallery/lib/gallery/drawer.dart
View file @
e9a775bf
...
...
@@ -215,9 +215,9 @@ class GalleryDrawer extends StatelessWidget {
);
final
Widget
aboutItem
=
new
AboutDrawerItem
(
icon:
new
FlutterLogo
(),
icon:
const
FlutterLogo
(),
applicationVersion:
'2016 Q3 Preview'
,
applicationIcon:
new
FlutterLogo
(),
applicationIcon:
const
FlutterLogo
(),
applicationLegalese:
'© 2016 The Chromium Authors'
,
aboutBoxChildren:
<
Widget
>[
new
Padding
(
...
...
examples/flutter_gallery/lib/gallery/syntax_highlighter.dart
View file @
e9a775bf
...
...
@@ -19,27 +19,27 @@ class SyntaxHighlighterStyle {
static
SyntaxHighlighterStyle
lightThemeStyle
()
{
return
new
SyntaxHighlighterStyle
(
baseStyle:
new
TextStyle
(
color:
const
Color
(
0xFF000000
)),
numberStyle:
new
TextStyle
(
color:
const
Color
(
0xFF1565C0
)),
commentStyle:
new
TextStyle
(
color:
const
Color
(
0xFF9E9E9E
)),
keywordStyle:
new
TextStyle
(
color:
const
Color
(
0xFF9C27B0
)),
stringStyle:
new
TextStyle
(
color:
const
Color
(
0xFF43A047
)),
punctuationStyle:
new
TextStyle
(
color:
const
Color
(
0xFF000000
)),
classStyle:
new
TextStyle
(
color:
const
Color
(
0xFF512DA8
)),
constantStyle:
new
TextStyle
(
color:
const
Color
(
0xFF795548
))
baseStyle:
const
TextStyle
(
color:
const
Color
(
0xFF000000
)),
numberStyle:
const
TextStyle
(
color:
const
Color
(
0xFF1565C0
)),
commentStyle:
const
TextStyle
(
color:
const
Color
(
0xFF9E9E9E
)),
keywordStyle:
const
TextStyle
(
color:
const
Color
(
0xFF9C27B0
)),
stringStyle:
const
TextStyle
(
color:
const
Color
(
0xFF43A047
)),
punctuationStyle:
const
TextStyle
(
color:
const
Color
(
0xFF000000
)),
classStyle:
const
TextStyle
(
color:
const
Color
(
0xFF512DA8
)),
constantStyle:
const
TextStyle
(
color:
const
Color
(
0xFF795548
))
);
}
static
SyntaxHighlighterStyle
darkThemeStyle
()
{
return
new
SyntaxHighlighterStyle
(
baseStyle:
new
TextStyle
(
color:
const
Color
(
0xFFFFFFFF
)),
numberStyle:
new
TextStyle
(
color:
const
Color
(
0xFF1565C0
)),
commentStyle:
new
TextStyle
(
color:
const
Color
(
0xFF9E9E9E
)),
keywordStyle:
new
TextStyle
(
color:
const
Color
(
0xFF80CBC4
)),
stringStyle:
new
TextStyle
(
color:
const
Color
(
0xFF009688
)),
punctuationStyle:
new
TextStyle
(
color:
const
Color
(
0xFFFFFFFF
)),
classStyle:
new
TextStyle
(
color:
const
Color
(
0xFF009688
)),
constantStyle:
new
TextStyle
(
color:
const
Color
(
0xFF795548
))
baseStyle:
const
TextStyle
(
color:
const
Color
(
0xFFFFFFFF
)),
numberStyle:
const
TextStyle
(
color:
const
Color
(
0xFF1565C0
)),
commentStyle:
const
TextStyle
(
color:
const
Color
(
0xFF9E9E9E
)),
keywordStyle:
const
TextStyle
(
color:
const
Color
(
0xFF80CBC4
)),
stringStyle:
const
TextStyle
(
color:
const
Color
(
0xFF009688
)),
punctuationStyle:
const
TextStyle
(
color:
const
Color
(
0xFFFFFFFF
)),
classStyle:
const
TextStyle
(
color:
const
Color
(
0xFF009688
)),
constantStyle:
const
TextStyle
(
color:
const
Color
(
0xFF795548
))
);
}
...
...
examples/flutter_gallery/lib/gallery/updates.dart
View file @
e9a775bf
...
...
@@ -32,7 +32,7 @@ class UpdaterState extends State<Updater> {
Future
<
Null
>
_checkForUpdates
()
async
{
// Only prompt once a day
if
(
_lastUpdateCheck
!=
null
&&
new
DateTime
.
now
().
difference
(
_lastUpdateCheck
)
<
new
Duration
(
days:
1
))
{
new
DateTime
.
now
().
difference
(
_lastUpdateCheck
)
<
const
Duration
(
days:
1
))
{
return
;
// We already checked for updates recently
}
_lastUpdateCheck
=
new
DateTime
.
now
();
...
...
examples/flutter_gallery/test/example_code_display_test.dart
View file @
e9a775bf
...
...
@@ -23,7 +23,7 @@ void main() {
final
Point
allDemosOrigin
=
tester
.
getTopRight
(
find
.
text
(
'Demos'
));
final
Finder
button
=
find
.
text
(
'Buttons'
);
while
(
button
.
evaluate
().
isEmpty
)
{
await
tester
.
scrollAt
(
allDemosOrigin
,
new
Offset
(
0.0
,
-
100.0
));
await
tester
.
scrollAt
(
allDemosOrigin
,
const
Offset
(
0.0
,
-
100.0
));
await
tester
.
pump
();
// start the scroll
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
}
...
...
examples/flutter_gallery/test_driver/memory_nav_test.dart
View file @
e9a775bf
...
...
@@ -37,6 +37,6 @@ void main() {
await
new
Future
<
Null
>.
delayed
(
kWaitBetweenActions
);
}
await
completer
.
future
;
},
timeout:
new
Timeout
(
new
Duration
(
minutes:
1
)));
},
timeout:
const
Timeout
(
const
Duration
(
minutes:
1
)));
});
}
examples/flutter_gallery/test_driver/scroll_perf_test.dart
View file @
e9a775bf
...
...
@@ -34,14 +34,14 @@ void main() {
// https://github.com/flutter/flutter/issues/3316
// Scroll down
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
await
driver
.
scroll
(
stockList
,
0.0
,
-
300.0
,
new
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
500
));
await
driver
.
scroll
(
stockList
,
0.0
,
-
300.0
,
const
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
500
));
}
// Scroll up
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
await
driver
.
scroll
(
stockList
,
0.0
,
300.0
,
new
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
500
));
await
driver
.
scroll
(
stockList
,
0.0
,
300.0
,
const
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
500
));
}
});
...
...
examples/flutter_gallery/test_driver/transitions_perf_test.dart
View file @
e9a775bf
...
...
@@ -56,7 +56,7 @@ final List<String> unsynchedDemoTitles = <String>[
'Progress indicators'
,
];
final
FileSystem
_fs
=
new
LocalFileSystem
();
final
FileSystem
_fs
=
const
LocalFileSystem
();
const
Duration
kWaitBetweenActions
=
const
Duration
(
milliseconds:
250
);
...
...
@@ -123,7 +123,7 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
// Save the durations Map to a file.
final
File
file
=
await
_fs
.
file
(
outputPath
).
create
(
recursive:
true
);
await
file
.
writeAsString
(
new
JsonEncoder
.
withIndent
(
' '
).
convert
(
durations
));
await
file
.
writeAsString
(
const
JsonEncoder
.
withIndent
(
' '
).
convert
(
durations
));
}
void
main
(
)
{
...
...
@@ -176,6 +176,6 @@ void main() {
await
summary
.
writeSummaryToFile
(
'transitions'
,
pretty:
true
);
String
histogramPath
=
path
.
join
(
testOutputsDirectory
,
'transition_durations.timeline.json'
);
await
saveDurationsHistogram
(
timeline
.
json
[
'traceEvents'
],
histogramPath
);
},
timeout:
new
Timeout
(
new
Duration
(
minutes:
5
)));
},
timeout:
const
Timeout
(
const
Duration
(
minutes:
5
)));
});
}
examples/layers/raw/canvas.dart
View file @
e9a775bf
...
...
@@ -42,7 +42,7 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas
.
rotate
(
math
.
PI
/
4.0
);
ui
.
Gradient
yellowBlue
=
new
ui
.
Gradient
.
linear
(
<
ui
.
Point
>[
new
ui
.
Point
(-
radius
,
-
radius
),
new
ui
.
Point
(
0.0
,
0.0
)],
<
ui
.
Point
>[
new
ui
.
Point
(-
radius
,
-
radius
),
const
ui
.
Point
(
0.0
,
0.0
)],
<
ui
.
Color
>[
const
ui
.
Color
(
0xFFFFFF00
),
const
ui
.
Color
(
0xFF0000FF
)]
);
canvas
.
drawRect
(
new
ui
.
Rect
.
fromLTRB
(-
radius
,
-
radius
,
radius
,
radius
),
...
...
@@ -61,7 +61,7 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas
.
restore
();
paint
.
color
=
const
ui
.
Color
.
fromARGB
(
128
,
255
,
0
,
0
);
canvas
.
drawCircle
(
new
ui
.
Point
(
150.0
,
300.0
),
radius
,
paint
);
canvas
.
drawCircle
(
const
ui
.
Point
(
150.0
,
300.0
),
radius
,
paint
);
// When we're done issuing painting commands, we end the recording an receive
// a Picture, which is an immutable record of the commands we've issued. You
...
...
examples/layers/rendering/flex_layout.dart
View file @
e9a775bf
...
...
@@ -15,25 +15,25 @@ void main() {
void
addAlignmentRow
(
CrossAxisAlignment
crossAxisAlignment
)
{
TextStyle
style
=
const
TextStyle
(
color:
const
Color
(
0xFF000000
));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$crossAxisAlignment
'
));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
new
EdgeInsets
.
only
(
top:
20.0
)));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
const
EdgeInsets
.
only
(
top:
20.0
)));
RenderFlex
row
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
style
=
new
TextStyle
(
fontSize:
15.0
,
color:
const
Color
(
0xFF000000
));
style
=
const
TextStyle
(
fontSize:
15.0
,
color:
const
Color
(
0xFF000000
));
row
.
add
(
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FFFCCCC
)),
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FFFCCCC
)),
child:
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'foo foo foo'
))
));
style
=
new
TextStyle
(
fontSize:
10.0
,
color:
const
Color
(
0xFF000000
));
style
=
const
TextStyle
(
fontSize:
10.0
,
color:
const
Color
(
0xFF000000
));
row
.
add
(
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCFFCC
)),
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCFFCC
)),
child:
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'foo foo foo'
))
));
RenderFlex
subrow
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
style
=
new
TextStyle
(
fontSize:
25.0
,
color:
const
Color
(
0xFF000000
));
style
=
const
TextStyle
(
fontSize:
25.0
,
color:
const
Color
(
0xFF000000
));
subrow
.
add
(
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCCCFF
)),
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCCCFF
)),
child:
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'foo foo foo foo'
))
));
subrow
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0x7FCCFFFF
),
desiredSize:
new
Size
(
30.0
,
40.0
)));
subrow
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0x7FCCFFFF
),
desiredSize:
const
Size
(
30.0
,
40.0
)));
row
.
add
(
subrow
);
table
.
add
(
row
);
final
FlexParentData
rowParentData
=
row
.
parentData
;
...
...
@@ -49,11 +49,11 @@ void main() {
void
addJustificationRow
(
MainAxisAlignment
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
)));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
const
EdgeInsets
.
only
(
top:
20.0
)));
RenderFlex
row
=
new
RenderFlex
(
direction:
Axis
.
horizontal
);
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
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFFFCCCC
),
desiredSize:
const
Size
(
80.0
,
60.0
)));
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFCCFFCC
),
desiredSize:
const
Size
(
64.0
,
60.0
)));
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFCCCCFF
),
desiredSize:
const
Size
(
160.0
,
60.0
)));
row
.
mainAxisAlignment
=
justify
;
table
.
add
(
row
);
final
FlexParentData
rowParentData
=
row
.
parentData
;
...
...
@@ -67,8 +67,8 @@ void main() {
addJustificationRow
(
MainAxisAlignment
.
spaceAround
);
RenderDecoratedBox
root
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFFFFFF
)),
child:
new
RenderPadding
(
child:
table
,
padding:
new
EdgeInsets
.
symmetric
(
vertical:
50.0
))
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFFFFFF
)),
child:
new
RenderPadding
(
child:
table
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
50.0
))
);
new
RenderingFlutterBinding
(
root:
root
);
...
...
examples/layers/rendering/hello_world.dart
View file @
e9a775bf
...
...
@@ -16,7 +16,7 @@ void main() {
alignment:
FractionalOffset
.
center
,
// We use a RenderParagraph to display the text 'Hello, world.' without
// any explicit styling.
child:
new
RenderParagraph
(
new
TextSpan
(
text:
'Hello, world.'
))
child:
new
RenderParagraph
(
const
TextSpan
(
text:
'Hello, world.'
))
)
);
}
examples/layers/rendering/src/sector_layout.dart
View file @
e9a775bf
...
...
@@ -572,7 +572,7 @@ class RenderSolidColor extends RenderDecoratedSector {
@override
void
handleEvent
(
PointerEvent
event
,
HitTestEntry
entry
)
{
if
(
event
is
PointerDownEvent
)
{
decoration
=
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFF0000
));
decoration
=
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFF0000
));
}
else
if
(
event
is
PointerUpEvent
)
{
decoration
=
new
BoxDecoration
(
backgroundColor:
backgroundColor
);
}
...
...
examples/layers/rendering/src/solid_color_box.dart
View file @
e9a775bf
...
...
@@ -41,7 +41,7 @@ class RenderSolidColorBox extends RenderDecoratedBox {
@override
void
handleEvent
(
PointerEvent
event
,
BoxHitTestEntry
entry
)
{
if
(
event
is
PointerDownEvent
)
{
decoration
=
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFF0000
));
decoration
=
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFF0000
));
}
else
if
(
event
is
PointerUpEvent
)
{
decoration
=
new
BoxDecoration
(
backgroundColor:
backgroundColor
);
}
...
...
examples/layers/widgets/custom_render_box.dart
View file @
e9a775bf
...
...
@@ -28,9 +28,9 @@ class RenderDots extends RenderConstrainedBox {
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
final
Canvas
canvas
=
context
.
canvas
;
canvas
.
drawRect
(
offset
&
size
,
new
Paint
()..
color
=
new
Color
(
0xFF0000FF
));
canvas
.
drawRect
(
offset
&
size
,
new
Paint
()..
color
=
const
Color
(
0xFF0000FF
));
Paint
paint
=
new
Paint
()..
color
=
new
Color
(
0xFF00FF00
);
Paint
paint
=
new
Paint
()..
color
=
const
Color
(
0xFF00FF00
);
for
(
Point
point
in
_dots
.
values
)
canvas
.
drawCircle
(
point
,
50.0
,
paint
);
...
...
examples/layers/widgets/gestures.dart
View file @
e9a775bf
...
...
@@ -165,7 +165,7 @@ class _GestureDemoState extends State<GestureDemo> {
left:
0.0
,
child:
new
Card
(
child:
new
Container
(
padding:
new
EdgeInsets
.
all
(
4.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
child:
new
Column
(
children:
<
Widget
>[
new
Row
(
...
...
examples/layers/widgets/sectors.dart
View file @
e9a775bf
...
...
@@ -93,7 +93,7 @@ class SectorAppState extends State<SectorApp> {
return
new
Column
(
children:
<
Widget
>[
new
Container
(
padding:
new
EdgeInsets
.
symmetric
(
horizontal:
8.0
,
vertical:
25.0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
,
vertical:
25.0
),
child:
new
Row
(
children:
<
Widget
>[
new
RaisedButton
(
...
...
@@ -102,8 +102,8 @@ class SectorAppState extends State<SectorApp> {
child:
new
Row
(
children:
<
Widget
>[
new
Container
(
padding:
new
EdgeInsets
.
all
(
4.0
),
margin:
new
EdgeInsets
.
only
(
right:
10.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
margin:
const
EdgeInsets
.
only
(
right:
10.0
),
child:
new
WidgetToRenderBoxAdapter
(
renderBox:
sectorAddIcon
)
),
new
Text
(
'ADD SECTOR'
),
...
...
@@ -117,8 +117,8 @@ class SectorAppState extends State<SectorApp> {
child:
new
Row
(
children:
<
Widget
>[
new
Container
(
padding:
new
EdgeInsets
.
all
(
4.0
),
margin:
new
EdgeInsets
.
only
(
right:
10.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
margin:
const
EdgeInsets
.
only
(
right:
10.0
),
child:
new
WidgetToRenderBoxAdapter
(
renderBox:
sectorRemoveIcon
)
),
new
Text
(
'REMOVE SECTOR'
),
...
...
@@ -132,11 +132,11 @@ class SectorAppState extends State<SectorApp> {
),
new
Expanded
(
child:
new
Container
(
margin:
new
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
decoration:
new
BoxDecoration
(
border:
new
Border
.
all
()
),
padding:
new
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
new
WidgetToRenderBoxAdapter
(
renderBox:
sectors
,
onBuild:
doUpdates
...
...
examples/layers/widgets/spinning_mixed.dart
View file @
e9a775bf
...
...
@@ -44,8 +44,8 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
new
Rectangle
(
const
Color
(
0xFF00FFFF
)),
new
Material
(
child:
new
Container
(
padding:
new
EdgeInsets
.
all
(
10.0
),
margin:
new
EdgeInsets
.
all
(
10.0
),
padding:
const
EdgeInsets
.
all
(
10.0
),
margin:
const
EdgeInsets
.
all
(
10.0
),
child:
new
Row
(
children:
<
Widget
>[
new
RaisedButton
(
...
...
@@ -99,7 +99,7 @@ void main() {
addFlexChildSolidColor
(
flexRoot
,
const
Color
(
0xFF0000FF
),
flex:
1
);
transformBox
=
new
RenderTransform
(
child:
flexRoot
,
transform:
new
Matrix4
.
identity
(),
alignment:
FractionalOffset
.
center
);
RenderPadding
root
=
new
RenderPadding
(
padding:
new
EdgeInsets
.
all
(
80.0
),
child:
transformBox
);
RenderPadding
root
=
new
RenderPadding
(
padding:
const
EdgeInsets
.
all
(
80.0
),
child:
transformBox
);
binding
.
renderView
.
child
=
root
;
binding
.
addPersistentFrameCallback
(
rotate
);
...
...
examples/layers/widgets/styled_text.dart
View file @
e9a775bf
...
...
@@ -46,7 +46,7 @@ Widget toStyledText(String name, String text) {
style:
_kUnderline
,
text:
name
),
new
TextSpan
(
text:
':'
)
const
TextSpan
(
text:
':'
)
]
),
new
TextSpan
(
text:
text
)
...
...
@@ -108,7 +108,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
return
new
GestureDetector
(
onTap:
_handleTap
,
child:
new
Container
(
padding:
new
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
child:
new
Column
(
children:
children
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
...
...
examples/stocks/lib/stock_data.dart
View file @
e9a775bf
...
...
@@ -78,7 +78,7 @@ class StockDataFetcher {
print
(
"Failed to load stock data chunk
${_nextChunk - 1}
"
);
return
null
;
}
JsonDecoder
decoder
=
new
JsonDecoder
();
JsonDecoder
decoder
=
const
JsonDecoder
();
callback
(
new
StockData
(
decoder
.
convert
(
json
)));
if
(
_nextChunk
<
_kChunkCount
)
_fetchNextChunk
();
...
...
examples/stocks/lib/stock_symbol_viewer.dart
View file @
e9a775bf
...
...
@@ -22,7 +22,7 @@ class _StockSymbolView extends StatelessWidget {
TextStyle
headings
=
Theme
.
of
(
context
).
textTheme
.
body2
;
return
new
Container
(
padding:
new
EdgeInsets
.
all
(
20.0
),
padding:
const
EdgeInsets
.
all
(
20.0
),
child:
new
Column
(
children:
<
Widget
>[
new
Row
(
...
...
@@ -47,11 +47,11 @@ class _StockSymbolView extends StatelessWidget {
),
new
RichText
(
text:
new
TextSpan
(
style:
DefaultTextStyle
.
of
(
context
).
style
.
merge
(
new
TextStyle
(
fontSize:
8.0
)),
style:
DefaultTextStyle
.
of
(
context
).
style
.
merge
(
const
TextStyle
(
fontSize:
8.0
)),
text:
'Prices may be delayed by '
,
children:
<
TextSpan
>[
new
TextSpan
(
text:
'several'
,
style:
new
TextStyle
(
fontStyle:
FontStyle
.
italic
)),
new
TextSpan
(
text:
' years.'
),
const
TextSpan
(
text:
'several'
,
style:
const
TextStyle
(
fontStyle:
FontStyle
.
italic
)),
const
TextSpan
(
text:
' years.'
),
]
)
),
...
...
@@ -75,7 +75,7 @@ class StockSymbolPage extends StatelessWidget {
),
body:
new
SingleChildScrollView
(
child:
new
Container
(
margin:
new
EdgeInsets
.
all
(
20.0
),
margin:
const
EdgeInsets
.
all
(
20.0
),
child:
new
Card
(
child:
new
_StockSymbolView
(
stock:
stock
,
...
...
@@ -99,7 +99,7 @@ class StockSymbolBottomSheet extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
new
Container
(
padding:
new
EdgeInsets
.
all
(
10.0
),
padding:
const
EdgeInsets
.
all
(
10.0
),
decoration:
new
BoxDecoration
(
border:
new
Border
(
top:
new
BorderSide
(
color:
Colors
.
black26
))
),
...
...
examples/stocks/test/icon_color_test.dart
View file @
e9a775bf
...
...
@@ -59,7 +59,7 @@ void main() {
// sanity check
expect
(
find
.
text
(
'MARKET'
),
findsOneWidget
);
expect
(
find
.
text
(
'Account Balance'
),
findsNothing
);
await
tester
.
pump
(
new
Duration
(
seconds:
2
));
await
tester
.
pump
(
const
Duration
(
seconds:
2
));
expect
(
find
.
text
(
'MARKET'
),
findsOneWidget
);
expect
(
find
.
text
(
'Account Balance'
),
findsNothing
);
...
...
examples/stocks/test_driver/scroll_perf_test.dart
View file @
e9a775bf
...
...
@@ -28,14 +28,14 @@ void main() {
// Scroll down
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
await
driver
.
scroll
(
stockList
,
0.0
,
-
300.0
,
new
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
500
));
await
driver
.
scroll
(
stockList
,
0.0
,
-
300.0
,
const
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
500
));
}
// Scroll up
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
await
driver
.
scroll
(
stockList
,
0.0
,
300.0
,
new
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
milliseconds:
500
));
await
driver
.
scroll
(
stockList
,
0.0
,
300.0
,
const
Duration
(
milliseconds:
300
));
await
new
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
500
));
}
});
...
...
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