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
6a2148dd
Commit
6a2148dd
authored
Mar 08, 2017
by
Alexandre Ardhuin
Committed by
Ian Hickson
Mar 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prefer const constructors (#8594)
* prefer const constructors * fix double throw
parent
ce734e8f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
34 additions
and
34 deletions
+34
-34
home.dart
examples/flutter_gallery/lib/demo/animation/home.dart
+3
-3
cupertino_dialog_demo.dart
...ter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart
+2
-2
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+1
-1
icon_button.dart
packages/flutter/lib/src/material/icon_button.dart
+1
-1
message_codecs.dart
packages/flutter/lib/src/services/message_codecs.dart
+5
-5
button_test.dart
packages/flutter/test/cupertino/button_test.dart
+2
-2
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+5
-5
icon_button_test.dart
packages/flutter/test/material/icon_button_test.dart
+7
-7
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+3
-3
scroll_view_test.dart
packages/flutter/test/widgets/scroll_view_test.dart
+1
-1
single_child_scroll_view_test.dart
...s/flutter/test/widgets/single_child_scroll_view_test.dart
+1
-1
executable.dart
packages/flutter_tools/lib/executable.dart
+1
-1
vmservice_record_replay.dart
packages/flutter_tools/lib/src/vmservice_record_replay.dart
+1
-1
crash_reporting_test.dart
packages/flutter_tools/test/crash_reporting_test.dart
+1
-1
No files found.
examples/flutter_gallery/lib/demo/animation/home.dart
View file @
6a2148dd
...
...
@@ -446,7 +446,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
final
List
<
Widget
>
headings
=
<
Widget
>[];
for
(
int
index
=
0
;
index
<
allSections
.
length
;
index
++)
{
headings
.
add
(
new
Container
(
decoration:
new
BoxDecoration
(
backgroundColor:
_kAppBackgroundColor
),
decoration:
const
BoxDecoration
(
backgroundColor:
_kAppBackgroundColor
),
child:
new
ClipRect
(
child:
new
_AllSectionsView
(
sectionIndex:
index
,
...
...
@@ -526,8 +526,8 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
top:
statusBarHeight
,
left:
0.0
,
child:
new
IconTheme
(
data:
new
IconThemeData
(
color:
Colors
.
white
),
child:
new
BackButton
(),
data:
const
IconThemeData
(
color:
Colors
.
white
),
child:
const
BackButton
(),
),
),
],
...
...
examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart
View file @
6a2148dd
...
...
@@ -57,7 +57,7 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
onPressed:
()
{
Navigator
.
pop
(
context
,
'OK'
);
}
),
new
CupertinoDialogAction
(
child:
new
Text
(
'Cancel'
,
style:
new
TextStyle
(
fontWeight:
FontWeight
.
w600
)),
child:
new
Text
(
'Cancel'
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
w600
)),
onPressed:
()
{
Navigator
.
pop
(
context
,
'Cancel'
);
}
),
]
...
...
@@ -69,7 +69,7 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
new
CupertinoButton
(
child:
new
Text
(
'Alert with Title'
),
color:
CupertinoButton
.
kBlue
,
padding:
new
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
36.0
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
36.0
),
onPressed:
()
{
showDemoDialog
<
String
>(
context:
context
,
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
6a2148dd
...
...
@@ -451,7 +451,7 @@ class _AppBarState extends State<AppBar> {
children:
<
Widget
>[
new
Flexible
(
child:
new
ConstrainedBox
(
constraints:
new
BoxConstraints
(
maxHeight:
kToolbarHeight
),
constraints:
const
BoxConstraints
(
maxHeight:
kToolbarHeight
),
child:
appBar
,
),
),
...
...
packages/flutter/lib/src/material/icon_button.dart
View file @
6a2148dd
...
...
@@ -143,7 +143,7 @@ class IconButton extends StatelessWidget {
currentColor
=
disabledColor
??
Theme
.
of
(
context
).
disabledColor
;
Widget
result
=
new
ConstrainedBox
(
constraints:
new
BoxConstraints
(
minWidth:
kMinButtonSize
,
minHeight:
kMinButtonSize
),
constraints:
const
BoxConstraints
(
minWidth:
kMinButtonSize
,
minHeight:
kMinButtonSize
),
child:
new
Padding
(
padding:
padding
,
child:
new
SizedBox
(
...
...
packages/flutter/lib/src/services/message_codecs.dart
View file @
6a2148dd
...
...
@@ -205,7 +205,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
final
ReadBuffer
buffer
=
new
ReadBuffer
(
message
);
final
dynamic
result
=
_readValue
(
buffer
);
if
(
buffer
.
hasRemaining
)
throw
new
FormatException
(
'Message corrupted'
);
throw
const
FormatException
(
'Message corrupted'
);
return
result
;
}
...
...
@@ -303,7 +303,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
static
dynamic
_readValue
(
ReadBuffer
buffer
)
{
if
(!
buffer
.
hasRemaining
)
throw
throw
new
FormatException
(
'Message corrupted'
);
throw
const
FormatException
(
'Message corrupted'
);
dynamic
result
;
switch
(
buffer
.
getUint8
())
{
case
_kNull:
...
...
@@ -363,7 +363,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
result
[
_readValue
(
buffer
)]
=
_readValue
(
buffer
);
}
break
;
default
:
throw
new
FormatException
(
'Message corrupted'
);
default
:
throw
const
FormatException
(
'Message corrupted'
);
}
return
result
;
}
...
...
@@ -405,7 +405,7 @@ class StandardMethodCodec implements MethodCodec {
dynamic
decodeEnvelope
(
ByteData
envelope
)
{
// First byte is zero in success case, and non-zero otherwise.
if
(
envelope
==
null
||
envelope
.
lengthInBytes
==
0
)
throw
new
FormatException
(
'Expected envelope, got nothing'
);
throw
const
FormatException
(
'Expected envelope, got nothing'
);
final
ReadBuffer
buffer
=
new
ReadBuffer
(
envelope
);
if
(
buffer
.
getUint8
()
==
0
)
return
StandardMessageCodec
.
_readValue
(
buffer
);
...
...
@@ -415,6 +415,6 @@ class StandardMethodCodec implements MethodCodec {
if
(
errorCode
is
String
&&
(
errorMessage
==
null
||
errorMessage
is
String
))
throw
new
PlatformException
(
code:
errorCode
,
message:
errorMessage
,
details:
errorDetails
);
else
throw
new
FormatException
(
'Invalid envelope'
);
throw
const
FormatException
(
'Invalid envelope'
);
}
}
packages/flutter/test/cupertino/button_test.dart
View file @
6a2148dd
...
...
@@ -47,7 +47,7 @@ void main() {
await
tester
.
pumpWidget
(
new
Center
(
child:
new
CupertinoButton
(
child:
new
Text
(
'X'
,
style:
testStyle
),
onPressed:
null
,
color:
new
Color
(
0xFFFFFFFF
),
color:
const
Color
(
0xFFFFFFFF
),
)));
final
RenderBox
buttonBox
=
tester
.
renderObject
(
find
.
byType
(
CupertinoButton
));
expect
(
...
...
@@ -61,7 +61,7 @@ void main() {
await
tester
.
pumpWidget
(
new
Center
(
child:
new
CupertinoButton
(
child:
new
Text
(
' '
,
style:
testStyle
),
onPressed:
null
,
padding:
new
EdgeInsets
.
all
(
100.0
),
padding:
const
EdgeInsets
.
all
(
100.0
),
)));
final
RenderBox
buttonBox
=
tester
.
renderObject
(
find
.
byType
(
CupertinoButton
));
expect
(
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
6a2148dd
...
...
@@ -311,8 +311,8 @@ void main() {
);
final
Finder
hamburger
=
find
.
byTooltip
(
'Open navigation menu'
);
expect
(
tester
.
getTopLeft
(
hamburger
),
new
Point
(
0.0
,
0.0
));
expect
(
tester
.
getSize
(
hamburger
),
new
Size
(
56.0
,
56.0
));
expect
(
tester
.
getTopLeft
(
hamburger
),
const
Point
(
0.0
,
0.0
));
expect
(
tester
.
getSize
(
hamburger
),
const
Size
(
56.0
,
56.0
));
});
testWidgets
(
'test action is 4dp from edge and 48dp min'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -343,13 +343,13 @@ void main() {
final
Finder
addButton
=
find
.
byTooltip
(
'Add'
);
// Right padding is 4dp.
expect
(
tester
.
getTopRight
(
addButton
),
new
Point
(
800.0
-
4.0
,
0.0
));
expect
(
tester
.
getTopRight
(
addButton
),
const
Point
(
800.0
-
4.0
,
0.0
));
// It's still the size it was plus the 2 * 8dp padding from IconButton.
expect
(
tester
.
getSize
(
addButton
),
new
Size
(
60.0
+
2
*
8.0
,
56.0
));
expect
(
tester
.
getSize
(
addButton
),
const
Size
(
60.0
+
2
*
8.0
,
56.0
));
final
Finder
shareButton
=
find
.
byTooltip
(
'Share'
);
// The 20dp icon is expanded to fill the IconButton's touch target to 48dp.
expect
(
tester
.
getSize
(
shareButton
),
new
Size
(
48.0
,
56.0
));
expect
(
tester
.
getSize
(
shareButton
),
const
Size
(
48.0
,
56.0
));
});
testWidgets
(
'SliverAppBar default configuration'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/material/icon_button_test.dart
View file @
6a2148dd
...
...
@@ -33,7 +33,7 @@ void main() {
);
final
RenderBox
iconButton
=
tester
.
renderObject
(
find
.
byType
(
IconButton
));
expect
(
iconButton
.
size
,
new
Size
(
48.0
,
48.0
));
expect
(
iconButton
.
size
,
const
Size
(
48.0
,
48.0
));
await
tester
.
tap
(
find
.
byType
(
IconButton
));
expect
(
mockOnPressedFunction
.
called
,
1
);
...
...
@@ -53,7 +53,7 @@ void main() {
);
final
RenderBox
iconButton
=
tester
.
renderObject
(
find
.
byType
(
IconButton
));
expect
(
iconButton
.
size
,
new
Size
(
48.0
,
48.0
));
expect
(
iconButton
.
size
,
const
Size
(
48.0
,
48.0
));
});
testWidgets
(
'test icons can be small when total size is >48dp'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -62,7 +62,7 @@ void main() {
child:
new
Center
(
child:
new
IconButton
(
iconSize:
10.0
,
padding:
new
EdgeInsets
.
all
(
30.0
),
padding:
const
EdgeInsets
.
all
(
30.0
),
onPressed:
mockOnPressedFunction
,
icon:
new
Icon
(
Icons
.
link
),
),
...
...
@@ -71,7 +71,7 @@ void main() {
);
final
RenderBox
iconButton
=
tester
.
renderObject
(
find
.
byType
(
IconButton
));
expect
(
iconButton
.
size
,
new
Size
(
70.0
,
70.0
));
expect
(
iconButton
.
size
,
const
Size
(
70.0
,
70.0
));
});
testWidgets
(
'test default icon buttons are constrained'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -89,7 +89,7 @@ void main() {
);
final
RenderBox
box
=
tester
.
renderObject
(
find
.
byType
(
IconButton
));
expect
(
box
.
size
,
new
Size
(
80.0
,
80.0
));
expect
(
box
.
size
,
const
Size
(
80.0
,
80.0
));
});
testWidgets
(
...
...
@@ -110,7 +110,7 @@ void main() {
);
final
RenderBox
box
=
tester
.
renderObject
(
find
.
byType
(
IconButton
));
expect
(
box
.
size
,
new
Size
(
48.0
,
600.0
));
expect
(
box
.
size
,
const
Size
(
48.0
,
600.0
));
});
testWidgets
(
'test default padding'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -127,7 +127,7 @@ void main() {
);
final
RenderBox
box
=
tester
.
renderObject
(
find
.
byType
(
IconButton
));
expect
(
box
.
size
,
new
Size
(
96.0
,
96.0
));
expect
(
box
.
size
,
const
Size
(
96.0
,
96.0
));
});
testWidgets
(
'test tooltip'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
6a2148dd
...
...
@@ -44,7 +44,7 @@ void main() {
testWidgets
(
'Scaffold large bottom padding test'
,
(
WidgetTester
tester
)
async
{
final
Key
bodyKey
=
new
UniqueKey
();
await
tester
.
pumpWidget
(
new
MediaQuery
(
data:
new
MediaQueryData
(
data:
const
MediaQueryData
(
padding:
const
EdgeInsets
.
only
(
bottom:
700.0
),
),
child:
new
Scaffold
(
...
...
@@ -56,7 +56,7 @@ void main() {
expect
(
bodyBox
.
size
,
equals
(
const
Size
(
800.0
,
0.0
)));
await
tester
.
pumpWidget
(
new
MediaQuery
(
data:
new
MediaQueryData
(
data:
const
MediaQueryData
(
padding:
const
EdgeInsets
.
only
(
bottom:
500.0
),
),
child:
new
Scaffold
(
...
...
@@ -67,7 +67,7 @@ void main() {
expect
(
bodyBox
.
size
,
equals
(
const
Size
(
800.0
,
100.0
)));
await
tester
.
pumpWidget
(
new
MediaQuery
(
data:
new
MediaQueryData
(
data:
const
MediaQueryData
(
padding:
const
EdgeInsets
.
only
(
bottom:
580.0
),
),
child:
new
Scaffold
(
...
...
packages/flutter/test/widgets/scroll_view_test.dart
View file @
6a2148dd
...
...
@@ -269,7 +269,7 @@ void main() {
primary:
true
,
children:
<
Widget
>[
new
Container
(
constraints:
new
BoxConstraints
(
maxHeight:
200.0
),
constraints:
const
BoxConstraints
(
maxHeight:
200.0
),
child:
new
ListView
(
key:
innerKey
,
primary:
true
),
),
],
...
...
packages/flutter/test/widgets/single_child_scroll_view_test.dart
View file @
6a2148dd
...
...
@@ -163,7 +163,7 @@ void main() {
child:
new
SingleChildScrollView
(
primary:
true
,
child:
new
Container
(
constraints:
new
BoxConstraints
(
maxHeight:
200.0
),
constraints:
const
BoxConstraints
(
maxHeight:
200.0
),
child:
new
ListView
(
key:
innerKey
,
primary:
true
),
),
),
...
...
packages/flutter_tools/lib/executable.dart
View file @
6a2148dd
...
...
@@ -238,7 +238,7 @@ Future<int> _handleToolError(
/// be recording. Additionally, in the case of a crash we do not trust the
/// integrity of the [AppContext].
@visibleForTesting
FileSystem
crashFileSystem
=
new
LocalFileSystem
();
FileSystem
crashFileSystem
=
const
LocalFileSystem
();
/// Saves the crash report to a local file.
Future
<
File
>
_createLocalCrashReport
(
List
<
String
>
args
,
dynamic
error
,
Chain
chain
)
async
{
...
...
packages/flutter_tools/lib/src/vmservice_record_replay.dart
View file @
6a2148dd
...
...
@@ -36,7 +36,7 @@ class RecordingVMServiceChannel extends DelegatingStreamChannel<String> {
_messages
.
sort
();
final
File
file
=
_getManifest
(
location
);
final
String
json
=
new
JsonEncoder
.
withIndent
(
' '
).
convert
(
_messages
);
final
String
json
=
const
JsonEncoder
.
withIndent
(
' '
).
convert
(
_messages
);
await
file
.
writeAsString
(
json
,
flush:
true
);
},
ShutdownStage
.
SERIALIZE_RECORDING
);
}
...
...
packages/flutter_tools/test/crash_reporting_test.dart
View file @
6a2148dd
...
...
@@ -28,7 +28,7 @@ void main() {
});
tearDown
(()
{
tools
.
crashFileSystem
=
new
LocalFileSystem
();
tools
.
crashFileSystem
=
const
LocalFileSystem
();
restoreExitFunction
();
exitTestingMode
();
});
...
...
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