Commit e9a775bf authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by Adam Barth

prefer const constructors (#8316)

parent 66386255
...@@ -73,7 +73,7 @@ class ComplexLayoutState extends State<ComplexLayout> { ...@@ -73,7 +73,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
children: <Widget>[ children: <Widget>[
new Expanded( new Expanded(
child: new ListView.builder( child: new ListView.builder(
key: new Key('main-scroll'), // this key is used by the driver test key: const Key('main-scroll'), // this key is used by the driver test
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
if (index % 2 == 0) if (index % 2 == 0)
return new FancyImageItem(index, key: new ValueKey<int>(index)); return new FancyImageItem(index, key: new ValueKey<int>(index));
...@@ -154,7 +154,7 @@ class MenuItemWithIcon extends StatelessWidget { ...@@ -154,7 +154,7 @@ class MenuItemWithIcon extends StatelessWidget {
children: <Widget>[ children: <Widget>[
new Icon(icon), new Icon(icon),
new Padding( new Padding(
padding: new EdgeInsets.only(left: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: new Text(title) child: new Text(title)
), ),
new Text(subtitle, style: Theme.of(context).textTheme.caption) new Text(subtitle, style: Theme.of(context).textTheme.caption)
...@@ -177,7 +177,7 @@ class FancyImageItem extends StatelessWidget { ...@@ -177,7 +177,7 @@ class FancyImageItem extends StatelessWidget {
new ItemImageBox(), new ItemImageBox(),
new InfoBar(), new InfoBar(),
new Padding( new Padding(
padding: new EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Divider() child: new Divider()
), ),
new IconBar(), new IconBar(),
...@@ -199,7 +199,7 @@ class FancyGalleryItem extends StatelessWidget { ...@@ -199,7 +199,7 @@ class FancyGalleryItem extends StatelessWidget {
new ItemGalleryBox(index), new ItemGalleryBox(index),
new InfoBar(), new InfoBar(),
new Padding( new Padding(
padding: new EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Divider() child: new Divider()
), ),
new IconBar(), new IconBar(),
...@@ -213,7 +213,7 @@ class InfoBar extends StatelessWidget { ...@@ -213,7 +213,7 @@ class InfoBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return new Padding(
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Row( child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
...@@ -229,7 +229,7 @@ class IconBar extends StatelessWidget { ...@@ -229,7 +229,7 @@ class IconBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return new Padding(
padding: new EdgeInsets.only(left: 16.0, right: 16.0), padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: new Row( child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
...@@ -275,7 +275,7 @@ class MiniIconWithText extends StatelessWidget { ...@@ -275,7 +275,7 @@ class MiniIconWithText extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
new Padding( new Padding(
padding: new EdgeInsets.only(right: 8.0), padding: const EdgeInsets.only(right: 8.0),
child: new Container( child: new Container(
width: 16.0, width: 16.0,
height: 16.0, height: 16.0,
...@@ -312,12 +312,12 @@ class UserHeader extends StatelessWidget { ...@@ -312,12 +312,12 @@ class UserHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return new Padding(
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Row( child: new Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
new Padding( new Padding(
padding: new EdgeInsets.only(right: 8.0), padding: const EdgeInsets.only(right: 8.0),
child: new Image( child: new Image(
image: new AssetImage('packages/flutter_gallery_assets/ali_connors_sml.png'), image: new AssetImage('packages/flutter_gallery_assets/ali_connors_sml.png'),
width: 32.0, width: 32.0,
...@@ -332,9 +332,9 @@ class UserHeader extends StatelessWidget { ...@@ -332,9 +332,9 @@ class UserHeader extends StatelessWidget {
new RichText(text: new TextSpan( new RichText(text: new TextSpan(
style: Theme.of(context).textTheme.body1, style: Theme.of(context).textTheme.body1,
children: <TextSpan>[ children: <TextSpan>[
new TextSpan(text: userName, style: new TextStyle(fontWeight: FontWeight.bold)), new TextSpan(text: userName, style: const TextStyle(fontWeight: FontWeight.bold)),
new TextSpan(text: ' shared a new '), const TextSpan(text: ' shared a new '),
new TextSpan(text: 'photo', style: new TextStyle(fontWeight: FontWeight.bold)) const TextSpan(text: 'photo', style: const TextStyle(fontWeight: FontWeight.bold))
] ]
)), )),
new Row( new Row(
...@@ -357,7 +357,7 @@ class ItemDescription extends StatelessWidget { ...@@ -357,7 +357,7 @@ class ItemDescription extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return new Padding(
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.') child: new Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.')
); );
} }
...@@ -367,7 +367,7 @@ class ItemImageBox extends StatelessWidget { ...@@ -367,7 +367,7 @@ class ItemImageBox extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return new Padding(
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Card( child: new Card(
child: new Column( child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
...@@ -404,16 +404,16 @@ class ItemImageBox extends StatelessWidget { ...@@ -404,16 +404,16 @@ class ItemImageBox extends StatelessWidget {
backgroundColor: Colors.black54, backgroundColor: Colors.black54,
borderRadius: new BorderRadius.circular(2.0) borderRadius: new BorderRadius.circular(2.0)
), ),
padding: new EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
child: new RichText( child: new RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( const TextSpan(
text: 'Photo by ' text: 'Photo by '
), ),
new TextSpan( const TextSpan(
style: new TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(fontWeight: FontWeight.bold),
text: 'Magic Mike' text: 'Magic Mike'
) )
] ]
...@@ -425,7 +425,7 @@ class ItemImageBox extends StatelessWidget { ...@@ -425,7 +425,7 @@ class ItemImageBox extends StatelessWidget {
) )
, ,
new Padding( new Padding(
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Column( child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
...@@ -465,7 +465,7 @@ class ItemGalleryBox extends StatelessWidget { ...@@ -465,7 +465,7 @@ class ItemGalleryBox extends StatelessWidget {
return new Container( return new Container(
key: new Key(tabName), key: new Key(tabName),
child: new Padding( child: new Padding(
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Card( child: new Card(
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
...@@ -491,7 +491,7 @@ class ItemGalleryBox extends StatelessWidget { ...@@ -491,7 +491,7 @@ class ItemGalleryBox extends StatelessWidget {
), ),
new Expanded( new Expanded(
child: new Padding( child: new Padding(
padding: new EdgeInsets.only(left: 8.0), padding: const EdgeInsets.only(left: 8.0),
child: new Text('This is item $tabName'), child: new Text('This is item $tabName'),
) )
) )
...@@ -550,7 +550,7 @@ class BottomBarButton extends StatelessWidget { ...@@ -550,7 +550,7 @@ class BottomBarButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return new Padding(
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
new IconButton( new IconButton(
......
...@@ -27,14 +27,14 @@ void main() { ...@@ -27,14 +27,14 @@ void main() {
// Scroll down // Scroll down
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, -300.0, new Duration(milliseconds: 300)); await driver.scroll(stockList, 0.0, -300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(new Duration(milliseconds: 500)); await new Future<Null>.delayed(const Duration(milliseconds: 500));
} }
// Scroll up // Scroll up
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, 300.0, new Duration(milliseconds: 300)); await driver.scroll(stockList, 0.0, 300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(new Duration(milliseconds: 500)); await new Future<Null>.delayed(const Duration(milliseconds: 500));
} }
}); });
......
...@@ -31,7 +31,7 @@ Future<Null> main() async { ...@@ -31,7 +31,7 @@ Future<Null> main() async {
stocks.main(); stocks.main();
await tester.pump(); // Start startup animation await tester.pump(); // Start startup animation
await tester.pump(const Duration(seconds: 1)); // Complete startup animation await tester.pump(const Duration(seconds: 1)); // Complete startup animation
await tester.tapAt(new Point(20.0, 40.0)); // Open drawer await tester.tapAt(const Point(20.0, 40.0)); // Open drawer
await tester.pump(); // Start drawer animation await tester.pump(); // Start drawer animation
await tester.pump(const Duration(seconds: 1)); // Complete drawer animation await tester.pump(const Duration(seconds: 1)); // Complete drawer animation
......
...@@ -30,7 +30,7 @@ Future<Null> main() async { ...@@ -30,7 +30,7 @@ Future<Null> main() async {
stocks.main(); stocks.main();
await tester.pump(); // Start startup animation await tester.pump(); // Start startup animation
await tester.pump(const Duration(seconds: 1)); // Complete startup animation await tester.pump(const Duration(seconds: 1)); // Complete startup animation
await tester.tapAt(new Point(20.0, 40.0)); // Open drawer await tester.tapAt(const Point(20.0, 40.0)); // Open drawer
await tester.pump(); // Start drawer animation await tester.pump(); // Start drawer animation
await tester.pump(const Duration(seconds: 1)); // Complete drawer animation await tester.pump(const Duration(seconds: 1)); // Complete drawer animation
......
...@@ -63,7 +63,7 @@ Future<Null> main(List<String> rawArgs) async { ...@@ -63,7 +63,7 @@ Future<Null> main(List<String> rawArgs) async {
exitCode = 1; exitCode = 1;
print('Task result:'); print('Task result:');
print(new JsonEncoder.withIndent(' ').convert(result)); print(const JsonEncoder.withIndent(' ').convert(result));
section('Finished task "$taskName"'); section('Finished task "$taskName"');
} }
} }
...@@ -115,7 +115,7 @@ final ArgParser _argParser = new ArgParser() ...@@ -115,7 +115,7 @@ final ArgParser _argParser = new ArgParser()
splitCommas: true, splitCommas: true,
callback: (List<String> value) { callback: (List<String> value) {
if (value.isNotEmpty) { if (value.isNotEmpty) {
throw new FormatException( throw const FormatException(
'Invalid option --test. Did you mean --task (-t)?', 'Invalid option --test. Did you mean --task (-t)?',
); );
} }
......
...@@ -42,8 +42,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as ...@@ -42,8 +42,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as
}); });
StreamSubscription<String> stdoutSub = runner.stdout StreamSubscription<String> stdoutSub = runner.stdout
.transform(new Utf8Decoder()) .transform(const Utf8Decoder())
.transform(new LineSplitter()) .transform(const LineSplitter())
.listen((String line) { .listen((String line) {
if (!silent) { if (!silent) {
stdout.writeln('[$taskName] [STDOUT] $line'); stdout.writeln('[$taskName] [STDOUT] $line');
...@@ -51,8 +51,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as ...@@ -51,8 +51,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as
}); });
StreamSubscription<String> stderrSub = runner.stderr StreamSubscription<String> stderrSub = runner.stderr
.transform(new Utf8Decoder()) .transform(const Utf8Decoder())
.transform(new LineSplitter()) .transform(const LineSplitter())
.listen((String line) { .listen((String line) {
stderr.writeln('[$taskName] [STDERR] $line'); stderr.writeln('[$taskName] [STDERR] $line');
}); });
......
...@@ -318,7 +318,7 @@ T requireConfigProperty<T>(Map<String, dynamic> map, String propertyName) { ...@@ -318,7 +318,7 @@ T requireConfigProperty<T>(Map<String, dynamic> map, String propertyName) {
} }
String jsonEncode(dynamic data) { String jsonEncode(dynamic data) {
return new JsonEncoder.withIndent(' ').convert(data) + '\n'; return const JsonEncoder.withIndent(' ').convert(data) + '\n';
} }
Future<Null> getFlutter(String revision) async { Future<Null> getFlutter(String revision) async {
......
...@@ -305,12 +305,12 @@ class AndroidBackButtonMemoryTest { ...@@ -305,12 +305,12 @@ class AndroidBackButtonMemoryTest {
// Perform a series of back button suspend and resume cycles. // Perform a series of back button suspend and resume cycles.
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
await device.shellExec('input', <String>['keyevent', 'KEYCODE_BACK']); await device.shellExec('input', <String>['keyevent', 'KEYCODE_BACK']);
await new Future<Null>.delayed(new Duration(milliseconds: 1000)); await new Future<Null>.delayed(const Duration(milliseconds: 1000));
String output = await device.shellEval('am', <String>['start', '-n', 'io.flutter.examples.gallery/io.flutter.app.FlutterActivity']); String output = await device.shellEval('am', <String>['start', '-n', 'io.flutter.examples.gallery/io.flutter.app.FlutterActivity']);
print(output); print(output);
if (output.contains('Error')) if (output.contains('Error'))
return new TaskResult.failure('unable to launch activity'); return new TaskResult.failure('unable to launch activity');
await new Future<Null>.delayed(new Duration(milliseconds: 1000)); await new Future<Null>.delayed(const Duration(milliseconds: 1000));
} }
Map<String, dynamic> endData = await device.getMemoryStats(packageName); Map<String, dynamic> endData = await device.getMemoryStats(packageName);
......
...@@ -27,7 +27,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> { ...@@ -27,7 +27,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
builder: (BuildContext context, List<Color> data, List<dynamic> rejectedData) { builder: (BuildContext context, List<Color> data, List<dynamic> rejectedData) {
return new Container( return new Container(
height: 100.0, height: 100.0,
margin: new EdgeInsets.all(10.0), margin: const EdgeInsets.all(10.0),
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border.all( border: new Border.all(
width: 3.0, width: 3.0,
......
...@@ -169,7 +169,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -169,7 +169,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
setState(() { setState(() {
markers[MarkerType.touch] = globalPosition; markers[MarkerType.touch] = globalPosition;
final RenderBox box = target.currentContext.findRenderObject(); final RenderBox box = target.currentContext.findRenderObject();
markers[MarkerType.topLeft] = box.localToGlobal(new Point(0.0, 0.0)); markers[MarkerType.topLeft] = box.localToGlobal(const Point(0.0, 0.0));
final Size size = box.size; final Size size = box.size;
markers[MarkerType.bottomRight] = box.localToGlobal(new Point(size.width, size.height)); markers[MarkerType.bottomRight] = box.localToGlobal(new Point(size.width, size.height));
final ScrollableState scrollable = Scrollable.of(target.currentContext); final ScrollableState scrollable = Scrollable.of(target.currentContext);
......
...@@ -40,7 +40,7 @@ class PageViewAppState extends State<PageViewApp> { ...@@ -40,7 +40,7 @@ class PageViewAppState extends State<PageViewApp> {
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold); const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
List<CardModel> cardModels; List<CardModel> cardModels;
Size pageSize = new Size(200.0, 200.0); Size pageSize = const Size(200.0, 200.0);
Axis scrollDirection = Axis.horizontal; Axis scrollDirection = Axis.horizontal;
bool itemsWrap = false; bool itemsWrap = false;
......
...@@ -90,7 +90,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -90,7 +90,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget buildRaisedButton() { Widget buildRaisedButton() {
return new Align( return new Align(
alignment: new FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new ButtonBar( child: new ButtonBar(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
...@@ -111,7 +111,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -111,7 +111,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget buildFlatButton() { Widget buildFlatButton() {
return new Align( return new Align(
alignment: new FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new ButtonBar( child: new ButtonBar(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
...@@ -158,7 +158,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -158,7 +158,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
}).toList(), }).toList(),
), ),
), ),
new SizedBox( const SizedBox(
height: 24.0, height: 24.0,
), ),
new ListItem( new ListItem(
...@@ -179,7 +179,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -179,7 +179,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
}).toList(), }).toList(),
), ),
), ),
new SizedBox( const SizedBox(
height: 24.0, height: 24.0,
), ),
new ListItem( new ListItem(
...@@ -213,7 +213,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -213,7 +213,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget buildIconButton() { Widget buildIconButton() {
return new Align( return new Align(
alignment: new FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new Row( child: new Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
...@@ -237,7 +237,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -237,7 +237,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
Widget buildActionButton() { Widget buildActionButton() {
return new Align( return new Align(
alignment: new FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new FloatingActionButton( child: new FloatingActionButton(
child: new Icon(Icons.add), child: new Icon(Icons.add),
onPressed: () { onPressed: () {
......
...@@ -95,7 +95,7 @@ class _DateTimePicker extends StatelessWidget { ...@@ -95,7 +95,7 @@ class _DateTimePicker extends StatelessWidget {
onPressed: () { _selectDate(context); }, onPressed: () { _selectDate(context); },
), ),
), ),
new SizedBox(width: 12.0), const SizedBox(width: 12.0),
new Expanded( new Expanded(
flex: 3, flex: 3,
child: new _InputDropdown( child: new _InputDropdown(
......
...@@ -122,7 +122,7 @@ class IconsDemoState extends State<IconsDemo> { ...@@ -122,7 +122,7 @@ class IconsDemoState extends State<IconsDemo> {
new Expanded( new Expanded(
child: new Center( child: new Center(
child: new IconTheme( child: new IconTheme(
data: new IconThemeData(opacity: 1.0), data: const IconThemeData(opacity: 1.0),
child: new Row( child: new Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
......
...@@ -26,7 +26,7 @@ class OverscrollDemoState extends State<OverscrollDemo> { ...@@ -26,7 +26,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
Future<Null> _handleRefresh() { Future<Null> _handleRefresh() {
Completer<Null> completer = new Completer<Null>(); Completer<Null> completer = new Completer<Null>();
new Timer(new Duration(seconds: 3), () { completer.complete(null); }); new Timer(const Duration(seconds: 3), () { completer.complete(null); });
return completer.future.then((_) { return completer.future.then((_) {
_scaffoldKey.currentState?.showSnackBar(new SnackBar( _scaffoldKey.currentState?.showSnackBar(new SnackBar(
content: new Text("Refresh complete"), content: new Text("Refresh complete"),
......
...@@ -140,7 +140,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -140,7 +140,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
return new SliverPadding( return new SliverPadding(
padding: padding, padding: padding,
child: new SliverGrid( child: new SliverGrid(
gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent( gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: _kRecipePageMaxWidth, maxCrossAxisExtent: _kRecipePageMaxWidth,
crossAxisSpacing: 8.0, crossAxisSpacing: 8.0,
mainAxisSpacing: 8.0, mainAxisSpacing: 8.0,
...@@ -299,7 +299,7 @@ class RecipePage extends StatefulWidget { ...@@ -299,7 +299,7 @@ class RecipePage extends StatefulWidget {
class _RecipePageState extends State<RecipePage> { class _RecipePageState extends State<RecipePage> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final TextStyle menuItemStyle = new PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0); final TextStyle menuItemStyle = const PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0);
double _getAppBarHeight(BuildContext context) => MediaQuery.of(context).size.height * 0.3; double _getAppBarHeight(BuildContext context) => MediaQuery.of(context).size.height * 0.3;
...@@ -448,7 +448,7 @@ class RecipeSheet extends StatelessWidget { ...@@ -448,7 +448,7 @@ class RecipeSheet extends StatelessWidget {
), ),
new TableRow( new TableRow(
children: <Widget>[ children: <Widget>[
new SizedBox(), const SizedBox(),
new Padding( new Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 4.0), padding: const EdgeInsets.only(top: 8.0, bottom: 4.0),
child: new Text(recipe.description, style: descriptionStyle) child: new Text(recipe.description, style: descriptionStyle)
...@@ -457,7 +457,7 @@ class RecipeSheet extends StatelessWidget { ...@@ -457,7 +457,7 @@ class RecipeSheet extends StatelessWidget {
), ),
new TableRow( new TableRow(
children: <Widget>[ children: <Widget>[
new SizedBox(), const SizedBox(),
new Padding( new Padding(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0), padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
child: new Text('Ingredients', style: headingStyle) child: new Text('Ingredients', style: headingStyle)
...@@ -471,7 +471,7 @@ class RecipeSheet extends StatelessWidget { ...@@ -471,7 +471,7 @@ class RecipeSheet extends StatelessWidget {
))..add( ))..add(
new TableRow( new TableRow(
children: <Widget>[ children: <Widget>[
new SizedBox(), const SizedBox(),
new Padding( new Padding(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0), padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
child: new Text('Steps', style: headingStyle) child: new Text('Steps', style: headingStyle)
......
...@@ -75,7 +75,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> { ...@@ -75,7 +75,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget buildCheckbox() { Widget buildCheckbox() {
return new Align( return new Align(
alignment: new FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new Column( child: new Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
...@@ -109,7 +109,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> { ...@@ -109,7 +109,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget buildRadio() { Widget buildRadio() {
return new Align( return new Align(
alignment: new FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new Column( child: new Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
...@@ -161,7 +161,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> { ...@@ -161,7 +161,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Widget buildSwitch() { Widget buildSwitch() {
return new Align( return new Align(
alignment: new FractionalOffset(0.5, 0.4), alignment: const FractionalOffset(0.5, 0.4),
child: new Row( child: new Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
......
...@@ -135,7 +135,7 @@ class VendorItem extends StatelessWidget { ...@@ -135,7 +135,7 @@ class VendorItem extends StatelessWidget {
child: new Image.asset(vendor.avatarAsset, fit: ImageFit.cover), child: new Image.asset(vendor.avatarAsset, fit: ImageFit.cover),
), ),
), ),
new SizedBox(width: 8.0), const SizedBox(width: 8.0),
new Expanded( new Expanded(
child: new Text(vendor.name, style: ShrineTheme.of(context).vendorItemStyle), child: new Text(vendor.name, style: ShrineTheme.of(context).vendorItemStyle),
), ),
......
...@@ -43,7 +43,7 @@ class OrderItem extends StatelessWidget { ...@@ -43,7 +43,7 @@ class OrderItem extends StatelessWidget {
), ),
), ),
), ),
new SizedBox(height: 24.0), const SizedBox(height: 24.0),
new Row( new Row(
children: <Widget>[ children: <Widget>[
new Padding( new Padding(
...@@ -66,9 +66,9 @@ class OrderItem extends StatelessWidget { ...@@ -66,9 +66,9 @@ class OrderItem extends StatelessWidget {
child: new Column( child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
new SizedBox(height: 24.0), const SizedBox(height: 24.0),
new Text(product.description, style: theme.featureStyle), new Text(product.description, style: theme.featureStyle),
new SizedBox(height: 16.0), const SizedBox(height: 16.0),
new Padding( new Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 88.0), padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 88.0),
child: new DropdownButtonHideUnderline( child: new DropdownButtonHideUnderline(
...@@ -94,7 +94,7 @@ class OrderItem extends StatelessWidget { ...@@ -94,7 +94,7 @@ class OrderItem extends StatelessWidget {
), ),
), ),
), ),
new SizedBox(height: 16.0), const SizedBox(height: 16.0),
new SizedBox( new SizedBox(
height: 24.0, height: 24.0,
child: new Align( child: new Align(
...@@ -102,9 +102,9 @@ class OrderItem extends StatelessWidget { ...@@ -102,9 +102,9 @@ class OrderItem extends StatelessWidget {
child: new Text(product.vendor.name, style: theme.vendorTitleStyle), child: new Text(product.vendor.name, style: theme.vendorTitleStyle),
), ),
), ),
new SizedBox(height: 16.0), const SizedBox(height: 16.0),
new Text(product.vendor.description, style: theme.vendorStyle), new Text(product.vendor.description, style: theme.vendorStyle),
new SizedBox(height: 24.0), const SizedBox(height: 24.0),
], ],
), ),
), ),
...@@ -186,13 +186,13 @@ class _OrderPageState extends State<OrderPage> { ...@@ -186,13 +186,13 @@ class _OrderPageState extends State<OrderPage> {
quantity: currentOrder.quantity, quantity: currentOrder.quantity,
quantityChanged: (int value) { updateOrder(quantity: value); }, quantityChanged: (int value) { updateOrder(quantity: value); },
), ),
new SizedBox(height: 24.0), const SizedBox(height: 24.0),
]), ]),
), ),
new SliverPadding( new SliverPadding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new SliverGrid( child: new SliverGrid(
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 8.0, mainAxisSpacing: 8.0,
crossAxisSpacing: 8.0, crossAxisSpacing: 8.0,
......
...@@ -14,7 +14,7 @@ Widget buildShrine(BuildContext context, Widget child) { ...@@ -14,7 +14,7 @@ Widget buildShrine(BuildContext context, Widget child) {
return new Theme( return new Theme(
data: new ThemeData( data: new ThemeData(
primarySwatch: Colors.grey, primarySwatch: Colors.grey,
iconTheme: new IconThemeData(color: const Color(0xFF707070)), iconTheme: const IconThemeData(color: const Color(0xFF707070)),
platform: Theme.of(context).platform, platform: Theme.of(context).platform,
), ),
child: new ShrineTheme(child: child) child: new ShrineTheme(child: child)
......
...@@ -145,7 +145,7 @@ class TextFieldDemoState extends State<TextFieldDemo> { ...@@ -145,7 +145,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
onSaved: (InputValue val) { person.password = val.text; } onSaved: (InputValue val) { person.password = val.text; }
) )
), ),
new SizedBox(width: 16.0), const SizedBox(width: 16.0),
new Expanded( new Expanded(
child: new TextField( child: new TextField(
hintText: 'How do you log in?', hintText: 'How do you log in?',
......
...@@ -134,10 +134,10 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> { ...@@ -134,10 +134,10 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
} else { } else {
body = new SingleChildScrollView( body = new SingleChildScrollView(
child: new Padding( child: new Padding(
padding: new EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: new RichText( child: new RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle(fontFamily: 'monospace', fontSize: 10.0), style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0),
children: <TextSpan>[ children: <TextSpan>[
new DartSyntaxHighlighter(style).format(_exampleCode) new DartSyntaxHighlighter(style).format(_exampleCode)
] ]
......
...@@ -215,9 +215,9 @@ class GalleryDrawer extends StatelessWidget { ...@@ -215,9 +215,9 @@ class GalleryDrawer extends StatelessWidget {
); );
final Widget aboutItem = new AboutDrawerItem( final Widget aboutItem = new AboutDrawerItem(
icon: new FlutterLogo(), icon: const FlutterLogo(),
applicationVersion: '2016 Q3 Preview', applicationVersion: '2016 Q3 Preview',
applicationIcon: new FlutterLogo(), applicationIcon: const FlutterLogo(),
applicationLegalese: '© 2016 The Chromium Authors', applicationLegalese: '© 2016 The Chromium Authors',
aboutBoxChildren: <Widget>[ aboutBoxChildren: <Widget>[
new Padding( new Padding(
......
...@@ -19,27 +19,27 @@ class SyntaxHighlighterStyle { ...@@ -19,27 +19,27 @@ class SyntaxHighlighterStyle {
static SyntaxHighlighterStyle lightThemeStyle() { static SyntaxHighlighterStyle lightThemeStyle() {
return new SyntaxHighlighterStyle( return new SyntaxHighlighterStyle(
baseStyle: new TextStyle(color: const Color(0xFF000000)), baseStyle: const TextStyle(color: const Color(0xFF000000)),
numberStyle: new TextStyle(color: const Color(0xFF1565C0)), numberStyle: const TextStyle(color: const Color(0xFF1565C0)),
commentStyle: new TextStyle(color: const Color(0xFF9E9E9E)), commentStyle: const TextStyle(color: const Color(0xFF9E9E9E)),
keywordStyle: new TextStyle(color: const Color(0xFF9C27B0)), keywordStyle: const TextStyle(color: const Color(0xFF9C27B0)),
stringStyle: new TextStyle(color: const Color(0xFF43A047)), stringStyle: const TextStyle(color: const Color(0xFF43A047)),
punctuationStyle: new TextStyle(color: const Color(0xFF000000)), punctuationStyle: const TextStyle(color: const Color(0xFF000000)),
classStyle: new TextStyle(color: const Color(0xFF512DA8)), classStyle: const TextStyle(color: const Color(0xFF512DA8)),
constantStyle: new TextStyle(color: const Color(0xFF795548)) constantStyle: const TextStyle(color: const Color(0xFF795548))
); );
} }
static SyntaxHighlighterStyle darkThemeStyle() { static SyntaxHighlighterStyle darkThemeStyle() {
return new SyntaxHighlighterStyle( return new SyntaxHighlighterStyle(
baseStyle: new TextStyle(color: const Color(0xFFFFFFFF)), baseStyle: const TextStyle(color: const Color(0xFFFFFFFF)),
numberStyle: new TextStyle(color: const Color(0xFF1565C0)), numberStyle: const TextStyle(color: const Color(0xFF1565C0)),
commentStyle: new TextStyle(color: const Color(0xFF9E9E9E)), commentStyle: const TextStyle(color: const Color(0xFF9E9E9E)),
keywordStyle: new TextStyle(color: const Color(0xFF80CBC4)), keywordStyle: const TextStyle(color: const Color(0xFF80CBC4)),
stringStyle: new TextStyle(color: const Color(0xFF009688)), stringStyle: const TextStyle(color: const Color(0xFF009688)),
punctuationStyle: new TextStyle(color: const Color(0xFFFFFFFF)), punctuationStyle: const TextStyle(color: const Color(0xFFFFFFFF)),
classStyle: new TextStyle(color: const Color(0xFF009688)), classStyle: const TextStyle(color: const Color(0xFF009688)),
constantStyle: new TextStyle(color: const Color(0xFF795548)) constantStyle: const TextStyle(color: const Color(0xFF795548))
); );
} }
......
...@@ -32,7 +32,7 @@ class UpdaterState extends State<Updater> { ...@@ -32,7 +32,7 @@ class UpdaterState extends State<Updater> {
Future<Null> _checkForUpdates() async { Future<Null> _checkForUpdates() async {
// Only prompt once a day // Only prompt once a day
if (_lastUpdateCheck != null && if (_lastUpdateCheck != null &&
new DateTime.now().difference(_lastUpdateCheck) < new Duration(days: 1)) { new DateTime.now().difference(_lastUpdateCheck) < const Duration(days: 1)) {
return; // We already checked for updates recently return; // We already checked for updates recently
} }
_lastUpdateCheck = new DateTime.now(); _lastUpdateCheck = new DateTime.now();
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
final Point allDemosOrigin = tester.getTopRight(find.text('Demos')); final Point allDemosOrigin = tester.getTopRight(find.text('Demos'));
final Finder button = find.text('Buttons'); final Finder button = find.text('Buttons');
while (button.evaluate().isEmpty) { while (button.evaluate().isEmpty) {
await tester.scrollAt(allDemosOrigin, new Offset(0.0, -100.0)); await tester.scrollAt(allDemosOrigin, const Offset(0.0, -100.0));
await tester.pump(); // start the scroll await tester.pump(); // start the scroll
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
} }
......
...@@ -37,6 +37,6 @@ void main() { ...@@ -37,6 +37,6 @@ void main() {
await new Future<Null>.delayed(kWaitBetweenActions); await new Future<Null>.delayed(kWaitBetweenActions);
} }
await completer.future; await completer.future;
}, timeout: new Timeout(new Duration(minutes: 1))); }, timeout: const Timeout(const Duration(minutes: 1)));
}); });
} }
...@@ -34,14 +34,14 @@ void main() { ...@@ -34,14 +34,14 @@ void main() {
// https://github.com/flutter/flutter/issues/3316 // https://github.com/flutter/flutter/issues/3316
// Scroll down // Scroll down
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, -300.0, new Duration(milliseconds: 300)); await driver.scroll(stockList, 0.0, -300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(new Duration(milliseconds: 500)); await new Future<Null>.delayed(const Duration(milliseconds: 500));
} }
// Scroll up // Scroll up
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, 300.0, new Duration(milliseconds: 300)); await driver.scroll(stockList, 0.0, 300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(new Duration(milliseconds: 500)); await new Future<Null>.delayed(const Duration(milliseconds: 500));
} }
}); });
......
...@@ -56,7 +56,7 @@ final List<String> unsynchedDemoTitles = <String>[ ...@@ -56,7 +56,7 @@ final List<String> unsynchedDemoTitles = <String>[
'Progress indicators', 'Progress indicators',
]; ];
final FileSystem _fs = new LocalFileSystem(); final FileSystem _fs = const LocalFileSystem();
const Duration kWaitBetweenActions = const Duration(milliseconds: 250); const Duration kWaitBetweenActions = const Duration(milliseconds: 250);
...@@ -123,7 +123,7 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou ...@@ -123,7 +123,7 @@ Future<Null> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
// Save the durations Map to a file. // Save the durations Map to a file.
final File file = await _fs.file(outputPath).create(recursive: true); final File file = await _fs.file(outputPath).create(recursive: true);
await file.writeAsString(new JsonEncoder.withIndent(' ').convert(durations)); await file.writeAsString(const JsonEncoder.withIndent(' ').convert(durations));
} }
void main() { void main() {
...@@ -176,6 +176,6 @@ void main() { ...@@ -176,6 +176,6 @@ void main() {
await summary.writeSummaryToFile('transitions', pretty: true); await summary.writeSummaryToFile('transitions', pretty: true);
String histogramPath = path.join(testOutputsDirectory, 'transition_durations.timeline.json'); String histogramPath = path.join(testOutputsDirectory, 'transition_durations.timeline.json');
await saveDurationsHistogram(timeline.json['traceEvents'], histogramPath); await saveDurationsHistogram(timeline.json['traceEvents'], histogramPath);
}, timeout: new Timeout(new Duration(minutes: 5))); }, timeout: const Timeout(const Duration(minutes: 5)));
}); });
} }
...@@ -42,7 +42,7 @@ ui.Picture paint(ui.Rect paintBounds) { ...@@ -42,7 +42,7 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas.rotate(math.PI/4.0); canvas.rotate(math.PI/4.0);
ui.Gradient yellowBlue = new ui.Gradient.linear( ui.Gradient yellowBlue = new ui.Gradient.linear(
<ui.Point>[new ui.Point(-radius, -radius), new ui.Point(0.0, 0.0)], <ui.Point>[new ui.Point(-radius, -radius), const ui.Point(0.0, 0.0)],
<ui.Color>[const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)] <ui.Color>[const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)]
); );
canvas.drawRect(new ui.Rect.fromLTRB(-radius, -radius, radius, radius), canvas.drawRect(new ui.Rect.fromLTRB(-radius, -radius, radius, radius),
...@@ -61,7 +61,7 @@ ui.Picture paint(ui.Rect paintBounds) { ...@@ -61,7 +61,7 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas.restore(); canvas.restore();
paint.color = const ui.Color.fromARGB(128, 255, 0, 0); paint.color = const ui.Color.fromARGB(128, 255, 0, 0);
canvas.drawCircle(new ui.Point(150.0, 300.0), radius, paint); canvas.drawCircle(const ui.Point(150.0, 300.0), radius, paint);
// When we're done issuing painting commands, we end the recording an receive // When we're done issuing painting commands, we end the recording an receive
// a Picture, which is an immutable record of the commands we've issued. You // a Picture, which is an immutable record of the commands we've issued. You
......
...@@ -15,25 +15,25 @@ void main() { ...@@ -15,25 +15,25 @@ void main() {
void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) { void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) {
TextStyle style = const TextStyle(color: const Color(0xFF000000)); TextStyle style = const TextStyle(color: const Color(0xFF000000));
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$crossAxisAlignment')); RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$crossAxisAlignment'));
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0))); table.add(new RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic); RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = new TextStyle(fontSize: 15.0, color: const Color(0xFF000000)); style = const TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
row.add(new RenderDecoratedBox( row.add(new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0x7FFFCCCC)), decoration: const BoxDecoration(backgroundColor: const Color(0x7FFFCCCC)),
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo')) child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo'))
)); ));
style = new TextStyle(fontSize: 10.0, color: const Color(0xFF000000)); style = const TextStyle(fontSize: 10.0, color: const Color(0xFF000000));
row.add(new RenderDecoratedBox( row.add(new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0x7FCCFFCC)), decoration: const BoxDecoration(backgroundColor: const Color(0x7FCCFFCC)),
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo')) child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo'))
)); ));
RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic); RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = new TextStyle(fontSize: 25.0, color: const Color(0xFF000000)); style = const TextStyle(fontSize: 25.0, color: const Color(0xFF000000));
subrow.add(new RenderDecoratedBox( subrow.add(new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0x7FCCCCFF)), decoration: const BoxDecoration(backgroundColor: const Color(0x7FCCCCFF)),
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo foo')) child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo foo'))
)); ));
subrow.add(new RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: new Size(30.0, 40.0))); subrow.add(new RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: const Size(30.0, 40.0)));
row.add(subrow); row.add(subrow);
table.add(row); table.add(row);
final FlexParentData rowParentData = row.parentData; final FlexParentData rowParentData = row.parentData;
...@@ -49,11 +49,11 @@ void main() { ...@@ -49,11 +49,11 @@ void main() {
void addJustificationRow(MainAxisAlignment justify) { void addJustificationRow(MainAxisAlignment justify) {
const TextStyle style = const TextStyle(color: const Color(0xFF000000)); const TextStyle style = const TextStyle(color: const Color(0xFF000000));
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify')); RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify'));
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0))); table.add(new RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
RenderFlex row = new RenderFlex(direction: Axis.horizontal); RenderFlex row = new RenderFlex(direction: Axis.horizontal);
row.add(new RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: new Size(80.0, 60.0))); row.add(new RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: const Size(80.0, 60.0)));
row.add(new RenderSolidColorBox(const Color(0xFFCCFFCC), desiredSize: new Size(64.0, 60.0))); row.add(new RenderSolidColorBox(const Color(0xFFCCFFCC), desiredSize: const Size(64.0, 60.0)));
row.add(new RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: new Size(160.0, 60.0))); row.add(new RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: const Size(160.0, 60.0)));
row.mainAxisAlignment = justify; row.mainAxisAlignment = justify;
table.add(row); table.add(row);
final FlexParentData rowParentData = row.parentData; final FlexParentData rowParentData = row.parentData;
...@@ -67,8 +67,8 @@ void main() { ...@@ -67,8 +67,8 @@ void main() {
addJustificationRow(MainAxisAlignment.spaceAround); addJustificationRow(MainAxisAlignment.spaceAround);
RenderDecoratedBox root = new RenderDecoratedBox( RenderDecoratedBox root = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), decoration: const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)),
child: new RenderPadding(child: table, padding: new EdgeInsets.symmetric(vertical: 50.0)) child: new RenderPadding(child: table, padding: const EdgeInsets.symmetric(vertical: 50.0))
); );
new RenderingFlutterBinding(root: root); new RenderingFlutterBinding(root: root);
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
// We use a RenderParagraph to display the text 'Hello, world.' without // We use a RenderParagraph to display the text 'Hello, world.' without
// any explicit styling. // any explicit styling.
child: new RenderParagraph(new TextSpan(text: 'Hello, world.')) child: new RenderParagraph(const TextSpan(text: 'Hello, world.'))
) )
); );
} }
...@@ -572,7 +572,7 @@ class RenderSolidColor extends RenderDecoratedSector { ...@@ -572,7 +572,7 @@ class RenderSolidColor extends RenderDecoratedSector {
@override @override
void handleEvent(PointerEvent event, HitTestEntry entry) { void handleEvent(PointerEvent event, HitTestEntry entry) {
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = const BoxDecoration(backgroundColor: const Color(0xFFFF0000));
} else if (event is PointerUpEvent) { } else if (event is PointerUpEvent) {
decoration = new BoxDecoration(backgroundColor: backgroundColor); decoration = new BoxDecoration(backgroundColor: backgroundColor);
} }
......
...@@ -41,7 +41,7 @@ class RenderSolidColorBox extends RenderDecoratedBox { ...@@ -41,7 +41,7 @@ class RenderSolidColorBox extends RenderDecoratedBox {
@override @override
void handleEvent(PointerEvent event, BoxHitTestEntry entry) { void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = const BoxDecoration(backgroundColor: const Color(0xFFFF0000));
} else if (event is PointerUpEvent) { } else if (event is PointerUpEvent) {
decoration = new BoxDecoration(backgroundColor: backgroundColor); decoration = new BoxDecoration(backgroundColor: backgroundColor);
} }
......
...@@ -28,9 +28,9 @@ class RenderDots extends RenderConstrainedBox { ...@@ -28,9 +28,9 @@ class RenderDots extends RenderConstrainedBox {
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final Canvas canvas = context.canvas; final Canvas canvas = context.canvas;
canvas.drawRect(offset & size, new Paint()..color = new Color(0xFF0000FF)); canvas.drawRect(offset & size, new Paint()..color = const Color(0xFF0000FF));
Paint paint = new Paint()..color = new Color(0xFF00FF00); Paint paint = new Paint()..color = const Color(0xFF00FF00);
for (Point point in _dots.values) for (Point point in _dots.values)
canvas.drawCircle(point, 50.0, paint); canvas.drawCircle(point, 50.0, paint);
......
...@@ -165,7 +165,7 @@ class _GestureDemoState extends State<GestureDemo> { ...@@ -165,7 +165,7 @@ class _GestureDemoState extends State<GestureDemo> {
left: 0.0, left: 0.0,
child: new Card( child: new Card(
child: new Container( child: new Container(
padding: new EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
new Row( new Row(
......
...@@ -93,7 +93,7 @@ class SectorAppState extends State<SectorApp> { ...@@ -93,7 +93,7 @@ class SectorAppState extends State<SectorApp> {
return new Column( return new Column(
children: <Widget>[ children: <Widget>[
new Container( new Container(
padding: new EdgeInsets.symmetric(horizontal: 8.0, vertical: 25.0), padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new RaisedButton( new RaisedButton(
...@@ -102,8 +102,8 @@ class SectorAppState extends State<SectorApp> { ...@@ -102,8 +102,8 @@ class SectorAppState extends State<SectorApp> {
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new Container( new Container(
padding: new EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
margin: new EdgeInsets.only(right: 10.0), margin: const EdgeInsets.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon) child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
), ),
new Text('ADD SECTOR'), new Text('ADD SECTOR'),
...@@ -117,8 +117,8 @@ class SectorAppState extends State<SectorApp> { ...@@ -117,8 +117,8 @@ class SectorAppState extends State<SectorApp> {
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new Container( new Container(
padding: new EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
margin: new EdgeInsets.only(right: 10.0), margin: const EdgeInsets.only(right: 10.0),
child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon) child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
), ),
new Text('REMOVE SECTOR'), new Text('REMOVE SECTOR'),
...@@ -132,11 +132,11 @@ class SectorAppState extends State<SectorApp> { ...@@ -132,11 +132,11 @@ class SectorAppState extends State<SectorApp> {
), ),
new Expanded( new Expanded(
child: new Container( child: new Container(
margin: new EdgeInsets.all(8.0), margin: const EdgeInsets.all(8.0),
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border.all() border: new Border.all()
), ),
padding: new EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new WidgetToRenderBoxAdapter( child: new WidgetToRenderBoxAdapter(
renderBox: sectors, renderBox: sectors,
onBuild: doUpdates onBuild: doUpdates
......
...@@ -44,8 +44,8 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) { ...@@ -44,8 +44,8 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
new Rectangle(const Color(0xFF00FFFF)), new Rectangle(const Color(0xFF00FFFF)),
new Material( new Material(
child: new Container( child: new Container(
padding: new EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
margin: new EdgeInsets.all(10.0), margin: const EdgeInsets.all(10.0),
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
new RaisedButton( new RaisedButton(
...@@ -99,7 +99,7 @@ void main() { ...@@ -99,7 +99,7 @@ void main() {
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: FractionalOffset.center); transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: FractionalOffset.center);
RenderPadding root = new RenderPadding(padding: new EdgeInsets.all(80.0), child: transformBox); RenderPadding root = new RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
binding.renderView.child = root; binding.renderView.child = root;
binding.addPersistentFrameCallback(rotate); binding.addPersistentFrameCallback(rotate);
......
...@@ -46,7 +46,7 @@ Widget toStyledText(String name, String text) { ...@@ -46,7 +46,7 @@ Widget toStyledText(String name, String text) {
style: _kUnderline, style: _kUnderline,
text: name text: name
), ),
new TextSpan(text: ':') const TextSpan(text: ':')
] ]
), ),
new TextSpan(text: text) new TextSpan(text: text)
...@@ -108,7 +108,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> { ...@@ -108,7 +108,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
return new GestureDetector( return new GestureDetector(
onTap: _handleTap, onTap: _handleTap,
child: new Container( child: new Container(
padding: new EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Column( child: new Column(
children: children, children: children,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
......
...@@ -78,7 +78,7 @@ class StockDataFetcher { ...@@ -78,7 +78,7 @@ class StockDataFetcher {
print("Failed to load stock data chunk ${_nextChunk - 1}"); print("Failed to load stock data chunk ${_nextChunk - 1}");
return null; return null;
} }
JsonDecoder decoder = new JsonDecoder(); JsonDecoder decoder = const JsonDecoder();
callback(new StockData(decoder.convert(json))); callback(new StockData(decoder.convert(json)));
if (_nextChunk < _kChunkCount) if (_nextChunk < _kChunkCount)
_fetchNextChunk(); _fetchNextChunk();
......
...@@ -22,7 +22,7 @@ class _StockSymbolView extends StatelessWidget { ...@@ -22,7 +22,7 @@ class _StockSymbolView extends StatelessWidget {
TextStyle headings = Theme.of(context).textTheme.body2; TextStyle headings = Theme.of(context).textTheme.body2;
return new Container( return new Container(
padding: new EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
new Row( new Row(
...@@ -47,11 +47,11 @@ class _StockSymbolView extends StatelessWidget { ...@@ -47,11 +47,11 @@ class _StockSymbolView extends StatelessWidget {
), ),
new RichText( new RichText(
text: new TextSpan( text: new TextSpan(
style: DefaultTextStyle.of(context).style.merge(new TextStyle(fontSize: 8.0)), style: DefaultTextStyle.of(context).style.merge(const TextStyle(fontSize: 8.0)),
text: 'Prices may be delayed by ', text: 'Prices may be delayed by ',
children: <TextSpan>[ children: <TextSpan>[
new TextSpan(text: 'several', style: new TextStyle(fontStyle: FontStyle.italic)), const TextSpan(text: 'several', style: const TextStyle(fontStyle: FontStyle.italic)),
new TextSpan(text: ' years.'), const TextSpan(text: ' years.'),
] ]
) )
), ),
...@@ -75,7 +75,7 @@ class StockSymbolPage extends StatelessWidget { ...@@ -75,7 +75,7 @@ class StockSymbolPage extends StatelessWidget {
), ),
body: new SingleChildScrollView( body: new SingleChildScrollView(
child: new Container( child: new Container(
margin: new EdgeInsets.all(20.0), margin: const EdgeInsets.all(20.0),
child: new Card( child: new Card(
child: new _StockSymbolView( child: new _StockSymbolView(
stock: stock, stock: stock,
...@@ -99,7 +99,7 @@ class StockSymbolBottomSheet extends StatelessWidget { ...@@ -99,7 +99,7 @@ class StockSymbolBottomSheet extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
padding: new EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border(top: new BorderSide(color: Colors.black26)) border: new Border(top: new BorderSide(color: Colors.black26))
), ),
......
...@@ -59,7 +59,7 @@ void main() { ...@@ -59,7 +59,7 @@ void main() {
// sanity check // sanity check
expect(find.text('MARKET'), findsOneWidget); expect(find.text('MARKET'), findsOneWidget);
expect(find.text('Account Balance'), findsNothing); expect(find.text('Account Balance'), findsNothing);
await tester.pump(new Duration(seconds: 2)); await tester.pump(const Duration(seconds: 2));
expect(find.text('MARKET'), findsOneWidget); expect(find.text('MARKET'), findsOneWidget);
expect(find.text('Account Balance'), findsNothing); expect(find.text('Account Balance'), findsNothing);
......
...@@ -28,14 +28,14 @@ void main() { ...@@ -28,14 +28,14 @@ void main() {
// Scroll down // Scroll down
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, -300.0, new Duration(milliseconds: 300)); await driver.scroll(stockList, 0.0, -300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(new Duration(milliseconds: 500)); await new Future<Null>.delayed(const Duration(milliseconds: 500));
} }
// Scroll up // Scroll up
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, 300.0, new Duration(milliseconds: 300)); await driver.scroll(stockList, 0.0, 300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(new Duration(milliseconds: 500)); await new Future<Null>.delayed(const Duration(milliseconds: 500));
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment