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
1eaefe18
Commit
1eaefe18
authored
Jun 08, 2017
by
Alexandre Ardhuin
Committed by
GitHub
Jun 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more const for immutables (#10563)
parent
dfc7788c
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
38 additions
and
38 deletions
+38
-38
animated_list.dart
examples/catalog/lib/animated_list.dart
+1
-1
expansion_tile_sample.dart
examples/catalog/lib/expansion_tile_sample.dart
+1
-1
home.dart
examples/flutter_gallery/lib/demo/animation/home.dart
+2
-2
widgets.dart
examples/flutter_gallery/lib/demo/animation/widgets.dart
+2
-2
colors_demo.dart
examples/flutter_gallery/lib/demo/colors_demo.dart
+1
-1
shrine_home.dart
examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
+2
-2
shrine_order.dart
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
+3
-3
shrine_page.dart
examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
+1
-1
typography_demo.dart
examples/flutter_gallery/lib/demo/typography_demo.dart
+1
-1
drawer.dart
examples/flutter_gallery/lib/gallery/drawer.dart
+1
-1
home.dart
examples/flutter_gallery/lib/gallery/home.dart
+1
-1
item.dart
examples/flutter_gallery/lib/gallery/item.dart
+1
-1
updates.dart
examples/flutter_gallery/lib/gallery/updates.dart
+1
-1
main.dart
examples/platform_view/lib/main.dart
+2
-2
message_codec.dart
packages/flutter/lib/src/services/message_codec.dart
+1
-1
animated_list.dart
packages/flutter/lib/src/widgets/animated_list.dart
+1
-1
async.dart
packages/flutter/lib/src/widgets/async.dart
+1
-1
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+2
-2
nested_scroll_view.dart
packages/flutter/lib/src/widgets/nested_scroll_view.dart
+1
-1
haptic_feedback_test.dart
packages/flutter/test/services/haptic_feedback_test.dart
+1
-1
platform_channel_test.dart
packages/flutter/test/services/platform_channel_test.dart
+5
-5
system_navigator_test.dart
packages/flutter/test/services/system_navigator_test.dart
+1
-1
system_sound_test.dart
packages/flutter/test/services/system_sound_test.dart
+3
-3
async_test.dart
packages/flutter/test/widgets/async_test.dart
+1
-1
layout_builder_mutations_test.dart
...s/flutter/test/widgets/layout_builder_mutations_test.dart
+1
-1
No files found.
examples/catalog/lib/animated_list.dart
View file @
1eaefe18
...
...
@@ -152,7 +152,7 @@ class ListModel<E> {
/// This widget's height is based on the animation parameter, it varies
/// from 0 to 128 as the animation varies from 0.0 to 1.0.
class
CardItem
extends
StatelessWidget
{
CardItem
({
const
CardItem
({
Key
key
,
@required
this
.
animation
,
this
.
onTap
,
...
...
examples/catalog/lib/expansion_tile_sample.dart
View file @
1eaefe18
...
...
@@ -68,7 +68,7 @@ final List<Entry> data = <Entry>[
// Displays one Entry. If the entry has children then it's displayed
// with an ExpansionTile.
class
EntryItem
extends
StatelessWidget
{
EntryItem
(
this
.
entry
);
const
EntryItem
(
this
.
entry
);
final
Entry
entry
;
...
...
examples/flutter_gallery/lib/demo/animation/home.dart
View file @
1eaefe18
...
...
@@ -75,7 +75,7 @@ class _RenderStatusBarPaddingSliver extends RenderSliver {
}
class
_StatusBarPaddingSliver
extends
SingleChildRenderObjectWidget
{
_StatusBarPaddingSliver
({
const
_StatusBarPaddingSliver
({
Key
key
,
@required
this
.
maxHeight
,
this
.
scrollFactor
:
5.0
,
...
...
@@ -369,7 +369,7 @@ class _AllSectionsView extends AnimatedWidget {
// app bar's height is _kAppBarMidHeight and only one section heading is
// visible.
class
_SnappingScrollPhysics
extends
ClampingScrollPhysics
{
_SnappingScrollPhysics
({
const
_SnappingScrollPhysics
({
ScrollPhysics
parent
,
@required
this
.
midScrollOffset
,
})
:
assert
(
midScrollOffset
!=
null
),
...
...
examples/flutter_gallery/lib/demo/animation/widgets.dart
View file @
1eaefe18
...
...
@@ -11,7 +11,7 @@ const double kSectionIndicatorWidth = 32.0;
// The card for a single section. Displays the section's gradient and background image.
class
SectionCard
extends
StatelessWidget
{
SectionCard
({
Key
key
,
@required
this
.
section
})
const
SectionCard
({
Key
key
,
@required
this
.
section
})
:
assert
(
section
!=
null
),
super
(
key:
key
);
...
...
@@ -60,7 +60,7 @@ class SectionTitle extends StatelessWidget {
color:
const
Color
(
0x19000000
),
);
SectionTitle
({
const
SectionTitle
({
Key
key
,
@required
this
.
section
,
@required
this
.
scale
,
...
...
examples/flutter_gallery/lib/demo/colors_demo.dart
View file @
1eaefe18
...
...
@@ -42,7 +42,7 @@ final List<Palette> allPalettes = <Palette>[
class
ColorItem
extends
StatelessWidget
{
ColorItem
({
const
ColorItem
({
Key
key
,
@required
this
.
index
,
@required
this
.
color
,
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
View file @
1eaefe18
...
...
@@ -116,7 +116,7 @@ class _ShrineGridDelegate extends SliverGridDelegate {
// Displays the Vendor's name and avatar.
class
_VendorItem
extends
StatelessWidget
{
_VendorItem
({
Key
key
,
@required
this
.
vendor
})
const
_VendorItem
({
Key
key
,
@required
this
.
vendor
})
:
assert
(
vendor
!=
null
),
super
(
key:
key
);
...
...
@@ -294,7 +294,7 @@ class _Heading extends StatelessWidget {
// A card that displays a product's image, price, and vendor. The _ProductItem
// cards appear in a grid below the heading.
class
_ProductItem
extends
StatelessWidget
{
_ProductItem
({
Key
key
,
@required
this
.
product
,
this
.
onPressed
})
const
_ProductItem
({
Key
key
,
@required
this
.
product
,
this
.
onPressed
})
:
assert
(
product
!=
null
),
super
(
key:
key
);
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
View file @
1eaefe18
...
...
@@ -12,7 +12,7 @@ import 'shrine_types.dart';
// Displays the product title's, description, and order quantity dropdown.
class
_ProductItem
extends
StatelessWidget
{
_ProductItem
({
const
_ProductItem
({
Key
key
,
@required
this
.
product
,
@required
this
.
quantity
,
...
...
@@ -69,7 +69,7 @@ class _ProductItem extends StatelessWidget {
// Vendor name and description
class
_VendorItem
extends
StatelessWidget
{
_VendorItem
({
Key
key
,
@required
this
.
vendor
})
const
_VendorItem
({
Key
key
,
@required
this
.
vendor
})
:
assert
(
vendor
!=
null
),
super
(
key:
key
);
...
...
@@ -140,7 +140,7 @@ class _HeadingLayout extends MultiChildLayoutDelegate {
// Describes a product and vendor in detail, supports specifying
// a order quantity (0-5). Appears at the top of the OrderPage.
class
_Heading
extends
StatelessWidget
{
_Heading
({
const
_Heading
({
Key
key
,
@required
this
.
product
,
@required
this
.
quantity
,
...
...
examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
View file @
1eaefe18
...
...
@@ -15,7 +15,7 @@ enum ShrineAction {
}
class
ShrinePage
extends
StatefulWidget
{
ShrinePage
({
const
ShrinePage
({
Key
key
,
@required
this
.
scaffoldKey
,
@required
this
.
body
,
...
...
examples/flutter_gallery/lib/demo/typography_demo.dart
View file @
1eaefe18
...
...
@@ -6,7 +6,7 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/material.dart'
;
class
TextStyleItem
extends
StatelessWidget
{
TextStyleItem
({
const
TextStyleItem
({
Key
key
,
@required
this
.
name
,
@required
this
.
style
,
...
...
examples/flutter_gallery/lib/gallery/drawer.dart
View file @
1eaefe18
...
...
@@ -88,7 +88,7 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> {
}
class
GalleryDrawer
extends
StatelessWidget
{
GalleryDrawer
({
const
GalleryDrawer
({
Key
key
,
this
.
useLightTheme
,
@required
this
.
onThemeChanged
,
...
...
examples/flutter_gallery/lib/gallery/home.dart
View file @
1eaefe18
...
...
@@ -66,7 +66,7 @@ class _AppBarBackground extends StatelessWidget {
}
class
GalleryHome
extends
StatefulWidget
{
GalleryHome
({
const
GalleryHome
({
Key
key
,
this
.
useLightTheme
,
@required
this
.
onThemeChanged
,
...
...
examples/flutter_gallery/lib/gallery/item.dart
View file @
1eaefe18
...
...
@@ -12,7 +12,7 @@ import '../demo/all.dart';
typedef
Widget
GalleryDemoBuilder
(
);
class
GalleryItem
extends
StatelessWidget
{
GalleryItem
({
const
GalleryItem
({
@required
this
.
title
,
this
.
subtitle
,
@required
this
.
category
,
...
...
examples/flutter_gallery/lib/gallery/updates.dart
View file @
1eaefe18
...
...
@@ -12,7 +12,7 @@ import 'package:url_launcher/url_launcher.dart';
typedef
Future
<
String
>
UpdateUrlFetcher
();
class
Updater
extends
StatefulWidget
{
Updater
({
@required
this
.
updateUrlFetcher
,
this
.
child
,
Key
key
})
const
Updater
({
@required
this
.
updateUrlFetcher
,
this
.
child
,
Key
key
})
:
assert
(
updateUrlFetcher
!=
null
),
super
(
key:
key
);
...
...
examples/platform_view/lib/main.dart
View file @
1eaefe18
...
...
@@ -19,13 +19,13 @@ class PlatformView extends StatelessWidget {
theme:
new
ThemeData
(
primarySwatch:
Colors
.
grey
,
),
home:
new
MyHomePage
(
title:
'Platform View'
),
home:
const
MyHomePage
(
title:
'Platform View'
),
);
}
}
class
MyHomePage
extends
StatefulWidget
{
MyHomePage
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
const
MyHomePage
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
...
...
packages/flutter/lib/src/services/message_codec.dart
View file @
1eaefe18
...
...
@@ -35,7 +35,7 @@ abstract class MessageCodec<T> {
class
MethodCall
{
/// Creates a [MethodCall] representing the invocation of [method] with the
/// specified [arguments].
MethodCall
(
this
.
method
,
[
this
.
arguments
])
const
MethodCall
(
this
.
method
,
[
this
.
arguments
])
:
assert
(
method
!=
null
);
/// The name of the method to be called.
...
...
packages/flutter/lib/src/widgets/animated_list.dart
View file @
1eaefe18
...
...
@@ -46,7 +46,7 @@ class _ActiveItem implements Comparable<_ActiveItem> {
/// This widget is similar to one created by [ListView.builder].
class
AnimatedList
extends
StatefulWidget
{
/// Creates a scrolling container that animates items when they are inserted or removed.
AnimatedList
({
const
AnimatedList
({
Key
key
,
@required
this
.
itemBuilder
,
this
.
initialItemCount
:
0
,
...
...
packages/flutter/lib/src/widgets/async.dart
View file @
1eaefe18
...
...
@@ -195,7 +195,7 @@ class AsyncSnapshot<T> {
const
AsyncSnapshot
.
nothing
()
:
this
.
_
(
ConnectionState
.
none
,
null
,
null
);
/// Creates an [AsyncSnapshot] in the specified [state] and with the specified [data].
AsyncSnapshot
.
withData
(
ConnectionState
state
,
T
data
)
:
this
.
_
(
state
,
data
,
null
);
// not const because https://github.com/dart-lang/sdk/issues/29432
const
AsyncSnapshot
.
withData
(
ConnectionState
state
,
T
data
)
:
this
.
_
(
state
,
data
,
null
);
/// Creates an [AsyncSnapshot] in the specified [state] and with the specified [error].
const
AsyncSnapshot
.
withError
(
ConnectionState
state
,
Object
error
)
:
this
.
_
(
state
,
null
,
error
);
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
1eaefe18
...
...
@@ -313,10 +313,10 @@ class LabeledGlobalKey<T extends State<StatefulWidget>> extends GlobalKey<T> {
/// Creates a global key with a debugging label.
///
/// The label does not affect the key's identity.
const
LabeledGlobalKey
(
this
.
_debugLabel
)
:
super
.
constructor
();
LabeledGlobalKey
(
this
.
_debugLabel
)
:
super
.
constructor
();
// Used for forwarding the constructor from GlobalKey.
const
LabeledGlobalKey
.
_
({
String
debugLabel
})
:
_debugLabel
=
debugLabel
,
super
.
constructor
();
LabeledGlobalKey
.
_
({
String
debugLabel
})
:
_debugLabel
=
debugLabel
,
super
.
constructor
();
final
String
_debugLabel
;
...
...
packages/flutter/lib/src/widgets/nested_scroll_view.dart
View file @
1eaefe18
...
...
@@ -36,7 +36,7 @@ typedef List<Widget> NestedScrollViewHeaderSliversBuilder(BuildContext context,
const
double
_kInitialScrollOffset
=
0.0
;
class
NestedScrollView
extends
StatefulWidget
{
NestedScrollView
({
const
NestedScrollView
({
Key
key
,
this
.
scrollDirection
:
Axis
.
vertical
,
this
.
reverse
:
false
,
...
...
packages/flutter/test/services/haptic_feedback_test.dart
View file @
1eaefe18
...
...
@@ -15,6 +15,6 @@ void main() {
await
HapticFeedback
.
vibrate
();
expect
(
log
,
equals
(<
MethodCall
>[
new
MethodCall
(
'HapticFeedback.vibrate'
)]));
expect
(
log
,
equals
(<
MethodCall
>[
const
MethodCall
(
'HapticFeedback.vibrate'
)]));
});
}
packages/flutter/test/services/platform_channel_test.dart
View file @
1eaefe18
...
...
@@ -91,7 +91,7 @@ void main() {
});
test
(
'can handle method call with no registered plugin'
,
()
async
{
channel
.
setMethodCallHandler
(
null
);
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
new
MethodCall
(
'sayHello'
,
'hello'
));
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
const
MethodCall
(
'sayHello'
,
'hello'
));
ByteData
envelope
;
await
BinaryMessages
.
handlePlatformMessage
(
'ch7'
,
call
,
(
ByteData
result
)
{
envelope
=
result
;
...
...
@@ -102,7 +102,7 @@ void main() {
channel
.
setMethodCallHandler
((
MethodCall
call
)
async
{
throw
new
MissingPluginException
();
});
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
new
MethodCall
(
'sayHello'
,
'hello'
));
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
const
MethodCall
(
'sayHello'
,
'hello'
));
ByteData
envelope
;
await
BinaryMessages
.
handlePlatformMessage
(
'ch7'
,
call
,
(
ByteData
result
)
{
envelope
=
result
;
...
...
@@ -111,7 +111,7 @@ void main() {
});
test
(
'can handle method call with successful result'
,
()
async
{
channel
.
setMethodCallHandler
((
MethodCall
call
)
async
=>
'
${call.arguments}
, world'
);
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
new
MethodCall
(
'sayHello'
,
'hello'
));
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
const
MethodCall
(
'sayHello'
,
'hello'
));
ByteData
envelope
;
await
BinaryMessages
.
handlePlatformMessage
(
'ch7'
,
call
,
(
ByteData
result
)
{
envelope
=
result
;
...
...
@@ -122,7 +122,7 @@ void main() {
channel
.
setMethodCallHandler
((
MethodCall
call
)
async
{
throw
new
PlatformException
(
code:
'bad'
,
message:
'sayHello failed'
,
details:
null
);
});
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
new
MethodCall
(
'sayHello'
,
'hello'
));
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
const
MethodCall
(
'sayHello'
,
'hello'
));
ByteData
envelope
;
await
BinaryMessages
.
handlePlatformMessage
(
'ch7'
,
call
,
(
ByteData
result
)
{
envelope
=
result
;
...
...
@@ -141,7 +141,7 @@ void main() {
channel
.
setMethodCallHandler
((
MethodCall
call
)
async
{
throw
new
ArgumentError
(
'bad'
);
});
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
new
MethodCall
(
'sayHello'
,
'hello'
));
final
ByteData
call
=
jsonMethod
.
encodeMethodCall
(
const
MethodCall
(
'sayHello'
,
'hello'
));
ByteData
envelope
;
await
BinaryMessages
.
handlePlatformMessage
(
'ch7'
,
call
,
(
ByteData
result
)
{
envelope
=
result
;
...
...
packages/flutter/test/services/system_navigator_test.dart
View file @
1eaefe18
...
...
@@ -15,6 +15,6 @@ void main() {
await
SystemNavigator
.
pop
();
expect
(
log
,
equals
(<
MethodCall
>[
new
MethodCall
(
'SystemNavigator.pop'
)]));
expect
(
log
,
equals
(<
MethodCall
>[
const
MethodCall
(
'SystemNavigator.pop'
)]));
});
}
packages/flutter/test/services/system_sound_test.dart
View file @
1eaefe18
...
...
@@ -8,13 +8,13 @@ import 'package:test/test.dart';
void
main
(
)
{
test
(
'System sound control test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
SystemChannels
.
platform
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
});
await
SystemSound
.
play
(
SystemSoundType
.
click
);
expect
(
log
,
equals
(<
MethodCall
>[
new
MethodCall
(
'SystemSound.play'
,
"SystemSoundType.click"
)]));
expect
(
log
,
equals
(<
MethodCall
>[
const
MethodCall
(
'SystemSound.play'
,
"SystemSoundType.click"
)]));
});
}
packages/flutter/test/widgets/async_test.dart
View file @
1eaefe18
...
...
@@ -14,7 +14,7 @@ void main() {
group
(
'AsyncSnapshot'
,
()
{
test
(
'requiring data succeeds if data is present'
,
()
{
expect
(
new
AsyncSnapshot
<
String
>.
withData
(
ConnectionState
.
done
,
'hello'
).
requireData
,
const
AsyncSnapshot
<
String
>.
withData
(
ConnectionState
.
done
,
'hello'
).
requireData
,
'hello'
,
);
});
...
...
packages/flutter/test/widgets/layout_builder_mutations_test.dart
View file @
1eaefe18
...
...
@@ -9,7 +9,7 @@ import 'package:flutter/src/widgets/layout_builder.dart';
import
'package:flutter_test/flutter_test.dart'
hide
TypeMatcher
;
class
Wrapper
extends
StatelessWidget
{
Wrapper
({
const
Wrapper
({
Key
key
,
@required
this
.
child
})
:
assert
(
child
!=
null
),
...
...
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