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
3c581953
Unverified
Commit
3c581953
authored
Sep 07, 2018
by
Alexandre Ardhuin
Committed by
GitHub
Sep 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint unnecessary_const on samples (#21155)
parent
c599f995
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
51 additions
and
45 deletions
+51
-45
analyze-sample-code.dart
dev/bots/analyze-sample-code.dart
+6
-0
segmented_control.dart
packages/flutter/lib/src/cupertino/segmented_control.dart
+2
-2
annotations.dart
packages/flutter/lib/src/foundation/annotations.dart
+5
-5
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+1
-1
card.dart
packages/flutter/lib/src/material/card.dart
+3
-3
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+6
-6
box_border.dart
packages/flutter/lib/src/painting/box_border.dart
+12
-12
gradient.dart
packages/flutter/lib/src/painting/gradient.dart
+5
-5
platform_channel.dart
packages/flutter/lib/src/services/platform_channel.dart
+1
-1
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+4
-4
scroll_view.dart
packages/flutter/lib/src/widgets/scroll_view.dart
+2
-2
text.dart
packages/flutter/lib/src/widgets/text.dart
+4
-4
No files found.
dev/bots/analyze-sample-code.dart
View file @
3c581953
...
...
@@ -107,6 +107,7 @@ Future<Null> main(List<String> arguments) async {
try
{
final
File
mainDart
=
new
File
(
path
.
join
(
tempDir
.
path
,
'main.dart'
));
final
File
pubSpec
=
new
File
(
path
.
join
(
tempDir
.
path
,
'pubspec.yaml'
));
final
File
analysisOptions
=
new
File
(
path
.
join
(
tempDir
.
path
,
'analysis_options.yaml'
));
Directory
flutterPackage
;
if
(
arguments
.
length
==
1
)
{
// Used for testing.
...
...
@@ -212,6 +213,11 @@ dependencies:
sdk: flutter
flutter_test:
sdk: flutter
'''
);
analysisOptions
.
writeAsStringSync
(
'''
linter:
rules:
- unnecessary_const
'''
);
print
(
'Found
$sampleCodeSections
sample code sections.'
);
final
Process
process
=
await
Process
.
start
(
...
...
packages/flutter/lib/src/cupertino/segmented_control.dart
View file @
3c581953
...
...
@@ -135,8 +135,8 @@ class CupertinoSegmentedControl<T> extends StatefulWidget {
///
/// class SegmentedControlExampleState extends State<SegmentedControlExample> {
/// final Map<int, Widget> children = const {
/// 0:
const
Text('Child 1'),
/// 1:
const
Text('Child 2'),
/// 0: Text('Child 1'),
/// 1: Text('Child 2'),
/// };
///
/// int currentValue;
...
...
packages/flutter/lib/src/foundation/annotations.dart
View file @
3c581953
...
...
@@ -18,8 +18,8 @@
/// ```dart
/// /// A copper coffee pot, as desired by Ben Turpin.
/// /// ...documentation...
/// @Category(
const
<String>['Pots', 'Coffee'])
/// @Category(
const
<String>['Copper', 'Cookware'])
/// @Category(<String>['Pots', 'Coffee'])
/// @Category(<String>['Copper', 'Cookware'])
/// @DocumentationIcon('https://example.com/images/coffee.png')
/// @Summary('A proper cup of coffee is made in a proper copper coffee pot.')
/// class CopperCoffeePot {
...
...
@@ -55,7 +55,7 @@ class Category {
/// ```dart
/// /// Utility class for beginning a dream-sharing sequence.
/// /// ...documentation...
/// @Category(
const
<String>['Military Technology', 'Experimental'])
/// @Category(<String>['Military Technology', 'Experimental'])
/// @DocumentationIcon('https://docs.example.org/icons/top.png')
/// class DreamSharing {
/// // ...code...
...
...
@@ -89,8 +89,8 @@ class DocumentationIcon {
/// ///
/// /// Instances of this class can hunt small animals.
/// /// This cat has three legs.
/// @Category(
const
<String>['Animals', 'Cats'])
/// @Category(
const
<String>['Cute', 'Pets'])
/// @Category(<String>['Animals', 'Cats'])
/// @Category(<String>['Cute', 'Pets'])
/// @DocumentationIcon('https://www.examples.net/docs/images/icons/pillar.jpeg')
/// @Summary('A famous three-legged cat.')
/// class Pillar extends Cat {
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
3c581953
...
...
@@ -696,7 +696,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
/// new SliverAppBar(
/// expandedHeight: 150.0,
/// flexibleSpace: const FlexibleSpaceBar(
/// title:
const
Text('Available seats'),
/// title: Text('Available seats'),
/// ),
/// actions: <Widget>[
/// new IconButton(
...
...
packages/flutter/lib/src/material/card.dart
View file @
3c581953
...
...
@@ -22,9 +22,9 @@ import 'theme.dart';
/// mainAxisSize: MainAxisSize.min,
/// children: <Widget>[
/// const ListTile(
/// leading:
const
Icon(Icons.album),
/// title:
const
Text('The Enchanted Nightingale'),
/// subtitle:
const
Text('Music by Julie Gable. Lyrics by Sidney Stein.'),
/// leading: Icon(Icons.album),
/// title: Text('The Enchanted Nightingale'),
/// subtitle: Text('Music by Julie Gable. Lyrics by Sidney Stein.'),
/// ),
/// new ButtonTheme.bar( // make buttons use the appropriate styles for cards
/// child: new ButtonBar(
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
3c581953
...
...
@@ -137,7 +137,7 @@ class _PopupMenuDividerState extends State<PopupMenuDivider> {
/// ```dart
/// const PopupMenuItem<WhyFarther>(
/// value: WhyFarther.harder,
/// child:
const
Text('Working a lot harder'),
/// child: Text('Working a lot harder'),
/// )
/// ```
///
...
...
@@ -312,7 +312,7 @@ class PopupMenuItemState<T, W extends PopupMenuItem<T>> extends State<W> {
/// const PopupMenuDivider(),
/// const PopupMenuItem<Commands>(
/// value: Commands.hurricaneCame,
/// child:
const ListTile(leading: const Icon(null), title: const
Text('Bring hurricane')),
/// child:
ListTile(leading: Icon(null), title:
Text('Bring hurricane')),
/// ),
/// // ...other items listed here
/// ],
...
...
@@ -779,19 +779,19 @@ typedef List<PopupMenuEntry<T>> PopupMenuItemBuilder<T>(BuildContext context);
/// itemBuilder: (BuildContext context) => <PopupMenuEntry<WhyFarther>>[
/// const PopupMenuItem<WhyFarther>(
/// value: WhyFarther.harder,
/// child:
const
Text('Working a lot harder'),
/// child: Text('Working a lot harder'),
/// ),
/// const PopupMenuItem<WhyFarther>(
/// value: WhyFarther.smarter,
/// child:
const
Text('Being a lot smarter'),
/// child: Text('Being a lot smarter'),
/// ),
/// const PopupMenuItem<WhyFarther>(
/// value: WhyFarther.selfStarter,
/// child:
const
Text('Being a self-starter'),
/// child: Text('Being a self-starter'),
/// ),
/// const PopupMenuItem<WhyFarther>(
/// value: WhyFarther.tradingCharter,
/// child:
const
Text('Placed in charge of trading charter'),
/// child: Text('Placed in charge of trading charter'),
/// ),
/// ],
/// )
...
...
packages/flutter/lib/src/painting/box_border.dart
View file @
3c581953
...
...
@@ -265,28 +265,28 @@ abstract class BoxBorder extends ShapeBorder {
/// ```dart
/// new Container(
/// decoration: const BoxDecoration(
/// border:
const
Border(
/// top:
const BorderSide(width: 1.0, color: const
Color(0xFFFFFFFFFF)),
/// left:
const BorderSide(width: 1.0, color: const
Color(0xFFFFFFFFFF)),
/// right:
const BorderSide(width: 1.0, color: const
Color(0xFFFF000000)),
/// bottom:
const BorderSide(width: 1.0, color: const
Color(0xFFFF000000)),
/// border: Border(
/// top:
BorderSide(width: 1.0, color:
Color(0xFFFFFFFFFF)),
/// left:
BorderSide(width: 1.0, color:
Color(0xFFFFFFFFFF)),
/// right:
BorderSide(width: 1.0, color:
Color(0xFFFF000000)),
/// bottom:
BorderSide(width: 1.0, color:
Color(0xFFFF000000)),
/// ),
/// ),
/// child: new Container(
/// padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 2.0),
/// decoration: const BoxDecoration(
/// border:
const
Border(
/// top:
const BorderSide(width: 1.0, color: const
Color(0xFFFFDFDFDF)),
/// left:
const BorderSide(width: 1.0, color: const
Color(0xFFFFDFDFDF)),
/// right:
const BorderSide(width: 1.0, color: const
Color(0xFFFF7F7F7F)),
/// bottom:
const BorderSide(width: 1.0, color: const
Color(0xFFFF7F7F7F)),
/// border: Border(
/// top:
BorderSide(width: 1.0, color:
Color(0xFFFFDFDFDF)),
/// left:
BorderSide(width: 1.0, color:
Color(0xFFFFDFDFDF)),
/// right:
BorderSide(width: 1.0, color:
Color(0xFFFF7F7F7F)),
/// bottom:
BorderSide(width: 1.0, color:
Color(0xFFFF7F7F7F)),
/// ),
/// color:
const
Color(0xFFBFBFBF),
/// color: Color(0xFFBFBFBF),
/// ),
/// child: const Text(
/// 'OK',
/// textAlign: TextAlign.center,
/// style:
const TextStyle(color: const
Color(0xFF000000))
/// style:
TextStyle(color:
Color(0xFF000000))
/// ),
/// ),
/// )
...
...
packages/flutter/lib/src/painting/gradient.dart
View file @
3c581953
...
...
@@ -740,11 +740,11 @@ class RadialGradient extends Gradient {
/// startAngle: 0.0,
/// endAngle: math.pi * 2,
/// colors: const <Color>[
///
const
Color(0xFF4285F4), // blue
///
const
Color(0xFF34A853), // green
///
const
Color(0xFFFBBC05), // yellow
///
const
Color(0xFFEA4335), // red
///
const
Color(0xFF4285F4), // blue again to seamlessly transition to the start
/// Color(0xFF4285F4), // blue
/// Color(0xFF34A853), // green
/// Color(0xFFFBBC05), // yellow
/// Color(0xFFEA4335), // red
/// Color(0xFF4285F4), // blue again to seamlessly transition to the start
/// ],
/// stops: const <double>[0.0, 0.25, 0.5, 0.75, 1.0],
/// ),
...
...
packages/flutter/lib/src/services/platform_channel.dart
View file @
3c581953
...
...
@@ -144,7 +144,7 @@ class MethodChannel {
///
/// ```dart
/// class Music {
/// static const MethodChannel _channel =
const
MethodChannel('music');
/// static const MethodChannel _channel = MethodChannel('music');
///
/// static Future<bool> isLicensed() async {
/// // invokeMethod returns a Future<dynamic>, and we cannot pass that for
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
3c581953
...
...
@@ -370,7 +370,7 @@ class BackdropFilter extends SingleChildRenderObjectWidget {
/// style: const TextStyle(
/// fontSize: 40.0,
/// fontWeight: FontWeight.w900,
/// color:
const
Color(0xFFFFFFFF),
/// color: Color(0xFFFFFFFF),
/// ),
/// ),
/// ),
...
...
@@ -1360,7 +1360,7 @@ class RotatedBox extends SingleChildRenderObjectWidget {
/// ```dart
/// new Padding(
/// padding: new EdgeInsets.all(8.0),
/// child: const Card(child:
const
Text('Hello World!')),
/// child: const Card(child: Text('Hello World!')),
/// )
/// ```
///
...
...
@@ -1700,7 +1700,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget {
/// new SizedBox(
/// width: 200.0,
/// height: 300.0,
/// child: const Card(child:
const
Text('Hello World!')),
/// child: const Card(child: Text('Hello World!')),
/// )
/// ```
///
...
...
@@ -1806,7 +1806,7 @@ class SizedBox extends SingleChildRenderObjectWidget {
/// ```dart
/// new ConstrainedBox(
/// constraints: const BoxConstraints.expand(),
/// child: const Card(child:
const
Text('Hello World!')),
/// child: const Card(child: Text('Hello World!')),
/// )
/// ```
///
...
...
packages/flutter/lib/src/widgets/scroll_view.dart
View file @
3c581953
...
...
@@ -279,8 +279,8 @@ abstract class ScrollView extends StatelessWidget {
/// const SliverAppBar(
/// pinned: true,
/// expandedHeight: 250.0,
/// flexibleSpace:
const
FlexibleSpaceBar(
/// title:
const
Text('Demo'),
/// flexibleSpace: FlexibleSpaceBar(
/// title: Text('Demo'),
/// ),
/// ),
/// new SliverGrid(
...
...
packages/flutter/lib/src/widgets/text.dart
View file @
3c581953
...
...
@@ -184,11 +184,11 @@ class DefaultTextStyle extends InheritedWidget {
///
/// ```dart
/// const Text.rich(
///
const
TextSpan(
/// TextSpan(
/// text: 'Hello', // default text style
/// children:
const
<TextSpan>[
///
const TextSpan(text: ' beautiful ', style: const
TextStyle(fontStyle: FontStyle.italic)),
///
const TextSpan(text: 'world', style: const
TextStyle(fontWeight: FontWeight.bold)),
/// children: <TextSpan>[
///
TextSpan(text: ' beautiful ', style:
TextStyle(fontStyle: FontStyle.italic)),
///
TextSpan(text: 'world', style:
TextStyle(fontWeight: FontWeight.bold)),
/// ],
/// ),
/// )
...
...
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