Add missing trailing commas (#28673)

* add trailing commas on list/map/parameters

* add trailing commas on Invocation with nb of arg>1

* add commas for widget containing widgets

* add trailing commas if instantiation contains trailing comma

* revert bad change
This commit is contained in:
Alexandre Ardhuin
2019-03-01 08:17:55 +01:00
committed by GitHub
parent 046f960ae2
commit 387f885481
626 changed files with 5183 additions and 5183 deletions

View File

@@ -71,7 +71,7 @@ class TileScrollLayout extends StatelessWidget {
child: IconBar(),
),
);
}
},
),
drawer: const GalleryDrawer(),
);
@@ -101,8 +101,8 @@ class ComplexLayoutState extends State<ComplexLayout> {
print('Pressed search');
},
),
TopBarMenu()
]
TopBarMenu(),
],
),
body: Column(
children: <Widget>[
@@ -115,7 +115,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
else
return FancyGalleryItem(index, key: PageStorageKey<int>(index));
},
)
),
),
BottomBar(),
],
@@ -133,45 +133,45 @@ class TopBarMenu extends StatelessWidget {
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
const PopupMenuItem<String>(
value: 'Friends',
child: MenuItemWithIcon(Icons.people, 'Friends', '5 new')
child: MenuItemWithIcon(Icons.people, 'Friends', '5 new'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.event, 'Events', '12 upcoming')
child: MenuItemWithIcon(Icons.event, 'Events', '12 upcoming'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.group, 'Groups', '14')
child: MenuItemWithIcon(Icons.group, 'Groups', '14'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.image, 'Pictures', '12')
child: MenuItemWithIcon(Icons.image, 'Pictures', '12'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33'),
),
const PopupMenuItem<String>(
value: 'Friends',
child: MenuItemWithIcon(Icons.people, 'Friends', '5')
child: MenuItemWithIcon(Icons.people, 'Friends', '5'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.event, 'Events', '12')
child: MenuItemWithIcon(Icons.event, 'Events', '12'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.group, 'Groups', '14')
child: MenuItemWithIcon(Icons.group, 'Groups', '14'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.image, 'Pictures', '12')
child: MenuItemWithIcon(Icons.image, 'Pictures', '12'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
)
]
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33'),
),
],
);
}
}
@@ -190,10 +190,10 @@ class MenuItemWithIcon extends StatelessWidget {
Icon(icon),
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Text(title)
child: Text(title),
),
Text(subtitle, style: Theme.of(context).textTheme.caption)
]
Text(subtitle, style: Theme.of(context).textTheme.caption),
],
);
}
}
@@ -213,11 +213,11 @@ class FancyImageItem extends StatelessWidget {
InfoBar(),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider()
child: Divider(),
),
IconBar(),
FatDivider()
]
FatDivider(),
],
);
}
}
@@ -235,11 +235,11 @@ class FancyGalleryItem extends StatelessWidget {
InfoBar(),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider()
child: Divider(),
),
IconBar(),
FatDivider()
]
FatDivider(),
],
);
}
}
@@ -253,9 +253,9 @@ class InfoBar extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
const MiniIconWithText(Icons.thumb_up, '42'),
Text('3 Comments', style: Theme.of(context).textTheme.caption)
]
)
Text('3 Comments', style: Theme.of(context).textTheme.caption),
],
),
);
}
}
@@ -271,8 +271,8 @@ class IconBar extends StatelessWidget {
IconWithText(Icons.thumb_up, 'Like'),
IconWithText(Icons.comment, 'Comment'),
IconWithText(Icons.share, 'Share'),
]
)
],
),
);
}
}
@@ -290,10 +290,10 @@ class IconWithText extends StatelessWidget {
children: <Widget>[
IconButton(
icon: Icon(icon),
onPressed: () { print('Pressed $title button'); }
onPressed: () { print('Pressed $title button'); },
),
Text(title)
]
Text(title),
],
);
}
}
@@ -316,13 +316,13 @@ class MiniIconWithText extends StatelessWidget {
height: 16.0,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
shape: BoxShape.circle
shape: BoxShape.circle,
),
child: Icon(icon, color: Colors.white, size: 12.0)
)
child: Icon(icon, color: Colors.white, size: 12.0),
),
),
Text(title, style: Theme.of(context).textTheme.caption)
]
Text(title, style: Theme.of(context).textTheme.caption),
],
);
}
}
@@ -354,8 +354,8 @@ class UserHeader extends StatelessWidget {
child: Image(
image: AssetImage('packages/flutter_gallery_assets/people/square/ali.png'),
width: 32.0,
height: 32.0
)
height: 32.0,
),
),
Expanded(
child: Column(
@@ -367,21 +367,21 @@ class UserHeader extends StatelessWidget {
children: <TextSpan>[
TextSpan(text: userName, style: const TextStyle(fontWeight: FontWeight.bold)),
const TextSpan(text: ' shared a new '),
const TextSpan(text: 'photo', style: TextStyle(fontWeight: FontWeight.bold))
]
const TextSpan(text: 'photo', style: TextStyle(fontWeight: FontWeight.bold)),
],
)),
Row(
children: <Widget>[
Text('Yesterday at 11:55 • ', style: Theme.of(context).textTheme.caption),
Icon(Icons.people, size: 16.0, color: Theme.of(context).textTheme.caption.color)
]
)
]
)
Icon(Icons.people, size: 16.0, color: Theme.of(context).textTheme.caption.color),
],
),
],
),
),
TopBarMenu()
]
)
TopBarMenu(),
],
),
);
}
}
@@ -391,7 +391,7 @@ class ItemDescription extends StatelessWidget {
Widget build(BuildContext context) {
return const Padding(
padding: EdgeInsets.all(8.0),
child: Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.')
child: Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'),
);
}
}
@@ -411,7 +411,7 @@ class ItemImageBox extends StatelessWidget {
height: 230.0,
child: Image(
image: AssetImage('packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png')
)
),
),
Theme(
data: ThemeData.dark(),
@@ -420,14 +420,14 @@ class ItemImageBox extends StatelessWidget {
children: <Widget>[
IconButton(
icon: const Icon(Icons.edit),
onPressed: () { print('Pressed edit button'); }
onPressed: () { print('Pressed edit button'); },
),
IconButton(
icon: const Icon(Icons.zoom_in),
onPressed: () { print('Pressed zoom button'); }
onPressed: () { print('Pressed zoom button'); },
),
]
)
],
),
),
Positioned(
bottom: 4.0,
@@ -435,7 +435,7 @@ class ItemImageBox extends StatelessWidget {
child: Container(
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.circular(2.0)
borderRadius: BorderRadius.circular(2.0),
),
padding: const EdgeInsets.all(4.0),
child: const RichText(
@@ -447,14 +447,14 @@ class ItemImageBox extends StatelessWidget {
),
TextSpan(
style: TextStyle(fontWeight: FontWeight.bold),
text: 'Chris Godley'
)
]
)
)
)
)
]
text: 'Chris Godley',
),
],
),
),
),
),
],
)
,
Padding(
@@ -464,13 +464,13 @@ class ItemImageBox extends StatelessWidget {
children: <Widget>[
Text('Artisans of Southern India', style: Theme.of(context).textTheme.body2),
Text('Silk Spinners', style: Theme.of(context).textTheme.body1),
Text('Sivaganga, Tamil Nadu', style: Theme.of(context).textTheme.caption)
]
)
)
]
)
)
Text('Sivaganga, Tamil Nadu', style: Theme.of(context).textTheme.caption),
],
),
),
],
),
),
);
}
}
@@ -483,7 +483,7 @@ class ItemGalleryBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
final List<String> tabNames = <String>[
'A', 'B', 'C', 'D'
'A', 'B', 'C', 'D',
];
return SizedBox(
@@ -507,8 +507,8 @@ class ItemGalleryBox extends StatelessWidget {
color: Theme.of(context).primaryColor,
child: Center(
child: Text(tabName, style: Theme.of(context).textTheme.headline.copyWith(color: Colors.white)),
)
)
),
),
),
Row(
children: <Widget>[
@@ -524,24 +524,24 @@ class ItemGalleryBox extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text('This is item $tabName'),
)
)
]
)
]
)
)
)
),
),
],
),
],
),
),
),
);
}).toList()
)
}).toList(),
),
),
Container(
child: const TabPageSelector()
)
]
)
)
child: const TabPageSelector(),
),
],
),
),
);
}
}
@@ -554,9 +554,9 @@ class BottomBar extends StatelessWidget {
border: Border(
top: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0
)
)
width: 1.0,
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -586,11 +586,11 @@ class BottomBarButton extends StatelessWidget {
children: <Widget>[
IconButton(
icon: Icon(icon),
onPressed: () { print('Pressed: $title'); }
onPressed: () { print('Pressed: $title'); },
),
Text(title, style: Theme.of(context).textTheme.caption)
]
)
Text(title, style: Theme.of(context).textTheme.caption),
],
),
);
}
}
@@ -625,7 +625,7 @@ class GalleryDrawer extends StatelessWidget {
_changeScrollMode(context, currentMode == ScrollMode.complex ? ScrollMode.tile : ScrollMode.complex);
Navigator.pop(context);
},
trailing: Text(currentMode == ScrollMode.complex ? 'Tile' : 'Complex')
trailing: Text(currentMode == ScrollMode.complex ? 'Tile' : 'Complex'),
),
ListTile(
leading: const Icon(Icons.brightness_5),
@@ -635,7 +635,7 @@ class GalleryDrawer extends StatelessWidget {
trailing: Radio<bool>(
value: true,
groupValue: ComplexLayoutApp.of(context).lightTheme,
onChanged: (bool value) { _changeTheme(context, value); }
onChanged: (bool value) { _changeTheme(context, value); },
),
),
ListTile(
@@ -657,7 +657,7 @@ class GalleryDrawer extends StatelessWidget {
onTap: () { ComplexLayoutApp.of(context).toggleAnimationSpeed(); },
trailing: Checkbox(
value: timeDilation != 1.0,
onChanged: (bool value) { ComplexLayoutApp.of(context).toggleAnimationSpeed(); }
onChanged: (bool value) { ComplexLayoutApp.of(context).toggleAnimationSpeed(); },
),
),
],

View File

@@ -47,7 +47,7 @@ class HomePage extends StatelessWidget {
onPressed: (){
Navigator.pushNamed(context, kCubicBezierRouteName);
},
)
),
],
),
);

View File

@@ -263,7 +263,7 @@ class AnimatedBezierState extends State<AnimatedBezier>
PathDetail(bezier2Path, translate: <double>[29.45, 151.0], rotation: -1.5708),
PathDetail(bezier3Path,
translate: <double>[53.0, 200.48], rotation: -3.14159),
PathDetail(bezier4Path, translate: <double>[122.48, 77.0], rotation: -4.71239)
PathDetail(bezier4Path, translate: <double>[122.48, 77.0], rotation: -4.71239),
];
}

View File

@@ -11,6 +11,6 @@ void main() {
'cull_opacity_perf',
kCullOpacityRouteName,
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10)
duration: const Duration(seconds: 10),
);
}

View File

@@ -236,7 +236,7 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
}
Future<void> _runFlutterAnalyze(String workingDirectory, {
List<String> options = const <String>[]
List<String> options = const <String>[],
}) {
return runCommand(flutter, <String>['analyze', '--dartdocs']..addAll(options),
workingDirectory: workingDirectory,

View File

@@ -58,7 +58,7 @@ Future<void> runCommand(String executable, List<String> arguments, {
if (printOutput) {
await Future.wait<void>(<Future<void>>[
stdout.addStream(process.stdout),
stderr.addStream(process.stderr)
stderr.addStream(process.stderr),
]);
} else {
savedStdout = process.stdout.toList();

View File

@@ -309,7 +309,7 @@ Future<void> _runCoverage() async {
Future<void> _pubRunTest(
String workingDirectory, {
String testPath,
bool enableFlutterToolAsserts = false
bool enableFlutterToolAsserts = false,
}) {
final List<String> args = <String>['run', 'test', '-rcompact', '-j1'];
if (!hasColor)

View File

@@ -103,7 +103,7 @@ class FakeProcessManager extends Mock implements ProcessManager {
when(runSync(
any,
environment: anyNamed('environment'),
workingDirectory: anyNamed('workingDirectory')
workingDirectory: anyNamed('workingDirectory'),
)).thenAnswer(_nextResultSync);
when(runSync(any)).thenAnswer(_nextResultSync);

View File

@@ -27,10 +27,10 @@ void main() {
test('start works', () async {
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output1', '')
ProcessResult(0, 0, 'output1', ''),
],
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output2', '')
ProcessResult(0, 0, 'output2', ''),
],
};
processManager.fakeResults = calls;
@@ -49,10 +49,10 @@ void main() {
test('run works', () async {
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output1', '')
ProcessResult(0, 0, 'output1', ''),
],
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output2', '')
ProcessResult(0, 0, 'output2', ''),
],
};
processManager.fakeResults = calls;
@@ -66,10 +66,10 @@ void main() {
test('runSync works', () async {
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output1', '')
ProcessResult(0, 0, 'output1', ''),
],
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output2', '')
ProcessResult(0, 0, 'output2', ''),
],
};
processManager.fakeResults = calls;
@@ -83,10 +83,10 @@ void main() {
test('captures stdin', () async {
final Map<String, List<ProcessResult>> calls = <String, List<ProcessResult>>{
'gsutil acl get gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output1', '')
ProcessResult(0, 0, 'output1', ''),
],
'gsutil cat gs://flutter_infra/releases/releases.json': <ProcessResult>[
ProcessResult(0, 0, 'output2', '')
ProcessResult(0, 0, 'output2', ''),
],
};
processManager.fakeResults = calls;

View File

@@ -41,7 +41,7 @@ Future<TaskResult> createFlutterRunTask() async {
startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options),
environment: null
environment: null,
);
final Completer<void> finished = Completer<void>();
final StreamSubscription<void> subscription = device.logcat.listen((String line) {

View File

@@ -276,7 +276,7 @@ Future<ProcessResult> _resultOfGradleTask({String workingDirectory, String task,
'./gradlew',
args,
workingDirectory: workingDirectory,
environment: <String, String>{ 'JAVA_HOME': javaHome }
environment: <String, String>{ 'JAVA_HOME': javaHome },
);
}

View File

@@ -26,7 +26,7 @@ Future<void> main() async {
'--org',
'io.flutter.devicelab',
'--template=module',
'hello'
'hello',
],
);
});

View File

@@ -100,7 +100,7 @@ void main() {
final Map<String, dynamic> req = <String, dynamic>{
'id': requestId,
'method': method,
'params': params
'params': params,
};
final String jsonEncoded = json.encode(<Map<String, dynamic>>[req]);
print('run:stdin: $jsonEncoded');

View File

@@ -40,7 +40,7 @@ Future<void> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
final List<File> xcconfigFiles = <File>[
_fs.file(path.join(flutterProjectPath, 'ios/Flutter/Flutter.xcconfig')),
_fs.file(path.join(flutterProjectPath, 'ios/Flutter/Debug.xcconfig')),
_fs.file(path.join(flutterProjectPath, 'ios/Flutter/Release.xcconfig'))
_fs.file(path.join(flutterProjectPath, 'ios/Flutter/Release.xcconfig')),
];
bool xcconfigFileExists = false;

View File

@@ -23,7 +23,7 @@ TaskFunction createHotModeTest() {
final File benchmarkFile = file(path.join(_editedFlutterGalleryDir.path, 'hot_benchmark.json'));
rm(benchmarkFile);
final List<String> options = <String>[
'--hot', '-d', device.deviceId, '--benchmark', '--verbose', '--resident'
'--hot', '-d', device.deviceId, '--benchmark', '--verbose', '--resident',
];
setLocalEngineOptionIfNecessary(options);
int hotReloadCount = 0;
@@ -40,7 +40,7 @@ TaskFunction createHotModeTest() {
final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options),
environment: null
environment: null,
);
final Completer<void> stdoutDone = Completer<void>();
@@ -53,11 +53,11 @@ TaskFunction createHotModeTest() {
if (hotReloadCount == 0) {
// Update the file and reload again.
final File appDartSource = file(path.join(
_editedFlutterGalleryDir.path, 'lib/gallery/app.dart'
_editedFlutterGalleryDir.path, 'lib/gallery/app.dart',
));
appDartSource.writeAsStringSync(
appDartSource.readAsStringSync().replaceFirst(
"'Flutter Gallery'", "'Updated Flutter Gallery'"
"'Flutter Gallery'", "'Updated Flutter Gallery'",
)
);
process.stdin.writeln('r');
@@ -94,7 +94,7 @@ TaskFunction createHotModeTest() {
final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options),
environment: null
environment: null,
);
final Completer<void> stdoutDone = Completer<void>();
final Completer<void> stderrDone = Completer<void>();
@@ -156,7 +156,7 @@ TaskFunction createHotModeTest() {
'hotReloadFlutterReassembleMillisecondsAfterChange',
'hotReloadVMReloadMillisecondsAfterChange',
'hotReloadInitialDevFSSyncAfterRelaunchMilliseconds',
]
],
);
};
}

View File

@@ -29,7 +29,7 @@ TaskFunction createFlavorsTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/flavors',
'lib/main.dart',
extraOptions: <String>['--flavor', 'paid']
extraOptions: <String>['--flavor', 'paid'],
);
}
@@ -66,7 +66,7 @@ TaskFunction createCodegenerationIntegrationTest() {
'${flutterDirectory.path}/dev/integration_tests/codegen',
'lib/main.dart',
environment: <String, String>{
'FLUTTER_EXPERIMENTAL_BUILD': 'true'
'FLUTTER_EXPERIMENTAL_BUILD': 'true',
},
);
}

View File

@@ -65,7 +65,7 @@ class FlutterProject {
await inDirectory(directory, () async {
await flutter(
'create',
options: <String>['--template=app', '--org', 'io.flutter.devicelab']..addAll(options)..add('plugintest')
options: <String>['--template=app', '--org', 'io.flutter.devicelab']..addAll(options)..add('plugintest'),
);
});
return FlutterProject(directory, 'plugintest');

View File

@@ -80,7 +80,7 @@ tasks:
tasks:
- a
- b
'''
''',
);
testManifestError(
@@ -89,7 +89,7 @@ tasks:
'''
tasks:
1: 2
'''
''',
);
testManifestError(
@@ -98,7 +98,7 @@ tasks:
'''
tasks:
foo: 2
'''
''',
);
testManifestError(
@@ -108,7 +108,7 @@ tasks:
tasks:
foo:
bar: 2
'''
''',
);
testManifestError(
@@ -118,7 +118,7 @@ tasks:
tasks:
foo:
required_agent_capabilities: 1
'''
''',
);
testManifestError(
@@ -128,7 +128,7 @@ tasks:
tasks:
foo:
required_agent_capabilities: [1]
'''
''',
);
testManifestError(
@@ -138,7 +138,7 @@ tasks:
tasks:
foo:
required_agent_capabilities: ["a"]
'''
''',
);
testManifestError(
@@ -149,7 +149,7 @@ tasks:
foo:
description: b
required_agent_capabilities: ["a"]
'''
''',
);
testManifestError(
@@ -161,7 +161,7 @@ tasks:
description: b
stage: c
required_agent_capabilities: []
'''
''',
);
testManifestError(
@@ -174,7 +174,7 @@ tasks:
stage: c
required_agent_capabilities: ["a"]
flaky: not-a-boolean
'''
''',
);
test('accepts boolean flaky option', () {

View File

@@ -109,9 +109,9 @@ class PlatformViewState extends State<PlatformViewPage> {
key: const ValueKey<String>('play'),
child: const Text('PLAY FILE'),
onPressed: () { playEventsFile(); },
)
),
],
)
),
],
);
}

View File

@@ -10,7 +10,7 @@ const List<int> kPointerActions = <int>[
0, // DOWN
1, // UP
5, // POINTER_DOWN
6 // POINTER_UP
6, // POINTER_UP
];
const double kDoubleErrorMargin = 0.0001;
@@ -152,7 +152,7 @@ String getActionName(int actionMasked, int action) {
'HOVER_ENTER',
'HOVER_EXIT',
'BUTTON_PRESS',
'BUTTON_RELEASE'
'BUTTON_RELEASE',
];
if (actionMasked < actionNames.length)
return '${actionNames[actionMasked]}($action)';

View File

@@ -31,7 +31,7 @@ class _TestAppState extends State<TestApp> {
0.0,
'hello',
<dynamic>[
<String, dynamic>{'key': 42}
<String, dynamic>{'key': 42},
],
];
static final Map<String, dynamic> aMap = <String, dynamic>{
@@ -40,7 +40,7 @@ class _TestAppState extends State<TestApp> {
'c': 0.0,
'd': 'hello',
'e': <dynamic>[
<String, dynamic>{'key': 42}
<String, dynamic>{'key': 42},
],
};
static final Uint8List someUint8s = Uint8List.fromList(<int>[

View File

@@ -56,14 +56,14 @@ class CardCollectionState extends State<CardCollection> {
(int i) {
_cardModels[i].height = _editable ? max(_cardHeights[i], 60.0) : _cardHeights[i];
return _cardModels[i];
}
},
);
}
void _initVariableSizedCardModels() {
_cardModels = List<CardModel>.generate(
_cardHeights.length,
(int i) => CardModel(i, _editable ? max(_cardHeights[i], 60.0) : _cardHeights[i])
(int i) => CardModel(i, _editable ? max(_cardHeights[i], 60.0) : _cardHeights[i]),
);
}
@@ -234,7 +234,7 @@ class CardCollectionState extends State<CardCollection> {
Widget _buildAppBar(BuildContext context) {
return AppBar(
actions: <Widget>[
Text(_dismissDirectionText(_dismissDirection))
Text(_dismissDirectionText(_dismissDirection)),
],
flexibleSpace: Container(
padding: const EdgeInsets.only(left: 72.0),

View File

@@ -32,11 +32,11 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
color: data.isEmpty ? _color : Colors.grey.shade200,
border: Border.all(
width: 3.0,
color: data.isEmpty ? Colors.white : Colors.blue
color: data.isEmpty ? Colors.white : Colors.blue,
),
)
),
);
}
},
);
}
}
@@ -65,10 +65,10 @@ class DotState extends State<Dot> {
decoration: BoxDecoration(
color: widget.color,
border: Border.all(width: taps.toDouble()),
shape: BoxShape.circle
shape: BoxShape.circle,
),
child: widget.child
)
child: widget.child,
),
);
}
}
@@ -79,7 +79,7 @@ class ExampleDragSource extends StatelessWidget {
this.color,
this.heavy = false,
this.under = true,
this.child
this.child,
}) : super(key: key);
final Color color;
@@ -103,13 +103,13 @@ class ExampleDragSource extends StatelessWidget {
child: Dot(
color: color,
size: size,
child: Center(child: child)
)
child: Center(child: child),
),
);
Widget feedback = Opacity(
opacity: 0.75,
child: contents
child: contents,
);
Offset feedbackOffset;
@@ -118,7 +118,7 @@ class ExampleDragSource extends StatelessWidget {
feedback = Transform(
transform: Matrix4.identity()
..translate(-size / 2.0, -(size / 2.0 + kFingerSize)),
child: feedback
child: feedback,
);
feedbackOffset = const Offset(0.0, -kFingerSize);
anchor = DragAnchor.pointer;
@@ -133,7 +133,7 @@ class ExampleDragSource extends StatelessWidget {
child: contents,
feedback: feedback,
feedbackOffset: feedbackOffset,
dragAnchor: anchor
dragAnchor: anchor,
);
} else {
return Draggable<Color>(
@@ -141,7 +141,7 @@ class ExampleDragSource extends StatelessWidget {
child: contents,
feedback: feedback,
feedbackOffset: feedbackOffset,
dragAnchor: anchor
dragAnchor: anchor,
);
}
}
@@ -193,15 +193,15 @@ class MovableBall extends StatelessWidget {
color: Colors.blue.shade700,
size: kBallSize,
tappable: true,
child: const Center(child: Text('BALL'))
)
child: const Center(child: Text('BALL')),
),
);
final Widget dashedBall = Container(
width: kBallSize,
height: kBallSize,
child: const CustomPaint(
painter: DashOutlineCirclePainter()
)
),
);
if (position == ballPosition) {
return Draggable<bool>(
@@ -209,14 +209,14 @@ class MovableBall extends StatelessWidget {
child: ball,
childWhenDragging: dashedBall,
feedback: ball,
maxSimultaneousDrags: 1
maxSimultaneousDrags: 1,
);
} else {
return DragTarget<bool>(
onAccept: (bool data) { callback(position); },
builder: (BuildContext context, List<bool> accepted, List<dynamic> rejected) {
return dashedBall;
}
},
);
}
}
@@ -238,7 +238,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Drag and Drop Flutter Demo')
title: const Text('Drag and Drop Flutter Demo'),
),
body: Column(
children: <Widget>[
@@ -251,22 +251,22 @@ class DragAndDropAppState extends State<DragAndDropApp> {
color: Colors.yellow.shade300,
under: true,
heavy: false,
child: const Text('under')
child: const Text('under'),
),
ExampleDragSource(
color: Colors.green.shade300,
under: false,
heavy: true,
child: const Text('long-press above')
child: const Text('long-press above'),
),
ExampleDragSource(
color: Colors.indigo.shade300,
under: false,
heavy: false,
child: const Text('above')
child: const Text('above'),
),
],
)
),
),
Expanded(
child: Row(
@@ -275,8 +275,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
Expanded(child: ExampleDragTarget()),
Expanded(child: ExampleDragTarget()),
Expanded(child: ExampleDragTarget()),
]
)
],
),
),
Expanded(
child: Row(
@@ -286,10 +286,10 @@ class DragAndDropAppState extends State<DragAndDropApp> {
MovableBall(2, position, moveBall),
MovableBall(3, position, moveBall),
],
)
),
),
]
)
],
),
);
}
}
@@ -297,6 +297,6 @@ class DragAndDropAppState extends State<DragAndDropApp> {
void main() {
runApp(MaterialApp(
title: 'Drag and Drop Flutter Demo',
home: DragAndDropApp()
home: DragAndDropApp(),
));
}

View File

@@ -48,7 +48,7 @@ class _IgnoreDrag extends Drag {
class _PointDemoPainter extends CustomPainter {
_PointDemoPainter({
Animation<double> repaint,
this.arc
this.arc,
}) : _repaint = repaint, super(repaint: repaint);
final MaterialPointArcTween arc;
@@ -202,7 +202,7 @@ class _PointDemoState extends State<_PointDemo> {
key: _painterKey,
foregroundPainter: _PointDemoPainter(
repaint: _animation,
arc: arc
arc: arc,
),
// Watch out: if this IgnorePointer is left out, then gestures that
// fail _PointDemoPainter.hitTest() will still be recognized because
@@ -213,12 +213,12 @@ class _PointDemoState extends State<_PointDemo> {
child: Text(
'Tap the refresh button to run the animation. Drag the green '
"and red points to change the animation's path.",
style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0)
)
)
)
)
)
style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0),
),
),
),
),
),
);
}
}
@@ -226,7 +226,7 @@ class _PointDemoState extends State<_PointDemo> {
class _RectangleDemoPainter extends CustomPainter {
_RectangleDemoPainter({
Animation<double> repaint,
this.arc
this.arc,
}) : _repaint = repaint, super(repaint: repaint);
final MaterialRectArcTween arc;
@@ -350,11 +350,11 @@ class _RectangleDemoState extends State<_RectangleDemo> {
_screenSize = screenSize;
_begin = Rect.fromLTWH(
screenSize.width * 0.5, screenSize.height * 0.2,
screenSize.width * 0.4, screenSize.height * 0.2
screenSize.width * 0.4, screenSize.height * 0.2,
);
_end = Rect.fromLTWH(
screenSize.width * 0.1, screenSize.height * 0.4,
screenSize.width * 0.3, screenSize.height * 0.3
screenSize.width * 0.3, screenSize.height * 0.3,
);
}
@@ -375,7 +375,7 @@ class _RectangleDemoState extends State<_RectangleDemo> {
key: _painterKey,
foregroundPainter: _RectangleDemoPainter(
repaint: _animation,
arc: arc
arc: arc,
),
// Watch out: if this IgnorePointer is left out, then gestures that
// fail _RectDemoPainter.hitTest() will still be recognized because
@@ -386,12 +386,12 @@ class _RectangleDemoState extends State<_RectangleDemo> {
child: Text(
'Tap the refresh button to run the animation. Drag the rectangles '
"to change the animation's path.",
style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0)
)
)
)
)
)
style: Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0),
),
),
),
),
),
);
}
}
@@ -426,13 +426,13 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
_ArcDemo('POINT', (_ArcDemo demo) {
return _PointDemo(
key: demo.key,
controller: demo.controller
controller: demo.controller,
);
}, this),
_ArcDemo('RECTANGLE', (_ArcDemo demo) {
return _RectangleDemo(
key: demo.key,
controller: demo.controller
controller: demo.controller,
);
}, this),
];
@@ -466,9 +466,9 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
},
),
body: TabBarView(
children: _allDemos.map<Widget>((_ArcDemo demo) => demo.builder(demo)).toList()
)
)
children: _allDemos.map<Widget>((_ArcDemo demo) => demo.builder(demo)).toList(),
),
),
);
}
}

View File

@@ -515,7 +515,7 @@ class _FuzzerState extends State<Fuzzer> with SingleTickerProviderStateMixin {
debugPrint(_textSpan.toStringDeep());
}
});
}
},
),
),
],
@@ -573,7 +573,7 @@ class _UnderlinesState extends State<Underlines> {
),
child: ListBody(
children: lines,
)
),
),
),
),
@@ -668,7 +668,7 @@ class _FallbackState extends State<Fallback> {
child: ListBody(
children: lines,
),
)
),
),
),
),

View File

@@ -39,7 +39,7 @@ void main(List<String> argList) {
'application template.',
getEnumName(SnippetType.sample):
'Produce a nicely formatted piece of sample code. Does not embed the '
'sample into an application template.'
'sample into an application template.',
},
help: 'The type of snippet to produce.',
);

View File

@@ -222,7 +222,7 @@ List<SvgPath> _interpretSvgGroup(List<XmlNode> children, _Transform transform) {
final _Transform subtreeTransform = _Transform(
transformMatrix: transformMatrix,
opacity: opacity
opacity: opacity,
);
paths.addAll(_interpretSvgGroup(element.children, subtreeTransform));
}
@@ -252,7 +252,7 @@ List<Point<double>> parsePoints(String points) {
final Match m = _pointMatcher.firstMatch(unParsed);
result.add(Point<double>(
double.parse(m.group(1)),
double.parse(m.group(2))
double.parse(m.group(2)),
));
unParsed = m.group(3);
}