enable lint unnecessary_const (#19342)

This commit is contained in:
Alexandre Ardhuin
2018-07-16 21:43:48 +02:00
committed by GitHub
parent d10e46ea65
commit cc1cf13eec
556 changed files with 40458 additions and 40457 deletions

View File

@@ -133,43 +133,43 @@ class TopBarMenu extends StatelessWidget {
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
const PopupMenuItem<String>(
value: 'Friends',
child: const MenuItemWithIcon(Icons.people, 'Friends', '5 new')
child: MenuItemWithIcon(Icons.people, 'Friends', '5 new')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.event, 'Events', '12 upcoming')
child: MenuItemWithIcon(Icons.event, 'Events', '12 upcoming')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.group, 'Groups', '14')
child: MenuItemWithIcon(Icons.group, 'Groups', '14')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.image, 'Pictures', '12')
child: MenuItemWithIcon(Icons.image, 'Pictures', '12')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
),
const PopupMenuItem<String>(
value: 'Friends',
child: const MenuItemWithIcon(Icons.people, 'Friends', '5')
child: MenuItemWithIcon(Icons.people, 'Friends', '5')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.event, 'Events', '12')
child: MenuItemWithIcon(Icons.event, 'Events', '12')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.group, 'Groups', '14')
child: MenuItemWithIcon(Icons.group, 'Groups', '14')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.image, 'Pictures', '12')
child: MenuItemWithIcon(Icons.image, 'Pictures', '12')
),
const PopupMenuItem<String>(
value: 'Events',
child: const MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33')
)
]
);
@@ -212,8 +212,8 @@ class FancyImageItem extends StatelessWidget {
new ItemImageBox(),
new InfoBar(),
const Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: const Divider()
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider()
),
new IconBar(),
new FatDivider()
@@ -234,8 +234,8 @@ class FancyGalleryItem extends StatelessWidget {
new ItemGalleryBox(index),
new InfoBar(),
const Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: const Divider()
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider()
),
new IconBar(),
new FatDivider()
@@ -268,9 +268,9 @@ class IconBar extends StatelessWidget {
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const <Widget>[
const IconWithText(Icons.thumb_up, 'Like'),
const IconWithText(Icons.comment, 'Comment'),
const IconWithText(Icons.share, 'Share'),
IconWithText(Icons.thumb_up, 'Like'),
IconWithText(Icons.comment, 'Comment'),
IconWithText(Icons.share, 'Share'),
]
)
);
@@ -350,9 +350,9 @@ class UserHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Padding(
padding: const EdgeInsets.only(right: 8.0),
child: const Image(
image: const AssetImage('packages/flutter_gallery_assets/people/square/ali.png'),
padding: EdgeInsets.only(right: 8.0),
child: Image(
image: AssetImage('packages/flutter_gallery_assets/people/square/ali.png'),
width: 32.0,
height: 32.0
)
@@ -367,7 +367,7 @@ class UserHeader extends StatelessWidget {
children: <TextSpan>[
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))
const TextSpan(text: 'photo', style: TextStyle(fontWeight: FontWeight.bold))
]
)),
new Row(
@@ -390,8 +390,8 @@ class ItemDescription extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const Padding(
padding: const EdgeInsets.all(8.0),
child: const Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.')
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.')
);
}
}
@@ -409,8 +409,8 @@ class ItemImageBox extends StatelessWidget {
children: <Widget>[
const SizedBox(
height: 230.0,
child: const Image(
image: const AssetImage('packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png')
child: Image(
image: AssetImage('packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png')
)
),
new Theme(
@@ -439,14 +439,14 @@ class ItemImageBox extends StatelessWidget {
),
padding: const EdgeInsets.all(4.0),
child: const RichText(
text: const TextSpan(
style: const TextStyle(color: Colors.white),
children: const <TextSpan>[
const TextSpan(
text: TextSpan(
style: TextStyle(color: Colors.white),
children: <TextSpan>[
TextSpan(
text: 'Photo by '
),
const TextSpan(
style: const TextStyle(fontWeight: FontWeight.bold),
TextSpan(
style: TextStyle(fontWeight: FontWeight.bold),
text: 'Chris Godley'
)
]
@@ -561,11 +561,11 @@ class BottomBar extends StatelessWidget {
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const <Widget>[
const BottomBarButton(Icons.new_releases, 'News'),
const BottomBarButton(Icons.people, 'Requests'),
const BottomBarButton(Icons.chat, 'Messenger'),
const BottomBarButton(Icons.bookmark, 'Bookmark'),
const BottomBarButton(Icons.alarm, 'Alarm'),
BottomBarButton(Icons.new_releases, 'News'),
BottomBarButton(Icons.people, 'Requests'),
BottomBarButton(Icons.chat, 'Messenger'),
BottomBarButton(Icons.bookmark, 'Bookmark'),
BottomBarButton(Icons.alarm, 'Alarm'),
],
),
);
@@ -670,7 +670,7 @@ class FancyDrawerHeader extends StatelessWidget {
height: 200.0,
child: const SafeArea(
bottom: false,
child: const Placeholder(),
child: Placeholder(),
),
);
}

View File

@@ -13,7 +13,7 @@ import 'package:stocks/stock_data.dart' as stock_data;
import '../common.dart';
const Duration kBenchmarkTime = const Duration(seconds: 15);
const Duration kBenchmarkTime = Duration(seconds: 15);
class BenchmarkingBinding extends LiveTestWidgetsFlutterBinding {
BenchmarkingBinding(this.stopwatch);

View File

@@ -13,7 +13,7 @@ import 'package:stocks/stock_data.dart' as stock_data;
import '../common.dart';
const Duration kBenchmarkTime = const Duration(seconds: 15);
const Duration kBenchmarkTime = Duration(seconds: 15);
Future<Null> main() async {
assert(false); // don't run this in checked mode! Use --release.

View File

@@ -13,7 +13,7 @@ import 'package:stocks/stock_data.dart' as stock_data;
import '../common.dart';
const Duration kBenchmarkTime = const Duration(seconds: 15);
const Duration kBenchmarkTime = Duration(seconds: 15);
Future<Null> main() async {
stock_data.StockData.actuallyFetchData = false;

View File

@@ -520,7 +520,7 @@ class ArchivePublisher {
jsonData = _addRelease(jsonData);
const JsonEncoder encoder = const JsonEncoder.withIndent(' ');
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
metadataFile.writeAsStringSync(encoder.convert(jsonData));
await _cloudCopy(metadataFile.absolute.path, metadataGsPath);
}

View File

@@ -25,7 +25,7 @@ final String yellow = hasColor ? '\x1B[33m' : '';
final String cyan = hasColor ? '\x1B[36m' : '';
final String reset = hasColor ? '\x1B[0m' : '';
const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{
const Map<String, ShardRunner> _kShards = <String, ShardRunner>{
'analyze': _analyzeRepo,
'tests': _runTests,
'coverage': _runCoverage,
@@ -33,8 +33,8 @@ const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{
// 'build_and_deploy_gallery': handled by travis_script.sh
};
const Duration _kLongTimeout = const Duration(minutes: 45);
const Duration _kShortTimeout = const Duration(minutes: 5);
const Duration _kLongTimeout = Duration(minutes: 45);
const Duration _kShortTimeout = Duration(minutes: 5);
/// When you call this, you can pass additional arguments to pass custom
/// arguments to flutter test. For example, you might want to call this

View File

@@ -313,7 +313,7 @@ void main() {
new DateTime.now().difference(DateTime.parse(releases[0]['release_date'])),
lessThan(const Duration(minutes: 1)),
);
const JsonEncoder encoder = const JsonEncoder.withIndent(' ');
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
expect(contents, equals(encoder.convert(jsonData)));
});
});

View File

@@ -16,7 +16,7 @@ import 'utils.dart';
/// Maximum amount of time a single task is allowed to take to run.
///
/// If exceeded the task is considered to have failed.
const Duration _kDefaultTaskTimeout = const Duration(minutes: 15);
const Duration _kDefaultTaskTimeout = Duration(minutes: 15);
/// Represents a unit of work performed in the CI environment that can
/// succeed, fail and be retried independently of others.
@@ -103,7 +103,7 @@ class _TaskRunner {
_keepAlivePort = new RawReceivePort();
// Timeout if nothing bothers to connect and ask us to run the task.
const Duration taskStartTimeout = const Duration(seconds: 10);
const Duration taskStartTimeout = Duration(seconds: 10);
_startTaskTimeout = new Timer(taskStartTimeout, () {
if (!_taskStarted) {
logger.severe('Task did not start in $taskStartTimeout.');
@@ -147,7 +147,7 @@ class TaskResult {
TaskResult.success(this.data, {this.benchmarkScoreKeys = const <String>[]})
: this.succeeded = true,
this.message = 'success' {
const JsonEncoder prettyJson = const JsonEncoder.withIndent(' ');
const JsonEncoder prettyJson = JsonEncoder.withIndent(' ');
if (benchmarkScoreKeys != null) {
for (String key in benchmarkScoreKeys) {
if (!data.containsKey(key)) {

View File

@@ -13,7 +13,7 @@ import 'utils.dart';
const String _kProvisioningConfigFileEnvironmentVariable = 'FLUTTER_DEVICELAB_XCODE_PROVISIONING_CONFIG';
const String _kTestXcconfigFileName = 'TestConfig.xcconfig';
const FileSystem _fs = const io.LocalFileSystem();
const FileSystem _fs = io.LocalFileSystem();
/// Patches the given Xcode project adding provisioning certificates and team
/// information required to build and run the project, if

View File

@@ -12,7 +12,7 @@ import 'package:flutter_devicelab/framework/utils.dart';
/// Slightly longer than task timeout that gives the task runner a chance to
/// clean-up before forcefully quitting it.
const Duration taskTimeoutWithGracePeriod = const Duration(minutes: 26);
const Duration taskTimeoutWithGracePeriod = Duration(minutes: 26);
/// Runs a task in a separate Dart VM and collects the result using the VM
/// service protocol.
@@ -111,7 +111,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
throw 'not ready yet';
return isolate;
} catch (error) {
const Duration connectionTimeout = const Duration(seconds: 10);
const Duration connectionTimeout = Duration(seconds: 10);
if (new DateTime.now().difference(started) > connectionTimeout) {
throw new TimeoutException(
'Failed to connect to the task runner process',
@@ -119,7 +119,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
);
}
print('VM service not ready yet: $error');
const Duration pauseBetweenRetries = const Duration(milliseconds: 200);
const Duration pauseBetweenRetries = Duration(milliseconds: 200);
print('Will retry in $pauseBetweenRetries.');
await new Future<Null>.delayed(pauseBetweenRetries);
}

View File

@@ -541,7 +541,7 @@ void setLocalEngineOptionIfNecessary(List<String> options, [String flavor]) {
// If engine flavor was not specified explicitly then scan options looking
// for flags that specify the engine flavor (--release, --profile or
// --debug). Default flavor to debug if no flags were found.
const Map<String, String> optionToFlavor = const <String, String>{
const Map<String, String> optionToFlavor = <String, String>{
'--release': 'release',
'--debug': 'debug',
'--profile': 'profile',
@@ -557,7 +557,7 @@ void setLocalEngineOptionIfNecessary(List<String> options, [String flavor]) {
flavor ??= 'debug';
}
const Map<DeviceOperatingSystem, String> osNames = const <DeviceOperatingSystem, String>{
const Map<DeviceOperatingSystem, String> osNames = <DeviceOperatingSystem, String>{
DeviceOperatingSystem.ios: 'ios',
DeviceOperatingSystem.android: 'android',
};

View File

@@ -21,7 +21,7 @@ Future<TaskResult> runEndToEndTests() async {
if (deviceOperatingSystem == DeviceOperatingSystem.ios)
await prepareProvisioningCertificates(testDirectory.path);
const List<String> entryPoints = const <String>[
const List<String> entryPoints = <String>[
'lib/keyboard_resize.dart',
'lib/driver.dart',
'lib/screenshot.dart',

View File

@@ -14,7 +14,7 @@ import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/utils.dart';
/// The maximum amount of time a single microbenchmark is allowed to take.
const Duration _kBenchmarkTimeout = const Duration(minutes: 10);
const Duration _kBenchmarkTimeout = Duration(minutes: 10);
/// Creates a device lab task that runs benchmarks in
/// `dev/benchmarks/microbenchmarks` reports results to the dashboard.

View File

@@ -113,7 +113,7 @@ TaskFunction createBasicMaterialCompileTest() {
/// Measure application startup performance.
class StartupTest {
static const Duration _startupTimeout = const Duration(minutes: 5);
static const Duration _startupTimeout = Duration(minutes: 5);
const StartupTest(this.testDirectory, { this.reportMetrics = true });
@@ -350,7 +350,7 @@ class CompileTest {
};
}
static const Map<String, String> _kSdkNameToMetricNameMapping = const <String, String> {
static const Map<String, String> _kSdkNameToMetricNameMapping = <String, String> {
'VMIsolate': 'aot_snapshot_size_vmisolate',
'Isolate': 'aot_snapshot_size_isolate',
'ReadOnlyData': 'aot_snapshot_size_rodata',

View File

@@ -10,7 +10,7 @@ import 'package:process/process.dart';
import 'package:test/test.dart';
void main() {
const ProcessManager processManager = const LocalProcessManager();
const ProcessManager processManager = LocalProcessManager();
group('run.dart script', () {
Future<ProcessResult> runScript(List<String> testNames) async {

View File

@@ -43,36 +43,36 @@ class ExtendedStandardMessageCodec extends StandardMessageCodec {
Future<TestStepResult> basicBinaryHandshake(ByteData message) async {
const BasicMessageChannel<ByteData> channel =
const BasicMessageChannel<ByteData>(
BasicMessageChannel<ByteData>(
'binary-msg',
const BinaryCodec(),
BinaryCodec(),
);
return _basicMessageHandshake<ByteData>(
'Binary >${toString(message)}<', channel, message);
}
Future<TestStepResult> basicStringHandshake(String message) async {
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
'string-msg',
const StringCodec(),
StringCodec(),
);
return _basicMessageHandshake<String>('String >$message<', channel, message);
}
Future<TestStepResult> basicJsonHandshake(dynamic message) async {
const BasicMessageChannel<dynamic> channel =
const BasicMessageChannel<dynamic>(
BasicMessageChannel<dynamic>(
'json-msg',
const JSONMessageCodec(),
JSONMessageCodec(),
);
return _basicMessageHandshake<dynamic>('JSON >$message<', channel, message);
}
Future<TestStepResult> basicStandardHandshake(dynamic message) async {
const BasicMessageChannel<dynamic> channel =
const BasicMessageChannel<dynamic>(
BasicMessageChannel<dynamic>(
'std-msg',
const ExtendedStandardMessageCodec(),
ExtendedStandardMessageCodec(),
);
return _basicMessageHandshake<dynamic>(
'Standard >${toString(message)}<', channel, message);
@@ -80,35 +80,35 @@ Future<TestStepResult> basicStandardHandshake(dynamic message) async {
Future<TestStepResult> basicBinaryMessageToUnknownChannel() async {
const BasicMessageChannel<ByteData> channel =
const BasicMessageChannel<ByteData>(
BasicMessageChannel<ByteData>(
'binary-unknown',
const BinaryCodec(),
BinaryCodec(),
);
return _basicMessageToUnknownChannel<ByteData>('Binary', channel);
}
Future<TestStepResult> basicStringMessageToUnknownChannel() async {
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
'string-unknown',
const StringCodec(),
StringCodec(),
);
return _basicMessageToUnknownChannel<String>('String', channel);
}
Future<TestStepResult> basicJsonMessageToUnknownChannel() async {
const BasicMessageChannel<dynamic> channel =
const BasicMessageChannel<dynamic>(
BasicMessageChannel<dynamic>(
'json-unknown',
const JSONMessageCodec(),
JSONMessageCodec(),
);
return _basicMessageToUnknownChannel<dynamic>('JSON', channel);
}
Future<TestStepResult> basicStandardMessageToUnknownChannel() async {
const BasicMessageChannel<dynamic> channel =
const BasicMessageChannel<dynamic>(
BasicMessageChannel<dynamic>(
'std-unknown',
const ExtendedStandardMessageCodec(),
ExtendedStandardMessageCodec(),
);
return _basicMessageToUnknownChannel<dynamic>('Standard', channel);
}

View File

@@ -9,46 +9,46 @@ import 'test_step.dart';
Future<TestStepResult> methodCallJsonSuccessHandshake(dynamic payload) async {
const MethodChannel channel =
const MethodChannel('json-method', const JSONMethodCodec());
MethodChannel('json-method', JSONMethodCodec());
return _methodCallSuccessHandshake(
'JSON success($payload)', channel, payload);
}
Future<TestStepResult> methodCallJsonErrorHandshake(dynamic payload) async {
const MethodChannel channel =
const MethodChannel('json-method', const JSONMethodCodec());
MethodChannel('json-method', JSONMethodCodec());
return _methodCallErrorHandshake('JSON error($payload)', channel, payload);
}
Future<TestStepResult> methodCallJsonNotImplementedHandshake() async {
const MethodChannel channel =
const MethodChannel('json-method', const JSONMethodCodec());
MethodChannel('json-method', JSONMethodCodec());
return _methodCallNotImplementedHandshake('JSON notImplemented()', channel);
}
Future<TestStepResult> methodCallStandardSuccessHandshake(
dynamic payload) async {
const MethodChannel channel = const MethodChannel(
const MethodChannel channel = MethodChannel(
'std-method',
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
StandardMethodCodec(ExtendedStandardMessageCodec()),
);
return _methodCallSuccessHandshake(
'Standard success($payload)', channel, payload);
}
Future<TestStepResult> methodCallStandardErrorHandshake(dynamic payload) async {
const MethodChannel channel = const MethodChannel(
const MethodChannel channel = MethodChannel(
'std-method',
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
StandardMethodCodec(ExtendedStandardMessageCodec()),
);
return _methodCallErrorHandshake(
'Standard error($payload)', channel, payload);
}
Future<TestStepResult> methodCallStandardNotImplementedHandshake() async {
const MethodChannel channel = const MethodChannel(
const MethodChannel channel = MethodChannel(
'std-method',
const StandardMethodCodec(const ExtendedStandardMessageCodec()),
StandardMethodCodec(ExtendedStandardMessageCodec()),
);
return _methodCallNotImplementedHandshake(
'Standard notImplemented()', channel);

View File

@@ -25,8 +25,8 @@ const String nothing = '-';
/// - The Flutter app records the incoming reply echo.
/// - The platform finally replies to the original message with another echo.
class TestStepResult {
static const TextStyle bold = const TextStyle(fontWeight: FontWeight.bold);
static const TestStepResult complete = const TestStepResult(
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
static const TestStepResult complete = TestStepResult(
'Test complete',
nothing,
TestStatus.complete,

View File

@@ -25,7 +25,7 @@ void main() {
if (status != 'complete') {
fail('Failed at step $step with status $status');
}
}, timeout: const Timeout(const Duration(minutes: 1)));
}, timeout: const Timeout(Duration(minutes: 1)));
tearDownAll(() async {
driver?.close();

View File

@@ -19,7 +19,7 @@ class MyApp extends StatefulWidget {
State createState() => new MyAppState();
}
const MethodChannel channel = const MethodChannel('texture');
const MethodChannel channel = MethodChannel('texture');
enum FrameState { initial, slow, afterSlow, fast, afterFast }

View File

@@ -8,7 +8,7 @@ import 'package:test/test.dart';
final RegExp calibrationRegExp = new RegExp('Flutter frame rate is (.*)fps');
final RegExp statsRegExp = new RegExp('Produced: (.*)fps\nConsumed: (.*)fps\nWidget builds: (.*)');
const Duration samplingTime = const Duration(seconds: 8);
const Duration samplingTime = Duration(seconds: 8);
Future<Null> main() async {
group('texture suite', () {
@@ -58,7 +58,7 @@ Future<Null> main() async {
expect(double.parse(matchFast.group(1)), closeTo(flutterFrameRate * 2.0, 5.0));
expect(double.parse(matchFast.group(2)), closeTo(flutterFrameRate, 10.0));
expect(int.parse(matchFast.group(3)), 1);
}, timeout: const Timeout(const Duration(minutes: 1)));
}, timeout: const Timeout(Duration(minutes: 1)));
tearDownAll(() async {
driver?.close();

View File

@@ -7,9 +7,9 @@ import 'package:flutter/services.dart';
import 'test_step.dart';
Future<TestStepResult> systemNavigatorPop() {
const BasicMessageChannel<String> channel = const BasicMessageChannel<String>(
const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
'navigation-test',
const StringCodec(),
StringCodec(),
);
final Completer<TestStepResult> completer = new Completer<TestStepResult>();

View File

@@ -13,8 +13,8 @@ typedef Future<TestStepResult> TestStep();
const String nothing = '-';
class TestStepResult {
static const TextStyle bold = const TextStyle(fontWeight: FontWeight.bold);
static const TestStepResult complete = const TestStepResult(
static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
static const TestStepResult complete = TestStepResult(
'Test complete',
nothing,
TestStatus.complete,

View File

@@ -40,7 +40,7 @@ class DriverTestAppState extends State<DriverTestApp> {
new RaisedButton(
child: const Text(
'toggle',
key: const ValueKey<String>('togglePresent'),
key: ValueKey<String>('togglePresent'),
),
onPressed: () {
setState(() {
@@ -53,7 +53,7 @@ class DriverTestAppState extends State<DriverTestApp> {
new Row(
children: <Widget>[
const Expanded(
child: const Text('hit testability'),
child: Text('hit testability'),
),
new DropdownButton<Letter>(
key: const ValueKey<String>('dropdown'),
@@ -64,24 +64,24 @@ class DriverTestAppState extends State<DriverTestApp> {
});
},
items: const <DropdownMenuItem<Letter>>[
const DropdownMenuItem<Letter>(
DropdownMenuItem<Letter>(
value: Letter.a,
child: const Text('Aaa', key: const ValueKey<String>('a')),
child: Text('Aaa', key: ValueKey<String>('a')),
),
const DropdownMenuItem<Letter>(
DropdownMenuItem<Letter>(
value: Letter.b,
child: const Text('Bbb', key: const ValueKey<String>('b')),
child: Text('Bbb', key: ValueKey<String>('b')),
),
const DropdownMenuItem<Letter>(
DropdownMenuItem<Letter>(
value: Letter.c,
child: const Text('Ccc', key: const ValueKey<String>('c')),
child: Text('Ccc', key: ValueKey<String>('c')),
),
],
),
],
),
const TextField(
key: const ValueKey<String>('enter-text-field'),
key: ValueKey<String>('enter-text-field'),
),
],
),

View File

@@ -60,7 +60,7 @@ class _MyHomePageState extends State<MyHomePage> {
height: MediaQuery.of(context).size.height,
),
const TextField(
key: const ValueKey<String>(keys.kDefaultTextField),
key: ValueKey<String>(keys.kDefaultTextField),
),
],
),

View File

@@ -4,7 +4,7 @@
import 'package:flutter/widgets.dart';
void main() => runApp(const Center(child: const Text(
void main() => runApp(const Center(child: Text(
'flutter drive lib/xxx.dart',
textDirection: TextDirection.ltr,
)));

View File

@@ -41,6 +41,6 @@ void main() {
imageBefore = imageAfter;
}
}, timeout: const Timeout(const Duration(minutes: 2)));
}, timeout: const Timeout(Duration(minutes: 2)));
});
}

View File

@@ -10,7 +10,7 @@ class AnimatedIconsTestApp extends StatelessWidget {
return new MaterialApp(
title: 'Animated Icons Test',
home: const Scaffold(
body: const IconsList(),
body: IconsList(),
),
);
}
@@ -76,27 +76,27 @@ class IconSampleRowState extends State<IconSampleRow> with SingleTickerProviderS
}
}
const List<IconSample> samples = const <IconSample> [
const IconSample(AnimatedIcons.arrow_menu, 'arrow_menu'),
const IconSample(AnimatedIcons.menu_arrow, 'menu_arrow'),
const List<IconSample> samples = <IconSample> [
IconSample(AnimatedIcons.arrow_menu, 'arrow_menu'),
IconSample(AnimatedIcons.menu_arrow, 'menu_arrow'),
const IconSample(AnimatedIcons.close_menu, 'close_menu'),
const IconSample(AnimatedIcons.menu_close, 'menu_close'),
IconSample(AnimatedIcons.close_menu, 'close_menu'),
IconSample(AnimatedIcons.menu_close, 'menu_close'),
const IconSample(AnimatedIcons.home_menu, 'home_menu'),
const IconSample(AnimatedIcons.menu_home, 'menu_home'),
IconSample(AnimatedIcons.home_menu, 'home_menu'),
IconSample(AnimatedIcons.menu_home, 'menu_home'),
const IconSample(AnimatedIcons.play_pause, 'play_pause'),
const IconSample(AnimatedIcons.pause_play, 'pause_play'),
IconSample(AnimatedIcons.play_pause, 'play_pause'),
IconSample(AnimatedIcons.pause_play, 'pause_play'),
const IconSample(AnimatedIcons.list_view, 'list_view'),
const IconSample(AnimatedIcons.view_list, 'view_list'),
IconSample(AnimatedIcons.list_view, 'list_view'),
IconSample(AnimatedIcons.view_list, 'view_list'),
const IconSample(AnimatedIcons.add_event, 'add_event'),
const IconSample(AnimatedIcons.event_add, 'event_add'),
IconSample(AnimatedIcons.add_event, 'add_event'),
IconSample(AnimatedIcons.event_add, 'event_add'),
const IconSample(AnimatedIcons.ellipsis_search, 'ellipsis_search'),
const IconSample(AnimatedIcons.search_ellipsis, 'search_ellipsis'),
IconSample(AnimatedIcons.ellipsis_search, 'ellipsis_search'),
IconSample(AnimatedIcons.search_ellipsis, 'search_ellipsis'),
];
class IconSample {

View File

@@ -26,14 +26,14 @@ class CardCollection extends StatefulWidget {
class CardCollectionState extends State<CardCollection> {
static const TextStyle cardLabelStyle =
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
// TODO(hansmuller): need a local image asset
static const String _sunshineURL = 'http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg';
static const double kCardMargins = 8.0;
static const double kFixedCardHeight = 100.0;
static const List<double> _cardHeights = const <double>[
static const List<double> _cardHeights = <double>[
48.0, 63.0, 85.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
48.0, 63.0, 85.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
48.0, 63.0, 85.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
@@ -102,7 +102,7 @@ class CardCollectionState extends State<CardCollection> {
data: const IconThemeData(color: Colors.black),
child: new ListView(
children: <Widget>[
const DrawerHeader(child: const Center(child: const Text('Options'))),
const DrawerHeader(child: Center(child: Text('Options'))),
buildDrawerCheckbox('Make card labels editable', _editable, _toggleEditable),
buildDrawerCheckbox('Fixed size cards', _fixedSizeCards, _toggleFixedSizeCards),
buildDrawerCheckbox('Let the sun shine', _sunshine, _toggleSunshine),
@@ -347,8 +347,8 @@ class CardCollectionState extends State<CardCollection> {
return const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: const <Color>[const Color(0x00FFFFFF), const Color(0xFFFFFFFF)],
stops: const <double>[0.1, 0.35],
colors: <Color>[Color(0x00FFFFFF), Color(0xFFFFFFFF)],
stops: <double>[0.1, 0.35],
)
.createShader(bounds);
}

View File

@@ -25,25 +25,25 @@ class ColorDemoHome extends StatelessWidget {
new Image.network('https://flutter.github.io/assets-for-api-docs/assets/tests/colors/gbr.png'),
new Image.network('https://flutter.github.io/assets-for-api-docs/assets/tests/colors/tf.png'),
new Image.network('https://flutter.github.io/assets-for-api-docs/assets/tests/colors/wide-gamut.png'),
const GradientRow(leftColor: const Color(0xFFFF0000), rightColor: const Color(0xFF00FF00)),
const GradientRow(leftColor: const Color(0xFF0000FF), rightColor: const Color(0xFFFFFF00)),
const GradientRow(leftColor: const Color(0xFFFF0000), rightColor: const Color(0xFF0000FF)),
const GradientRow(leftColor: const Color(0xFF00FF00), rightColor: const Color(0xFFFFFF00)),
const GradientRow(leftColor: const Color(0xFF0000FF), rightColor: const Color(0xFF00FF00)),
const GradientRow(leftColor: const Color(0xFFFF0000), rightColor: const Color(0xFFFFFF00)),
const GradientRow(leftColor: Color(0xFFFF0000), rightColor: Color(0xFF00FF00)),
const GradientRow(leftColor: Color(0xFF0000FF), rightColor: Color(0xFFFFFF00)),
const GradientRow(leftColor: Color(0xFFFF0000), rightColor: Color(0xFF0000FF)),
const GradientRow(leftColor: Color(0xFF00FF00), rightColor: Color(0xFFFFFF00)),
const GradientRow(leftColor: Color(0xFF0000FF), rightColor: Color(0xFF00FF00)),
const GradientRow(leftColor: Color(0xFFFF0000), rightColor: Color(0xFFFFFF00)),
// For the following pairs, the blend result should match the opaque color.
const ColorRow(color: const Color(0xFFBCBCBC)),
const ColorRow(color: const Color(0x80000000)),
const ColorRow(color: Color(0xFFBCBCBC)),
const ColorRow(color: Color(0x80000000)),
const ColorRow(color: const Color(0xFFFFBCBC)),
const ColorRow(color: const Color(0x80FF0000)),
const ColorRow(color: Color(0xFFFFBCBC)),
const ColorRow(color: Color(0x80FF0000)),
const ColorRow(color: const Color(0xFFBCFFBC)),
const ColorRow(color: const Color(0x8000FF00)),
const ColorRow(color: Color(0xFFBCFFBC)),
const ColorRow(color: Color(0x8000FF00)),
const ColorRow(color: const Color(0xFFBCBCFF)),
const ColorRow(color: const Color(0x800000FF)),
const ColorRow(color: Color(0xFFBCBCFF)),
const ColorRow(color: Color(0x800000FF)),
],
),
);

View File

@@ -193,14 +193,14 @@ class MovableBall extends StatelessWidget {
color: Colors.blue.shade700,
size: kBallSize,
tappable: true,
child: const Center(child: const Text('BALL'))
child: const Center(child: Text('BALL'))
)
);
final Widget dashedBall = new Container(
width: kBallSize,
height: kBallSize,
child: const CustomPaint(
painter: const DashOutlineCirclePainter()
painter: DashOutlineCirclePainter()
)
);
if (position == ballPosition) {

View File

@@ -4,4 +4,4 @@
import 'package:flutter/widgets.dart';
void main() => runApp(const Center(child: const Text('flutter run -t xxx.dart')));
void main() => runApp(const Center(child: Text('flutter run -t xxx.dart')));

View File

@@ -101,7 +101,7 @@ class CardBuilder extends SliverChildDelegate {
final CardTapCallback onTapUp;
static const TextStyle cardLabelStyle =
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
@override
Widget build(BuildContext context, int index) {

View File

@@ -22,12 +22,12 @@ class PageViewAppState extends State<PageViewApp> {
@override
void initState() {
super.initState();
const List<Size> cardSizes = const <Size>[
const Size(100.0, 300.0),
const Size(300.0, 100.0),
const Size(200.0, 400.0),
const Size(400.0, 400.0),
const Size(300.0, 400.0),
const List<Size> cardSizes = <Size>[
Size(100.0, 300.0),
Size(300.0, 100.0),
Size(200.0, 400.0),
Size(400.0, 400.0),
Size(300.0, 400.0),
];
cardModels = new List<CardModel>.generate(cardSizes.length, (int i) {
@@ -37,7 +37,7 @@ class PageViewAppState extends State<PageViewApp> {
}
static const TextStyle cardLabelStyle =
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
List<CardModel> cardModels;
Size pageSize = const Size(200.0, 200.0);
@@ -84,7 +84,7 @@ class PageViewAppState extends State<PageViewApp> {
return new Drawer(
child: new ListView(
children: <Widget>[
const DrawerHeader(child: const Center(child: const Text('Options'))),
const DrawerHeader(child: Center(child: Text('Options'))),
new ListTile(
leading: const Icon(Icons.more_horiz),
selected: scrollDirection == Axis.horizontal,

View File

@@ -13,7 +13,7 @@ void main() {
title: const Text('Hardware Key Demo'),
),
body: const Center(
child: const RawKeyboardDemo(),
child: RawKeyboardDemo(),
),
),
));

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ const String kDefaultIconsPath = 'packages/flutter/lib/src/material/icons.dart';
const String kBeginGeneratedMark = '// BEGIN GENERATED';
const String kEndGeneratedMark = '// END GENERATED';
const Map<String, String> kIdentifierRewrites = const <String, String>{
const Map<String, String> kIdentifierRewrites = <String, String>{
'360': 'threesixty',
'3d_rotation': 'threed_rotation',
'4k': 'four_k',

View File

@@ -73,7 +73,7 @@ class PathAnimation {
factory PathAnimation.fromFrameData(List<FrameData> frames, int pathIdx) {
if (frames.isEmpty)
return const PathAnimation(const <PathCommandAnimation>[], opacities: const <double>[]);
return const PathAnimation(<PathCommandAnimation>[], opacities: <double>[]);
final List<PathCommandAnimation> commands = <PathCommandAnimation>[];
for (int commandIdx = 0; commandIdx < frames[0].paths[pathIdx].commands.length; commandIdx += 1) {
@@ -386,7 +386,7 @@ class SvgPathCommand {
}
class SvgPathCommandBuilder {
static const Map<String, Null> kRelativeCommands = const <String, Null> {
static const Map<String, Null> kRelativeCommands = <String, Null> {
'c': null,
'l': null,
'm': null,

View File

@@ -21,18 +21,18 @@ void main() {
test('parsePoints', () {
expect(parsePoints('1.0, 2.0'),
const <Point<double>>[const Point<double>(1.0, 2.0)]
const <Point<double>>[Point<double>(1.0, 2.0)]
);
expect(parsePoints('12.0, 34.0 5.0, 6.6'),
const <Point<double>>[
const Point<double>(12.0, 34.0),
const Point<double>(5.0, 6.6),
Point<double>(12.0, 34.0),
Point<double>(5.0, 6.6),
]
);
expect(parsePoints('12.0 34.0 5.0 6.6'),
const <Point<double>>[
const Point<double>(12.0, 34.0),
const Point<double>(5.0, 6.6),
Point<double>(12.0, 34.0),
Point<double>(5.0, 6.6),
]
);
});
@@ -65,12 +65,12 @@ void main() {
test('horizontal bar', () {
final FrameData frameData = interpretSvg(testAsset('horizontal_bar.svg'));
expect(frameData.paths, <SvgPath>[
const SvgPath('path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
const SvgPath('path_1', <SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 29.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(0.0, 29.0)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
]);
});
@@ -90,19 +90,19 @@ void main() {
test('SVG group', () {
final FrameData frameData = interpretSvg(testAsset('bars_group.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath('path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
SvgPath('path_1', <SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 29.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(0.0, 29.0)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
const SvgPath('path_2', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 44.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 44.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
SvgPath('path_2', <SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 34.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 34.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 44.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(0.0, 44.0)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
]);
});
@@ -110,12 +110,12 @@ void main() {
test('SVG group translate', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_translate.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath('path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 44.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 44.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
SvgPath('path_1', <SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 34.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 34.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 44.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(0.0, 44.0)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
]);
});
@@ -123,13 +123,13 @@ void main() {
test('SVG group scale', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_scale.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 9.5)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(24.0, 9.5)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(24.0, 14.5)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 14.5)]),
const SvgPathCommand('Z', const <Point<double>>[]),
SvgPath(
'path_1', <SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 9.5)]),
SvgPathCommand('L', <Point<double>>[Point<double>(24.0, 9.5)]),
SvgPathCommand('L', <Point<double>>[Point<double>(24.0, 14.5)]),
SvgPathCommand('L', <Point<double>>[Point<double>(0.0, 14.5)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
]);
});
@@ -137,14 +137,14 @@ void main() {
test('SVG group rotate scale', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_rotate_scale.svg'));
expect(frameData.paths, const <PathMatcher>[
const PathMatcher(
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('L', const <Point<double>>[const Point<double>(29.0, 0.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(29.0, 48.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(19.0, 48.0)]),
const SvgPathCommand('M', const <Point<double>>[const Point<double>(19.0, 0.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
PathMatcher(
SvgPath(
'path_1', <SvgPathCommand>[
SvgPathCommand('L', <Point<double>>[Point<double>(29.0, 0.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(29.0, 48.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(19.0, 48.0)]),
SvgPathCommand('M', <Point<double>>[Point<double>(19.0, 0.0)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
margin: 0.000000001
)
@@ -161,14 +161,14 @@ void main() {
test('SVG group opacity', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_opacity.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
SvgPath(
'path_1',
const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 29.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(0.0, 29.0)]),
SvgPathCommand('Z', <Point<double>>[]),
],
opacity: 0.5,
),
@@ -179,13 +179,13 @@ void main() {
// This asset uses the relative 'l' command instead of 'L'.
final FrameData frameData = interpretSvg(testAsset('horizontal_bar_relative.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
SvgPath(
'path_1', <SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 19.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(48.0, 29.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(0.0, 29.0)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
]);
});
@@ -194,15 +194,15 @@ void main() {
// This asset uses the relative 'l' command instead of 'L'.
final FrameData frameData = interpretSvg(testAsset('close_path_in_middle.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(50.0, 50.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(60.0, 50.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(60.0, 60.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(50.0, 40.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(40.0, 40.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
SvgPath(
'path_1', <SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(50.0, 50.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(60.0, 50.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(60.0, 60.0)]),
SvgPathCommand('Z', <Point<double>>[]),
SvgPathCommand('L', <Point<double>>[Point<double>(50.0, 40.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(40.0, 40.0)]),
SvgPathCommand('Z', <Point<double>>[]),
]),
]);
});
@@ -210,115 +210,115 @@ void main() {
group('create PathAnimation', () {
test('single path', () {
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
const List<FrameData> frameData = <FrameData>[
FrameData(
Point<double>(10.0, 10.0),
<SvgPath>[
SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(10.0, 10.0)]),
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 0.0)]),
SvgPathCommand('L', <Point<double>>[Point<double>(10.0, 10.0)]),
],
),
],
),
];
expect(new PathAnimation.fromFrameData(frameData, 0),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(0.0, 0.0)],
const PathAnimationMatcher(PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[Point<double>(0.0, 0.0)],
]),
const PathCommandAnimation('L', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(10.0, 10.0)],
PathCommandAnimation('L', <List<Point<double>>>[
<Point<double>>[Point<double>(10.0, 10.0)],
]),
],
opacities: const <double>[1.0]
opacities: <double>[1.0]
))
);
});
test('multiple paths', () {
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
const List<FrameData> frameData = <FrameData>[
FrameData(
Point<double>(10.0, 10.0),
<SvgPath>[
SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)]),
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 0.0)]),
],
),
const SvgPath(
SvgPath(
'path_2',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(5.0, 6.0)]),
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(5.0, 6.0)]),
],
),
],
),
];
expect(new PathAnimation.fromFrameData(frameData, 0),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(0.0, 0.0)],
const PathAnimationMatcher(PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[Point<double>(0.0, 0.0)],
])
],
opacities: const <double>[1.0]
opacities: <double>[1.0]
))
);
expect(new PathAnimation.fromFrameData(frameData, 1),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(5.0, 6.0)],
const PathAnimationMatcher(PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[Point<double>(5.0, 6.0)],
])
],
opacities: const <double>[1.0]
opacities: <double>[1.0]
))
);
});
test('multiple frames', () {
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
const List<FrameData> frameData = <FrameData>[
FrameData(
Point<double>(10.0, 10.0),
<SvgPath>[
SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)])
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 0.0)])
],
opacity: 0.5,
),
],
),
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
FrameData(
Point<double>(10.0, 10.0),
<SvgPath>[
SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(10.0, 10.0)])
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(10.0, 10.0)])
],
),
],
),
];
expect(new PathAnimation.fromFrameData(frameData, 0),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
const PathAnimationMatcher(PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[
Point<double>(0.0, 0.0),
Point<double>(10.0, 10.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
opacities: <double>[0.5, 1.0]
))
);
});
@@ -326,20 +326,20 @@ void main() {
group('create Animation', () {
test('multiple paths', () {
const List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
const List<FrameData> frameData = <FrameData>[
FrameData(
Point<double>(10.0, 10.0),
<SvgPath>[
SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)]),
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(0.0, 0.0)]),
],
),
const SvgPath(
SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(5.0, 6.0)]),
<SvgPathCommand>[
SvgPathCommand('M', <Point<double>>[Point<double>(5.0, 6.0)]),
],
),
],
@@ -347,24 +347,24 @@ void main() {
];
final Animation animation = new Animation.fromFrameData(frameData);
expect(animation.paths[0],
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(0.0, 0.0)],
const PathAnimationMatcher(PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[Point<double>(0.0, 0.0)],
])
],
opacities: const <double>[1.0]
opacities: <double>[1.0]
))
);
expect(animation.paths[1],
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(5.0, 6.0)],
const PathAnimationMatcher(PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[Point<double>(5.0, 6.0)],
])
],
opacities: const <double>[1.0]
opacities: <double>[1.0]
))
);
@@ -374,12 +374,12 @@ void main() {
group('toDart', () {
test('_PathMoveTo', () {
const PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = PathCommandAnimation(
'M',
const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(1.0, 2.0),
const Point<double>(3.0, 4.0),
<List<Point<double>>>[
<Point<double>>[
Point<double>(1.0, 2.0),
Point<double>(3.0, 4.0),
],
],
);
@@ -396,12 +396,12 @@ void main() {
});
test('_PathLineTo', () {
const PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = PathCommandAnimation(
'L',
const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(1.0, 2.0),
const Point<double>(3.0, 4.0),
<List<Point<double>>>[
<Point<double>>[
Point<double>(1.0, 2.0),
Point<double>(3.0, 4.0),
],
],
);
@@ -418,20 +418,20 @@ void main() {
});
test('_PathCubicTo', () {
const PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = PathCommandAnimation(
'C',
const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(16.0, 24.0),
const Point<double>(16.0, 10.0),
<List<Point<double>>>[
<Point<double>>[
Point<double>(16.0, 24.0),
Point<double>(16.0, 10.0),
],
const <Point<double>>[
const Point<double>(16.0, 25.0),
const Point<double>(16.0, 11.0),
<Point<double>>[
Point<double>(16.0, 25.0),
Point<double>(16.0, 11.0),
],
const <Point<double>>[
const Point<double>(40.0, 40.0),
const Point<double>(40.0, 40.0),
<Point<double>>[
Point<double>(40.0, 40.0),
Point<double>(40.0, 40.0),
],
],
);
@@ -456,9 +456,9 @@ void main() {
});
test('_PathClose', () {
const PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = PathCommandAnimation(
'Z',
const <List<Point<double>>>[],
<List<Point<double>>>[],
);
expect(command.toDart(),
@@ -469,9 +469,9 @@ void main() {
});
test('Unsupported path command', () {
const PathCommandAnimation command = const PathCommandAnimation(
const PathCommandAnimation command = PathCommandAnimation(
'h',
const <List<Point<double>>>[],
<List<Point<double>>>[],
);
expect(
@@ -481,22 +481,22 @@ void main() {
});
test('_PathFrames', () {
const PathAnimation pathAnimation = const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
const PathAnimation pathAnimation = PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[
Point<double>(0.0, 0.0),
Point<double>(10.0, 10.0),
],
]),
const PathCommandAnimation('L', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(48.0, 10.0),
const Point<double>(0.0, 0.0),
PathCommandAnimation('L', <List<Point<double>>>[
<Point<double>>[
Point<double>(48.0, 10.0),
Point<double>(0.0, 0.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
opacities: <double>[0.5, 1.0]
);
expect(pathAnimation.toDart(),
@@ -524,37 +524,37 @@ void main() {
});
test('Animation', () {
const Animation animation = const Animation(
const Point<double>(48.0, 48.0),
const <PathAnimation>[
const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
const Animation animation = Animation(
Point<double>(48.0, 48.0),
<PathAnimation>[
PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[
Point<double>(0.0, 0.0),
Point<double>(10.0, 10.0),
],
]),
const PathCommandAnimation('L', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(48.0, 10.0),
const Point<double>(0.0, 0.0),
PathCommandAnimation('L', <List<Point<double>>>[
<Point<double>>[
Point<double>(48.0, 10.0),
Point<double>(0.0, 0.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
opacities: <double>[0.5, 1.0]
),
const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
PathAnimation(
<PathCommandAnimation>[
PathCommandAnimation('M', <List<Point<double>>>[
<Point<double>>[
Point<double>(0.0, 0.0),
Point<double>(10.0, 10.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
opacities: <double>[0.5, 1.0]
),
]);