Unnecessary new (#20138)
* enable lint unnecessary_new
* fix tests
* fix tests
* fix tests
diff --git a/examples/catalog/bin/sample_page.dart b/examples/catalog/bin/sample_page.dart
index 7f67d24..42afe92 100644
--- a/examples/catalog/bin/sample_page.dart
+++ b/examples/catalog/bin/sample_page.dart
@@ -33,18 +33,18 @@
void logError(String s) { print(s); }
File inputFile(String dir, String name) {
- return new File(dir + Platform.pathSeparator + name);
+ return File(dir + Platform.pathSeparator + name);
}
File outputFile(String name, [Directory directory]) {
- return new File((directory ?? outputDirectory).path + Platform.pathSeparator + name);
+ return File((directory ?? outputDirectory).path + Platform.pathSeparator + name);
}
void initialize() {
- outputDirectory = new Directory('.generated');
- sampleDirectory = new Directory('lib');
- testDirectory = new Directory('test');
- driverDirectory = new Directory('test_driver');
+ outputDirectory = Directory('.generated');
+ sampleDirectory = Directory('lib');
+ testDirectory = Directory('test');
+ driverDirectory = Directory('test_driver');
outputDirectory.createSync();
}
@@ -52,10 +52,10 @@
// by values[foo].
String expandTemplate(String template, Map<String, String> values) {
// Matches @(foo), match[1] == 'foo'
- final RegExp tokenRE = new RegExp(r'@\(([\w ]+)\)', multiLine: true);
+ final RegExp tokenRE = RegExp(r'@\(([\w ]+)\)', multiLine: true);
return template.replaceAllMapped(tokenRE, (Match match) {
if (match.groupCount != 1)
- throw new SampleError('bad template keyword $match[0]');
+ throw SampleError('bad template keyword $match[0]');
final String keyword = match[1];
return values[keyword] ?? '';
});
@@ -102,8 +102,8 @@
bool initialize() {
final String contents = sourceFile.readAsStringSync();
- final RegExp startRE = new RegExp(r'^/\*\s+^Sample\s+Catalog', multiLine: true);
- final RegExp endRE = new RegExp(r'^\*/', multiLine: true);
+ final RegExp startRE = RegExp(r'^/\*\s+^Sample\s+Catalog', multiLine: true);
+ final RegExp endRE = RegExp(r'^\*/', multiLine: true);
final Match startMatch = startRE.firstMatch(contents);
if (startMatch == null)
return false;
@@ -116,12 +116,12 @@
final String comment = contents.substring(startIndex, startIndex + endMatch.start);
sourceCode = contents.substring(0, startMatch.start) + contents.substring(startIndex + endMatch.end);
if (sourceCode.trim().isEmpty)
- throw new SampleError('did not find any source code in $sourceFile');
+ throw SampleError('did not find any source code in $sourceFile');
- final RegExp keywordsRE = new RegExp(sampleCatalogKeywords, multiLine: true);
+ final RegExp keywordsRE = RegExp(sampleCatalogKeywords, multiLine: true);
final List<Match> keywordMatches = keywordsRE.allMatches(comment).toList();
if (keywordMatches.isEmpty)
- throw new SampleError('did not find any keywords in the Sample Catalog comment in $sourceFile');
+ throw SampleError('did not find any keywords in the Sample Catalog comment in $sourceFile');
commentValues = <String, String>{};
for (int i = 0; i < keywordMatches.length; i += 1) {
@@ -148,7 +148,7 @@
final List<SampleInfo> samples = <SampleInfo>[];
for (FileSystemEntity entity in sampleDirectory.listSync()) {
if (entity is File && entity.path.endsWith('.dart')) {
- final SampleInfo sample = new SampleInfo(entity, commit);
+ final SampleInfo sample = SampleInfo(entity, commit);
if (sample.initialize()) // skip files that lack the Sample Catalog comment
samples.add(sample);
}
diff --git a/examples/catalog/lib/animated_list.dart b/examples/catalog/lib/animated_list.dart
index 31d173a..4aab2a4 100644
--- a/examples/catalog/lib/animated_list.dart
+++ b/examples/catalog/lib/animated_list.dart
@@ -7,11 +7,11 @@
class AnimatedListSample extends StatefulWidget {
@override
- _AnimatedListSampleState createState() => new _AnimatedListSampleState();
+ _AnimatedListSampleState createState() => _AnimatedListSampleState();
}
class _AnimatedListSampleState extends State<AnimatedListSample> {
- final GlobalKey<AnimatedListState> _listKey = new GlobalKey<AnimatedListState>();
+ final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
ListModel<int> _list;
int _selectedItem;
int _nextItem; // The next item inserted when the user presses the '+' button.
@@ -19,7 +19,7 @@
@override
void initState() {
super.initState();
- _list = new ListModel<int>(
+ _list = ListModel<int>(
listKey: _listKey,
initialItems: <int>[0, 1, 2],
removedItemBuilder: _buildRemovedItem,
@@ -29,7 +29,7 @@
// Used to build list items that haven't been removed.
Widget _buildItem(BuildContext context, int index, Animation<double> animation) {
- return new CardItem(
+ return CardItem(
animation: animation,
item: _list[index],
selected: _selectedItem == _list[index],
@@ -47,7 +47,7 @@
// The widget will be used by the [AnimatedListState.removeItem] method's
// [AnimatedListRemovedItemBuilder] parameter.
Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) {
- return new CardItem(
+ return CardItem(
animation: animation,
item: item,
selected: false,
@@ -73,26 +73,26 @@
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- home: new Scaffold(
- appBar: new AppBar(
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('AnimatedList'),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.add_circle),
onPressed: _insert,
tooltip: 'insert a new item',
),
- new IconButton(
+ IconButton(
icon: const Icon(Icons.remove_circle),
onPressed: _remove,
tooltip: 'remove the selected item',
),
],
),
- body: new Padding(
+ body: Padding(
padding: const EdgeInsets.all(16.0),
- child: new AnimatedList(
+ child: AnimatedList(
key: _listKey,
initialItemCount: _list.length,
itemBuilder: _buildItem,
@@ -119,7 +119,7 @@
Iterable<E> initialItems,
}) : assert(listKey != null),
assert(removedItemBuilder != null),
- _items = new List<E>.from(initialItems ?? <E>[]);
+ _items = List<E>.from(initialItems ?? <E>[]);
final GlobalKey<AnimatedListState> listKey;
final dynamic removedItemBuilder;
@@ -173,20 +173,20 @@
TextStyle textStyle = Theme.of(context).textTheme.display1;
if (selected)
textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]);
- return new Padding(
+ return Padding(
padding: const EdgeInsets.all(2.0),
- child: new SizeTransition(
+ child: SizeTransition(
axis: Axis.vertical,
sizeFactor: animation,
- child: new GestureDetector(
+ child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap,
- child: new SizedBox(
+ child: SizedBox(
height: 128.0,
- child: new Card(
+ child: Card(
color: Colors.primaries[item % Colors.primaries.length],
- child: new Center(
- child: new Text('Item $item', style: textStyle),
+ child: Center(
+ child: Text('Item $item', style: textStyle),
),
),
),
@@ -197,7 +197,7 @@
}
void main() {
- runApp(new AnimatedListSample());
+ runApp(AnimatedListSample());
}
/*
diff --git a/examples/catalog/lib/app_bar_bottom.dart b/examples/catalog/lib/app_bar_bottom.dart
index 06ca9b6..fd6be4dd 100644
--- a/examples/catalog/lib/app_bar_bottom.dart
+++ b/examples/catalog/lib/app_bar_bottom.dart
@@ -6,7 +6,7 @@
class AppBarBottomSample extends StatefulWidget {
@override
- _AppBarBottomSampleState createState() => new _AppBarBottomSampleState();
+ _AppBarBottomSampleState createState() => _AppBarBottomSampleState();
}
class _AppBarBottomSampleState extends State<AppBarBottomSample> with SingleTickerProviderStateMixin {
@@ -15,7 +15,7 @@
@override
void initState() {
super.initState();
- _tabController = new TabController(vsync: this, length: choices.length);
+ _tabController = TabController(vsync: this, length: choices.length);
}
@override
@@ -33,40 +33,40 @@
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- home: new Scaffold(
- appBar: new AppBar(
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('AppBar Bottom Widget'),
- leading: new IconButton(
+ leading: IconButton(
tooltip: 'Previous choice',
icon: const Icon(Icons.arrow_back),
onPressed: () { _nextPage(-1); },
),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.arrow_forward),
tooltip: 'Next choice',
onPressed: () { _nextPage(1); },
),
],
- bottom: new PreferredSize(
+ bottom: PreferredSize(
preferredSize: const Size.fromHeight(48.0),
- child: new Theme(
+ child: Theme(
data: Theme.of(context).copyWith(accentColor: Colors.white),
- child: new Container(
+ child: Container(
height: 48.0,
alignment: Alignment.center,
- child: new TabPageSelector(controller: _tabController),
+ child: TabPageSelector(controller: _tabController),
),
),
),
),
- body: new TabBarView(
+ body: TabBarView(
controller: _tabController,
children: choices.map((Choice choice) {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.all(16.0),
- child: new ChoiceCard(choice: choice),
+ child: ChoiceCard(choice: choice),
);
}).toList(),
),
@@ -98,15 +98,15 @@
@override
Widget build(BuildContext context) {
final TextStyle textStyle = Theme.of(context).textTheme.display1;
- return new Card(
+ return Card(
color: Colors.white,
- child: new Center(
- child: new Column(
+ child: Center(
+ child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- new Icon(choice.icon, size: 128.0, color: textStyle.color),
- new Text(choice.title, style: textStyle),
+ Icon(choice.icon, size: 128.0, color: textStyle.color),
+ Text(choice.title, style: textStyle),
],
),
),
@@ -115,7 +115,7 @@
}
void main() {
- runApp(new AppBarBottomSample());
+ runApp(AppBarBottomSample());
}
/*
diff --git a/examples/catalog/lib/basic_app_bar.dart b/examples/catalog/lib/basic_app_bar.dart
index f5c9a57..3638d64 100644
--- a/examples/catalog/lib/basic_app_bar.dart
+++ b/examples/catalog/lib/basic_app_bar.dart
@@ -7,7 +7,7 @@
// This app is a stateful, it tracks the user's current choice.
class BasicAppBarSample extends StatefulWidget {
@override
- _BasicAppBarSampleState createState() => new _BasicAppBarSampleState();
+ _BasicAppBarSampleState createState() => _BasicAppBarSampleState();
}
class _BasicAppBarSampleState extends State<BasicAppBarSample> {
@@ -21,35 +21,35 @@
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- home: new Scaffold(
- appBar: new AppBar(
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('Basic AppBar'),
actions: <Widget>[
- new IconButton( // action button
- icon: new Icon(choices[0].icon),
+ IconButton( // action button
+ icon: Icon(choices[0].icon),
onPressed: () { _select(choices[0]); },
),
- new IconButton( // action button
- icon: new Icon(choices[1].icon),
+ IconButton( // action button
+ icon: Icon(choices[1].icon),
onPressed: () { _select(choices[1]); },
),
- new PopupMenuButton<Choice>( // overflow menu
+ PopupMenuButton<Choice>( // overflow menu
onSelected: _select,
itemBuilder: (BuildContext context) {
return choices.skip(2).map((Choice choice) {
- return new PopupMenuItem<Choice>(
+ return PopupMenuItem<Choice>(
value: choice,
- child: new Text(choice.title),
+ child: Text(choice.title),
);
}).toList();
},
),
],
),
- body: new Padding(
+ body: Padding(
padding: const EdgeInsets.all(16.0),
- child: new ChoiceCard(choice: _selectedChoice),
+ child: ChoiceCard(choice: _selectedChoice),
),
),
);
@@ -79,15 +79,15 @@
@override
Widget build(BuildContext context) {
final TextStyle textStyle = Theme.of(context).textTheme.display1;
- return new Card(
+ return Card(
color: Colors.white,
- child: new Center(
- child: new Column(
+ child: Center(
+ child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- new Icon(choice.icon, size: 128.0, color: textStyle.color),
- new Text(choice.title, style: textStyle),
+ Icon(choice.icon, size: 128.0, color: textStyle.color),
+ Text(choice.title, style: textStyle),
],
),
),
@@ -96,7 +96,7 @@
}
void main() {
- runApp(new BasicAppBarSample());
+ runApp(BasicAppBarSample());
}
/*
diff --git a/examples/catalog/lib/custom_a11y_traversal.dart b/examples/catalog/lib/custom_a11y_traversal.dart
index bae1100..3d0b286 100644
--- a/examples/catalog/lib/custom_a11y_traversal.dart
+++ b/examples/catalog/lib/custom_a11y_traversal.dart
@@ -76,10 +76,10 @@
/// The resulting order is the same.
@override
Widget build(BuildContext context) {
- return new Semantics(
- sortKey: new OrdinalSortKey(columnOrder.toDouble()),
- child: new Semantics(
- sortKey: new OrdinalSortKey(rowOrder.toDouble()),
+ return Semantics(
+ sortKey: OrdinalSortKey(columnOrder.toDouble()),
+ child: Semantics(
+ sortKey: OrdinalSortKey(rowOrder.toDouble()),
child: child,
),
);
@@ -111,12 +111,12 @@
Widget build(BuildContext context) {
final String label = '${increment ? 'Increment' : 'Decrement'} ${_fieldToName(field)}';
- return new RowColumnTraversal(
+ return RowColumnTraversal(
rowOrder: rowOrder,
columnOrder: columnOrder,
- child: new Center(
- child: new IconButton(
- icon: new Icon(icon),
+ child: Center(
+ child: IconButton(
+ icon: Icon(icon),
onPressed: onPressed,
tooltip: label,
),
@@ -151,17 +151,17 @@
final String increasedValue = '${_fieldToName(field)} ${value + 1}';
final String decreasedValue = '${_fieldToName(field)} ${value - 1}';
- return new RowColumnTraversal(
+ return RowColumnTraversal(
rowOrder: rowOrder,
columnOrder: columnOrder,
- child: new Center(
- child: new Semantics(
+ child: Center(
+ child: Semantics(
onDecrease: onDecrease,
onIncrease: onIncrease,
value: stringValue,
increasedValue: increasedValue,
decreasedValue: decreasedValue,
- child: new ExcludeSemantics(child: new Text(value.toString())),
+ child: ExcludeSemantics(child: Text(value.toString())),
),
),
);
@@ -190,7 +190,7 @@
/// The top-level example widget that serves as the body of the app.
class CustomTraversalExample extends StatefulWidget {
@override
- CustomTraversalExampleState createState() => new CustomTraversalExampleState();
+ CustomTraversalExampleState createState() => CustomTraversalExampleState();
}
/// The state object for the top level example widget.
@@ -206,15 +206,15 @@
}
Widget _makeFieldHeader(int rowOrder, int columnOrder, Field field) {
- return new RowColumnTraversal(
+ return RowColumnTraversal(
rowOrder: rowOrder,
columnOrder: columnOrder,
- child: new Text(_fieldToName(field)),
+ child: Text(_fieldToName(field)),
);
}
Widget _makeSpinnerButton(int rowOrder, int columnOrder, Field field, {bool increment = true}) {
- return new SpinnerButton(
+ return SpinnerButton(
rowOrder: rowOrder,
columnOrder: columnOrder,
icon: increment ? Icons.arrow_upward : Icons.arrow_downward,
@@ -225,7 +225,7 @@
}
Widget _makeEntryField(int rowOrder, int columnOrder, Field field) {
- return new FieldWidget(
+ return FieldWidget(
rowOrder: rowOrder,
columnOrder: columnOrder,
onIncrease: () => _addToField(field, 1),
@@ -237,20 +237,20 @@
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- home: new Scaffold(
- appBar: new AppBar(
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('Pet Inventory'),
),
- body: new Builder(
+ body: Builder(
builder: (BuildContext context) {
- return new DefaultTextStyle(
+ return DefaultTextStyle(
style: DefaultTextStyle.of(context).style.copyWith(fontSize: 21.0),
- child: new Column(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- new Semantics(
+ Semantics(
// Since this is the only sort key that the text has, it
// will be compared with the 'column' OrdinalSortKeys of all the
// fields, because the column sort keys are first in the other fields.
@@ -262,7 +262,7 @@
),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 10.0)),
- new Row(
+ Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_makeFieldHeader(1, 0, Field.DOGS),
@@ -270,7 +270,7 @@
_makeFieldHeader(1, 2, Field.FISH),
],
),
- new Row(
+ Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_makeSpinnerButton(3, 0, Field.DOGS, increment: true),
@@ -278,7 +278,7 @@
_makeSpinnerButton(3, 2, Field.FISH, increment: true),
],
),
- new Row(
+ Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_makeEntryField(2, 0, Field.DOGS),
@@ -286,7 +286,7 @@
_makeEntryField(2, 2, Field.FISH),
],
),
- new Row(
+ Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_makeSpinnerButton(4, 0, Field.DOGS, increment: false),
@@ -295,14 +295,14 @@
],
),
const Padding(padding: EdgeInsets.symmetric(vertical: 10.0)),
- new Semantics(
+ Semantics(
// Since this is the only sort key that the reset button has, it
// will be compared with the 'column' OrdinalSortKeys of all the
// fields, because the column sort keys are first in the other fields.
//
// an ordinal of "5.0" means that it will be traversed after column 4.
sortKey: const OrdinalSortKey(5.0),
- child: new MaterialButton(
+ child: MaterialButton(
child: const Text('RESET'),
textTheme: ButtonTextTheme.normal,
textColor: Colors.blue,
@@ -324,7 +324,7 @@
}
void main() {
- runApp(new CustomTraversalExample());
+ runApp(CustomTraversalExample());
}
/*
diff --git a/examples/catalog/lib/custom_semantics.dart b/examples/catalog/lib/custom_semantics.dart
index dcd5ce6..f9dc9e4 100644
--- a/examples/catalog/lib/custom_semantics.dart
+++ b/examples/catalog/lib/custom_semantics.dart
@@ -36,7 +36,7 @@
final bool canIncrease = indexOfValue < items.length - 1;
final bool canDecrease = indexOfValue > 0;
- return new Semantics(
+ return Semantics(
container: true,
label: label,
value: value,
@@ -44,16 +44,16 @@
decreasedValue: canDecrease ? _decreasedValue : null,
onIncrease: canIncrease ? _performIncrease : null,
onDecrease: canDecrease ? _performDecrease : null,
- child: new ExcludeSemantics(
- child: new ListTile(
- title: new Text(label),
- trailing: new DropdownButton<String>(
+ child: ExcludeSemantics(
+ child: ListTile(
+ title: Text(label),
+ trailing: DropdownButton<String>(
value: value,
onChanged: onChanged,
items: items.map((String item) {
- return new DropdownMenuItem<String>(
+ return DropdownMenuItem<String>(
value: item,
- child: new Text(item),
+ child: Text(item),
);
}).toList(),
),
@@ -81,7 +81,7 @@
class AdjustableDropdownExample extends StatefulWidget {
@override
- AdjustableDropdownExampleState createState() => new AdjustableDropdownExampleState();
+ AdjustableDropdownExampleState createState() => AdjustableDropdownExampleState();
}
class AdjustableDropdownExampleState extends State<AdjustableDropdownExample> {
@@ -97,14 +97,14 @@
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- home: new Scaffold(
- appBar: new AppBar(
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('Adjustable DropDown'),
),
- body: new ListView(
+ body: ListView(
children: <Widget>[
- new AdjustableDropdownListTile(
+ AdjustableDropdownListTile(
label: 'Timeout',
value: timeout ?? items[2],
items: items,
@@ -122,7 +122,7 @@
}
void main() {
- runApp(new AdjustableDropdownExample());
+ runApp(AdjustableDropdownExample());
}
/*
diff --git a/examples/catalog/lib/expansion_tile_sample.dart b/examples/catalog/lib/expansion_tile_sample.dart
index c3ca67d..9e0264d 100644
--- a/examples/catalog/lib/expansion_tile_sample.dart
+++ b/examples/catalog/lib/expansion_tile_sample.dart
@@ -7,13 +7,13 @@
class ExpansionTileSample extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- home: new Scaffold(
- appBar: new AppBar(
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('ExpansionTile'),
),
- body: new ListView.builder(
- itemBuilder: (BuildContext context, int index) => new EntryItem(data[index]),
+ body: ListView.builder(
+ itemBuilder: (BuildContext context, int index) => EntryItem(data[index]),
itemCount: data.length,
),
),
@@ -30,35 +30,35 @@
// The entire multilevel list displayed by this app.
final List<Entry> data = <Entry>[
- new Entry('Chapter A',
+ Entry('Chapter A',
<Entry>[
- new Entry('Section A0',
+ Entry('Section A0',
<Entry>[
- new Entry('Item A0.1'),
- new Entry('Item A0.2'),
- new Entry('Item A0.3'),
+ Entry('Item A0.1'),
+ Entry('Item A0.2'),
+ Entry('Item A0.3'),
],
),
- new Entry('Section A1'),
- new Entry('Section A2'),
+ Entry('Section A1'),
+ Entry('Section A2'),
],
),
- new Entry('Chapter B',
+ Entry('Chapter B',
<Entry>[
- new Entry('Section B0'),
- new Entry('Section B1'),
+ Entry('Section B0'),
+ Entry('Section B1'),
],
),
- new Entry('Chapter C',
+ Entry('Chapter C',
<Entry>[
- new Entry('Section C0'),
- new Entry('Section C1'),
- new Entry('Section C2',
+ Entry('Section C0'),
+ Entry('Section C1'),
+ Entry('Section C2',
<Entry>[
- new Entry('Item C2.0'),
- new Entry('Item C2.1'),
- new Entry('Item C2.2'),
- new Entry('Item C2.3'),
+ Entry('Item C2.0'),
+ Entry('Item C2.1'),
+ Entry('Item C2.2'),
+ Entry('Item C2.3'),
],
),
],
@@ -74,10 +74,10 @@
Widget _buildTiles(Entry root) {
if (root.children.isEmpty)
- return new ListTile(title: new Text(root.title));
- return new ExpansionTile(
- key: new PageStorageKey<Entry>(root),
- title: new Text(root.title),
+ return ListTile(title: Text(root.title));
+ return ExpansionTile(
+ key: PageStorageKey<Entry>(root),
+ title: Text(root.title),
children: root.children.map(_buildTiles).toList(),
);
}
@@ -89,7 +89,7 @@
}
void main() {
- runApp(new ExpansionTileSample());
+ runApp(ExpansionTileSample());
}
/*
diff --git a/examples/catalog/lib/tabbed_app_bar.dart b/examples/catalog/lib/tabbed_app_bar.dart
index 11c506a..6bcfc1d 100644
--- a/examples/catalog/lib/tabbed_app_bar.dart
+++ b/examples/catalog/lib/tabbed_app_bar.dart
@@ -7,27 +7,27 @@
class TabbedAppBarSample extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- home: new DefaultTabController(
+ return MaterialApp(
+ home: DefaultTabController(
length: choices.length,
- child: new Scaffold(
- appBar: new AppBar(
+ child: Scaffold(
+ appBar: AppBar(
title: const Text('Tabbed AppBar'),
- bottom: new TabBar(
+ bottom: TabBar(
isScrollable: true,
tabs: choices.map((Choice choice) {
- return new Tab(
+ return Tab(
text: choice.title,
- icon: new Icon(choice.icon),
+ icon: Icon(choice.icon),
);
}).toList(),
),
),
- body: new TabBarView(
+ body: TabBarView(
children: choices.map((Choice choice) {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.all(16.0),
- child: new ChoiceCard(choice: choice),
+ child: ChoiceCard(choice: choice),
);
}).toList(),
),
@@ -60,15 +60,15 @@
@override
Widget build(BuildContext context) {
final TextStyle textStyle = Theme.of(context).textTheme.display1;
- return new Card(
+ return Card(
color: Colors.white,
- child: new Center(
- child: new Column(
+ child: Center(
+ child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- new Icon(choice.icon, size: 128.0, color: textStyle.color),
- new Text(choice.title, style: textStyle),
+ Icon(choice.icon, size: 128.0, color: textStyle.color),
+ Text(choice.title, style: textStyle),
],
),
),
@@ -77,7 +77,7 @@
}
void main() {
- runApp(new TabbedAppBarSample());
+ runApp(TabbedAppBarSample());
}
/*
diff --git a/examples/flutter_gallery/lib/demo/animation/home.dart b/examples/flutter_gallery/lib/demo/animation/home.dart
index 3abb748..4a0de2d 100644
--- a/examples/flutter_gallery/lib/demo/animation/home.dart
+++ b/examples/flutter_gallery/lib/demo/animation/home.dart
@@ -65,7 +65,7 @@
@override
void performLayout() {
final double height = (maxHeight - constraints.scrollOffset / scrollFactor).clamp(0.0, maxHeight);
- geometry = new SliverGeometry(
+ geometry = SliverGeometry(
paintExtent: math.min(height, constraints.remainingPaintExtent),
scrollExtent: maxHeight,
maxPaintExtent: maxHeight,
@@ -87,7 +87,7 @@
@override
_RenderStatusBarPaddingSliver createRenderObject(BuildContext context) {
- return new _RenderStatusBarPaddingSliver(
+ return _RenderStatusBarPaddingSliver(
maxHeight: maxHeight,
scrollFactor: scrollFactor,
);
@@ -103,8 +103,8 @@
@override
void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description);
- description.add(new DoubleProperty('maxHeight', maxHeight));
- description.add(new DoubleProperty('scrollFactor', scrollFactor));
+ description.add(DoubleProperty('maxHeight', maxHeight));
+ description.add(DoubleProperty('scrollFactor', scrollFactor));
}
}
@@ -124,7 +124,7 @@
@override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
- return new SizedBox.expand(child: child);
+ return SizedBox.expand(child: child);
}
@override
@@ -210,34 +210,34 @@
for (int index = 0; index < cardCount; index++) {
// Layout the card for index.
- final Rect columnCardRect = new Rect.fromLTWH(columnCardX, columnCardY, columnCardWidth, columnCardHeight);
- final Rect rowCardRect = new Rect.fromLTWH(rowCardX, 0.0, rowCardWidth, size.height);
+ final Rect columnCardRect = Rect.fromLTWH(columnCardX, columnCardY, columnCardWidth, columnCardHeight);
+ final Rect rowCardRect = Rect.fromLTWH(rowCardX, 0.0, rowCardWidth, size.height);
final Rect cardRect = _interpolateRect(columnCardRect, rowCardRect).shift(offset);
final String cardId = 'card$index';
if (hasChild(cardId)) {
- layoutChild(cardId, new BoxConstraints.tight(cardRect.size));
+ layoutChild(cardId, BoxConstraints.tight(cardRect.size));
positionChild(cardId, cardRect.topLeft);
}
// Layout the title for index.
- final Size titleSize = layoutChild('title$index', new BoxConstraints.loose(cardRect.size));
+ final Size titleSize = layoutChild('title$index', BoxConstraints.loose(cardRect.size));
final double columnTitleY = columnCardRect.centerLeft.dy - titleSize.height / 2.0;
final double rowTitleY = rowCardRect.centerLeft.dy - titleSize.height / 2.0;
final double centeredRowTitleX = rowTitleX + (rowTitleWidth - titleSize.width) / 2.0;
- final Offset columnTitleOrigin = new Offset(columnTitleX, columnTitleY);
- final Offset rowTitleOrigin = new Offset(centeredRowTitleX, rowTitleY);
+ final Offset columnTitleOrigin = Offset(columnTitleX, columnTitleY);
+ final Offset rowTitleOrigin = Offset(centeredRowTitleX, rowTitleY);
final Offset titleOrigin = _interpolatePoint(columnTitleOrigin, rowTitleOrigin);
positionChild('title$index', titleOrigin + offset);
// Layout the selection indicator for index.
- final Size indicatorSize = layoutChild('indicator$index', new BoxConstraints.loose(cardRect.size));
+ final Size indicatorSize = layoutChild('indicator$index', BoxConstraints.loose(cardRect.size));
final double columnIndicatorX = cardRect.centerRight.dx - indicatorSize.width - 16.0;
final double columnIndicatorY = cardRect.bottomRight.dy - indicatorSize.height - 16.0;
- final Offset columnIndicatorOrigin = new Offset(columnIndicatorX, columnIndicatorY);
- final Rect titleRect = new Rect.fromPoints(titleOrigin, titleSize.bottomRight(titleOrigin));
+ final Offset columnIndicatorOrigin = Offset(columnIndicatorX, columnIndicatorY);
+ final Rect titleRect = Rect.fromPoints(titleOrigin, titleSize.bottomRight(titleOrigin));
final double centeredRowIndicatorX = rowIndicatorX + (rowIndicatorWidth - indicatorSize.width) / 2.0;
final double rowIndicatorY = titleRect.bottomCenter.dy + 16.0;
- final Offset rowIndicatorOrigin = new Offset(centeredRowIndicatorX, rowIndicatorY);
+ final Offset rowIndicatorOrigin = Offset(centeredRowIndicatorX, rowIndicatorY);
final Offset indicatorOrigin = _interpolatePoint(columnIndicatorOrigin, rowIndicatorOrigin);
positionChild('indicator$index', indicatorOrigin + offset);
@@ -319,13 +319,13 @@
return 1.0 - _selectedIndexDelta(index) * tColumnToRow * 0.15;
}
- final List<Widget> children = new List<Widget>.from(sectionCards);
+ final List<Widget> children = List<Widget>.from(sectionCards);
for (int index = 0; index < sections.length; index++) {
final Section section = sections[index];
- children.add(new LayoutId(
+ children.add(LayoutId(
id: 'title$index',
- child: new SectionTitle(
+ child: SectionTitle(
section: section,
scale: _titleScale(index),
opacity: _titleOpacity(index),
@@ -334,17 +334,17 @@
}
for (int index = 0; index < sections.length; index++) {
- children.add(new LayoutId(
+ children.add(LayoutId(
id: 'indicator$index',
- child: new SectionIndicator(
+ child: SectionIndicator(
opacity: _indicatorOpacity(index),
),
));
}
- return new CustomMultiChildLayout(
- delegate: new _AllSectionsLayout(
- translation: new Alignment((selectedIndex.value - sectionIndex) * 2.0 - 1.0, -1.0),
+ return CustomMultiChildLayout(
+ delegate: _AllSectionsLayout(
+ translation: Alignment((selectedIndex.value - sectionIndex) * 2.0 - 1.0, -1.0),
tColumnToRow: tColumnToRow,
tCollapsed: tCollapsed,
cardCount: sections.length,
@@ -356,7 +356,7 @@
@override
Widget build(BuildContext context) {
- return new LayoutBuilder(builder: _build);
+ return LayoutBuilder(builder: _build);
}
}
@@ -374,17 +374,17 @@
@override
_SnappingScrollPhysics applyTo(ScrollPhysics ancestor) {
- return new _SnappingScrollPhysics(parent: buildParent(ancestor), midScrollOffset: midScrollOffset);
+ return _SnappingScrollPhysics(parent: buildParent(ancestor), midScrollOffset: midScrollOffset);
}
Simulation _toMidScrollOffsetSimulation(double offset, double dragVelocity) {
final double velocity = math.max(dragVelocity, minFlingVelocity);
- return new ScrollSpringSimulation(spring, offset, midScrollOffset, velocity, tolerance: tolerance);
+ return ScrollSpringSimulation(spring, offset, midScrollOffset, velocity, tolerance: tolerance);
}
Simulation _toZeroScrollOffsetSimulation(double offset, double dragVelocity) {
final double velocity = math.max(dragVelocity, minFlingVelocity);
- return new ScrollSpringSimulation(spring, offset, 0.0, velocity, tolerance: tolerance);
+ return ScrollSpringSimulation(spring, offset, 0.0, velocity, tolerance: tolerance);
}
@override
@@ -425,21 +425,21 @@
static const String routeName = '/animation';
@override
- _AnimationDemoHomeState createState() => new _AnimationDemoHomeState();
+ _AnimationDemoHomeState createState() => _AnimationDemoHomeState();
}
class _AnimationDemoHomeState extends State<AnimationDemoHome> {
- final ScrollController _scrollController = new ScrollController();
- final PageController _headingPageController = new PageController();
- final PageController _detailsPageController = new PageController();
+ final ScrollController _scrollController = ScrollController();
+ final PageController _headingPageController = PageController();
+ final PageController _detailsPageController = PageController();
ScrollPhysics _headingScrollPhysics = const NeverScrollableScrollPhysics();
- ValueNotifier<double> selectedIndex = new ValueNotifier<double>(0.0);
+ ValueNotifier<double> selectedIndex = ValueNotifier<double>(0.0);
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
backgroundColor: _kAppBackgroundColor,
- body: new Builder(
+ body: Builder(
// Insert an element so that _buildBody can find the PrimaryScrollController.
builder: _buildBody,
),
@@ -494,7 +494,7 @@
Iterable<Widget> _detailItemsFor(Section section) {
final Iterable<Widget> detailItems = section.details.map((SectionDetail detail) {
- return new SectionDetailView(detail: detail);
+ return SectionDetailView(detail: detail);
});
return ListTile.divideTiles(context: context, tiles: detailItems);
}
@@ -502,11 +502,11 @@
Iterable<Widget> _allHeadingItems(double maxHeight, double midScrollOffset) {
final List<Widget> sectionCards = <Widget>[];
for (int index = 0; index < allSections.length; index++) {
- sectionCards.add(new LayoutId(
+ sectionCards.add(LayoutId(
id: 'card$index',
- child: new GestureDetector(
+ child: GestureDetector(
behavior: HitTestBehavior.opaque,
- child: new SectionCard(section: allSections[index]),
+ child: SectionCard(section: allSections[index]),
onTapUp: (TapUpDetails details) {
final double xOffset = details.globalPosition.dx;
setState(() {
@@ -519,10 +519,10 @@
final List<Widget> headings = <Widget>[];
for (int index = 0; index < allSections.length; index++) {
- headings.add(new Container(
+ headings.add(Container(
color: _kAppBackgroundColor,
- child: new ClipRect(
- child: new _AllSectionsView(
+ child: ClipRect(
+ child: _AllSectionsView(
sectionIndex: index,
sections: allSections,
selectedIndex: selectedIndex,
@@ -547,33 +547,33 @@
// The scroll offset that reveals the appBarMidHeight appbar.
final double appBarMidScrollOffset = statusBarHeight + appBarMaxHeight - _kAppBarMidHeight;
- return new SizedBox.expand(
- child: new Stack(
+ return SizedBox.expand(
+ child: Stack(
children: <Widget>[
- new NotificationListener<ScrollNotification>(
+ NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification notification) {
return _handleScrollNotification(notification, appBarMidScrollOffset);
},
- child: new CustomScrollView(
+ child: CustomScrollView(
controller: _scrollController,
- physics: new _SnappingScrollPhysics(midScrollOffset: appBarMidScrollOffset),
+ physics: _SnappingScrollPhysics(midScrollOffset: appBarMidScrollOffset),
slivers: <Widget>[
// Start out below the status bar, gradually move to the top of the screen.
- new _StatusBarPaddingSliver(
+ _StatusBarPaddingSliver(
maxHeight: statusBarHeight,
scrollFactor: 7.0,
),
// Section Headings
- new SliverPersistentHeader(
+ SliverPersistentHeader(
pinned: true,
- delegate: new _SliverAppBarDelegate(
+ delegate: _SliverAppBarDelegate(
minHeight: _kAppBarMinHeight,
maxHeight: appBarMaxHeight,
- child: new NotificationListener<ScrollNotification>(
+ child: NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification notification) {
return _handlePageNotification(notification, _headingPageController, _detailsPageController);
},
- child: new PageView(
+ child: PageView(
physics: _headingScrollPhysics,
controller: _headingPageController,
children: _allHeadingItems(appBarMaxHeight, appBarMidScrollOffset),
@@ -582,17 +582,17 @@
),
),
// Details
- new SliverToBoxAdapter(
- child: new SizedBox(
+ SliverToBoxAdapter(
+ child: SizedBox(
height: 610.0,
- child: new NotificationListener<ScrollNotification>(
+ child: NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification notification) {
return _handlePageNotification(notification, _detailsPageController, _headingPageController);
},
- child: new PageView(
+ child: PageView(
controller: _detailsPageController,
children: allSections.map((Section section) {
- return new Column(
+ return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _detailItemsFor(section).toList(),
);
@@ -604,15 +604,15 @@
],
),
),
- new Positioned(
+ Positioned(
top: statusBarHeight,
left: 0.0,
- child: new IconTheme(
+ child: IconTheme(
data: const IconThemeData(color: Colors.white),
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new IconButton(
+ child: IconButton(
icon: const BackButtonIcon(),
tooltip: 'Back',
onPressed: () {
diff --git a/examples/flutter_gallery/lib/demo/animation/widgets.dart b/examples/flutter_gallery/lib/demo/animation/widgets.dart
index a6f874d..6c82ec2 100644
--- a/examples/flutter_gallery/lib/demo/animation/widgets.dart
+++ b/examples/flutter_gallery/lib/demo/animation/widgets.dart
@@ -18,12 +18,12 @@
@override
Widget build(BuildContext context) {
- return new Semantics(
+ return Semantics(
label: section.title,
button: true,
- child: new DecoratedBox(
- decoration: new BoxDecoration(
- gradient: new LinearGradient(
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: <Color>[
@@ -32,7 +32,7 @@
],
),
),
- child: new Image.asset(
+ child: Image.asset(
section.backgroundAsset,
package: section.backgroundAssetPackage,
color: const Color.fromRGBO(255, 255, 255, 0.075),
@@ -76,19 +76,19 @@
@override
Widget build(BuildContext context) {
- return new IgnorePointer(
- child: new Opacity(
+ return IgnorePointer(
+ child: Opacity(
opacity: opacity,
- child: new Transform(
- transform: new Matrix4.identity()..scale(scale),
+ child: Transform(
+ transform: Matrix4.identity()..scale(scale),
alignment: Alignment.center,
- child: new Stack(
+ child: Stack(
children: <Widget>[
- new Positioned(
+ Positioned(
top: 4.0,
- child: new Text(section.title, style: sectionTitleShadowStyle),
+ child: Text(section.title, style: sectionTitleShadowStyle),
),
- new Text(section.title, style: sectionTitleStyle),
+ Text(section.title, style: sectionTitleStyle),
],
),
),
@@ -105,8 +105,8 @@
@override
Widget build(BuildContext context) {
- return new IgnorePointer(
- child: new Container(
+ return IgnorePointer(
+ child: Container(
width: kSectionIndicatorWidth,
height: 3.0,
color: Colors.white.withOpacity(opacity),
@@ -126,11 +126,11 @@
@override
Widget build(BuildContext context) {
- final Widget image = new DecoratedBox(
- decoration: new BoxDecoration(
- borderRadius: new BorderRadius.circular(6.0),
- image: new DecorationImage(
- image: new AssetImage(
+ final Widget image = DecoratedBox(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(6.0),
+ image: DecorationImage(
+ image: AssetImage(
detail.imageAsset,
package: detail.imageAssetPackage,
),
@@ -142,25 +142,25 @@
Widget item;
if (detail.title == null && detail.subtitle == null) {
- item = new Container(
+ item = Container(
height: 240.0,
padding: const EdgeInsets.all(16.0),
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
child: image,
),
);
} else {
- item = new ListTile(
- title: new Text(detail.title),
- subtitle: new Text(detail.subtitle),
- leading: new SizedBox(width: 32.0, height: 32.0, child: image),
+ item = ListTile(
+ title: Text(detail.title),
+ subtitle: Text(detail.subtitle),
+ leading: SizedBox(width: 32.0, height: 32.0, child: image),
);
}
- return new DecoratedBox(
- decoration: new BoxDecoration(color: Colors.grey.shade200),
+ return DecoratedBox(
+ decoration: BoxDecoration(color: Colors.grey.shade200),
child: item,
);
}
diff --git a/examples/flutter_gallery/lib/demo/calculator/home.dart b/examples/flutter_gallery/lib/demo/calculator/home.dart
index cacea78..2be02ec 100644
--- a/examples/flutter_gallery/lib/demo/calculator/home.dart
+++ b/examples/flutter_gallery/lib/demo/calculator/home.dart
@@ -10,7 +10,7 @@
const Calculator({Key key}) : super(key: key);
@override
- _CalculatorState createState() => new _CalculatorState();
+ _CalculatorState createState() => _CalculatorState();
}
class _CalculatorState extends State<Calculator> {
@@ -18,7 +18,7 @@
/// keep a stack of previous expressions so we can return to earlier states
/// when the user hits the DEL key.
final List<CalcExpression> _expressionStack = <CalcExpression>[];
- CalcExpression _expression = new CalcExpression.empty();
+ CalcExpression _expression = CalcExpression.empty();
// Make `expression` the current expression and push the previous current
// expression onto the stack.
@@ -32,7 +32,7 @@
if (_expressionStack.isNotEmpty) {
_expression = _expressionStack.removeLast();
} else {
- _expression = new CalcExpression.empty();
+ _expression = CalcExpression.empty();
}
}
@@ -113,23 +113,23 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
backgroundColor: Theme.of(context).canvasColor,
elevation: 0.0
),
- body: new Column(
+ body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
// Give the key-pad 3/5 of the vertical space and the display 2/5.
- new Expanded(
+ Expanded(
flex: 2,
- child: new CalcDisplay(content: _expression.toString())
+ child: CalcDisplay(content: _expression.toString())
),
const Divider(height: 1.0),
- new Expanded(
+ Expanded(
flex: 3,
- child: new KeyPad(calcState: this)
+ child: KeyPad(calcState: this)
)
]
)
@@ -144,8 +144,8 @@
@override
Widget build(BuildContext context) {
- return new Center(
- child: new Text(
+ return Center(
+ child: Text(
content,
style: const TextStyle(fontSize: 24.0)
)
@@ -160,56 +160,56 @@
@override
Widget build(BuildContext context) {
- final ThemeData themeData = new ThemeData(
+ final ThemeData themeData = ThemeData(
primarySwatch: Colors.purple,
brightness: Brightness.dark,
platform: Theme.of(context).platform,
);
- return new Theme(
+ return Theme(
data: themeData,
- child: new Material(
- child: new Row(
+ child: Material(
+ child: Row(
children: <Widget>[
- new Expanded(
+ Expanded(
// We set flex equal to the number of columns so that the main keypad
// and the op keypad have sizes proportional to their number of
// columns.
flex: 3,
- child: new Column(
+ child: Column(
children: <Widget>[
- new KeyRow(<Widget>[
- new NumberKey(7, calcState),
- new NumberKey(8, calcState),
- new NumberKey(9, calcState)
+ KeyRow(<Widget>[
+ NumberKey(7, calcState),
+ NumberKey(8, calcState),
+ NumberKey(9, calcState)
]),
- new KeyRow(<Widget>[
- new NumberKey(4, calcState),
- new NumberKey(5, calcState),
- new NumberKey(6, calcState)
+ KeyRow(<Widget>[
+ NumberKey(4, calcState),
+ NumberKey(5, calcState),
+ NumberKey(6, calcState)
]),
- new KeyRow(<Widget>[
- new NumberKey(1, calcState),
- new NumberKey(2, calcState),
- new NumberKey(3, calcState)
+ KeyRow(<Widget>[
+ NumberKey(1, calcState),
+ NumberKey(2, calcState),
+ NumberKey(3, calcState)
]),
- new KeyRow(<Widget>[
- new CalcKey('.', calcState.handlePointTap),
- new NumberKey(0, calcState),
- new CalcKey('=', calcState.handleEqualsTap),
+ KeyRow(<Widget>[
+ CalcKey('.', calcState.handlePointTap),
+ NumberKey(0, calcState),
+ CalcKey('=', calcState.handleEqualsTap),
])
]
)
),
- new Expanded(
- child: new Material(
+ Expanded(
+ child: Material(
color: themeData.backgroundColor,
- child: new Column(
+ child: Column(
children: <Widget>[
- new CalcKey('\u232B', calcState.handleDelTap),
- new CalcKey('\u00F7', calcState.handleDivTap),
- new CalcKey('\u00D7', calcState.handleMultTap),
- new CalcKey('-', calcState.handleMinusTap),
- new CalcKey('+', calcState.handlePlusTap)
+ CalcKey('\u232B', calcState.handleDelTap),
+ CalcKey('\u00F7', calcState.handleDivTap),
+ CalcKey('\u00D7', calcState.handleMultTap),
+ CalcKey('-', calcState.handleMinusTap),
+ CalcKey('+', calcState.handlePlusTap)
]
)
)
@@ -228,8 +228,8 @@
@override
Widget build(BuildContext context) {
- return new Expanded(
- child: new Row(
+ return Expanded(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: keys
)
@@ -246,13 +246,13 @@
@override
Widget build(BuildContext context) {
final Orientation orientation = MediaQuery.of(context).orientation;
- return new Expanded(
- child: new InkResponse(
+ return Expanded(
+ child: InkResponse(
onTap: onTap,
- child: new Center(
- child: new Text(
+ child: Center(
+ child: Text(
text,
- style: new TextStyle(
+ style: TextStyle(
fontSize: (orientation == Orientation.portrait) ? 32.0 : 24.0
)
)
diff --git a/examples/flutter_gallery/lib/demo/calculator/logic.dart b/examples/flutter_gallery/lib/demo/calculator/logic.dart
index 266f12f..730544c 100644
--- a/examples/flutter_gallery/lib/demo/calculator/logic.dart
+++ b/examples/flutter_gallery/lib/demo/calculator/logic.dart
@@ -138,7 +138,7 @@
/// in the calculator's display panel.
@override
String toString() {
- final StringBuffer buffer = new StringBuffer('');
+ final StringBuffer buffer = StringBuffer('');
buffer.writeAll(_list);
return buffer.toString();
}
@@ -153,29 +153,29 @@
switch (state) {
case ExpressionState.Start:
// Start a new number with digit.
- newToken = new IntToken('$digit');
+ newToken = IntToken('$digit');
break;
case ExpressionState.LeadingNeg:
// Replace the leading neg with a negative number starting with digit.
outList.removeLast();
- newToken = new IntToken('-$digit');
+ newToken = IntToken('-$digit');
break;
case ExpressionState.Number:
final ExpressionToken last = outList.removeLast();
- newToken = new IntToken('${last.stringRep}$digit');
+ newToken = IntToken('${last.stringRep}$digit');
break;
case ExpressionState.Point:
case ExpressionState.NumberWithPoint:
final ExpressionToken last = outList.removeLast();
newState = ExpressionState.NumberWithPoint;
- newToken = new FloatToken('${last.stringRep}$digit');
+ newToken = FloatToken('${last.stringRep}$digit');
break;
case ExpressionState.Result:
// Cannot enter a number now
return null;
}
outList.add(newToken);
- return new CalcExpression(outList, newState);
+ return CalcExpression(outList, newState);
}
/// Append a point to the current expression and return a new expression
@@ -186,12 +186,12 @@
final List<ExpressionToken> outList = _list.toList();
switch (state) {
case ExpressionState.Start:
- newToken = new FloatToken('.');
+ newToken = FloatToken('.');
break;
case ExpressionState.LeadingNeg:
case ExpressionState.Number:
final ExpressionToken last = outList.removeLast();
- newToken = new FloatToken(last.stringRep + '.');
+ newToken = FloatToken(last.stringRep + '.');
break;
case ExpressionState.Point:
case ExpressionState.NumberWithPoint:
@@ -200,7 +200,7 @@
return null;
}
outList.add(newToken);
- return new CalcExpression(outList, ExpressionState.Point);
+ return CalcExpression(outList, ExpressionState.Point);
}
/// Append an operation symbol to the current expression and return a new
@@ -219,8 +219,8 @@
break;
}
final List<ExpressionToken> outList = _list.toList();
- outList.add(new OperationToken(op));
- return new CalcExpression(outList, ExpressionState.Start);
+ outList.add(OperationToken(op));
+ return CalcExpression(outList, ExpressionState.Start);
}
/// Append a leading minus sign to the current expression and return a new
@@ -239,8 +239,8 @@
return null;
}
final List<ExpressionToken> outList = _list.toList();
- outList.add(new LeadingNegToken());
- return new CalcExpression(outList, ExpressionState.LeadingNeg);
+ outList.add(LeadingNegToken());
+ return CalcExpression(outList, ExpressionState.LeadingNeg);
}
/// Append a minus sign to the current expression and return a new expression
@@ -303,8 +303,8 @@
}
}
final List<ExpressionToken> outList = <ExpressionToken>[];
- outList.add(new ResultToken(currentTermValue));
- return new CalcExpression(outList, ExpressionState.Result);
+ outList.add(ResultToken(currentTermValue));
+ return CalcExpression(outList, ExpressionState.Result);
}
/// Removes the next "term" from `list` and returns its numeric value.
diff --git a/examples/flutter_gallery/lib/demo/colors_demo.dart b/examples/flutter_gallery/lib/demo/colors_demo.dart
index 7038509..a38999b 100644
--- a/examples/flutter_gallery/lib/demo/colors_demo.dart
+++ b/examples/flutter_gallery/lib/demo/colors_demo.dart
@@ -18,25 +18,25 @@
}
final List<Palette> allPalettes = <Palette>[
- new Palette(name: 'RED', primary: Colors.red, accent: Colors.redAccent, threshold: 300),
- new Palette(name: 'PINK', primary: Colors.pink, accent: Colors.pinkAccent, threshold: 200),
- new Palette(name: 'PURPLE', primary: Colors.purple, accent: Colors.purpleAccent, threshold: 200),
- new Palette(name: 'DEEP PURPLE', primary: Colors.deepPurple, accent: Colors.deepPurpleAccent, threshold: 200),
- new Palette(name: 'INDIGO', primary: Colors.indigo, accent: Colors.indigoAccent, threshold: 200),
- new Palette(name: 'BLUE', primary: Colors.blue, accent: Colors.blueAccent, threshold: 400),
- new Palette(name: 'LIGHT BLUE', primary: Colors.lightBlue, accent: Colors.lightBlueAccent, threshold: 500),
- new Palette(name: 'CYAN', primary: Colors.cyan, accent: Colors.cyanAccent, threshold: 600),
- new Palette(name: 'TEAL', primary: Colors.teal, accent: Colors.tealAccent, threshold: 400),
- new Palette(name: 'GREEN', primary: Colors.green, accent: Colors.greenAccent, threshold: 500),
- new Palette(name: 'LIGHT GREEN', primary: Colors.lightGreen, accent: Colors.lightGreenAccent, threshold: 600),
- new Palette(name: 'LIME', primary: Colors.lime, accent: Colors.limeAccent, threshold: 800),
- new Palette(name: 'YELLOW', primary: Colors.yellow, accent: Colors.yellowAccent),
- new Palette(name: 'AMBER', primary: Colors.amber, accent: Colors.amberAccent),
- new Palette(name: 'ORANGE', primary: Colors.orange, accent: Colors.orangeAccent, threshold: 700),
- new Palette(name: 'DEEP ORANGE', primary: Colors.deepOrange, accent: Colors.deepOrangeAccent, threshold: 400),
- new Palette(name: 'BROWN', primary: Colors.brown, threshold: 200),
- new Palette(name: 'GREY', primary: Colors.grey, threshold: 500),
- new Palette(name: 'BLUE GREY', primary: Colors.blueGrey, threshold: 500),
+ Palette(name: 'RED', primary: Colors.red, accent: Colors.redAccent, threshold: 300),
+ Palette(name: 'PINK', primary: Colors.pink, accent: Colors.pinkAccent, threshold: 200),
+ Palette(name: 'PURPLE', primary: Colors.purple, accent: Colors.purpleAccent, threshold: 200),
+ Palette(name: 'DEEP PURPLE', primary: Colors.deepPurple, accent: Colors.deepPurpleAccent, threshold: 200),
+ Palette(name: 'INDIGO', primary: Colors.indigo, accent: Colors.indigoAccent, threshold: 200),
+ Palette(name: 'BLUE', primary: Colors.blue, accent: Colors.blueAccent, threshold: 400),
+ Palette(name: 'LIGHT BLUE', primary: Colors.lightBlue, accent: Colors.lightBlueAccent, threshold: 500),
+ Palette(name: 'CYAN', primary: Colors.cyan, accent: Colors.cyanAccent, threshold: 600),
+ Palette(name: 'TEAL', primary: Colors.teal, accent: Colors.tealAccent, threshold: 400),
+ Palette(name: 'GREEN', primary: Colors.green, accent: Colors.greenAccent, threshold: 500),
+ Palette(name: 'LIGHT GREEN', primary: Colors.lightGreen, accent: Colors.lightGreenAccent, threshold: 600),
+ Palette(name: 'LIME', primary: Colors.lime, accent: Colors.limeAccent, threshold: 800),
+ Palette(name: 'YELLOW', primary: Colors.yellow, accent: Colors.yellowAccent),
+ Palette(name: 'AMBER', primary: Colors.amber, accent: Colors.amberAccent),
+ Palette(name: 'ORANGE', primary: Colors.orange, accent: Colors.orangeAccent, threshold: 700),
+ Palette(name: 'DEEP ORANGE', primary: Colors.deepOrange, accent: Colors.deepOrangeAccent, threshold: 400),
+ Palette(name: 'BROWN', primary: Colors.brown, threshold: 200),
+ Palette(name: 'GREY', primary: Colors.grey, threshold: 500),
+ Palette(name: 'BLUE GREY', primary: Colors.blueGrey, threshold: 500),
];
@@ -59,21 +59,21 @@
@override
Widget build(BuildContext context) {
- return new Semantics(
+ return Semantics(
container: true,
- child: new Container(
+ child: Container(
height: kColorItemHeight,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
color: color,
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- new Text('$prefix$index'),
- new Text(colorString()),
+ Text('$prefix$index'),
+ Text(colorString()),
],
),
),
@@ -100,22 +100,22 @@
final TextStyle whiteTextStyle = textTheme.body1.copyWith(color: Colors.white);
final TextStyle blackTextStyle = textTheme.body1.copyWith(color: Colors.black);
final List<Widget> colorItems = primaryKeys.map((int index) {
- return new DefaultTextStyle(
+ return DefaultTextStyle(
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
- child: new ColorItem(index: index, color: colors.primary[index]),
+ child: ColorItem(index: index, color: colors.primary[index]),
);
}).toList();
if (colors.accent != null) {
colorItems.addAll(accentKeys.map((int index) {
- return new DefaultTextStyle(
+ return DefaultTextStyle(
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
- child: new ColorItem(index: index, color: colors.accent[index], prefix: 'A'),
+ child: ColorItem(index: index, color: colors.accent[index], prefix: 'A'),
);
}).toList());
}
- return new ListView(
+ return ListView(
itemExtent: kColorItemHeight,
children: colorItems,
);
@@ -127,20 +127,20 @@
@override
Widget build(BuildContext context) {
- return new DefaultTabController(
+ return DefaultTabController(
length: allPalettes.length,
- child: new Scaffold(
- appBar: new AppBar(
+ child: Scaffold(
+ appBar: AppBar(
elevation: 0.0,
title: const Text('Colors'),
- bottom: new TabBar(
+ bottom: TabBar(
isScrollable: true,
- tabs: allPalettes.map((Palette swatch) => new Tab(text: swatch.name)).toList(),
+ tabs: allPalettes.map((Palette swatch) => Tab(text: swatch.name)).toList(),
),
),
- body: new TabBarView(
+ body: TabBarView(
children: allPalettes.map((Palette colors) {
- return new PaletteTabView(colors: colors);
+ return PaletteTabView(colors: colors);
}).toList(),
),
),
diff --git a/examples/flutter_gallery/lib/demo/contacts_demo.dart b/examples/flutter_gallery/lib/demo/contacts_demo.dart
index e67eb4c..3ff7e6f 100644
--- a/examples/flutter_gallery/lib/demo/contacts_demo.dart
+++ b/examples/flutter_gallery/lib/demo/contacts_demo.dart
@@ -14,25 +14,25 @@
@override
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
- return new Container(
+ return Container(
padding: const EdgeInsets.symmetric(vertical: 16.0),
- decoration: new BoxDecoration(
- border: new Border(bottom: new BorderSide(color: themeData.dividerColor))
+ decoration: BoxDecoration(
+ border: Border(bottom: BorderSide(color: themeData.dividerColor))
),
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
style: Theme.of(context).textTheme.subhead,
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new Row(
+ child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Container(
+ Container(
padding: const EdgeInsets.symmetric(vertical: 24.0),
width: 72.0,
- child: new Icon(icon, color: themeData.primaryColor)
+ child: Icon(icon, color: themeData.primaryColor)
),
- new Expanded(child: new Column(children: children))
+ Expanded(child: Column(children: children))
],
),
),
@@ -54,31 +54,31 @@
@override
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
- final List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map((String line) => new Text(line)).toList();
- columnChildren.add(new Text(lines.last, style: themeData.textTheme.caption));
+ final List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map((String line) => Text(line)).toList();
+ columnChildren.add(Text(lines.last, style: themeData.textTheme.caption));
final List<Widget> rowChildren = <Widget>[
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: columnChildren
)
)
];
if (icon != null) {
- rowChildren.add(new SizedBox(
+ rowChildren.add(SizedBox(
width: 72.0,
- child: new IconButton(
- icon: new Icon(icon),
+ child: IconButton(
+ icon: Icon(icon),
color: themeData.primaryColor,
onPressed: onPressed
)
));
}
- return new MergeSemantics(
- child: new Padding(
+ return MergeSemantics(
+ child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: rowChildren
)
@@ -91,36 +91,36 @@
static const String routeName = '/contacts';
@override
- ContactsDemoState createState() => new ContactsDemoState();
+ ContactsDemoState createState() => ContactsDemoState();
}
enum AppBarBehavior { normal, pinned, floating, snapping }
class ContactsDemoState extends State<ContactsDemo> {
- static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ static final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final double _appBarHeight = 256.0;
AppBarBehavior _appBarBehavior = AppBarBehavior.pinned;
@override
Widget build(BuildContext context) {
- return new Theme(
- data: new ThemeData(
+ return Theme(
+ data: ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.indigo,
platform: Theme.of(context).platform,
),
- child: new Scaffold(
+ child: Scaffold(
key: _scaffoldKey,
- body: new CustomScrollView(
+ body: CustomScrollView(
slivers: <Widget>[
- new SliverAppBar(
+ SliverAppBar(
expandedHeight: _appBarHeight,
pinned: _appBarBehavior == AppBarBehavior.pinned,
floating: _appBarBehavior == AppBarBehavior.floating || _appBarBehavior == AppBarBehavior.snapping,
snap: _appBarBehavior == AppBarBehavior.snapping,
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.create),
tooltip: 'Edit',
onPressed: () {
@@ -129,7 +129,7 @@
));
},
),
- new PopupMenuButton<AppBarBehavior>(
+ PopupMenuButton<AppBarBehavior>(
onSelected: (AppBarBehavior value) {
setState(() {
_appBarBehavior = value;
@@ -155,12 +155,12 @@
],
),
],
- flexibleSpace: new FlexibleSpaceBar(
+ flexibleSpace: FlexibleSpaceBar(
title: const Text('Ali Connors'),
- background: new Stack(
+ background: Stack(
fit: StackFit.expand,
children: <Widget>[
- new Image.asset(
+ Image.asset(
'people/ali_landscape.png',
package: 'flutter_gallery_assets',
fit: BoxFit.cover,
@@ -181,14 +181,14 @@
),
),
),
- new SliverList(
- delegate: new SliverChildListDelegate(<Widget>[
- new AnnotatedRegion<SystemUiOverlayStyle>(
+ SliverList(
+ delegate: SliverChildListDelegate(<Widget>[
+ AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.dark,
- child: new _ContactCategory(
+ child: _ContactCategory(
icon: Icons.call,
children: <Widget>[
- new _ContactItem(
+ _ContactItem(
icon: Icons.message,
tooltip: 'Send message',
onPressed: () {
@@ -201,7 +201,7 @@
'Mobile',
],
),
- new _ContactItem(
+ _ContactItem(
icon: Icons.message,
tooltip: 'Send message',
onPressed: () {
@@ -214,7 +214,7 @@
'Work',
],
),
- new _ContactItem(
+ _ContactItem(
icon: Icons.message,
tooltip: 'Send message',
onPressed: () {
@@ -230,10 +230,10 @@
],
),
),
- new _ContactCategory(
+ _ContactCategory(
icon: Icons.contact_mail,
children: <Widget>[
- new _ContactItem(
+ _ContactItem(
icon: Icons.email,
tooltip: 'Send personal e-mail',
onPressed: () {
@@ -246,7 +246,7 @@
'Personal',
],
),
- new _ContactItem(
+ _ContactItem(
icon: Icons.email,
tooltip: 'Send work e-mail',
onPressed: () {
@@ -261,10 +261,10 @@
),
],
),
- new _ContactCategory(
+ _ContactCategory(
icon: Icons.location_on,
children: <Widget>[
- new _ContactItem(
+ _ContactItem(
icon: Icons.map,
tooltip: 'Open map',
onPressed: () {
@@ -278,7 +278,7 @@
'Home',
],
),
- new _ContactItem(
+ _ContactItem(
icon: Icons.map,
tooltip: 'Open map',
onPressed: () {
@@ -292,7 +292,7 @@
'Work',
],
),
- new _ContactItem(
+ _ContactItem(
icon: Icons.map,
tooltip: 'Open map',
onPressed: () {
@@ -308,28 +308,28 @@
),
],
),
- new _ContactCategory(
+ _ContactCategory(
icon: Icons.today,
children: <Widget>[
- new _ContactItem(
+ _ContactItem(
lines: const <String>[
'Birthday',
'January 9th, 1989',
],
),
- new _ContactItem(
+ _ContactItem(
lines: const <String>[
'Wedding anniversary',
'June 21st, 2014',
],
),
- new _ContactItem(
+ _ContactItem(
lines: const <String>[
'First day in office',
'January 20th, 2015',
],
),
- new _ContactItem(
+ _ContactItem(
lines: const <String>[
'Last day in office',
'August 9th, 2018',
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart
index b1dbc74..d5efbba 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart
@@ -10,8 +10,8 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Cupertino Activity Indicator'),
),
body: const Center(
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_alert_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_alert_demo.dart
index eca06c3..137dc3d 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_alert_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_alert_demo.dart
@@ -9,11 +9,11 @@
static const String routeName = '/cupertino/alert';
@override
- _CupertinoAlertDemoState createState() => new _CupertinoAlertDemoState();
+ _CupertinoAlertDemoState createState() => _CupertinoAlertDemoState();
}
class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
void showDemoDialog<T>({BuildContext context, Widget child}) {
showDialog<T>(
@@ -24,8 +24,8 @@
// The value passed to Navigator.pop() or null.
if (value != null) {
_scaffoldKey.currentState.showSnackBar(
- new SnackBar(
- content: new Text('You selected: $value'),
+ SnackBar(
+ content: Text('You selected: $value'),
),
);
}
@@ -39,8 +39,8 @@
).then<void>((T value) {
if (value != null) {
_scaffoldKey.currentState.showSnackBar(
- new SnackBar(
- content: new Text('You selected: $value'),
+ SnackBar(
+ content: Text('You selected: $value'),
),
);
}
@@ -49,31 +49,31 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Cupertino Alerts'),
),
- body: new ListView(
+ body: ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
children: <Widget>[
- new CupertinoButton(
+ CupertinoButton(
child: const Text('Alert'),
color: CupertinoColors.activeBlue,
onPressed: () {
showDemoDialog<String>(
context: context,
- child: new CupertinoAlertDialog(
+ child: CupertinoAlertDialog(
title: const Text('Discard draft?'),
actions: <Widget>[
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Discard'),
isDestructiveAction: true,
onPressed: () {
Navigator.pop(context, 'Discard');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Cancel'),
isDefaultAction: true,
onPressed: () {
@@ -86,25 +86,25 @@
},
),
const Padding(padding: EdgeInsets.all(8.0)),
- new CupertinoButton(
+ CupertinoButton(
child: const Text('Alert with Title'),
color: CupertinoColors.activeBlue,
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
onPressed: () {
showDemoDialog<String>(
context: context,
- child: new CupertinoAlertDialog(
+ child: CupertinoAlertDialog(
title: const Text('Allow "Maps" to access your location while you are using the app?'),
content: const Text('Your current location will be displayed on the map and used '
'for directions, nearby search results, and estimated travel times.'),
actions: <Widget>[
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Don\'t Allow'),
onPressed: () {
Navigator.pop(context, 'Disallow');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Allow'),
onPressed: () {
Navigator.pop(context, 'Allow');
@@ -116,7 +116,7 @@
},
),
const Padding(padding: EdgeInsets.all(8.0)),
- new CupertinoButton(
+ CupertinoButton(
child: const Text('Alert with Buttons'),
color: CupertinoColors.activeBlue,
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
@@ -133,7 +133,7 @@
},
),
const Padding(padding: EdgeInsets.all(8.0)),
- new CupertinoButton(
+ CupertinoButton(
child: const Text('Alert Buttons Only'),
color: CupertinoColors.activeBlue,
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
@@ -145,37 +145,37 @@
},
),
const Padding(padding: EdgeInsets.all(8.0)),
- new CupertinoButton(
+ CupertinoButton(
child: const Text('Action Sheet'),
color: CupertinoColors.activeBlue,
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0),
onPressed: () {
showDemoActionSheet<String>(
context: context,
- child: new CupertinoActionSheet(
+ child: CupertinoActionSheet(
title: const Text('Favorite Dessert'),
message: const Text('Please select the best dessert from the options below.'),
actions: <Widget>[
- new CupertinoActionSheetAction(
+ CupertinoActionSheetAction(
child: const Text('Profiteroles'),
onPressed: () {
Navigator.pop(context, 'Profiteroles');
},
),
- new CupertinoActionSheetAction(
+ CupertinoActionSheetAction(
child: const Text('Cannolis'),
onPressed: () {
Navigator.pop(context, 'Cannolis');
},
),
- new CupertinoActionSheetAction(
+ CupertinoActionSheetAction(
child: const Text('Trifle'),
onPressed: () {
Navigator.pop(context, 'Trifle');
},
),
],
- cancelButton: new CupertinoActionSheetAction(
+ cancelButton: CupertinoActionSheetAction(
child: const Text('Cancel'),
isDefaultAction: true,
onPressed: () {
@@ -200,53 +200,53 @@
@override
Widget build(BuildContext context) {
- return new CupertinoAlertDialog(
+ return CupertinoAlertDialog(
title: title,
content: content,
actions: <Widget>[
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Cheesecake'),
onPressed: () {
Navigator.pop(context, 'Cheesecake');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Tiramisu'),
onPressed: () {
Navigator.pop(context, 'Tiramisu');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Apple Pie'),
onPressed: () {
Navigator.pop(context, 'Apple Pie');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text("Devil's food cake"),
onPressed: () {
Navigator.pop(context, "Devil's food cake");
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Banana Split'),
onPressed: () {
Navigator.pop(context, 'Banana Split');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Oatmeal Cookie'),
onPressed: () {
Navigator.pop(context, 'Oatmeal Cookies');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Chocolate Brownie'),
onPressed: () {
Navigator.pop(context, 'Chocolate Brownies');
},
),
- new CupertinoDialogAction(
+ CupertinoDialogAction(
child: const Text('Cancel'),
isDestructiveAction: true,
onPressed: () {
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
index ba6bc51..6625fd5 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_buttons_demo.dart
@@ -9,7 +9,7 @@
static const String routeName = '/cupertino/buttons';
@override
- _CupertinoButtonDemoState createState() => new _CupertinoButtonDemoState();
+ _CupertinoButtonDemoState createState() => _CupertinoButtonDemoState();
}
class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
@@ -17,11 +17,11 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Cupertino Buttons'),
),
- body: new Column(
+ body: Column(
children: <Widget> [
const Padding(
padding: EdgeInsets.all(16.0),
@@ -30,20 +30,20 @@
'only when necessary.'
),
),
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget> [
- new Text(_pressedCount > 0
+ Text(_pressedCount > 0
? 'Button pressed $_pressedCount time${_pressedCount == 1 ? "" : "s"}'
: ' '),
const Padding(padding: EdgeInsets.all(12.0)),
- new Align(
+ Align(
alignment: const Alignment(0.0, -0.2),
- child: new Row(
+ child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new CupertinoButton(
+ CupertinoButton(
child: const Text('Cupertino Button'),
onPressed: () {
setState(() { _pressedCount += 1; });
@@ -57,7 +57,7 @@
),
),
const Padding(padding: EdgeInsets.all(12.0)),
- new CupertinoButton(
+ CupertinoButton(
child: const Text('With Background'),
color: CupertinoColors.activeBlue,
onPressed: () {
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart
index 4554480..fd32d73 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart
@@ -30,11 +30,11 @@
class CupertinoNavigationDemo extends StatelessWidget {
CupertinoNavigationDemo()
- : colorItems = new List<Color>.generate(50, (int index) {
- return coolColors[new math.Random().nextInt(coolColors.length)];
+ : colorItems = List<Color>.generate(50, (int index) {
+ return coolColors[math.Random().nextInt(coolColors.length)];
}) ,
- colorNameItems = new List<String>.generate(50, (int index) {
- return coolColorNames[new math.Random().nextInt(coolColorNames.length)];
+ colorNameItems = List<String>.generate(50, (int index) {
+ return coolColorNames[math.Random().nextInt(coolColorNames.length)];
});
static const String routeName = '/cupertino/navigation';
@@ -44,17 +44,17 @@
@override
Widget build(BuildContext context) {
- return new WillPopScope(
+ return WillPopScope(
// Prevent swipe popping of this page. Use explicit exit buttons only.
- onWillPop: () => new Future<bool>.value(true),
- child: new DefaultTextStyle(
+ onWillPop: () => Future<bool>.value(true),
+ child: DefaultTextStyle(
style: const TextStyle(
fontFamily: '.SF UI Text',
fontSize: 17.0,
color: CupertinoColors.black,
),
- child: new CupertinoTabScaffold(
- tabBar: new CupertinoTabBar(
+ child: CupertinoTabScaffold(
+ tabBar: CupertinoTabBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.home),
@@ -74,9 +74,9 @@
assert(index >= 0 && index <= 2);
switch (index) {
case 0:
- return new CupertinoTabView(
+ return CupertinoTabView(
builder: (BuildContext context) {
- return new CupertinoDemoTab1(
+ return CupertinoDemoTab1(
colorItems: colorItems,
colorNameItems: colorNameItems
);
@@ -85,13 +85,13 @@
);
break;
case 1:
- return new CupertinoTabView(
+ return CupertinoTabView(
builder: (BuildContext context) => CupertinoDemoTab2(),
defaultTitle: 'Support Chat',
);
break;
case 2:
- return new CupertinoTabView(
+ return CupertinoTabView(
builder: (BuildContext context) => CupertinoDemoTab3(),
defaultTitle: 'Account',
);
@@ -110,7 +110,7 @@
@override
Widget build(BuildContext context) {
- return new CupertinoButton(
+ return CupertinoButton(
padding: EdgeInsets.zero,
child: const Tooltip(
message: 'Back',
@@ -133,13 +133,13 @@
@override
Widget build(BuildContext context) {
- return new CupertinoPageScaffold(
- child: new CustomScrollView(
+ return CupertinoPageScaffold(
+ child: CustomScrollView(
slivers: <Widget>[
const CupertinoSliverNavigationBar(
trailing: ExitButton(),
),
- new SliverPadding(
+ SliverPadding(
// Top media padding consumed by CupertinoSliverNavigationBar.
// Left/Right media padding consumed by Tab1RowItem.
padding: MediaQuery.of(context).removePadding(
@@ -147,10 +147,10 @@
removeLeft: true,
removeRight: true,
).padding,
- sliver: new SliverList(
- delegate: new SliverChildBuilderDelegate(
+ sliver: SliverList(
+ delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
- return new Tab1RowItem(
+ return Tab1RowItem(
index: index,
lastItem: index == 49,
color: colorItems[index],
@@ -177,40 +177,40 @@
@override
Widget build(BuildContext context) {
- final Widget row = new GestureDetector(
+ final Widget row = GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
- Navigator.of(context).push(new CupertinoPageRoute<void>(
+ Navigator.of(context).push(CupertinoPageRoute<void>(
title: colorName,
- builder: (BuildContext context) => new Tab1ItemPage(
+ builder: (BuildContext context) => Tab1ItemPage(
color: color,
colorName: colorName,
index: index,
),
));
},
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.only(left: 16.0, top: 8.0, bottom: 8.0, right: 8.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new Container(
+ Container(
height: 60.0,
width: 60.0,
- decoration: new BoxDecoration(
+ decoration: BoxDecoration(
color: color,
- borderRadius: new BorderRadius.circular(8.0),
+ borderRadius: BorderRadius.circular(8.0),
),
),
- new Expanded(
- child: new Padding(
+ Expanded(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Text(colorName),
+ Text(colorName),
const Padding(padding: EdgeInsets.only(top: 8.0)),
const Text(
'Buy this cool color',
@@ -224,7 +224,7 @@
),
),
),
- new CupertinoButton(
+ CupertinoButton(
padding: EdgeInsets.zero,
child: const Icon(CupertinoIcons.plus_circled,
color: CupertinoColors.activeBlue,
@@ -232,7 +232,7 @@
),
onPressed: () { },
),
- new CupertinoButton(
+ CupertinoButton(
padding: EdgeInsets.zero,
child: const Icon(CupertinoIcons.share,
color: CupertinoColors.activeBlue,
@@ -250,10 +250,10 @@
return row;
}
- return new Column(
+ return Column(
children: <Widget>[
row,
- new Container(
+ Container(
height: 1.0,
color: const Color(0xFFD9D9D9),
),
@@ -270,16 +270,16 @@
final int index;
@override
- State<StatefulWidget> createState() => new Tab1ItemPageState();
+ State<StatefulWidget> createState() => Tab1ItemPageState();
}
class Tab1ItemPageState extends State<Tab1ItemPage> {
@override
void initState() {
super.initState();
- relatedColors = new List<Color>.generate(10, (int index) {
- final math.Random random = new math.Random();
- return new Color.fromARGB(
+ relatedColors = List<Color>.generate(10, (int index) {
+ final math.Random random = math.Random();
+ return Color.fromARGB(
255,
(widget.color.red + random.nextInt(100) - 50).clamp(0, 255),
(widget.color.green + random.nextInt(100) - 50).clamp(0, 255),
@@ -292,41 +292,41 @@
@override
Widget build(BuildContext context) {
- return new CupertinoPageScaffold(
+ return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
trailing: ExitButton(),
),
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new ListView(
+ child: ListView(
children: <Widget>[
const Padding(padding: EdgeInsets.only(top: 16.0)),
- new Padding(
+ Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: new Row(
+ child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
- new Container(
+ Container(
height: 128.0,
width: 128.0,
- decoration: new BoxDecoration(
+ decoration: BoxDecoration(
color: widget.color,
- borderRadius: new BorderRadius.circular(24.0),
+ borderRadius: BorderRadius.circular(24.0),
),
),
const Padding(padding: EdgeInsets.only(left: 18.0)),
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Text(
+ Text(
widget.colorName,
style: const TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold),
),
const Padding(padding: EdgeInsets.only(top: 6.0)),
- new Text(
+ Text(
'Item number ${widget.index}',
style: const TextStyle(
color: Color(0xFF8E8E93),
@@ -335,14 +335,14 @@
),
),
const Padding(padding: EdgeInsets.only(top: 20.0)),
- new Row(
+ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
- new CupertinoButton(
+ CupertinoButton(
color: CupertinoColors.activeBlue,
minSize: 30.0,
padding: const EdgeInsets.symmetric(horizontal: 24.0),
- borderRadius: new BorderRadius.circular(32.0),
+ borderRadius: BorderRadius.circular(32.0),
child: const Text(
'GET',
style: TextStyle(
@@ -353,11 +353,11 @@
),
onPressed: () { },
),
- new CupertinoButton(
+ CupertinoButton(
color: CupertinoColors.activeBlue,
minSize: 30.0,
padding: EdgeInsets.zero,
- borderRadius: new BorderRadius.circular(32.0),
+ borderRadius: BorderRadius.circular(32.0),
child: const Icon(CupertinoIcons.ellipsis, color: CupertinoColors.white),
onPressed: () { },
),
@@ -381,22 +381,22 @@
),
),
),
- new SizedBox(
+ SizedBox(
height: 200.0,
- child: new ListView.builder(
+ child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 10,
itemExtent: 160.0,
itemBuilder: (BuildContext context, int index) {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.only(left: 16.0),
- child: new Container(
- decoration: new BoxDecoration(
- borderRadius: new BorderRadius.circular(8.0),
+ child: Container(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8.0),
color: relatedColors[index],
),
- child: new Center(
- child: new CupertinoButton(
+ child: Center(
+ child: CupertinoButton(
child: const Icon(
CupertinoIcons.plus_circled,
color: CupertinoColors.white,
@@ -420,13 +420,13 @@
class CupertinoDemoTab2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new CupertinoPageScaffold(
+ return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
trailing: ExitButton(),
),
- child: new ListView(
+ child: ListView(
children: <Widget>[
- new Tab2Header(),
+ Tab2Header(),
]..addAll(buildTab2Conversation()),
),
);
@@ -436,23 +436,23 @@
class Tab2Header extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.all(16.0),
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new ClipRRect(
+ child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(16.0)),
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Container(
+ Container(
decoration: const BoxDecoration(
color: Color(0xFFE5E5E5),
),
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 12.0),
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const <Widget>[
Text(
@@ -477,13 +477,13 @@
),
),
),
- new Container(
+ Container(
decoration: const BoxDecoration(
color: Color(0xFFF3F3F3),
),
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 12.0),
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Text(
@@ -505,9 +505,9 @@
),
),
const Padding(padding: EdgeInsets.only(top: 8.0)),
- new Row(
+ Row(
children: <Widget>[
- new Container(
+ Container(
width: 44.0,
height: 44.0,
decoration: const BoxDecoration(
@@ -521,7 +521,7 @@
),
),
const Padding(padding: EdgeInsets.only(left: 8.0)),
- new Container(
+ Container(
width: 44.0,
height: 44.0,
decoration: const BoxDecoration(
@@ -567,8 +567,8 @@
@override
Widget build(BuildContext context) {
- return new Container(
- decoration: new BoxDecoration(
+ return Container(
+ decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(18.0)),
color: color == Tab2ConversationBubbleColor.blue
? CupertinoColors.activeBlue
@@ -576,9 +576,9 @@
),
margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8.0),
padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 10.0),
- child: new Text(
+ child: Text(
text,
- style: new TextStyle(
+ style: TextStyle(
color: color == Tab2ConversationBubbleColor.blue
? CupertinoColors.white
: CupertinoColors.black,
@@ -599,15 +599,15 @@
@override
Widget build(BuildContext context) {
- return new Container(
- decoration: new BoxDecoration(
+ return Container(
+ decoration: BoxDecoration(
shape: BoxShape.circle,
- gradient: new LinearGradient(
+ gradient: LinearGradient(
begin: FractionalOffset.topCenter,
end: FractionalOffset.bottomCenter,
colors: <Color>[
color,
- new Color.fromARGB(
+ Color.fromARGB(
color.alpha,
(color.red - 60).clamp(0, 255),
(color.green - 60).clamp(0, 255),
@@ -618,7 +618,7 @@
),
margin: const EdgeInsets.only(left: 8.0, bottom: 8.0),
padding: const EdgeInsets.all(12.0),
- child: new Text(
+ child: Text(
text,
style: const TextStyle(
color: CupertinoColors.white,
@@ -644,15 +644,15 @@
final bool isSelf = avatar == null;
children.add(
- new Tab2ConversationBubble(
+ Tab2ConversationBubble(
text: text,
color: isSelf
? Tab2ConversationBubbleColor.blue
: Tab2ConversationBubbleColor.gray,
),
);
- return new SafeArea(
- child: new Row(
+ return SafeArea(
+ child: Row(
mainAxisAlignment: isSelf ? MainAxisAlignment.end : MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: isSelf ? CrossAxisAlignment.center : CrossAxisAlignment.end,
@@ -703,25 +703,25 @@
class CupertinoDemoTab3 extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new CupertinoPageScaffold(
+ return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
trailing: ExitButton(),
),
- child: new DecoratedBox(
+ child: DecoratedBox(
decoration: const BoxDecoration(color: Color(0xFFEFEFF4)),
- child: new ListView(
+ child: ListView(
children: <Widget>[
const Padding(padding: EdgeInsets.only(top: 32.0)),
- new GestureDetector(
+ GestureDetector(
onTap: () {
Navigator.of(context, rootNavigator: true).push(
- new CupertinoPageRoute<bool>(
+ CupertinoPageRoute<bool>(
fullscreenDialog: true,
- builder: (BuildContext context) => new Tab3Dialog(),
+ builder: (BuildContext context) => Tab3Dialog(),
),
);
},
- child: new Container(
+ child: Container(
decoration: const BoxDecoration(
color: CupertinoColors.white,
border: Border(
@@ -730,12 +730,12 @@
),
),
height: 44.0,
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new Row(
+ child: Row(
children: const <Widget>[
Text(
'Sign in',
@@ -757,9 +757,9 @@
class Tab3Dialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new CupertinoPageScaffold(
- navigationBar: new CupertinoNavigationBar(
- leading: new CupertinoButton(
+ return CupertinoPageScaffold(
+ navigationBar: CupertinoNavigationBar(
+ leading: CupertinoButton(
child: const Text('Cancel'),
padding: EdgeInsets.zero,
onPressed: () {
@@ -767,8 +767,8 @@
},
),
),
- child: new Center(
- child: new Column(
+ child: Center(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const Icon(
@@ -777,7 +777,7 @@
color: Color(0xFF646464),
),
const Padding(padding: EdgeInsets.only(top: 18.0)),
- new CupertinoButton(
+ CupertinoButton(
color: CupertinoColors.activeBlue,
child: const Text('Sign in'),
onPressed: () {
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart
index bc210f8..7e36064 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart
@@ -13,16 +13,16 @@
static const String routeName = '/cupertino/picker';
@override
- _CupertinoPickerDemoState createState() => new _CupertinoPickerDemoState();
+ _CupertinoPickerDemoState createState() => _CupertinoPickerDemoState();
}
class _CupertinoPickerDemoState extends State<CupertinoPickerDemo> {
int _selectedColorIndex = 0;
- Duration timer = new Duration();
+ Duration timer = Duration();
Widget _buildMenu(List<Widget> children) {
- return new Container(
+ return Container(
decoration: const BoxDecoration(
color: CupertinoColors.white,
border: Border(
@@ -31,18 +31,18 @@
),
),
height: 44.0,
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
style: const TextStyle(
letterSpacing: -0.24,
fontSize: 17.0,
color: CupertinoColors.black,
),
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: children,
),
@@ -54,8 +54,8 @@
Widget _buildColorPicker() {
final FixedExtentScrollController scrollController =
- new FixedExtentScrollController(initialItem: _selectedColorIndex);
- return new CupertinoPicker(
+ FixedExtentScrollController(initialItem: _selectedColorIndex);
+ return CupertinoPicker(
scrollController: scrollController,
itemExtent: _kPickerItemHeight,
backgroundColor: CupertinoColors.white,
@@ -64,27 +64,27 @@
_selectedColorIndex = index;
});
},
- children: new List<Widget>.generate(coolColorNames.length, (int index) {
- return new Center(child:
- new Text(coolColorNames[index]),
+ children: List<Widget>.generate(coolColorNames.length, (int index) {
+ return Center(child:
+ Text(coolColorNames[index]),
);
}),
);
}
Widget _buildBottomPicker(Widget picker) {
- return new Container(
+ return Container(
height: _kPickerSheetHeight,
color: CupertinoColors.white,
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
style: const TextStyle(
color: CupertinoColors.black,
fontSize: 22.0,
),
- child: new GestureDetector(
+ child: GestureDetector(
// Blocks taps from propagating to the modal sheet and popping.
onTap: () {},
- child: new SafeArea(
+ child: SafeArea(
child: picker,
),
),
@@ -93,13 +93,13 @@
}
Widget _buildCountdownTimerPicker(BuildContext context) {
- return new GestureDetector(
+ return GestureDetector(
onTap: () {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) {
return _buildBottomPicker(
- new CupertinoTimerPicker(
+ CupertinoTimerPicker(
initialTimerDuration: timer,
onTimerDurationChanged: (Duration newTimer) {
setState(() {
@@ -114,7 +114,7 @@
child: _buildMenu(
<Widget>[
const Text('Countdown Timer'),
- new Text(
+ Text(
'${timer.inHours}:'
'${(timer.inMinutes % 60).toString().padLeft(2,'0')}:'
'${(timer.inSeconds % 60).toString().padLeft(2,'0')}',
@@ -127,22 +127,22 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Cupertino Picker'),
),
- body: new DefaultTextStyle(
+ body: DefaultTextStyle(
style: const TextStyle(
fontFamily: '.SF UI Text',
fontSize: 17.0,
color: CupertinoColors.black,
),
- child: new DecoratedBox(
+ child: DecoratedBox(
decoration: const BoxDecoration(color: Color(0xFFEFEFF4)),
- child: new ListView(
+ child: ListView(
children: <Widget>[
const Padding(padding: EdgeInsets.only(top: 32.0)),
- new GestureDetector(
+ GestureDetector(
onTap: () async {
await showCupertinoModalPopup<void>(
context: context,
@@ -154,7 +154,7 @@
child: _buildMenu(
<Widget>[
const Text('Favorite Color'),
- new Text(
+ Text(
coolColorNames[_selectedColorIndex],
style: const TextStyle(
color: CupertinoColors.inactiveGray
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_refresh_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_refresh_demo.dart
index d1fdc5e..4eaf0e9 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_refresh_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_refresh_demo.dart
@@ -10,7 +10,7 @@
static const String routeName = '/cupertino/refresh';
@override
- _CupertinoRefreshControlDemoState createState() => new _CupertinoRefreshControlDemoState();
+ _CupertinoRefreshControlDemoState createState() => _CupertinoRefreshControlDemoState();
}
class _CupertinoRefreshControlDemoState extends State<CupertinoRefreshControlDemo> {
@@ -23,8 +23,8 @@
}
void repopulateList() {
- final Random random = new Random();
- randomizedContacts = new List<List<String>>.generate(
+ final Random random = Random();
+ randomizedContacts = List<List<String>>.generate(
100,
(int index) {
return contacts[random.nextInt(contacts.length)]
@@ -36,25 +36,25 @@
@override
Widget build(BuildContext context) {
- return new DefaultTextStyle(
+ return DefaultTextStyle(
style: const TextStyle(
fontFamily: '.SF UI Text',
inherit: false,
fontSize: 17.0,
color: CupertinoColors.black,
),
- child: new CupertinoPageScaffold(
- child: new DecoratedBox(
+ child: CupertinoPageScaffold(
+ child: DecoratedBox(
decoration: const BoxDecoration(color: Color(0xFFEFEFF4)),
- child: new CustomScrollView(
+ child: CustomScrollView(
slivers: <Widget>[
const CupertinoSliverNavigationBar(
largeTitle: Text('Cupertino Refresh'),
previousPageTitle: 'Cupertino',
),
- new CupertinoSliverRefreshControl(
+ CupertinoSliverRefreshControl(
onRefresh: () {
- return new Future<void>.delayed(const Duration(seconds: 2))
+ return Future<void>.delayed(const Duration(seconds: 2))
..then((_) {
if (mounted) {
setState(() => repopulateList());
@@ -62,12 +62,12 @@
});
},
),
- new SliverSafeArea(
+ SliverSafeArea(
top: false, // Top safe area is consumed by the navigation bar.
- sliver: new SliverList(
- delegate: new SliverChildBuilderDelegate(
+ sliver: SliverList(
+ delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
- return new _ListItem(
+ return _ListItem(
name: randomizedContacts[index][0],
place: randomizedContacts[index][1],
date: randomizedContacts[index][2],
@@ -148,13 +148,13 @@
@override
Widget build(BuildContext context) {
- return new Container(
+ return Container(
color: CupertinoColors.white,
height: 60.0,
padding: const EdgeInsets.only(top: 9.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new Container(
+ Container(
width: 38.0,
child: called
? const Align(
@@ -167,22 +167,22 @@
)
: null,
),
- new Expanded(
- child: new Container(
+ Expanded(
+ child: Container(
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(color: Color(0xFFBCBBC1), width: 0.0),
),
),
padding: const EdgeInsets.only(left: 1.0, bottom: 9.0, right: 10.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
- new Text(
+ Text(
name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -191,7 +191,7 @@
letterSpacing: -0.18,
),
),
- new Text(
+ Text(
place,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -204,7 +204,7 @@
],
),
),
- new Text(
+ Text(
date,
style: const TextStyle(
color: CupertinoColors.inactiveGray,
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart
index 09e7c51..5d35281 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart
@@ -13,7 +13,7 @@
static const String routeName = 'cupertino/segmented_control';
@override
- _CupertinoSegmentedControlDemoState createState() => new _CupertinoSegmentedControlDemoState();
+ _CupertinoSegmentedControlDemoState createState() => _CupertinoSegmentedControlDemoState();
}
class _CupertinoSegmentedControlDemoState extends State<CupertinoSegmentedControlDemo> {
@@ -48,18 +48,18 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Segmented Control'),
),
- body: new Column(
+ body: Column(
children: <Widget>[
const Padding(
padding: EdgeInsets.all(16.0),
),
- new SizedBox(
+ SizedBox(
width: 500.0,
- child: new CupertinoSegmentedControl<int>(
+ child: CupertinoSegmentedControl<int>(
children: children,
onValueChanged: (int newValue) {
setState(() {
@@ -69,20 +69,20 @@
groupValue: sharedValue,
),
),
- new Expanded(
- child: new Padding(
+ Expanded(
+ child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 32.0,
horizontal: 16.0,
),
- child: new Container(
+ child: Container(
padding: const EdgeInsets.symmetric(
vertical: 64.0,
horizontal: 16.0,
),
- decoration: new BoxDecoration(
+ decoration: BoxDecoration(
color: CupertinoColors.white,
- borderRadius: new BorderRadius.circular(3.0),
+ borderRadius: BorderRadius.circular(3.0),
boxShadow: const <BoxShadow>[
BoxShadow(
offset: Offset(0.0, 3.0),
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart
index 5952489..79ddb64 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_slider_demo.dart
@@ -9,7 +9,7 @@
static const String routeName = '/cupertino/slider';
@override
- _CupertinoSliderDemoState createState() => new _CupertinoSliderDemoState();
+ _CupertinoSliderDemoState createState() => _CupertinoSliderDemoState();
}
class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
@@ -18,18 +18,18 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Cupertino Sliders'),
),
- body: new Center(
- child: new Column(
+ body: Center(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
- new Column(
+ Column(
mainAxisSize: MainAxisSize.min,
children: <Widget> [
- new CupertinoSlider(
+ CupertinoSlider(
value: _value,
min: 0.0,
max: 100.0,
@@ -39,13 +39,13 @@
});
}
),
- new Text('Cupertino Continuous: ${_value.toStringAsFixed(1)}'),
+ Text('Cupertino Continuous: ${_value.toStringAsFixed(1)}'),
]
),
- new Column(
+ Column(
mainAxisSize: MainAxisSize.min,
children: <Widget> [
- new CupertinoSlider(
+ CupertinoSlider(
value: _discreteValue,
min: 0.0,
max: 100.0,
@@ -56,7 +56,7 @@
});
}
),
- new Text('Cupertino Discrete: $_discreteValue'),
+ Text('Cupertino Discrete: $_discreteValue'),
]
),
],
diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart
index 46b568a..81998c7 100644
--- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart
@@ -9,7 +9,7 @@
static const String routeName = '/cupertino/switch';
@override
- _CupertinoSwitchDemoState createState() => new _CupertinoSwitchDemoState();
+ _CupertinoSwitchDemoState createState() => _CupertinoSwitchDemoState();
}
class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
@@ -18,19 +18,19 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Cupertino Switch'),
),
- body: new Center(
- child: new Column(
+ body: Center(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
- new Semantics(
+ Semantics(
container: true,
- child: new Column(
+ child: Column(
children: <Widget>[
- new CupertinoSwitch(
+ CupertinoSwitch(
value: _switchValue,
onChanged: (bool value) {
setState(() {
@@ -44,9 +44,9 @@
],
),
),
- new Semantics(
+ Semantics(
container: true,
- child: new Column(
+ child: Column(
children: const <Widget>[
CupertinoSwitch(
value: true,
@@ -58,9 +58,9 @@
],
),
),
- new Semantics(
+ Semantics(
container: true,
- child: new Column(
+ child: Column(
children: const <Widget>[
CupertinoSwitch(
value: false,
diff --git a/examples/flutter_gallery/lib/demo/images_demo.dart b/examples/flutter_gallery/lib/demo/images_demo.dart
index da3fe77..c214d2a 100644
--- a/examples/flutter_gallery/lib/demo/images_demo.dart
+++ b/examples/flutter_gallery/lib/demo/images_demo.dart
@@ -7,28 +7,28 @@
@override
Widget build(BuildContext context) {
- return new TabbedComponentDemoScaffold(
+ return TabbedComponentDemoScaffold(
title: 'Animated images',
demos: <ComponentDemoTabData>[
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'WEBP',
description: '',
exampleCodeTag: 'animated_image',
- demoWidget: new Semantics(
+ demoWidget: Semantics(
label: 'Example of animated WEBP',
- child: new Image.asset(
+ child: Image.asset(
'animated_images/animated_flutter_stickers.webp',
package: 'flutter_gallery_assets',
),
),
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'GIF',
description: '',
exampleCodeTag: 'animated_image',
- demoWidget: new Semantics(
+ demoWidget: Semantics(
label: 'Example of animated GIF',
- child:new Image.asset(
+ child:Image.asset(
'animated_images/animated_flutter_lgtm.gif',
package: 'flutter_gallery_assets',
),
diff --git a/examples/flutter_gallery/lib/demo/material/backdrop_demo.dart b/examples/flutter_gallery/lib/demo/material/backdrop_demo.dart
index 56a6485..b0d6c0e 100644
--- a/examples/flutter_gallery/lib/demo/material/backdrop_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/backdrop_demo.dart
@@ -102,31 +102,31 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new ListView(
- key: new PageStorageKey<Category>(category),
+ return ListView(
+ key: PageStorageKey<Category>(category),
padding: const EdgeInsets.symmetric(
vertical: 16.0,
horizontal: 64.0,
),
children: category.assets.map<Widget>((String asset) {
- return new Column(
+ return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
- new Card(
- child: new Container(
+ Card(
+ child: Container(
width: 144.0,
alignment: Alignment.center,
- child: new Column(
+ child: Column(
children: <Widget>[
- new Image.asset(
+ Image.asset(
asset,
package: 'flutter_gallery_assets',
fit: BoxFit.contain,
),
- new Container(
+ Container(
padding: const EdgeInsets.only(bottom: 16.0),
alignment: AlignmentDirectional.center,
- child: new Text(
+ child: Text(
asset,
style: theme.textTheme.caption,
),
@@ -164,27 +164,27 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new Material(
+ return Material(
elevation: 2.0,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16.0),
topRight: Radius.circular(16.0),
),
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
- new GestureDetector(
+ GestureDetector(
behavior: HitTestBehavior.opaque,
onVerticalDragUpdate: onVerticalDragUpdate,
onVerticalDragEnd: onVerticalDragEnd,
onTap: onTap,
- child: new Container(
+ child: Container(
height: 48.0,
padding: const EdgeInsetsDirectional.only(start: 16.0),
alignment: AlignmentDirectional.centerStart,
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
style: theme.textTheme.subhead,
- child: new Tooltip(
+ child: Tooltip(
message: 'Tap to dismiss',
child: title,
),
@@ -192,7 +192,7 @@
),
),
const Divider(height: 1.0),
- new Expanded(child: child),
+ Expanded(child: child),
],
),
);
@@ -209,21 +209,21 @@
@override
Widget build(BuildContext context) {
final Animation<double> animation = listenable;
- return new DefaultTextStyle(
+ return DefaultTextStyle(
style: Theme.of(context).primaryTextTheme.title,
softWrap: false,
overflow: TextOverflow.ellipsis,
- child: new Stack(
+ child: Stack(
children: <Widget>[
- new Opacity(
- opacity: new CurvedAnimation(
- parent: new ReverseAnimation(animation),
+ Opacity(
+ opacity: CurvedAnimation(
+ parent: ReverseAnimation(animation),
curve: const Interval(0.5, 1.0),
).value,
child: const Text('Select a Category'),
),
- new Opacity(
- opacity: new CurvedAnimation(
+ Opacity(
+ opacity: CurvedAnimation(
parent: animation,
curve: const Interval(0.5, 1.0),
).value,
@@ -240,18 +240,18 @@
static const String routeName = '/material/backdrop';
@override
- _BackdropDemoState createState() => new _BackdropDemoState();
+ _BackdropDemoState createState() => _BackdropDemoState();
}
class _BackdropDemoState extends State<BackdropDemo> with SingleTickerProviderStateMixin {
- final GlobalKey _backdropKey = new GlobalKey(debugLabel: 'Backdrop');
+ final GlobalKey _backdropKey = GlobalKey(debugLabel: 'Backdrop');
AnimationController _controller;
Category _category = allCategories[0];
@override
void initState() {
super.initState();
- _controller = new AnimationController(
+ _controller = AnimationController(
duration: const Duration(milliseconds: 300),
value: 1.0,
vsync: this,
@@ -318,8 +318,8 @@
final Size panelSize = constraints.biggest;
final double panelTop = panelSize.height - panelTitleHeight;
- final Animation<RelativeRect> panelAnimation = new RelativeRectTween(
- begin: new RelativeRect.fromLTRB(
+ final Animation<RelativeRect> panelAnimation = RelativeRectTween(
+ begin: RelativeRect.fromLTRB(
0.0,
panelTop - MediaQuery.of(context).padding.bottom,
0.0,
@@ -327,7 +327,7 @@
),
end: const RelativeRect.fromLTRB(0.0, 0.0, 0.0, 0.0),
).animate(
- new CurvedAnimation(
+ CurvedAnimation(
parent: _controller,
curve: Curves.linear,
),
@@ -336,15 +336,15 @@
final ThemeData theme = Theme.of(context);
final List<Widget> backdropItems = allCategories.map<Widget>((Category category) {
final bool selected = category == _category;
- return new Material(
+ return Material(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
),
color: selected
? Colors.white.withOpacity(0.25)
: Colors.transparent,
- child: new ListTile(
- title: new Text(category.title),
+ child: ListTile(
+ title: Text(category.title),
selected: selected,
onTap: () {
_changeCategory(category);
@@ -353,31 +353,31 @@
);
}).toList();
- return new Container(
+ return Container(
key: _backdropKey,
color: theme.primaryColor,
- child: new Stack(
+ child: Stack(
children: <Widget>[
- new ListTileTheme(
+ ListTileTheme(
iconColor: theme.primaryIconTheme.color,
textColor: theme.primaryTextTheme.title.color.withOpacity(0.6),
selectedColor: theme.primaryTextTheme.title.color,
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: backdropItems,
),
),
),
- new PositionedTransition(
+ PositionedTransition(
rect: panelAnimation,
- child: new BackdropPanel(
+ child: BackdropPanel(
onTap: _toggleBackdropPanelVisibility,
onVerticalDragUpdate: _handleDragUpdate,
onVerticalDragEnd: _handleDragEnd,
- title: new Text(_category.title),
- child: new CategoryView(category: _category),
+ title: Text(_category.title),
+ child: CategoryView(category: _category),
),
),
],
@@ -387,23 +387,23 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
elevation: 0.0,
- title: new BackdropTitle(
+ title: BackdropTitle(
listenable: _controller.view,
),
actions: <Widget>[
- new IconButton(
+ IconButton(
onPressed: _toggleBackdropPanelVisibility,
- icon: new AnimatedIcon(
+ icon: AnimatedIcon(
icon: AnimatedIcons.close_menu,
progress: _controller.view,
),
),
],
),
- body: new LayoutBuilder(
+ body: LayoutBuilder(
builder: _buildStack,
),
);
diff --git a/examples/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart b/examples/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart
index d3d9576..0a68f87 100644
--- a/examples/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart
@@ -8,7 +8,7 @@
static const String routeName = '/material/bottom_app_bar';
@override
- State createState() => new _BottomAppBarDemoState();
+ State createState() => _BottomAppBarDemoState();
}
// Flutter generally frowns upon abbrevation however this class uses two
@@ -16,7 +16,7 @@
// for bottom application bar.
class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
- static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ static final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
// FAB shape
@@ -137,13 +137,13 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Bottom app bar'),
elevation: 0.0,
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() {
@@ -153,38 +153,38 @@
),
],
),
- body: new ListView(
+ body: ListView(
padding: const EdgeInsets.only(bottom: 88.0),
children: <Widget>[
const _Heading('FAB Shape'),
- new _RadioItem<Widget>(kCircularFab, _fabShape, _onFabShapeChanged),
- new _RadioItem<Widget>(kDiamondFab, _fabShape, _onFabShapeChanged),
- new _RadioItem<Widget>(kNoFab, _fabShape, _onFabShapeChanged),
+ _RadioItem<Widget>(kCircularFab, _fabShape, _onFabShapeChanged),
+ _RadioItem<Widget>(kDiamondFab, _fabShape, _onFabShapeChanged),
+ _RadioItem<Widget>(kNoFab, _fabShape, _onFabShapeChanged),
const Divider(),
const _Heading('Notch'),
- new _RadioItem<bool>(kShowNotchTrue, _showNotch, _onShowNotchChanged),
- new _RadioItem<bool>(kShowNotchFalse, _showNotch, _onShowNotchChanged),
+ _RadioItem<bool>(kShowNotchTrue, _showNotch, _onShowNotchChanged),
+ _RadioItem<bool>(kShowNotchFalse, _showNotch, _onShowNotchChanged),
const Divider(),
const _Heading('FAB Position'),
- new _RadioItem<FloatingActionButtonLocation>(kFabEndDocked, _fabLocation, _onFabLocationChanged),
- new _RadioItem<FloatingActionButtonLocation>(kFabCenterDocked, _fabLocation, _onFabLocationChanged),
- new _RadioItem<FloatingActionButtonLocation>(kFabEndFloat, _fabLocation, _onFabLocationChanged),
- new _RadioItem<FloatingActionButtonLocation>(kFabCenterFloat, _fabLocation, _onFabLocationChanged),
+ _RadioItem<FloatingActionButtonLocation>(kFabEndDocked, _fabLocation, _onFabLocationChanged),
+ _RadioItem<FloatingActionButtonLocation>(kFabCenterDocked, _fabLocation, _onFabLocationChanged),
+ _RadioItem<FloatingActionButtonLocation>(kFabEndFloat, _fabLocation, _onFabLocationChanged),
+ _RadioItem<FloatingActionButtonLocation>(kFabCenterFloat, _fabLocation, _onFabLocationChanged),
const Divider(),
const _Heading('App bar color'),
- new _ColorsItem(kBabColors, _babColor, _onBabColorChanged),
+ _ColorsItem(kBabColors, _babColor, _onBabColorChanged),
],
),
floatingActionButton: _fabShape.value,
floatingActionButtonLocation: _fabLocation.value,
- bottomNavigationBar: new _DemoBottomAppBar(
+ bottomNavigationBar: _DemoBottomAppBar(
color: _babColor,
fabLocation: _fabLocation.value,
shape: _selectNotch(),
@@ -224,29 +224,29 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new Container(
+ return Container(
height: 56.0,
padding: const EdgeInsetsDirectional.only(start: 16.0),
alignment: AlignmentDirectional.centerStart,
- child: new MergeSemantics(
- child: new Row(
+ child: MergeSemantics(
+ child: Row(
children: <Widget>[
- new Radio<_ChoiceValue<T>>(
+ Radio<_ChoiceValue<T>>(
value: value,
groupValue: groupValue,
onChanged: onChanged,
),
- new Expanded(
- child: new Semantics(
+ Expanded(
+ child: Semantics(
container: true,
button: true,
label: value.label,
- child: new GestureDetector(
+ child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
onChanged(value);
},
- child: new Text(
+ child: Text(
value.title,
style: theme.textTheme.subhead,
),
@@ -276,10 +276,10 @@
@override
Widget build(BuildContext context) {
- return new Row(
+ return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: colors.map((_NamedColor namedColor) {
- return new RawMaterialButton(
+ return RawMaterialButton(
onPressed: () {
onChanged(namedColor.color);
},
@@ -288,13 +288,13 @@
height: 32.0,
),
fillColor: namedColor.color,
- shape: new CircleBorder(
- side: new BorderSide(
+ shape: CircleBorder(
+ side: BorderSide(
color: namedColor.color == selectedColor ? Colors.black : const Color(0xFFD5D7DA),
width: 2.0,
),
),
- child: new Semantics(
+ child: Semantics(
value: namedColor.name,
selected: namedColor.color == selectedColor,
),
@@ -312,11 +312,11 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new Container(
+ return Container(
height: 48.0,
padding: const EdgeInsetsDirectional.only(start: 56.0),
alignment: AlignmentDirectional.centerStart,
- child: new Text(
+ child: Text(
text,
style: theme.textTheme.body1.copyWith(
color: theme.primaryColor,
@@ -345,7 +345,7 @@
@override
Widget build(BuildContext context) {
final List<Widget> rowContents = <Widget> [
- new IconButton(
+ IconButton(
icon: const Icon(Icons.menu),
onPressed: () {
showModalBottomSheet<Null>(
@@ -363,7 +363,7 @@
}
rowContents.addAll(<Widget> [
- new IconButton(
+ IconButton(
icon: const Icon(Icons.search),
onPressed: () {
Scaffold.of(context).showSnackBar(
@@ -371,8 +371,8 @@
);
},
),
- new IconButton(
- icon: new Icon(
+ IconButton(
+ icon: Icon(
Theme.of(context).platform == TargetPlatform.iOS
? Icons.more_horiz
: Icons.more_vert,
@@ -385,9 +385,9 @@
),
]);
- return new BottomAppBar(
+ return BottomAppBar(
color: color,
- child: new Row(children: rowContents),
+ child: Row(children: rowContents),
shape: shape,
);
}
@@ -399,8 +399,8 @@
@override
Widget build(BuildContext context) {
- return new Drawer(
- child: new Column(
+ return Drawer(
+ child: Column(
children: const <Widget>[
ListTile(
leading: Icon(Icons.search),
@@ -428,16 +428,16 @@
@override
Widget build(BuildContext context) {
- return new Material(
+ return Material(
shape: const _DiamondBorder(),
color: Colors.orange,
- child: new InkWell(
+ child: InkWell(
onTap: onPressed,
- child: new Container(
+ child: Container(
width: 56.0,
height: 56.0,
child: IconTheme.merge(
- data: new IconThemeData(color: Theme.of(context).accentIconTheme.color),
+ data: IconThemeData(color: Theme.of(context).accentIconTheme.color),
child: child,
),
),
@@ -453,7 +453,7 @@
@override
Path getOuterPath(Rect host, Rect guest) {
if (!host.overlaps(guest))
- return new Path()..addRect(host);
+ return Path()..addRect(host);
assert(guest.width > 0.0);
final Rect intersection = guest.intersect(host);
@@ -473,7 +473,7 @@
intersection.height * (guest.height / 2.0)
/ (guest.width / 2.0);
- return new Path()
+ return Path()
..moveTo(host.left, host.top)
..lineTo(guest.center.dx - notchToCenter, host.top)
..lineTo(guest.left + guest.width / 2.0, guest.bottom)
@@ -500,7 +500,7 @@
@override
Path getOuterPath(Rect rect, { TextDirection textDirection }) {
- return new Path()
+ return Path()
..moveTo(rect.left + rect.width / 2.0, rect.top)
..lineTo(rect.right, rect.top + rect.height / 2.0)
..lineTo(rect.left + rect.width / 2.0, rect.bottom)
diff --git a/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart b/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart
index fcaef9f..9264ff6 100644
--- a/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart
@@ -14,17 +14,17 @@
}) : _icon = icon,
_color = color,
_title = title,
- item = new BottomNavigationBarItem(
+ item = BottomNavigationBarItem(
icon: icon,
activeIcon: activeIcon,
- title: new Text(title),
+ title: Text(title),
backgroundColor: color,
),
- controller = new AnimationController(
+ controller = AnimationController(
duration: kThemeAnimationDuration,
vsync: vsync,
) {
- _animation = new CurvedAnimation(
+ _animation = CurvedAnimation(
parent: controller,
curve: const Interval(0.5, 1.0, curve: Curves.fastOutSlowIn),
);
@@ -48,19 +48,19 @@
: themeData.accentColor;
}
- return new FadeTransition(
+ return FadeTransition(
opacity: _animation,
- child: new SlideTransition(
- position: new Tween<Offset>(
+ child: SlideTransition(
+ position: Tween<Offset>(
begin: const Offset(0.0, 0.02), // Slightly down.
end: Offset.zero,
).animate(_animation),
- child: new IconTheme(
- data: new IconThemeData(
+ child: IconTheme(
+ data: IconThemeData(
color: iconColor,
size: 120.0,
),
- child: new Semantics(
+ child: Semantics(
label: 'Placeholder for $_title tab',
child: _icon,
),
@@ -74,7 +74,7 @@
@override
Widget build(BuildContext context) {
final IconThemeData iconTheme = IconTheme.of(context);
- return new Container(
+ return Container(
margin: const EdgeInsets.all(4.0),
width: iconTheme.size - 8.0,
height: iconTheme.size - 8.0,
@@ -87,12 +87,12 @@
@override
Widget build(BuildContext context) {
final IconThemeData iconTheme = IconTheme.of(context);
- return new Container(
+ return Container(
margin: const EdgeInsets.all(4.0),
width: iconTheme.size - 8.0,
height: iconTheme.size - 8.0,
- decoration: new BoxDecoration(
- border: new Border.all(color: iconTheme.color, width: 2.0),
+ decoration: BoxDecoration(
+ border: Border.all(color: iconTheme.color, width: 2.0),
)
);
}
@@ -102,7 +102,7 @@
static const String routeName = '/material/bottom_navigation';
@override
- _BottomNavigationDemoState createState() => new _BottomNavigationDemoState();
+ _BottomNavigationDemoState createState() => _BottomNavigationDemoState();
}
class _BottomNavigationDemoState extends State<BottomNavigationDemo>
@@ -115,34 +115,34 @@
void initState() {
super.initState();
_navigationViews = <NavigationIconView>[
- new NavigationIconView(
+ NavigationIconView(
icon: const Icon(Icons.access_alarm),
title: 'Alarm',
color: Colors.deepPurple,
vsync: this,
),
- new NavigationIconView(
- activeIcon: new CustomIcon(),
- icon: new CustomInactiveIcon(),
+ NavigationIconView(
+ activeIcon: CustomIcon(),
+ icon: CustomInactiveIcon(),
title: 'Box',
color: Colors.deepOrange,
vsync: this,
),
- new NavigationIconView(
+ NavigationIconView(
activeIcon: const Icon(Icons.cloud),
icon: const Icon(Icons.cloud_queue),
title: 'Cloud',
color: Colors.teal,
vsync: this,
),
- new NavigationIconView(
+ NavigationIconView(
activeIcon: const Icon(Icons.favorite),
icon: const Icon(Icons.favorite_border),
title: 'Favorites',
color: Colors.indigo,
vsync: this,
),
- new NavigationIconView(
+ NavigationIconView(
icon: const Icon(Icons.event_available),
title: 'Event',
color: Colors.pink,
@@ -184,12 +184,12 @@
return aValue.compareTo(bValue);
});
- return new Stack(children: transitions);
+ return Stack(children: transitions);
}
@override
Widget build(BuildContext context) {
- final BottomNavigationBar botNavBar = new BottomNavigationBar(
+ final BottomNavigationBar botNavBar = BottomNavigationBar(
items: _navigationViews
.map((NavigationIconView navigationView) => navigationView.item)
.toList(),
@@ -204,11 +204,11 @@
},
);
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Bottom navigation'),
actions: <Widget>[
- new PopupMenuButton<BottomNavigationBarType>(
+ PopupMenuButton<BottomNavigationBarType>(
onSelected: (BottomNavigationBarType value) {
setState(() {
_type = value;
@@ -227,7 +227,7 @@
)
],
),
- body: new Center(
+ body: Center(
child: _buildTransitionsStack()
),
bottomNavigationBar: botNavBar,
diff --git a/examples/flutter_gallery/lib/demo/material/buttons_demo.dart b/examples/flutter_gallery/lib/demo/material/buttons_demo.dart
index aacbbf7..01746cd 100644
--- a/examples/flutter_gallery/lib/demo/material/buttons_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/buttons_demo.dart
@@ -49,7 +49,7 @@
static const String routeName = '/material/buttons';
@override
- _ButtonsDemoState createState() => new _ButtonsDemoState();
+ _ButtonsDemoState createState() => _ButtonsDemoState();
}
class _ButtonsDemoState extends State<ButtonsDemo> {
@@ -62,46 +62,46 @@
);
final List<ComponentDemoTabData> demos = <ComponentDemoTabData>[
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'RAISED',
description: _raisedText,
- demoWidget: new ButtonTheme.fromButtonThemeData(
+ demoWidget: ButtonTheme.fromButtonThemeData(
data: buttonTheme,
child: buildRaisedButton(),
),
exampleCodeTag: _raisedCode,
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'FLAT',
description: _flatText,
- demoWidget: new ButtonTheme.fromButtonThemeData(
+ demoWidget: ButtonTheme.fromButtonThemeData(
data: buttonTheme,
child: buildFlatButton(),
),
exampleCodeTag: _flatCode,
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'OUTLINE',
description: _outlineText,
- demoWidget: new ButtonTheme.fromButtonThemeData(
+ demoWidget: ButtonTheme.fromButtonThemeData(
data: buttonTheme,
child: buildOutlineButton(),
),
exampleCodeTag: _outlineCode,
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'DROPDOWN',
description: _dropdownText,
demoWidget: buildDropdownButton(),
exampleCodeTag: _dropdownCode,
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'ICON',
description: _iconText,
demoWidget: buildIconButton(),
exampleCodeTag: _iconCode,
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'ACTION',
description: _actionText,
demoWidget: buildActionButton(),
@@ -109,11 +109,11 @@
),
];
- return new TabbedComponentDemoScaffold(
+ return TabbedComponentDemoScaffold(
title: 'Buttons',
demos: demos,
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() {
@@ -126,15 +126,15 @@
}
Widget buildRaisedButton() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new ButtonBar(
+ ButtonBar(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new RaisedButton(
+ RaisedButton(
child: const Text('RAISED BUTTON'),
onPressed: () {
// Perform some action
@@ -146,17 +146,17 @@
),
],
),
- new ButtonBar(
+ ButtonBar(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new RaisedButton.icon(
+ RaisedButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('RAISED BUTTON'),
onPressed: () {
// Perform some action
},
),
- new RaisedButton.icon(
+ RaisedButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('DISABLED'),
onPressed: null,
@@ -169,15 +169,15 @@
}
Widget buildFlatButton() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new ButtonBar(
+ ButtonBar(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('FLAT BUTTON'),
onPressed: () {
// Perform some action
@@ -189,17 +189,17 @@
),
],
),
- new ButtonBar(
+ ButtonBar(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new FlatButton.icon(
+ FlatButton.icon(
icon: const Icon(Icons.add_circle_outline, size: 18.0),
label: const Text('FLAT BUTTON'),
onPressed: () {
// Perform some action
},
),
- new FlatButton.icon(
+ FlatButton.icon(
icon: const Icon(Icons.add_circle_outline, size: 18.0),
label: const Text('DISABLED'),
onPressed: null,
@@ -212,15 +212,15 @@
}
Widget buildOutlineButton() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new ButtonBar(
+ ButtonBar(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new OutlineButton(
+ OutlineButton(
child: const Text('OUTLINE BUTTON'),
onPressed: () {
// Perform some action
@@ -232,17 +232,17 @@
),
],
),
- new ButtonBar(
+ ButtonBar(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new OutlineButton.icon(
+ OutlineButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('OUTLINE BUTTON'),
onPressed: () {
// Perform some action
},
),
- new OutlineButton.icon(
+ OutlineButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('DISABLED'),
onPressed: null,
@@ -260,14 +260,14 @@
String dropdown3Value = 'Four';
Widget buildDropdownButton() {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.all(24.0),
- child: new Column(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
- new ListTile(
+ ListTile(
title: const Text('Simple dropdown:'),
- trailing: new DropdownButton<String>(
+ trailing: DropdownButton<String>(
value: dropdown1Value,
onChanged: (String newValue) {
setState(() {
@@ -275,9 +275,9 @@
});
},
items: <String>['One', 'Two', 'Free', 'Four'].map((String value) {
- return new DropdownMenuItem<String>(
+ return DropdownMenuItem<String>(
value: value,
- child: new Text(value),
+ child: Text(value),
);
}).toList(),
),
@@ -285,9 +285,9 @@
const SizedBox(
height: 24.0,
),
- new ListTile(
+ ListTile(
title: const Text('Dropdown with a hint:'),
- trailing: new DropdownButton<String>(
+ trailing: DropdownButton<String>(
value: dropdown2Value,
hint: const Text('Choose'),
onChanged: (String newValue) {
@@ -296,9 +296,9 @@
});
},
items: <String>['One', 'Two', 'Free', 'Four'].map((String value) {
- return new DropdownMenuItem<String>(
+ return DropdownMenuItem<String>(
value: value,
- child: new Text(value),
+ child: Text(value),
);
}).toList(),
),
@@ -306,9 +306,9 @@
const SizedBox(
height: 24.0,
),
- new ListTile(
+ ListTile(
title: const Text('Scrollable dropdown:'),
- trailing: new DropdownButton<String>(
+ trailing: DropdownButton<String>(
value: dropdown3Value,
onChanged: (String newValue) {
setState(() {
@@ -320,9 +320,9 @@
'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'
]
.map((String value) {
- return new DropdownMenuItem<String>(
+ return DropdownMenuItem<String>(
value: value,
- child: new Text(value),
+ child: Text(value),
);
})
.toList(),
@@ -336,12 +336,12 @@
bool iconButtonToggle = false;
Widget buildIconButton() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new Row(
+ child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(
Icons.thumb_up,
semanticLabel: 'Thumbs up',
@@ -359,16 +359,16 @@
onPressed: null,
)
]
- .map((Widget button) => new SizedBox(width: 64.0, height: 64.0, child: button))
+ .map((Widget button) => SizedBox(width: 64.0, height: 64.0, child: button))
.toList(),
),
);
}
Widget buildActionButton() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new FloatingActionButton(
+ child: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {
// Perform some action
diff --git a/examples/flutter_gallery/lib/demo/material/cards_demo.dart b/examples/flutter_gallery/lib/demo/material/cards_demo.dart
index f7e17e4..1d60ea4 100644
--- a/examples/flutter_gallery/lib/demo/material/cards_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/cards_demo.dart
@@ -61,37 +61,37 @@
final TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white);
final TextStyle descriptionStyle = theme.textTheme.subhead;
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new Container(
+ child: Container(
padding: const EdgeInsets.all(8.0),
height: height,
- child: new Card(
+ child: Card(
shape: shape,
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// photo and title
- new SizedBox(
+ SizedBox(
height: 184.0,
- child: new Stack(
+ child: Stack(
children: <Widget>[
- new Positioned.fill(
- child: new Image.asset(
+ Positioned.fill(
+ child: Image.asset(
destination.assetName,
package: destination.assetPackage,
fit: BoxFit.cover,
),
),
- new Positioned(
+ Positioned(
bottom: 16.0,
left: 16.0,
right: 16.0,
- child: new FittedBox(
+ child: FittedBox(
fit: BoxFit.scaleDown,
alignment: Alignment.centerLeft,
- child: new Text(destination.title,
+ child: Text(destination.title,
style: titleStyle,
),
),
@@ -100,42 +100,42 @@
),
),
// description and share/explore buttons
- new Expanded(
- child: new Padding(
+ Expanded(
+ child: Padding(
padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 0.0),
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
softWrap: false,
overflow: TextOverflow.ellipsis,
style: descriptionStyle,
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// three line description
- new Padding(
+ Padding(
padding: const EdgeInsets.only(bottom: 8.0),
- child: new Text(
+ child: Text(
destination.description[0],
style: descriptionStyle.copyWith(color: Colors.black54),
),
),
- new Text(destination.description[1]),
- new Text(destination.description[2]),
+ Text(destination.description[1]),
+ Text(destination.description[2]),
],
),
),
),
),
// share, explore buttons
- new ButtonTheme.bar(
- child: new ButtonBar(
+ ButtonTheme.bar(
+ child: ButtonBar(
alignment: MainAxisAlignment.start,
children: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('SHARE'),
textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ },
),
- new FlatButton(
+ FlatButton(
child: const Text('EXPLORE'),
textColor: Colors.amber.shade500,
onPressed: () { /* do nothing */ },
@@ -156,7 +156,7 @@
static const String routeName = '/material/cards';
@override
- _CardsDemoState createState() => new _CardsDemoState();
+ _CardsDemoState createState() => _CardsDemoState();
}
class _CardsDemoState extends State<CardsDemo> {
@@ -164,11 +164,11 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Travel stream'),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() {
@@ -185,13 +185,13 @@
),
],
),
- body: new ListView(
+ body: ListView(
itemExtent: TravelDestinationItem.height,
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
children: destinations.map((TravelDestination destination) {
- return new Container(
+ return Container(
margin: const EdgeInsets.only(bottom: 8.0),
- child: new TravelDestinationItem(
+ child: TravelDestinationItem(
destination: destination,
shape: _shape,
),
diff --git a/examples/flutter_gallery/lib/demo/material/chip_demo.dart b/examples/flutter_gallery/lib/demo/material/chip_demo.dart
index 55d5fb3..77a259e 100644
--- a/examples/flutter_gallery/lib/demo/material/chip_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/chip_demo.dart
@@ -53,19 +53,19 @@
};
final Map<String, Set<String>> _toolActions = <String, Set<String>>{
- 'hammer': new Set<String>()..addAll(<String>['flake', 'fragment', 'splinter']),
- 'chisel': new Set<String>()..addAll(<String>['flake', 'nick', 'splinter']),
- 'fryer': new Set<String>()..addAll(<String>['fry']),
- 'fabricator': new Set<String>()..addAll(<String>['solder']),
- 'customer': new Set<String>()..addAll(<String>['cash in', 'eat']),
+ 'hammer': Set<String>()..addAll(<String>['flake', 'fragment', 'splinter']),
+ 'chisel': Set<String>()..addAll(<String>['flake', 'nick', 'splinter']),
+ 'fryer': Set<String>()..addAll(<String>['fry']),
+ 'fabricator': Set<String>()..addAll(<String>['solder']),
+ 'customer': Set<String>()..addAll(<String>['cash in', 'eat']),
};
final Map<String, Set<String>> _materialActions = <String, Set<String>>{
- 'poker': new Set<String>()..addAll(<String>['cash in']),
- 'tortilla': new Set<String>()..addAll(<String>['fry', 'eat']),
- 'fish and': new Set<String>()..addAll(<String>['fry', 'eat']),
- 'micro': new Set<String>()..addAll(<String>['solder', 'fragment']),
- 'wood': new Set<String>()..addAll(<String>['flake', 'cut', 'splinter', 'nick']),
+ 'poker': Set<String>()..addAll(<String>['cash in']),
+ 'tortilla': Set<String>()..addAll(<String>['fry', 'eat']),
+ 'fish and': Set<String>()..addAll(<String>['fry', 'eat']),
+ 'micro': Set<String>()..addAll(<String>['solder', 'fragment']),
+ 'wood': Set<String>()..addAll(<String>['flake', 'cut', 'splinter', 'nick']),
};
class _ChipsTile extends StatelessWidget {
@@ -82,16 +82,16 @@
@override
Widget build(BuildContext context) {
final List<Widget> cardChildren = <Widget>[
- new Container(
+ Container(
padding: const EdgeInsets.only(top: 16.0, bottom: 4.0),
alignment: Alignment.center,
- child: new Text(label, textAlign: TextAlign.start),
+ child: Text(label, textAlign: TextAlign.start),
),
];
if (children.isNotEmpty) {
- cardChildren.add(new Wrap(
+ cardChildren.add(Wrap(
children: children.map((Widget chip) {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.all(2.0),
child: chip,
);
@@ -99,20 +99,20 @@
} else {
final TextStyle textStyle = Theme.of(context).textTheme.caption.copyWith(fontStyle: FontStyle.italic);
cardChildren.add(
- new Semantics(
+ Semantics(
container: true,
- child: new Container(
+ child: Container(
alignment: Alignment.center,
constraints: const BoxConstraints(minWidth: 48.0, minHeight: 48.0),
padding: const EdgeInsets.all(8.0),
- child: new Text('None', style: textStyle),
+ child: Text('None', style: textStyle),
),
));
}
- return new Card(
+ return Card(
semanticContainer: false,
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: cardChildren,
)
@@ -124,7 +124,7 @@
static const String routeName = '/material/chip';
@override
- _ChipDemoState createState() => new _ChipDemoState();
+ _ChipDemoState createState() => _ChipDemoState();
}
class _ChipDemoState extends State<ChipDemo> {
@@ -132,12 +132,12 @@
_reset();
}
- final Set<String> _materials = new Set<String>();
+ final Set<String> _materials = Set<String>();
String _selectedMaterial = '';
String _selectedAction = '';
- final Set<String> _tools = new Set<String>();
- final Set<String> _selectedTools = new Set<String>();
- final Set<String> _actions = new Set<String>();
+ final Set<String> _tools = Set<String>();
+ final Set<String> _selectedTools = Set<String>();
+ final Set<String> _actions = Set<String>();
bool _showShapeBorder = false;
// Initialize members with the default data.
@@ -180,12 +180,12 @@
assert(name.length > 1);
final int hash = name.hashCode & 0xffff;
final double hue = (360.0 * hash / (1 << 15)) % 360.0;
- return new HSVColor.fromAHSV(1.0, hue, 0.4, 0.90).toColor();
+ return HSVColor.fromAHSV(1.0, hue, 0.4, 0.90).toColor();
}
AssetImage _nameToAvatar(String name) {
assert(_avatars.containsKey(name));
- return new AssetImage(
+ return AssetImage(
_avatars[name],
package: 'flutter_gallery_assets',
);
@@ -201,10 +201,10 @@
@override
Widget build(BuildContext context) {
final List<Widget> chips = _materials.map<Widget>((String name) {
- return new Chip(
- key: new ValueKey<String>(name),
+ return Chip(
+ key: ValueKey<String>(name),
backgroundColor: _nameToColor(name),
- label: new Text(_capitalize(name)),
+ label: Text(_capitalize(name)),
onDeleted: () {
setState(() {
_removeMaterial(name);
@@ -214,12 +214,12 @@
}).toList();
final List<Widget> inputChips = _tools.map<Widget>((String name) {
- return new InputChip(
- key: new ValueKey<String>(name),
- avatar: new CircleAvatar(
+ return InputChip(
+ key: ValueKey<String>(name),
+ avatar: CircleAvatar(
backgroundImage: _nameToAvatar(name),
),
- label: new Text(_capitalize(name)),
+ label: Text(_capitalize(name)),
onDeleted: () {
setState(() {
_removeTool(name);
@@ -228,10 +228,10 @@
}).toList();
final List<Widget> choiceChips = _materials.map<Widget>((String name) {
- return new ChoiceChip(
- key: new ValueKey<String>(name),
+ return ChoiceChip(
+ key: ValueKey<String>(name),
backgroundColor: _nameToColor(name),
- label: new Text(_capitalize(name)),
+ label: Text(_capitalize(name)),
selected: _selectedMaterial == name,
onSelected: (bool value) {
setState(() {
@@ -242,9 +242,9 @@
}).toList();
final List<Widget> filterChips = _defaultTools.map<Widget>((String name) {
- return new FilterChip(
- key: new ValueKey<String>(name),
- label: new Text(_capitalize(name)),
+ return FilterChip(
+ key: ValueKey<String>(name),
+ label: Text(_capitalize(name)),
selected: _tools.contains(name) ? _selectedTools.contains(name) : false,
onSelected: !_tools.contains(name)
? null
@@ -260,7 +260,7 @@
);
}).toList();
- Set<String> allowedActions = new Set<String>();
+ Set<String> allowedActions = Set<String>();
if (_selectedMaterial != null && _selectedMaterial.isNotEmpty) {
for (String tool in _selectedTools) {
allowedActions.addAll(_toolActions[tool]);
@@ -269,8 +269,8 @@
}
final List<Widget> actionChips = allowedActions.map<Widget>((String name) {
- return new ActionChip(
- label: new Text(_capitalize(name)),
+ return ActionChip(
+ label: Text(_capitalize(name)),
onPressed: () {
setState(() {
_selectedAction = name;
@@ -282,16 +282,16 @@
final ThemeData theme = Theme.of(context);
final List<Widget> tiles = <Widget>[
const SizedBox(height: 8.0, width: 0.0),
- new _ChipsTile(label: 'Available Materials (Chip)', children: chips),
- new _ChipsTile(label: 'Available Tools (InputChip)', children: inputChips),
- new _ChipsTile(label: 'Choose a Material (ChoiceChip)', children: choiceChips),
- new _ChipsTile(label: 'Choose Tools (FilterChip)', children: filterChips),
- new _ChipsTile(label: 'Perform Allowed Action (ActionChip)', children: actionChips),
+ _ChipsTile(label: 'Available Materials (Chip)', children: chips),
+ _ChipsTile(label: 'Available Tools (InputChip)', children: inputChips),
+ _ChipsTile(label: 'Choose a Material (ChoiceChip)', children: choiceChips),
+ _ChipsTile(label: 'Choose Tools (FilterChip)', children: filterChips),
+ _ChipsTile(label: 'Perform Allowed Action (ActionChip)', children: actionChips),
const Divider(),
- new Padding(
+ Padding(
padding: const EdgeInsets.all(8.0),
- child: new Center(
- child: new Text(
+ child: Center(
+ child: Text(
_createResult(),
style: theme.textTheme.title,
),
@@ -299,11 +299,11 @@
),
];
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Chips'),
actions: <Widget>[
- new IconButton(
+ IconButton(
onPressed: () {
setState(() {
_showShapeBorder = !_showShapeBorder;
@@ -313,17 +313,17 @@
)
],
),
- body: new ChipTheme(
+ body: ChipTheme(
data: _showShapeBorder
? theme.chipTheme.copyWith(
- shape: new BeveledRectangleBorder(
+ shape: BeveledRectangleBorder(
side: const BorderSide(width: 0.66, style: BorderStyle.solid, color: Colors.grey),
- borderRadius: new BorderRadius.circular(10.0),
+ borderRadius: BorderRadius.circular(10.0),
))
: theme.chipTheme,
- child: new ListView(children: tiles),
+ child: ListView(children: tiles),
),
- floatingActionButton: new FloatingActionButton(
+ floatingActionButton: FloatingActionButton(
onPressed: () => setState(_reset),
child: const Icon(Icons.refresh, semanticLabel: 'Reset chips'),
),
diff --git a/examples/flutter_gallery/lib/demo/material/data_table_demo.dart b/examples/flutter_gallery/lib/demo/material/data_table_demo.dart
index 7bfd0f7..d14cd25 100644
--- a/examples/flutter_gallery/lib/demo/material/data_table_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/data_table_demo.dart
@@ -21,60 +21,60 @@
class DessertDataSource extends DataTableSource {
final List<Dessert> _desserts = <Dessert>[
- new Dessert('Frozen yogurt', 159, 6.0, 24, 4.0, 87, 14, 1),
- new Dessert('Ice cream sandwich', 237, 9.0, 37, 4.3, 129, 8, 1),
- new Dessert('Eclair', 262, 16.0, 24, 6.0, 337, 6, 7),
- new Dessert('Cupcake', 305, 3.7, 67, 4.3, 413, 3, 8),
- new Dessert('Gingerbread', 356, 16.0, 49, 3.9, 327, 7, 16),
- new Dessert('Jelly bean', 375, 0.0, 94, 0.0, 50, 0, 0),
- new Dessert('Lollipop', 392, 0.2, 98, 0.0, 38, 0, 2),
- new Dessert('Honeycomb', 408, 3.2, 87, 6.5, 562, 0, 45),
- new Dessert('Donut', 452, 25.0, 51, 4.9, 326, 2, 22),
- new Dessert('KitKat', 518, 26.0, 65, 7.0, 54, 12, 6),
+ Dessert('Frozen yogurt', 159, 6.0, 24, 4.0, 87, 14, 1),
+ Dessert('Ice cream sandwich', 237, 9.0, 37, 4.3, 129, 8, 1),
+ Dessert('Eclair', 262, 16.0, 24, 6.0, 337, 6, 7),
+ Dessert('Cupcake', 305, 3.7, 67, 4.3, 413, 3, 8),
+ Dessert('Gingerbread', 356, 16.0, 49, 3.9, 327, 7, 16),
+ Dessert('Jelly bean', 375, 0.0, 94, 0.0, 50, 0, 0),
+ Dessert('Lollipop', 392, 0.2, 98, 0.0, 38, 0, 2),
+ Dessert('Honeycomb', 408, 3.2, 87, 6.5, 562, 0, 45),
+ Dessert('Donut', 452, 25.0, 51, 4.9, 326, 2, 22),
+ Dessert('KitKat', 518, 26.0, 65, 7.0, 54, 12, 6),
- new Dessert('Frozen yogurt with sugar', 168, 6.0, 26, 4.0, 87, 14, 1),
- new Dessert('Ice cream sandwich with sugar', 246, 9.0, 39, 4.3, 129, 8, 1),
- new Dessert('Eclair with sugar', 271, 16.0, 26, 6.0, 337, 6, 7),
- new Dessert('Cupcake with sugar', 314, 3.7, 69, 4.3, 413, 3, 8),
- new Dessert('Gingerbread with sugar', 345, 16.0, 51, 3.9, 327, 7, 16),
- new Dessert('Jelly bean with sugar', 364, 0.0, 96, 0.0, 50, 0, 0),
- new Dessert('Lollipop with sugar', 401, 0.2, 100, 0.0, 38, 0, 2),
- new Dessert('Honeycomb with sugar', 417, 3.2, 89, 6.5, 562, 0, 45),
- new Dessert('Donut with sugar', 461, 25.0, 53, 4.9, 326, 2, 22),
- new Dessert('KitKat with sugar', 527, 26.0, 67, 7.0, 54, 12, 6),
+ Dessert('Frozen yogurt with sugar', 168, 6.0, 26, 4.0, 87, 14, 1),
+ Dessert('Ice cream sandwich with sugar', 246, 9.0, 39, 4.3, 129, 8, 1),
+ Dessert('Eclair with sugar', 271, 16.0, 26, 6.0, 337, 6, 7),
+ Dessert('Cupcake with sugar', 314, 3.7, 69, 4.3, 413, 3, 8),
+ Dessert('Gingerbread with sugar', 345, 16.0, 51, 3.9, 327, 7, 16),
+ Dessert('Jelly bean with sugar', 364, 0.0, 96, 0.0, 50, 0, 0),
+ Dessert('Lollipop with sugar', 401, 0.2, 100, 0.0, 38, 0, 2),
+ Dessert('Honeycomb with sugar', 417, 3.2, 89, 6.5, 562, 0, 45),
+ Dessert('Donut with sugar', 461, 25.0, 53, 4.9, 326, 2, 22),
+ Dessert('KitKat with sugar', 527, 26.0, 67, 7.0, 54, 12, 6),
- new Dessert('Frozen yogurt with honey', 223, 6.0, 36, 4.0, 87, 14, 1),
- new Dessert('Ice cream sandwich with honey', 301, 9.0, 49, 4.3, 129, 8, 1),
- new Dessert('Eclair with honey', 326, 16.0, 36, 6.0, 337, 6, 7),
- new Dessert('Cupcake with honey', 369, 3.7, 79, 4.3, 413, 3, 8),
- new Dessert('Gingerbread with honey', 420, 16.0, 61, 3.9, 327, 7, 16),
- new Dessert('Jelly bean with honey', 439, 0.0, 106, 0.0, 50, 0, 0),
- new Dessert('Lollipop with honey', 456, 0.2, 110, 0.0, 38, 0, 2),
- new Dessert('Honeycomb with honey', 472, 3.2, 99, 6.5, 562, 0, 45),
- new Dessert('Donut with honey', 516, 25.0, 63, 4.9, 326, 2, 22),
- new Dessert('KitKat with honey', 582, 26.0, 77, 7.0, 54, 12, 6),
+ Dessert('Frozen yogurt with honey', 223, 6.0, 36, 4.0, 87, 14, 1),
+ Dessert('Ice cream sandwich with honey', 301, 9.0, 49, 4.3, 129, 8, 1),
+ Dessert('Eclair with honey', 326, 16.0, 36, 6.0, 337, 6, 7),
+ Dessert('Cupcake with honey', 369, 3.7, 79, 4.3, 413, 3, 8),
+ Dessert('Gingerbread with honey', 420, 16.0, 61, 3.9, 327, 7, 16),
+ Dessert('Jelly bean with honey', 439, 0.0, 106, 0.0, 50, 0, 0),
+ Dessert('Lollipop with honey', 456, 0.2, 110, 0.0, 38, 0, 2),
+ Dessert('Honeycomb with honey', 472, 3.2, 99, 6.5, 562, 0, 45),
+ Dessert('Donut with honey', 516, 25.0, 63, 4.9, 326, 2, 22),
+ Dessert('KitKat with honey', 582, 26.0, 77, 7.0, 54, 12, 6),
- new Dessert('Frozen yogurt with milk', 262, 8.4, 36, 12.0, 194, 44, 1),
- new Dessert('Ice cream sandwich with milk', 339, 11.4, 49, 12.3, 236, 38, 1),
- new Dessert('Eclair with milk', 365, 18.4, 36, 14.0, 444, 36, 7),
- new Dessert('Cupcake with milk', 408, 6.1, 79, 12.3, 520, 33, 8),
- new Dessert('Gingerbread with milk', 459, 18.4, 61, 11.9, 434, 37, 16),
- new Dessert('Jelly bean with milk', 478, 2.4, 106, 8.0, 157, 30, 0),
- new Dessert('Lollipop with milk', 495, 2.6, 110, 8.0, 145, 30, 2),
- new Dessert('Honeycomb with milk', 511, 5.6, 99, 14.5, 669, 30, 45),
- new Dessert('Donut with milk', 555, 27.4, 63, 12.9, 433, 32, 22),
- new Dessert('KitKat with milk', 621, 28.4, 77, 15.0, 161, 42, 6),
+ Dessert('Frozen yogurt with milk', 262, 8.4, 36, 12.0, 194, 44, 1),
+ Dessert('Ice cream sandwich with milk', 339, 11.4, 49, 12.3, 236, 38, 1),
+ Dessert('Eclair with milk', 365, 18.4, 36, 14.0, 444, 36, 7),
+ Dessert('Cupcake with milk', 408, 6.1, 79, 12.3, 520, 33, 8),
+ Dessert('Gingerbread with milk', 459, 18.4, 61, 11.9, 434, 37, 16),
+ Dessert('Jelly bean with milk', 478, 2.4, 106, 8.0, 157, 30, 0),
+ Dessert('Lollipop with milk', 495, 2.6, 110, 8.0, 145, 30, 2),
+ Dessert('Honeycomb with milk', 511, 5.6, 99, 14.5, 669, 30, 45),
+ Dessert('Donut with milk', 555, 27.4, 63, 12.9, 433, 32, 22),
+ Dessert('KitKat with milk', 621, 28.4, 77, 15.0, 161, 42, 6),
- new Dessert('Coconut slice and frozen yogurt', 318, 21.0, 31, 5.5, 96, 14, 7),
- new Dessert('Coconut slice and ice cream sandwich', 396, 24.0, 44, 5.8, 138, 8, 7),
- new Dessert('Coconut slice and eclair', 421, 31.0, 31, 7.5, 346, 6, 13),
- new Dessert('Coconut slice and cupcake', 464, 18.7, 74, 5.8, 422, 3, 14),
- new Dessert('Coconut slice and gingerbread', 515, 31.0, 56, 5.4, 316, 7, 22),
- new Dessert('Coconut slice and jelly bean', 534, 15.0, 101, 1.5, 59, 0, 6),
- new Dessert('Coconut slice and lollipop', 551, 15.2, 105, 1.5, 47, 0, 8),
- new Dessert('Coconut slice and honeycomb', 567, 18.2, 94, 8.0, 571, 0, 51),
- new Dessert('Coconut slice and donut', 611, 40.0, 58, 6.4, 335, 2, 28),
- new Dessert('Coconut slice and KitKat', 677, 41.0, 72, 8.5, 63, 12, 12),
+ Dessert('Coconut slice and frozen yogurt', 318, 21.0, 31, 5.5, 96, 14, 7),
+ Dessert('Coconut slice and ice cream sandwich', 396, 24.0, 44, 5.8, 138, 8, 7),
+ Dessert('Coconut slice and eclair', 421, 31.0, 31, 7.5, 346, 6, 13),
+ Dessert('Coconut slice and cupcake', 464, 18.7, 74, 5.8, 422, 3, 14),
+ Dessert('Coconut slice and gingerbread', 515, 31.0, 56, 5.4, 316, 7, 22),
+ Dessert('Coconut slice and jelly bean', 534, 15.0, 101, 1.5, 59, 0, 6),
+ Dessert('Coconut slice and lollipop', 551, 15.2, 105, 1.5, 47, 0, 8),
+ Dessert('Coconut slice and honeycomb', 567, 18.2, 94, 8.0, 571, 0, 51),
+ Dessert('Coconut slice and donut', 611, 40.0, 58, 6.4, 335, 2, 28),
+ Dessert('Coconut slice and KitKat', 677, 41.0, 72, 8.5, 63, 12, 12),
];
void _sort<T>(Comparable<T> getField(Dessert d), bool ascending) {
@@ -99,7 +99,7 @@
if (index >= _desserts.length)
return null;
final Dessert dessert = _desserts[index];
- return new DataRow.byIndex(
+ return DataRow.byIndex(
index: index,
selected: dessert.selected,
onSelectChanged: (bool value) {
@@ -111,14 +111,14 @@
}
},
cells: <DataCell>[
- new DataCell(new Text('${dessert.name}')),
- new DataCell(new Text('${dessert.calories}')),
- new DataCell(new Text('${dessert.fat.toStringAsFixed(1)}')),
- new DataCell(new Text('${dessert.carbs}')),
- new DataCell(new Text('${dessert.protein.toStringAsFixed(1)}')),
- new DataCell(new Text('${dessert.sodium}')),
- new DataCell(new Text('${dessert.calcium}%')),
- new DataCell(new Text('${dessert.iron}%')),
+ DataCell(Text('${dessert.name}')),
+ DataCell(Text('${dessert.calories}')),
+ DataCell(Text('${dessert.fat.toStringAsFixed(1)}')),
+ DataCell(Text('${dessert.carbs}')),
+ DataCell(Text('${dessert.protein.toStringAsFixed(1)}')),
+ DataCell(Text('${dessert.sodium}')),
+ DataCell(Text('${dessert.calcium}%')),
+ DataCell(Text('${dessert.iron}%')),
]
);
}
@@ -144,14 +144,14 @@
static const String routeName = '/material/data-table';
@override
- _DataTableDemoState createState() => new _DataTableDemoState();
+ _DataTableDemoState createState() => _DataTableDemoState();
}
class _DataTableDemoState extends State<DataTableDemo> {
int _rowsPerPage = PaginatedDataTable.defaultRowsPerPage;
int _sortColumnIndex;
bool _sortAscending = true;
- final DessertDataSource _dessertsDataSource = new DessertDataSource();
+ final DessertDataSource _dessertsDataSource = DessertDataSource();
void _sort<T>(Comparable<T> getField(Dessert d), int columnIndex, bool ascending) {
_dessertsDataSource._sort<T>(getField, ascending);
@@ -163,12 +163,12 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(title: const Text('Data tables')),
- body: new ListView(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Data tables')),
+ body: ListView(
padding: const EdgeInsets.all(20.0),
children: <Widget>[
- new PaginatedDataTable(
+ PaginatedDataTable(
header: const Text('Nutrition'),
rowsPerPage: _rowsPerPage,
onRowsPerPageChanged: (int value) { setState(() { _rowsPerPage = value; }); },
@@ -176,43 +176,43 @@
sortAscending: _sortAscending,
onSelectAll: _dessertsDataSource._selectAll,
columns: <DataColumn>[
- new DataColumn(
+ DataColumn(
label: const Text('Dessert (100g serving)'),
onSort: (int columnIndex, bool ascending) => _sort<String>((Dessert d) => d.name, columnIndex, ascending)
),
- new DataColumn(
+ DataColumn(
label: const Text('Calories'),
tooltip: 'The total amount of food energy in the given serving size.',
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calories, columnIndex, ascending)
),
- new DataColumn(
+ DataColumn(
label: const Text('Fat (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.fat, columnIndex, ascending)
),
- new DataColumn(
+ DataColumn(
label: const Text('Carbs (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.carbs, columnIndex, ascending)
),
- new DataColumn(
+ DataColumn(
label: const Text('Protein (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.protein, columnIndex, ascending)
),
- new DataColumn(
+ DataColumn(
label: const Text('Sodium (mg)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.sodium, columnIndex, ascending)
),
- new DataColumn(
+ DataColumn(
label: const Text('Calcium (%)'),
tooltip: 'The amount of calcium as a percentage of the recommended daily amount.',
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calcium, columnIndex, ascending)
),
- new DataColumn(
+ DataColumn(
label: const Text('Iron (%)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.iron, columnIndex, ascending)
diff --git a/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart b/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart
index fe531b5..c09d714 100644
--- a/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart
@@ -24,19 +24,19 @@
@override
Widget build(BuildContext context) {
- return new InkWell(
+ return InkWell(
onTap: onPressed,
- child: new InputDecorator(
- decoration: new InputDecoration(
+ child: InputDecorator(
+ decoration: InputDecoration(
labelText: labelText,
),
baseStyle: valueStyle,
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Text(valueText, style: valueStyle),
- new Icon(Icons.arrow_drop_down,
+ Text(valueText, style: valueStyle),
+ Icon(Icons.arrow_drop_down,
color: Theme.of(context).brightness == Brightness.light ? Colors.grey.shade700 : Colors.white70
),
],
@@ -66,8 +66,8 @@
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
- firstDate: new DateTime(2015, 8),
- lastDate: new DateTime(2101)
+ firstDate: DateTime(2015, 8),
+ lastDate: DateTime(2101)
);
if (picked != null && picked != selectedDate)
selectDate(picked);
@@ -85,22 +85,22 @@
@override
Widget build(BuildContext context) {
final TextStyle valueStyle = Theme.of(context).textTheme.title;
- return new Row(
+ return Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
- new Expanded(
+ Expanded(
flex: 4,
- child: new _InputDropdown(
+ child: _InputDropdown(
labelText: labelText,
- valueText: new DateFormat.yMMMd().format(selectedDate),
+ valueText: DateFormat.yMMMd().format(selectedDate),
valueStyle: valueStyle,
onPressed: () { _selectDate(context); },
),
),
const SizedBox(width: 12.0),
- new Expanded(
+ Expanded(
flex: 3,
- child: new _InputDropdown(
+ child: _InputDropdown(
valueText: selectedTime.format(context),
valueStyle: valueStyle,
onPressed: () { _selectTime(context); },
@@ -115,29 +115,29 @@
static const String routeName = '/material/date-and-time-pickers';
@override
- _DateAndTimePickerDemoState createState() => new _DateAndTimePickerDemoState();
+ _DateAndTimePickerDemoState createState() => _DateAndTimePickerDemoState();
}
class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
- DateTime _fromDate = new DateTime.now();
+ DateTime _fromDate = DateTime.now();
TimeOfDay _fromTime = const TimeOfDay(hour: 7, minute: 28);
- DateTime _toDate = new DateTime.now();
+ DateTime _toDate = DateTime.now();
TimeOfDay _toTime = const TimeOfDay(hour: 7, minute: 28);
final List<String> _allActivities = <String>['hiking', 'swimming', 'boating', 'fishing'];
String _activity = 'fishing';
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(title: const Text('Date and time pickers')),
- body: new DropdownButtonHideUnderline(
- child: new SafeArea(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Date and time pickers')),
+ body: DropdownButtonHideUnderline(
+ child: SafeArea(
top: false,
bottom: false,
- child: new ListView(
+ child: ListView(
padding: const EdgeInsets.all(16.0),
children: <Widget>[
- new TextField(
+ TextField(
enabled: true,
decoration: const InputDecoration(
labelText: 'Event name',
@@ -145,13 +145,13 @@
),
style: Theme.of(context).textTheme.display1,
),
- new TextField(
+ TextField(
decoration: const InputDecoration(
labelText: 'Location',
),
style: Theme.of(context).textTheme.display1.copyWith(fontSize: 20.0),
),
- new _DateTimePicker(
+ _DateTimePicker(
labelText: 'From',
selectedDate: _fromDate,
selectedTime: _fromTime,
@@ -166,7 +166,7 @@
});
},
),
- new _DateTimePicker(
+ _DateTimePicker(
labelText: 'To',
selectedDate: _toDate,
selectedTime: _toTime,
@@ -181,13 +181,13 @@
});
},
),
- new InputDecorator(
+ InputDecorator(
decoration: const InputDecoration(
labelText: 'Activity',
hintText: 'Choose an activity',
),
isEmpty: _activity == null,
- child: new DropdownButton<String>(
+ child: DropdownButton<String>(
value: _activity,
isDense: true,
onChanged: (String newValue) {
@@ -196,9 +196,9 @@
});
},
items: _allActivities.map((String value) {
- return new DropdownMenuItem<String>(
+ return DropdownMenuItem<String>(
value: value,
- child: new Text(value),
+ child: Text(value),
);
}).toList(),
),
diff --git a/examples/flutter_gallery/lib/demo/material/dialog_demo.dart b/examples/flutter_gallery/lib/demo/material/dialog_demo.dart
index aa061c4..09c7a02 100644
--- a/examples/flutter_gallery/lib/demo/material/dialog_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/dialog_demo.dart
@@ -29,16 +29,16 @@
@override
Widget build(BuildContext context) {
- return new SimpleDialogOption(
+ return SimpleDialogOption(
onPressed: onPressed,
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- new Icon(icon, size: 36.0, color: color),
- new Padding(
+ Icon(icon, size: 36.0, color: color),
+ Padding(
padding: const EdgeInsets.only(left: 16.0),
- child: new Text(text),
+ child: Text(text),
),
],
),
@@ -50,19 +50,19 @@
static const String routeName = '/material/dialog';
@override
- DialogDemoState createState() => new DialogDemoState();
+ DialogDemoState createState() => DialogDemoState();
}
class DialogDemoState extends State<DialogDemo> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
TimeOfDay _selectedTime;
@override
void initState() {
super.initState();
- final DateTime now = new DateTime.now();
- _selectedTime = new TimeOfDay(hour: now.hour, minute: now.minute);
+ final DateTime now = DateTime.now();
+ _selectedTime = TimeOfDay(hour: now.hour, minute: now.minute);
}
void showDemoDialog<T>({ BuildContext context, Widget child }) {
@@ -72,8 +72,8 @@
)
.then<void>((T value) { // The value passed to Navigator.pop() or null.
if (value != null) {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text('You selected: $value')
+ _scaffoldKey.currentState.showSnackBar(SnackBar(
+ content: Text('You selected: $value')
));
}
});
@@ -84,30 +84,30 @@
final ThemeData theme = Theme.of(context);
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Dialogs')
),
- body: new ListView(
+ body: ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
children: <Widget>[
- new RaisedButton(
+ RaisedButton(
child: const Text('ALERT'),
onPressed: () {
showDemoDialog<DialogDemoAction>(
context: context,
- child: new AlertDialog(
- content: new Text(
+ child: AlertDialog(
+ content: Text(
_alertWithoutTitleText,
style: dialogTextStyle
),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('CANCEL'),
onPressed: () { Navigator.pop(context, DialogDemoAction.cancel); }
),
- new FlatButton(
+ FlatButton(
child: const Text('DISCARD'),
onPressed: () { Navigator.pop(context, DialogDemoAction.discard); }
)
@@ -116,23 +116,23 @@
);
}
),
- new RaisedButton(
+ RaisedButton(
child: const Text('ALERT WITH TITLE'),
onPressed: () {
showDemoDialog<DialogDemoAction>(
context: context,
- child: new AlertDialog(
+ child: AlertDialog(
title: const Text('Use Google\'s location service?'),
- content: new Text(
+ content: Text(
_alertWithTitleText,
style: dialogTextStyle
),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('DISAGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.disagree); }
),
- new FlatButton(
+ FlatButton(
child: const Text('AGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.agree); }
)
@@ -141,27 +141,27 @@
);
}
),
- new RaisedButton(
+ RaisedButton(
child: const Text('SIMPLE'),
onPressed: () {
showDemoDialog<String>(
context: context,
- child: new SimpleDialog(
+ child: SimpleDialog(
title: const Text('Set backup account'),
children: <Widget>[
- new DialogDemoItem(
+ DialogDemoItem(
icon: Icons.account_circle,
color: theme.primaryColor,
text: 'username@gmail.com',
onPressed: () { Navigator.pop(context, 'username@gmail.com'); }
),
- new DialogDemoItem(
+ DialogDemoItem(
icon: Icons.account_circle,
color: theme.primaryColor,
text: 'user02@gmail.com',
onPressed: () { Navigator.pop(context, 'user02@gmail.com'); }
),
- new DialogDemoItem(
+ DialogDemoItem(
icon: Icons.add_circle,
text: 'add account',
color: theme.disabledColor
@@ -171,7 +171,7 @@
);
}
),
- new RaisedButton(
+ RaisedButton(
child: const Text('CONFIRMATION'),
onPressed: () {
showTimePicker(
@@ -181,18 +181,18 @@
.then<Null>((TimeOfDay value) {
if (value != null && value != _selectedTime) {
_selectedTime = value;
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text('You selected: ${value.format(context)}')
+ _scaffoldKey.currentState.showSnackBar(SnackBar(
+ content: Text('You selected: ${value.format(context)}')
));
}
});
}
),
- new RaisedButton(
+ RaisedButton(
child: const Text('FULLSCREEN'),
onPressed: () {
- Navigator.push(context, new MaterialPageRoute<DismissDialogAction>(
- builder: (BuildContext context) => new FullScreenDialogDemo(),
+ Navigator.push(context, MaterialPageRoute<DismissDialogAction>(
+ builder: (BuildContext context) => FullScreenDialogDemo(),
fullscreenDialog: true,
));
}
@@ -200,7 +200,7 @@
]
// Add a little space between the buttons
.map((Widget button) {
- return new Container(
+ return Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: button
);
diff --git a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
index dfceb25..19bd0c5 100644
--- a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
@@ -13,11 +13,11 @@
static const String routeName = '/material/drawer';
@override
- _DrawerDemoState createState() => new _DrawerDemoState();
+ _DrawerDemoState createState() => _DrawerDemoState();
}
class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
static const List<String> _drawerContents = <String>[
'A', 'B', 'C', 'D', 'E',
@@ -31,18 +31,18 @@
@override
void initState() {
super.initState();
- _controller = new AnimationController(
+ _controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 200),
);
- _drawerContentsOpacity = new CurvedAnimation(
- parent: new ReverseAnimation(_controller),
+ _drawerContentsOpacity = CurvedAnimation(
+ parent: ReverseAnimation(_controller),
curve: Curves.fastOutSlowIn,
);
- _drawerDetailsPosition = new Tween<Offset>(
+ _drawerDetailsPosition = Tween<Offset>(
begin: const Offset(0.0, -1.0),
end: Offset.zero,
- ).animate(new CurvedAnimation(
+ ).animate(CurvedAnimation(
parent: _controller,
curve: Curves.fastOutSlowIn,
));
@@ -75,11 +75,11 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
- leading: new IconButton(
- icon: new Icon(_backIcon()),
+ appBar: AppBar(
+ leading: IconButton(
+ icon: Icon(_backIcon()),
alignment: Alignment.centerLeft,
tooltip: 'Back',
onPressed: () {
@@ -88,10 +88,10 @@
),
title: const Text('Navigation drawer'),
),
- drawer: new Drawer(
- child: new Column(
+ drawer: Drawer(
+ child: Column(
children: <Widget>[
- new UserAccountsDrawerHeader(
+ UserAccountsDrawerHeader(
accountName: const Text('Trevor Widget'),
accountEmail: const Text('trevor.widget@example.com'),
currentAccountPicture: const CircleAvatar(
@@ -101,11 +101,11 @@
),
),
otherAccountsPictures: <Widget>[
- new GestureDetector(
+ GestureDetector(
onTap: () {
_onOtherAccountsTap(context);
},
- child: new Semantics(
+ child: Semantics(
label: 'Switch to Account B',
child: const CircleAvatar(
backgroundImage: AssetImage(
@@ -115,11 +115,11 @@
),
),
),
- new GestureDetector(
+ GestureDetector(
onTap: () {
_onOtherAccountsTap(context);
},
- child: new Semantics(
+ child: Semantics(
label: 'Switch to Account C',
child: const CircleAvatar(
backgroundImage: AssetImage(
@@ -139,46 +139,46 @@
_controller.forward();
},
),
- new MediaQuery.removePadding(
+ MediaQuery.removePadding(
context: context,
// DrawerHeader consumes top MediaQuery padding.
removeTop: true,
- child: new Expanded(
- child: new ListView(
+ child: Expanded(
+ child: ListView(
padding: const EdgeInsets.only(top: 8.0),
children: <Widget>[
- new Stack(
+ Stack(
children: <Widget>[
// The initial contents of the drawer.
- new FadeTransition(
+ FadeTransition(
opacity: _drawerContentsOpacity,
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _drawerContents.map((String id) {
- return new ListTile(
- leading: new CircleAvatar(child: new Text(id)),
- title: new Text('Drawer item $id'),
+ return ListTile(
+ leading: CircleAvatar(child: Text(id)),
+ title: Text('Drawer item $id'),
onTap: _showNotImplementedMessage,
);
}).toList(),
),
),
// The drawer's "details" view.
- new SlideTransition(
+ SlideTransition(
position: _drawerDetailsPosition,
- child: new FadeTransition(
- opacity: new ReverseAnimation(_drawerContentsOpacity),
- child: new Column(
+ child: FadeTransition(
+ opacity: ReverseAnimation(_drawerContentsOpacity),
+ child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
- new ListTile(
+ ListTile(
leading: const Icon(Icons.add),
title: const Text('Add account'),
onTap: _showNotImplementedMessage,
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.settings),
title: const Text('Manage accounts'),
onTap: _showNotImplementedMessage,
@@ -196,19 +196,19 @@
],
),
),
- body: new Center(
- child: new InkWell(
+ body: Center(
+ child: InkWell(
onTap: () {
_scaffoldKey.currentState.openDrawer();
},
- child: new Semantics(
+ child: Semantics(
button: true,
label: 'Open drawer',
excludeSemantics: true,
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Container(
+ Container(
width: 100.0,
height: 100.0,
decoration: const BoxDecoration(
@@ -221,9 +221,9 @@
),
),
),
- new Padding(
+ Padding(
padding: const EdgeInsets.only(top: 8.0),
- child: new Text('Tap here to open the drawer',
+ child: Text('Tap here to open the drawer',
style: Theme.of(context).textTheme.subhead,
),
),
@@ -239,10 +239,10 @@
showDialog<void>(
context: context,
builder: (BuildContext context) {
- return new AlertDialog(
+ return AlertDialog(
title: const Text('Account switching not implemented.'),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('OK'),
onPressed: () {
Navigator.pop(context);
diff --git a/examples/flutter_gallery/lib/demo/material/elevation_demo.dart b/examples/flutter_gallery/lib/demo/material/elevation_demo.dart
index 8f63dd6..986fc72 100644
--- a/examples/flutter_gallery/lib/demo/material/elevation_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/elevation_demo.dart
@@ -24,15 +24,15 @@
];
return elevations.map((double elevation) {
- return new Center(
- child: new Card(
+ return Center(
+ child: Card(
margin: const EdgeInsets.all(20.0),
elevation: _showElevation ? elevation : 0.0,
- child: new SizedBox(
+ child: SizedBox(
height: 100.0,
width: 100.0,
- child: new Center(
- child: new Text('${elevation.toStringAsFixed(0)} pt'),
+ child: Center(
+ child: Text('${elevation.toStringAsFixed(0)} pt'),
),
),
),
@@ -42,11 +42,11 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Elevation'),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() => _showElevation = !_showElevation);
@@ -54,7 +54,7 @@
)
],
),
- body: new ListView(
+ body: ListView(
children: buildCards(),
),
);
diff --git a/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart b/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
index 0363ffd..15ec62f 100644
--- a/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
@@ -27,7 +27,7 @@
final bool showHint;
Widget _crossFade(Widget first, Widget second, bool isExpanded) {
- return new AnimatedCrossFade(
+ return AnimatedCrossFade(
firstChild: first,
secondChild: second,
firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn),
@@ -43,29 +43,29 @@
final ThemeData theme = Theme.of(context);
final TextTheme textTheme = theme.textTheme;
- return new Row(
+ return Row(
children: <Widget>[
- new Expanded(
+ Expanded(
flex: 2,
- child: new Container(
+ child: Container(
margin: const EdgeInsets.only(left: 24.0),
- child: new FittedBox(
+ child: FittedBox(
fit: BoxFit.scaleDown,
alignment: Alignment.centerLeft,
- child: new Text(
+ child: Text(
name,
style: textTheme.body1.copyWith(fontSize: 15.0),
),
),
),
),
- new Expanded(
+ Expanded(
flex: 3,
- child: new Container(
+ child: Container(
margin: const EdgeInsets.only(left: 24.0),
child: _crossFade(
- new Text(value, style: textTheme.caption.copyWith(fontSize: 15.0)),
- new Text(hint, style: textTheme.caption.copyWith(fontSize: 15.0)),
+ Text(value, style: textTheme.caption.copyWith(fontSize: 15.0)),
+ Text(hint, style: textTheme.caption.copyWith(fontSize: 15.0)),
showHint
)
)
@@ -93,30 +93,30 @@
final ThemeData theme = Theme.of(context);
final TextTheme textTheme = theme.textTheme;
- return new Column(
+ return Column(
children: <Widget>[
- new Container(
+ Container(
margin: const EdgeInsets.only(
left: 24.0,
right: 24.0,
bottom: 24.0
) - margin,
- child: new Center(
- child: new DefaultTextStyle(
+ child: Center(
+ child: DefaultTextStyle(
style: textTheme.caption.copyWith(fontSize: 15.0),
child: child
)
)
),
const Divider(height: 1.0),
- new Container(
+ Container(
padding: const EdgeInsets.symmetric(vertical: 16.0),
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
- new Container(
+ Container(
margin: const EdgeInsets.only(right: 8.0),
- child: new FlatButton(
+ child: FlatButton(
onPressed: onCancel,
child: const Text('CANCEL', style: TextStyle(
color: Colors.black54,
@@ -125,9 +125,9 @@
))
)
),
- new Container(
+ Container(
margin: const EdgeInsets.only(right: 8.0),
- child: new FlatButton(
+ child: FlatButton(
onPressed: onSave,
textTheme: ButtonTextTheme.accent,
child: const Text('SAVE')
@@ -148,7 +148,7 @@
this.hint,
this.builder,
this.valueToString
- }) : textController = new TextEditingController(text: valueToString(value));
+ }) : textController = TextEditingController(text: valueToString(value));
final String name;
final String hint;
@@ -160,7 +160,7 @@
ExpansionPanelHeaderBuilder get headerBuilder {
return (BuildContext context, bool isExpanded) {
- return new DualHeaderWithHint(
+ return DualHeaderWithHint(
name: name,
value: valueToString(value),
hint: hint,
@@ -176,7 +176,7 @@
static const String routeName = '/material/expansion_panels';
@override
- _ExpansionPanelsDemoState createState() => new _ExpansionPanelsDemoState();
+ _ExpansionPanelsDemoState createState() => _ExpansionPanelsDemoState();
}
class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
@@ -187,7 +187,7 @@
super.initState();
_demoItems = <DemoItem<dynamic>>[
- new DemoItem<String>(
+ DemoItem<String>(
name: 'Trip',
value: 'Caribbean cruise',
hint: 'Change trip name',
@@ -199,18 +199,18 @@
});
}
- return new Form(
- child: new Builder(
+ return Form(
+ child: Builder(
builder: (BuildContext context) {
- return new CollapsibleBody(
+ return CollapsibleBody(
margin: const EdgeInsets.symmetric(horizontal: 16.0),
onSave: () { Form.of(context).save(); close(); },
onCancel: () { Form.of(context).reset(); close(); },
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: new TextFormField(
+ child: TextFormField(
controller: item.textController,
- decoration: new InputDecoration(
+ decoration: InputDecoration(
hintText: item.hint,
labelText: item.name,
),
@@ -223,7 +223,7 @@
);
},
),
- new DemoItem<_Location>(
+ DemoItem<_Location>(
name: 'Location',
value: _Location.Bahamas,
hint: 'Select location',
@@ -234,24 +234,24 @@
item.isExpanded = false;
});
}
- return new Form(
- child: new Builder(
+ return Form(
+ child: Builder(
builder: (BuildContext context) {
- return new CollapsibleBody(
+ return CollapsibleBody(
onSave: () { Form.of(context).save(); close(); },
onCancel: () { Form.of(context).reset(); close(); },
- child: new FormField<_Location>(
+ child: FormField<_Location>(
initialValue: item.value,
onSaved: (_Location result) { item.value = result; },
builder: (FormFieldState<_Location> field) {
- return new Column(
+ return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Row(
+ Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Radio<_Location>(
+ Radio<_Location>(
value: _Location.Bahamas,
groupValue: field.value,
onChanged: field.didChange,
@@ -259,10 +259,10 @@
const Text('Bahamas')
]
),
- new Row(
+ Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Radio<_Location>(
+ Radio<_Location>(
value: _Location.Barbados,
groupValue: field.value,
onChanged: field.didChange,
@@ -270,10 +270,10 @@
const Text('Barbados')
]
),
- new Row(
+ Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Radio<_Location>(
+ Radio<_Location>(
value: _Location.Bermuda,
groupValue: field.value,
onChanged: field.didChange,
@@ -291,7 +291,7 @@
);
}
),
- new DemoItem<double>(
+ DemoItem<double>(
name: 'Sun',
value: 80.0,
hint: 'Select sun level',
@@ -303,17 +303,17 @@
});
}
- return new Form(
- child: new Builder(
+ return Form(
+ child: Builder(
builder: (BuildContext context) {
- return new CollapsibleBody(
+ return CollapsibleBody(
onSave: () { Form.of(context).save(); close(); },
onCancel: () { Form.of(context).reset(); close(); },
- child: new FormField<double>(
+ child: FormField<double>(
initialValue: item.value,
onSaved: (double value) { item.value = value; },
builder: (FormFieldState<double> field) {
- return new Slider(
+ return Slider(
min: 0.0,
max: 100.0,
divisions: 5,
@@ -335,22 +335,22 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(title: const Text('Expansion panels')),
- body: new SingleChildScrollView(
- child: new SafeArea(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Expansion panels')),
+ body: SingleChildScrollView(
+ child: SafeArea(
top: false,
bottom: false,
- child: new Container(
+ child: Container(
margin: const EdgeInsets.all(24.0),
- child: new ExpansionPanelList(
+ child: ExpansionPanelList(
expansionCallback: (int index, bool isExpanded) {
setState(() {
_demoItems[index].isExpanded = !isExpanded;
});
},
children: _demoItems.map((DemoItem<dynamic> item) {
- return new ExpansionPanel(
+ return ExpansionPanel(
isExpanded: item.isExpanded,
headerBuilder: item.headerBuilder,
body: item.build()
diff --git a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart
index 396dfa7..99db465 100644
--- a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart
@@ -19,8 +19,8 @@
class DateTimeItem extends StatelessWidget {
DateTimeItem({ Key key, DateTime dateTime, @required this.onChanged })
: assert(onChanged != null),
- date = new DateTime(dateTime.year, dateTime.month, dateTime.day),
- time = new TimeOfDay(hour: dateTime.hour, minute: dateTime.minute),
+ date = DateTime(dateTime.year, dateTime.month, dateTime.day),
+ time = TimeOfDay(hour: dateTime.hour, minute: dateTime.minute),
super(key: key);
final DateTime date;
@@ -31,17 +31,17 @@
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new DefaultTextStyle(
+ return DefaultTextStyle(
style: theme.textTheme.subhead,
- child: new Row(
+ child: Row(
children: <Widget>[
- new Expanded(
- child: new Container(
+ Expanded(
+ child: Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
- decoration: new BoxDecoration(
- border: new Border(bottom: new BorderSide(color: theme.dividerColor))
+ decoration: BoxDecoration(
+ border: Border(bottom: BorderSide(color: theme.dividerColor))
),
- child: new InkWell(
+ child: InkWell(
onTap: () {
showDatePicker(
context: context,
@@ -51,26 +51,26 @@
)
.then<Null>((DateTime value) {
if (value != null)
- onChanged(new DateTime(value.year, value.month, value.day, time.hour, time.minute));
+ onChanged(DateTime(value.year, value.month, value.day, time.hour, time.minute));
});
},
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
- new Text(new DateFormat('EEE, MMM d yyyy').format(date)),
+ Text(DateFormat('EEE, MMM d yyyy').format(date)),
const Icon(Icons.arrow_drop_down, color: Colors.black54),
]
)
)
)
),
- new Container(
+ Container(
margin: const EdgeInsets.only(left: 8.0),
padding: const EdgeInsets.symmetric(vertical: 8.0),
- decoration: new BoxDecoration(
- border: new Border(bottom: new BorderSide(color: theme.dividerColor))
+ decoration: BoxDecoration(
+ border: Border(bottom: BorderSide(color: theme.dividerColor))
),
- child: new InkWell(
+ child: InkWell(
onTap: () {
showTimePicker(
context: context,
@@ -78,12 +78,12 @@
)
.then<Null>((TimeOfDay value) {
if (value != null)
- onChanged(new DateTime(date.year, date.month, date.day, value.hour, value.minute));
+ onChanged(DateTime(date.year, date.month, date.day, value.hour, value.minute));
});
},
- child: new Row(
+ child: Row(
children: <Widget>[
- new Text('${time.format(context)}'),
+ Text('${time.format(context)}'),
const Icon(Icons.arrow_drop_down, color: Colors.black54),
]
)
@@ -97,12 +97,12 @@
class FullScreenDialogDemo extends StatefulWidget {
@override
- FullScreenDialogDemoState createState() => new FullScreenDialogDemoState();
+ FullScreenDialogDemoState createState() => FullScreenDialogDemoState();
}
class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
- DateTime _fromDateTime = new DateTime.now();
- DateTime _toDateTime = new DateTime.now();
+ DateTime _fromDateTime = DateTime.now();
+ DateTime _toDateTime = DateTime.now();
bool _allDayValue = false;
bool _saveNeeded = false;
bool _hasLocation = false;
@@ -120,19 +120,19 @@
return await showDialog<bool>(
context: context,
builder: (BuildContext context) {
- return new AlertDialog(
- content: new Text(
+ return AlertDialog(
+ content: Text(
'Discard new event?',
style: dialogTextStyle
),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop(false); // Pops the confirmation dialog but not the page.
}
),
- new FlatButton(
+ FlatButton(
child: const Text('DISCARD'),
onPressed: () {
Navigator.of(context).pop(true); // Returning true to _onWillPop will pop again.
@@ -148,27 +148,27 @@
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new Scaffold(
- appBar: new AppBar(
- title: new Text(_hasName ? _eventName : 'Event Name TBD'),
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(_hasName ? _eventName : 'Event Name TBD'),
actions: <Widget> [
- new FlatButton(
- child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
+ FlatButton(
+ child: Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
onPressed: () {
Navigator.pop(context, DismissDialogAction.save);
}
)
]
),
- body: new Form(
+ body: Form(
onWillPop: _onWillPop,
- child: new ListView(
+ child: ListView(
padding: const EdgeInsets.all(16.0),
children: <Widget>[
- new Container(
+ Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
alignment: Alignment.bottomLeft,
- child: new TextField(
+ child: TextField(
decoration: const InputDecoration(
labelText: 'Event name',
filled: true
@@ -184,10 +184,10 @@
}
)
),
- new Container(
+ Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
alignment: Alignment.bottomLeft,
- child: new TextField(
+ child: TextField(
decoration: const InputDecoration(
labelText: 'Location',
hintText: 'Where is the event?',
@@ -200,11 +200,11 @@
}
)
),
- new Column(
+ Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Text('From', style: theme.textTheme.caption),
- new DateTimeItem(
+ Text('From', style: theme.textTheme.caption),
+ DateTimeItem(
dateTime: _fromDateTime,
onChanged: (DateTime value) {
setState(() {
@@ -215,11 +215,11 @@
)
]
),
- new Column(
+ Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Text('To', style: theme.textTheme.caption),
- new DateTimeItem(
+ Text('To', style: theme.textTheme.caption),
+ DateTimeItem(
dateTime: _toDateTime,
onChanged: (DateTime value) {
setState(() {
@@ -231,13 +231,13 @@
const Text('All-day'),
]
),
- new Container(
- decoration: new BoxDecoration(
- border: new Border(bottom: new BorderSide(color: theme.dividerColor))
+ Container(
+ decoration: BoxDecoration(
+ border: Border(bottom: BorderSide(color: theme.dividerColor))
),
- child: new Row(
+ child: Row(
children: <Widget> [
- new Checkbox(
+ Checkbox(
value: _allDayValue,
onChanged: (bool value) {
setState(() {
@@ -252,7 +252,7 @@
)
]
.map((Widget child) {
- return new Container(
+ return Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
height: 96.0,
child: child
diff --git a/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart b/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart
index 1f6ee00..418e045 100644
--- a/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart
@@ -41,7 +41,7 @@
final Photo photo;
@override
- _GridPhotoViewerState createState() => new _GridPhotoViewerState();
+ _GridPhotoViewerState createState() => _GridPhotoViewerState();
}
class _GridTitleText extends StatelessWidget {
@@ -51,10 +51,10 @@
@override
Widget build(BuildContext context) {
- return new FittedBox(
+ return FittedBox(
fit: BoxFit.scaleDown,
alignment: Alignment.centerLeft,
- child: new Text(text),
+ child: Text(text),
);
}
}
@@ -70,7 +70,7 @@
@override
void initState() {
super.initState();
- _controller = new AnimationController(vsync: this)
+ _controller = AnimationController(vsync: this)
..addListener(_handleFlingAnimation);
}
@@ -84,8 +84,8 @@
// then the minimum offset value is w - _scale * w, h - _scale * h.
Offset _clampOffset(Offset offset) {
final Size size = context.size;
- final Offset minOffset = new Offset(size.width, size.height) * (1.0 - _scale);
- return new Offset(offset.dx.clamp(minOffset.dx, 0.0), offset.dy.clamp(minOffset.dy, 0.0));
+ final Offset minOffset = Offset(size.width, size.height) * (1.0 - _scale);
+ return Offset(offset.dx.clamp(minOffset.dx, 0.0), offset.dy.clamp(minOffset.dy, 0.0));
}
void _handleFlingAnimation() {
@@ -117,7 +117,7 @@
return;
final Offset direction = details.velocity.pixelsPerSecond / magnitude;
final double distance = (Offset.zero & context.size).shortestSide;
- _flingAnimation = new Tween<Offset>(
+ _flingAnimation = Tween<Offset>(
begin: _offset,
end: _clampOffset(_offset + direction * distance)
).animate(_controller);
@@ -128,16 +128,16 @@
@override
Widget build(BuildContext context) {
- return new GestureDetector(
+ return GestureDetector(
onScaleStart: _handleOnScaleStart,
onScaleUpdate: _handleOnScaleUpdate,
onScaleEnd: _handleOnScaleEnd,
- child: new ClipRect(
- child: new Transform(
- transform: new Matrix4.identity()
+ child: ClipRect(
+ child: Transform(
+ transform: Matrix4.identity()
..translate(_offset.dx, _offset.dy)
..scale(_scale),
- child: new Image.asset(
+ child: Image.asset(
widget.photo.assetName,
package: widget.photo.assetPackage,
fit: BoxFit.cover,
@@ -164,16 +164,16 @@
final BannerTapCallback onBannerTap; // User taps on the photo's header or footer.
void showPhoto(BuildContext context) {
- Navigator.push(context, new MaterialPageRoute<void>(
+ Navigator.push(context, MaterialPageRoute<void>(
builder: (BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
- title: new Text(photo.title)
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(photo.title)
),
- body: new SizedBox.expand(
- child: new Hero(
+ body: SizedBox.expand(
+ child: Hero(
tag: photo.tag,
- child: new GridPhotoViewer(photo: photo),
+ child: GridPhotoViewer(photo: photo),
),
),
);
@@ -183,12 +183,12 @@
@override
Widget build(BuildContext context) {
- final Widget image = new GestureDetector(
+ final Widget image = GestureDetector(
onTap: () { showPhoto(context); },
- child: new Hero(
- key: new Key(photo.assetName),
+ child: Hero(
+ key: Key(photo.assetName),
tag: photo.tag,
- child: new Image.asset(
+ child: Image.asset(
photo.assetName,
package: photo.assetPackage,
fit: BoxFit.cover,
@@ -203,13 +203,13 @@
return image;
case GridDemoTileStyle.oneLine:
- return new GridTile(
- header: new GestureDetector(
+ return GridTile(
+ header: GestureDetector(
onTap: () { onBannerTap(photo); },
- child: new GridTileBar(
- title: new _GridTitleText(photo.title),
+ child: GridTileBar(
+ title: _GridTitleText(photo.title),
backgroundColor: Colors.black45,
- leading: new Icon(
+ leading: Icon(
icon,
color: Colors.white,
),
@@ -219,14 +219,14 @@
);
case GridDemoTileStyle.twoLine:
- return new GridTile(
- footer: new GestureDetector(
+ return GridTile(
+ footer: GestureDetector(
onTap: () { onBannerTap(photo); },
- child: new GridTileBar(
+ child: GridTileBar(
backgroundColor: Colors.black45,
- title: new _GridTitleText(photo.title),
- subtitle: new _GridTitleText(photo.caption),
- trailing: new Icon(
+ title: _GridTitleText(photo.title),
+ subtitle: _GridTitleText(photo.caption),
+ trailing: Icon(
icon,
color: Colors.white,
),
@@ -246,80 +246,80 @@
static const String routeName = '/material/grid-list';
@override
- GridListDemoState createState() => new GridListDemoState();
+ GridListDemoState createState() => GridListDemoState();
}
class GridListDemoState extends State<GridListDemo> {
GridDemoTileStyle _tileStyle = GridDemoTileStyle.twoLine;
List<Photo> photos = <Photo>[
- new Photo(
+ Photo(
assetName: 'places/india_chennai_flower_market.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Chennai',
caption: 'Flower Market',
),
- new Photo(
+ Photo(
assetName: 'places/india_tanjore_bronze_works.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Tanjore',
caption: 'Bronze Works',
),
- new Photo(
+ Photo(
assetName: 'places/india_tanjore_market_merchant.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Tanjore',
caption: 'Market',
),
- new Photo(
+ Photo(
assetName: 'places/india_tanjore_thanjavur_temple.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Tanjore',
caption: 'Thanjavur Temple',
),
- new Photo(
+ Photo(
assetName: 'places/india_tanjore_thanjavur_temple_carvings.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Tanjore',
caption: 'Thanjavur Temple',
),
- new Photo(
+ Photo(
assetName: 'places/india_pondicherry_salt_farm.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Pondicherry',
caption: 'Salt Farm',
),
- new Photo(
+ Photo(
assetName: 'places/india_chennai_highway.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Chennai',
caption: 'Scooters',
),
- new Photo(
+ Photo(
assetName: 'places/india_chettinad_silk_maker.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Chettinad',
caption: 'Silk Maker',
),
- new Photo(
+ Photo(
assetName: 'places/india_chettinad_produce.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Chettinad',
caption: 'Lunch Prep',
),
- new Photo(
+ Photo(
assetName: 'places/india_tanjore_market_technology.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Tanjore',
caption: 'Market',
),
- new Photo(
+ Photo(
assetName: 'places/india_pondicherry_beach.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Pondicherry',
caption: 'Beach',
),
- new Photo(
+ Photo(
assetName: 'places/india_pondicherry_fisherman.png',
assetPackage: _kGalleryAssetsPackage,
title: 'Pondicherry',
@@ -336,11 +336,11 @@
@override
Widget build(BuildContext context) {
final Orientation orientation = MediaQuery.of(context).orientation;
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Grid list'),
actions: <Widget>[
- new PopupMenuButton<GridDemoTileStyle>(
+ PopupMenuButton<GridDemoTileStyle>(
onSelected: changeTileStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<GridDemoTileStyle>>[
const PopupMenuItem<GridDemoTileStyle>(
@@ -359,20 +359,20 @@
),
],
),
- body: new Column(
+ body: Column(
children: <Widget>[
- new Expanded(
- child: new SafeArea(
+ Expanded(
+ child: SafeArea(
top: false,
bottom: false,
- child: new GridView.count(
+ child: GridView.count(
crossAxisCount: (orientation == Orientation.portrait) ? 2 : 3,
mainAxisSpacing: 4.0,
crossAxisSpacing: 4.0,
padding: const EdgeInsets.all(4.0),
childAspectRatio: (orientation == Orientation.portrait) ? 1.0 : 1.3,
children: photos.map((Photo photo) {
- return new GridDemoPhotoItem(
+ return GridDemoPhotoItem(
photo: photo,
tileStyle: _tileStyle,
onBannerTap: (Photo photo) {
diff --git a/examples/flutter_gallery/lib/demo/material/icons_demo.dart b/examples/flutter_gallery/lib/demo/material/icons_demo.dart
index d5692f0..60bd9c5 100644
--- a/examples/flutter_gallery/lib/demo/material/icons_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/icons_demo.dart
@@ -8,7 +8,7 @@
static const String routeName = '/material/icons';
@override
- IconsDemoState createState() => new IconsDemoState();
+ IconsDemoState createState() => IconsDemoState();
}
class IconsDemoState extends State<IconsDemo> {
@@ -46,21 +46,21 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Icons')
),
- body: new IconTheme(
- data: new IconThemeData(color: iconColor),
- child: new SafeArea(
+ body: IconTheme(
+ data: IconThemeData(color: iconColor),
+ child: SafeArea(
top: false,
bottom: false,
- child: new ListView(
+ child: ListView(
padding: const EdgeInsets.all(24.0),
children: <Widget>[
- new _IconsDemoCard(handleIconButtonPress, Icons.face), // direction-agnostic icon
+ _IconsDemoCard(handleIconButtonPress, Icons.face), // direction-agnostic icon
const SizedBox(height: 24.0),
- new _IconsDemoCard(handleIconButtonPress, Icons.battery_unknown), // direction-aware icon
+ _IconsDemoCard(handleIconButtonPress, Icons.battery_unknown), // direction-aware icon
],
),
),
@@ -76,8 +76,8 @@
final IconData icon;
Widget _buildIconButton(double iconSize, IconData icon, bool enabled) {
- return new IconButton(
- icon: new Icon(icon),
+ return IconButton(
+ icon: Icon(icon),
iconSize: iconSize,
tooltip: "${enabled ? 'Enabled' : 'Disabled'} icon button",
onPressed: enabled ? handleIconButtonPress : null
@@ -85,14 +85,14 @@
}
Widget _centeredText(String label) =>
- new Padding(
+ Padding(
// Match the default padding of IconButton.
padding: const EdgeInsets.all(8.0),
- child: new Text(label, textAlign: TextAlign.center),
+ child: Text(label, textAlign: TextAlign.center),
);
TableRow _buildIconRow(double size) {
- return new TableRow(
+ return TableRow(
children: <Widget> [
_centeredText(size.floor().toString()),
_buildIconButton(size, icon, true),
@@ -105,15 +105,15 @@
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
- return new Card(
- child: new DefaultTextStyle(
+ return Card(
+ child: DefaultTextStyle(
style: textStyle,
- child: new Semantics(
+ child: Semantics(
explicitChildNodes: true,
- child: new Table(
+ child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
children: <TableRow> [
- new TableRow(
+ TableRow(
children: <Widget> [
_centeredText('Size'),
_centeredText('Enabled'),
diff --git a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
index d55c0c2..d85b1e0 100644
--- a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
@@ -35,17 +35,17 @@
static const String routeName = '/material/leave-behind';
@override
- LeaveBehindDemoState createState() => new LeaveBehindDemoState();
+ LeaveBehindDemoState createState() => LeaveBehindDemoState();
}
class LeaveBehindDemoState extends State<LeaveBehindDemo> {
- static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ static final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
DismissDirection _dismissDirection = DismissDirection.horizontal;
List<LeaveBehindItem> leaveBehindItems;
void initListItems() {
- leaveBehindItems = new List<LeaveBehindItem>.generate(16, (int index) {
- return new LeaveBehindItem(
+ leaveBehindItems = List<LeaveBehindItem>.generate(16, (int index) {
+ return LeaveBehindItem(
index: index,
name: 'Item $index Sender',
subject: 'Subject: $index',
@@ -90,9 +90,9 @@
setState(() {
leaveBehindItems.remove(item);
});
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text('You archived item ${item.index}'),
- action: new SnackBarAction(
+ _scaffoldKey.currentState.showSnackBar(SnackBar(
+ content: Text('You archived item ${item.index}'),
+ action: SnackBarAction(
label: 'UNDO',
onPressed: () { handleUndo(item); }
)
@@ -103,9 +103,9 @@
setState(() {
leaveBehindItems.remove(item);
});
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text('You deleted item ${item.index}'),
- action: new SnackBarAction(
+ _scaffoldKey.currentState.showSnackBar(SnackBar(
+ content: Text('You deleted item ${item.index}'),
+ action: SnackBarAction(
label: 'UNDO',
onPressed: () { handleUndo(item); }
)
@@ -116,16 +116,16 @@
Widget build(BuildContext context) {
Widget body;
if (leaveBehindItems.isEmpty) {
- body = new Center(
- child: new RaisedButton(
+ body = Center(
+ child: RaisedButton(
onPressed: () => handleDemoAction(LeaveBehindDemoAction.reset),
child: const Text('Reset the list'),
),
);
} else {
- body = new ListView(
+ body = ListView(
children: leaveBehindItems.map((LeaveBehindItem item) {
- return new _LeaveBehindListItem(
+ return _LeaveBehindListItem(
item: item,
onArchive: _handleArchive,
onDelete: _handleDelete,
@@ -135,12 +135,12 @@
);
}
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Swipe to dismiss'),
actions: <Widget>[
- new PopupMenuButton<LeaveBehindDemoAction>(
+ PopupMenuButton<LeaveBehindDemoAction>(
onSelected: handleDemoAction,
itemBuilder: (BuildContext context) => <PopupMenuEntry<LeaveBehindDemoAction>>[
const PopupMenuItem<LeaveBehindDemoAction>(
@@ -148,17 +148,17 @@
child: Text('Reset the list')
),
const PopupMenuDivider(),
- new CheckedPopupMenuItem<LeaveBehindDemoAction>(
+ CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.horizontalSwipe,
checked: _dismissDirection == DismissDirection.horizontal,
child: const Text('Horizontal swipe')
),
- new CheckedPopupMenuItem<LeaveBehindDemoAction>(
+ CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.leftSwipe,
checked: _dismissDirection == DismissDirection.endToStart,
child: const Text('Only swipe left')
),
- new CheckedPopupMenuItem<LeaveBehindDemoAction>(
+ CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.rightSwipe,
checked: _dismissDirection == DismissDirection.startToEnd,
child: const Text('Only swipe right')
@@ -197,13 +197,13 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new Semantics(
+ return Semantics(
customSemanticsActions: <CustomSemanticsAction, VoidCallback>{
const CustomSemanticsAction(label: 'Archive'): _handleArchive,
const CustomSemanticsAction(label: 'Delete'): _handleDelete,
},
- child: new Dismissible(
- key: new ObjectKey(item),
+ child: Dismissible(
+ key: ObjectKey(item),
direction: dismissDirection,
onDismissed: (DismissDirection direction) {
if (direction == DismissDirection.endToStart)
@@ -211,26 +211,26 @@
else
_handleDelete();
},
- background: new Container(
+ background: Container(
color: theme.primaryColor,
child: const ListTile(
leading: Icon(Icons.delete, color: Colors.white, size: 36.0)
)
),
- secondaryBackground: new Container(
+ secondaryBackground: Container(
color: theme.primaryColor,
child: const ListTile(
trailing: Icon(Icons.archive, color: Colors.white, size: 36.0)
)
),
- child: new Container(
- decoration: new BoxDecoration(
+ child: Container(
+ decoration: BoxDecoration(
color: theme.canvasColor,
- border: new Border(bottom: new BorderSide(color: theme.dividerColor))
+ border: Border(bottom: BorderSide(color: theme.dividerColor))
),
- child: new ListTile(
- title: new Text(item.name),
- subtitle: new Text('${item.subject}\n${item.body}'),
+ child: ListTile(
+ title: Text(item.name),
+ subtitle: Text('${item.subject}\n${item.body}'),
isThreeLine: true
),
),
diff --git a/examples/flutter_gallery/lib/demo/material/list_demo.dart b/examples/flutter_gallery/lib/demo/material/list_demo.dart
index ab5baf7..2353f02 100644
--- a/examples/flutter_gallery/lib/demo/material/list_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/list_demo.dart
@@ -24,11 +24,11 @@
static const String routeName = '/material/list';
@override
- _ListDemoState createState() => new _ListDemoState();
+ _ListDemoState createState() => _ListDemoState();
}
class _ListDemoState extends State<ListDemo> {
- static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
+ static final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
PersistentBottomSheetController<Null> _bottomSheet;
_MaterialListType _itemType = _MaterialListType.threeLine;
@@ -50,52 +50,52 @@
void _showConfigurationSheet() {
final PersistentBottomSheetController<Null> bottomSheet = scaffoldKey.currentState.showBottomSheet((BuildContext bottomSheetContext) {
- return new Container(
+ return Container(
decoration: const BoxDecoration(
border: Border(top: BorderSide(color: Colors.black26)),
),
- child: new ListView(
+ child: ListView(
shrinkWrap: true,
primary: false,
children: <Widget>[
- new MergeSemantics(
- child: new ListTile(
+ MergeSemantics(
+ child: ListTile(
dense: true,
title: const Text('One-line'),
- trailing: new Radio<_MaterialListType>(
+ trailing: Radio<_MaterialListType>(
value: _showAvatars ? _MaterialListType.oneLineWithAvatar : _MaterialListType.oneLine,
groupValue: _itemType,
onChanged: changeItemType,
)
),
),
- new MergeSemantics(
- child: new ListTile(
+ MergeSemantics(
+ child: ListTile(
dense: true,
title: const Text('Two-line'),
- trailing: new Radio<_MaterialListType>(
+ trailing: Radio<_MaterialListType>(
value: _MaterialListType.twoLine,
groupValue: _itemType,
onChanged: changeItemType,
)
),
),
- new MergeSemantics(
- child: new ListTile(
+ MergeSemantics(
+ child: ListTile(
dense: true,
title: const Text('Three-line'),
- trailing: new Radio<_MaterialListType>(
+ trailing: Radio<_MaterialListType>(
value: _MaterialListType.threeLine,
groupValue: _itemType,
onChanged: changeItemType,
),
),
),
- new MergeSemantics(
- child: new ListTile(
+ MergeSemantics(
+ child: ListTile(
dense: true,
title: const Text('Show avatar'),
- trailing: new Checkbox(
+ trailing: Checkbox(
value: _showAvatars,
onChanged: (bool value) {
setState(() {
@@ -106,11 +106,11 @@
),
),
),
- new MergeSemantics(
- child: new ListTile(
+ MergeSemantics(
+ child: ListTile(
dense: true,
title: const Text('Show icon'),
- trailing: new Checkbox(
+ trailing: Checkbox(
value: _showIcons,
onChanged: (bool value) {
setState(() {
@@ -121,11 +121,11 @@
),
),
),
- new MergeSemantics(
- child: new ListTile(
+ MergeSemantics(
+ child: ListTile(
dense: true,
title: const Text('Show dividers'),
- trailing: new Checkbox(
+ trailing: Checkbox(
value: _showDividers,
onChanged: (bool value) {
setState(() {
@@ -136,11 +136,11 @@
),
),
),
- new MergeSemantics(
- child: new ListTile(
+ MergeSemantics(
+ child: ListTile(
dense: true,
title: const Text('Dense layout'),
- trailing: new Checkbox(
+ trailing: Checkbox(
value: _dense,
onChanged: (bool value) {
setState(() {
@@ -178,14 +178,14 @@
'Even more additional list item information appears on line three.',
);
}
- return new MergeSemantics(
- child: new ListTile(
+ return MergeSemantics(
+ child: ListTile(
isThreeLine: _itemType == _MaterialListType.threeLine,
dense: _dense,
- leading: _showAvatars ? new ExcludeSemantics(child: new CircleAvatar(child: new Text(item))) : null,
- title: new Text('This item represents $item.'),
+ leading: _showAvatars ? ExcludeSemantics(child: CircleAvatar(child: Text(item))) : null,
+ title: Text('This item represents $item.'),
subtitle: secondary,
- trailing: _showIcons ? new Icon(Icons.info, color: Theme.of(context).disabledColor) : null,
+ trailing: _showIcons ? Icon(Icons.info, color: Theme.of(context).disabledColor) : null,
),
);
}
@@ -211,12 +211,12 @@
if (_showDividers)
listTiles = ListTile.divideTiles(context: context, tiles: listTiles);
- return new Scaffold(
+ return Scaffold(
key: scaffoldKey,
- appBar: new AppBar(
- title: new Text('Scrolling list\n$itemTypeText$layoutText'),
+ appBar: AppBar(
+ title: Text('Scrolling list\n$itemTypeText$layoutText'),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sort_by_alpha),
tooltip: 'Sort',
onPressed: () {
@@ -226,8 +226,8 @@
});
},
),
- new IconButton(
- icon: new Icon(
+ IconButton(
+ icon: Icon(
Theme.of(context).platform == TargetPlatform.iOS
? Icons.more_horiz
: Icons.more_vert,
@@ -237,9 +237,9 @@
),
],
),
- body: new Scrollbar(
- child: new ListView(
- padding: new EdgeInsets.symmetric(vertical: _dense ? 4.0 : 8.0),
+ body: Scrollbar(
+ child: ListView(
+ padding: EdgeInsets.symmetric(vertical: _dense ? 4.0 : 8.0),
children: listTiles.toList(),
),
),
diff --git a/examples/flutter_gallery/lib/demo/material/menu_demo.dart b/examples/flutter_gallery/lib/demo/material/menu_demo.dart
index 31bb740..3d0f4a3 100644
--- a/examples/flutter_gallery/lib/demo/material/menu_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/menu_demo.dart
@@ -10,11 +10,11 @@
static const String routeName = '/material/menu';
@override
- MenuDemoState createState() => new MenuDemoState();
+ MenuDemoState createState() => MenuDemoState();
}
class MenuDemoState extends State<MenuDemo> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final String _simpleValue1 = 'Menu item value one';
final String _simpleValue2 = 'Menu item value two';
@@ -35,8 +35,8 @@
}
void showInSnackBar(String value) {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text(value)
+ _scaffoldKey.currentState.showSnackBar(SnackBar(
+ content: Text(value)
));
}
@@ -59,12 +59,12 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Menus'),
actions: <Widget>[
- new PopupMenuButton<String>(
+ PopupMenuButton<String>(
onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
const PopupMenuItem<String>(
@@ -83,19 +83,19 @@
),
],
),
- body: new ListView(
+ body: ListView(
padding: kMaterialListPadding,
children: <Widget>[
// Pressing the PopupMenuButton on the right of this item shows
// a simple menu with one disabled item. Typically the contents
// of this "contextual menu" would reflect the app's state.
- new ListTile(
+ ListTile(
title: const Text('An item with a context menu button'),
- trailing: new PopupMenuButton<String>(
+ trailing: PopupMenuButton<String>(
padding: EdgeInsets.zero,
onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
- new PopupMenuItem<String>(
+ PopupMenuItem<String>(
value: _simpleValue1,
child: const Text('Context menu item one')
),
@@ -103,7 +103,7 @@
enabled: false,
child: Text('A disabled menu item')
),
- new PopupMenuItem<String>(
+ PopupMenuItem<String>(
value: _simpleValue3,
child: const Text('Context menu item three')
),
@@ -113,9 +113,9 @@
// Pressing the PopupMenuButton on the right of this item shows
// a menu whose items have text labels and icons and a divider
// That separates the first three items from the last one.
- new ListTile(
+ ListTile(
title: const Text('An item with a sectioned menu'),
- trailing: new PopupMenuButton<String>(
+ trailing: PopupMenuButton<String>(
padding: EdgeInsets.zero,
onSelected: showMenuSelection,
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
@@ -154,57 +154,57 @@
// This entire list item is a PopupMenuButton. Tapping anywhere shows
// a menu whose current value is highlighted and aligned over the
// list item's center line.
- new PopupMenuButton<String>(
+ PopupMenuButton<String>(
padding: EdgeInsets.zero,
initialValue: _simpleValue,
onSelected: showMenuSelection,
- child: new ListTile(
+ child: ListTile(
title: const Text('An item with a simple menu'),
- subtitle: new Text(_simpleValue)
+ subtitle: Text(_simpleValue)
),
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
- new PopupMenuItem<String>(
+ PopupMenuItem<String>(
value: _simpleValue1,
- child: new Text(_simpleValue1)
+ child: Text(_simpleValue1)
),
- new PopupMenuItem<String>(
+ PopupMenuItem<String>(
value: _simpleValue2,
- child: new Text(_simpleValue2)
+ child: Text(_simpleValue2)
),
- new PopupMenuItem<String>(
+ PopupMenuItem<String>(
value: _simpleValue3,
- child: new Text(_simpleValue3)
+ child: Text(_simpleValue3)
)
]
),
// Pressing the PopupMenuButton on the right of this item shows a menu
// whose items have checked icons that reflect this app's state.
- new ListTile(
+ ListTile(
title: const Text('An item with a checklist menu'),
- trailing: new PopupMenuButton<String>(
+ trailing: PopupMenuButton<String>(
padding: EdgeInsets.zero,
onSelected: showCheckedMenuSelections,
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
- new CheckedPopupMenuItem<String>(
+ CheckedPopupMenuItem<String>(
value: _checkedValue1,
checked: isChecked(_checkedValue1),
- child: new Text(_checkedValue1)
+ child: Text(_checkedValue1)
),
- new CheckedPopupMenuItem<String>(
+ CheckedPopupMenuItem<String>(
value: _checkedValue2,
enabled: false,
checked: isChecked(_checkedValue2),
- child: new Text(_checkedValue2)
+ child: Text(_checkedValue2)
),
- new CheckedPopupMenuItem<String>(
+ CheckedPopupMenuItem<String>(
value: _checkedValue3,
checked: isChecked(_checkedValue3),
- child: new Text(_checkedValue3)
+ child: Text(_checkedValue3)
),
- new CheckedPopupMenuItem<String>(
+ CheckedPopupMenuItem<String>(
value: _checkedValue4,
checked: isChecked(_checkedValue4),
- child: new Text(_checkedValue4)
+ child: Text(_checkedValue4)
)
]
)
diff --git a/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart b/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart
index 8fdbf41..ce4f081 100644
--- a/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart
@@ -9,19 +9,19 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(title: const Text('Modal bottom sheet')),
- body: new Center(
- child: new RaisedButton(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Modal bottom sheet')),
+ body: Center(
+ child: RaisedButton(
child: const Text('SHOW BOTTOM SHEET'),
onPressed: () {
showModalBottomSheet<void>(context: context, builder: (BuildContext context) {
- return new Container(
- child: new Padding(
+ return Container(
+ child: Padding(
padding: const EdgeInsets.all(32.0),
- child: new Text('This is the modal bottom sheet. Tap anywhere to dismiss.',
+ child: Text('This is the modal bottom sheet. Tap anywhere to dismiss.',
textAlign: TextAlign.center,
- style: new TextStyle(
+ style: TextStyle(
color: Theme.of(context).accentColor,
fontSize: 24.0
)
diff --git a/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart b/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart
index 5e73d97..5b4939f 100644
--- a/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/overscroll_demo.dart
@@ -14,23 +14,23 @@
static const String routeName = '/material/overscroll';
@override
- OverscrollDemoState createState() => new OverscrollDemoState();
+ OverscrollDemoState createState() => OverscrollDemoState();
}
class OverscrollDemoState extends State<OverscrollDemo> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
- final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = new GlobalKey<RefreshIndicatorState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
+ final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
static final List<String> _items = <String>[
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'
];
Future<Null> _handleRefresh() {
- final Completer<Null> completer = new Completer<Null>();
- new Timer(const Duration(seconds: 3), () { completer.complete(null); });
+ final Completer<Null> completer = Completer<Null>();
+ Timer(const Duration(seconds: 3), () { completer.complete(null); });
return completer.future.then((_) {
- _scaffoldKey.currentState?.showSnackBar(new SnackBar(
+ _scaffoldKey.currentState?.showSnackBar(SnackBar(
content: const Text('Refresh complete'),
- action: new SnackBarAction(
+ action: SnackBarAction(
label: 'RETRY',
onPressed: () {
_refreshIndicatorKey.currentState.show();
@@ -42,12 +42,12 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Pull to refresh'),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.refresh),
tooltip: 'Refresh',
onPressed: () {
@@ -56,18 +56,18 @@
),
]
),
- body: new RefreshIndicator(
+ body: RefreshIndicator(
key: _refreshIndicatorKey,
onRefresh: _handleRefresh,
- child: new ListView.builder(
+ child: ListView.builder(
padding: kMaterialListPadding,
itemCount: _items.length,
itemBuilder: (BuildContext context, int index) {
final String item = _items[index];
- return new ListTile(
+ return ListTile(
isThreeLine: true,
- leading: new CircleAvatar(child: new Text(item)),
- title: new Text('This item represents $item.'),
+ leading: CircleAvatar(child: Text(item)),
+ title: Text('This item represents $item.'),
subtitle: const Text('Even more additional list item information appears on line three.'),
);
},
diff --git a/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart b/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart
index 33dc588..2f3b67d 100644
--- a/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/page_selector_demo.dart
@@ -19,23 +19,23 @@
Widget build(BuildContext context) {
final TabController controller = DefaultTabController.of(context);
final Color color = Theme.of(context).accentColor;
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new Column(
+ child: Column(
children: <Widget>[
- new Container(
+ Container(
margin: const EdgeInsets.only(top: 16.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.chevron_left),
color: color,
onPressed: () { _handleArrowButtonPress(context, -1); },
tooltip: 'Page back'
),
- new TabPageSelector(controller: controller),
- new IconButton(
+ TabPageSelector(controller: controller),
+ IconButton(
icon: const Icon(Icons.chevron_right),
color: color,
onPressed: () { _handleArrowButtonPress(context, 1); },
@@ -45,18 +45,18 @@
mainAxisAlignment: MainAxisAlignment.spaceBetween
)
),
- new Expanded(
- child: new IconTheme(
- data: new IconThemeData(
+ Expanded(
+ child: IconTheme(
+ data: IconThemeData(
size: 128.0,
color: color,
),
- child: new TabBarView(
+ child: TabBarView(
children: icons.map((Icon icon) {
- return new Container(
+ return Container(
padding: const EdgeInsets.all(12.0),
- child: new Card(
- child: new Center(
+ child: Card(
+ child: Center(
child: icon,
),
),
@@ -84,11 +84,11 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(title: const Text('Page selector')),
- body: new DefaultTabController(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Page selector')),
+ body: DefaultTabController(
length: icons.length,
- child: new _PageSelector(icons: icons),
+ child: _PageSelector(icons: icons),
),
);
}
diff --git a/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart b/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart
index 97ff8df..090a4ae 100644
--- a/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart
@@ -8,11 +8,11 @@
static const String routeName = '/material/persistent-bottom-sheet';
@override
- _PersistentBottomSheetDemoState createState() => new _PersistentBottomSheetDemoState();
+ _PersistentBottomSheetDemoState createState() => _PersistentBottomSheetDemoState();
}
class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
VoidCallback _showBottomSheetCallback;
@@ -28,15 +28,15 @@
});
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
final ThemeData themeData = Theme.of(context);
- return new Container(
- decoration: new BoxDecoration(
- border: new Border(top: new BorderSide(color: themeData.disabledColor))
+ return Container(
+ decoration: BoxDecoration(
+ border: Border(top: BorderSide(color: themeData.disabledColor))
),
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.all(32.0),
- child: new Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.',
+ child: Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.',
textAlign: TextAlign.center,
- style: new TextStyle(
+ style: TextStyle(
color: themeData.accentColor,
fontSize: 24.0
)
@@ -57,10 +57,10 @@
showDialog<void>(
context: context,
builder: (BuildContext context) {
- return new AlertDialog(
+ return AlertDialog(
content: const Text('You tapped the floating action button.'),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
onPressed: () {
Navigator.pop(context);
},
@@ -74,10 +74,10 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(title: const Text('Persistent bottom sheet')),
- floatingActionButton: new FloatingActionButton(
+ appBar: AppBar(title: const Text('Persistent bottom sheet')),
+ floatingActionButton: FloatingActionButton(
onPressed: _showMessage,
backgroundColor: Colors.redAccent,
child: const Icon(
@@ -85,8 +85,8 @@
semanticLabel: 'Add',
),
),
- body: new Center(
- child: new RaisedButton(
+ body: Center(
+ child: RaisedButton(
onPressed: _showBottomSheetCallback,
child: const Text('SHOW BOTTOM SHEET')
)
diff --git a/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart b/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart
index 5a26eb8..2035739 100644
--- a/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/progress_indicator_demo.dart
@@ -8,7 +8,7 @@
static const String routeName = '/material/progress-indicator';
@override
- _ProgressIndicatorDemoState createState() => new _ProgressIndicatorDemoState();
+ _ProgressIndicatorDemoState createState() => _ProgressIndicatorDemoState();
}
class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with SingleTickerProviderStateMixin {
@@ -18,13 +18,13 @@
@override
void initState() {
super.initState();
- _controller = new AnimationController(
+ _controller = AnimationController(
duration: const Duration(milliseconds: 1500),
vsync: this,
animationBehavior: AnimationBehavior.preserve,
)..forward();
- _animation = new CurvedAnimation(
+ _animation = CurvedAnimation(
parent: _controller,
curve: const Interval(0.0, 0.9, curve: Curves.fastOutSlowIn),
reverseCurve: Curves.fastOutSlowIn
@@ -70,50 +70,50 @@
),
const LinearProgressIndicator(),
const LinearProgressIndicator(),
- new LinearProgressIndicator(value: _animation.value),
- new Row(
+ LinearProgressIndicator(value: _animation.value),
+ Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const CircularProgressIndicator(),
- new SizedBox(
+ SizedBox(
width: 20.0,
height: 20.0,
- child: new CircularProgressIndicator(value: _animation.value)
+ child: CircularProgressIndicator(value: _animation.value)
),
- new SizedBox(
+ SizedBox(
width: 100.0,
height: 20.0,
- child: new Text('${(_animation.value * 100.0).toStringAsFixed(1)}%',
+ child: Text('${(_animation.value * 100.0).toStringAsFixed(1)}%',
textAlign: TextAlign.right
),
),
],
),
];
- return new Column(
+ return Column(
children: indicators
- .map((Widget c) => new Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
+ .map((Widget c) => Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
.toList(),
);
}
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(title: const Text('Progress indicators')),
- body: new Center(
- child: new SingleChildScrollView(
- child: new DefaultTextStyle(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Progress indicators')),
+ body: Center(
+ child: SingleChildScrollView(
+ child: DefaultTextStyle(
style: Theme.of(context).textTheme.title,
- child: new GestureDetector(
+ child: GestureDetector(
onTap: _handleTap,
behavior: HitTestBehavior.opaque,
- child: new SafeArea(
+ child: SafeArea(
top: false,
bottom: false,
- child: new Container(
+ child: Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
- child: new AnimatedBuilder(
+ child: AnimatedBuilder(
animation: _animation,
builder: _buildIndicators
),
diff --git a/examples/flutter_gallery/lib/demo/material/reorderable_list_demo.dart b/examples/flutter_gallery/lib/demo/material/reorderable_list_demo.dart
index 6762e54..f71666f 100644
--- a/examples/flutter_gallery/lib/demo/material/reorderable_list_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/reorderable_list_demo.dart
@@ -23,7 +23,7 @@
static const String routeName = '/material/reorderable-list';
@override
- _ListDemoState createState() => new _ListDemoState();
+ _ListDemoState createState() => _ListDemoState();
}
class _ListItem {
@@ -35,14 +35,14 @@
}
class _ListDemoState extends State<ReorderableListDemo> {
- static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
+ static final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
PersistentBottomSheetController<Null> _bottomSheet;
_ReorderableListType _itemType = _ReorderableListType.threeLine;
bool _reverseSort = false;
final List<_ListItem> _items = <String>[
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
- ].map((String item) => new _ListItem(item, false)).toList();
+ ].map((String item) => _ListItem(item, false)).toList();
void changeItemType(_ReorderableListType type) {
setState(() {
@@ -57,29 +57,29 @@
void _showConfigurationSheet() {
setState(() {
_bottomSheet = scaffoldKey.currentState.showBottomSheet((BuildContext bottomSheetContext) {
- return new DecoratedBox(
+ return DecoratedBox(
decoration: const BoxDecoration(
border: Border(top: BorderSide(color: Colors.black26)),
),
- child: new ListView(
+ child: ListView(
shrinkWrap: true,
primary: false,
children: <Widget>[
- new RadioListTile<_ReorderableListType>(
+ RadioListTile<_ReorderableListType>(
dense: true,
title: const Text('Horizontal Avatars'),
value: _ReorderableListType.horizontalAvatar,
groupValue: _itemType,
onChanged: changeItemType,
),
- new RadioListTile<_ReorderableListType>(
+ RadioListTile<_ReorderableListType>(
dense: true,
title: const Text('Vertical Avatars'),
value: _ReorderableListType.verticalAvatar,
groupValue: _itemType,
onChanged: changeItemType,
),
- new RadioListTile<_ReorderableListType>(
+ RadioListTile<_ReorderableListType>(
dense: true,
title: const Text('Three-line'),
value: _ReorderableListType.threeLine,
@@ -109,8 +109,8 @@
Widget listTile;
switch (_itemType) {
case _ReorderableListType.threeLine:
- listTile = new CheckboxListTile(
- key: new Key(item.value),
+ listTile = CheckboxListTile(
+ key: Key(item.value),
isThreeLine: true,
value: item.checkState ?? false,
onChanged: (bool newValue) {
@@ -118,18 +118,18 @@
item.checkState = newValue;
});
},
- title: new Text('This item represents ${item.value}.'),
+ title: Text('This item represents ${item.value}.'),
subtitle: secondary,
secondary: const Icon(Icons.drag_handle),
);
break;
case _ReorderableListType.horizontalAvatar:
case _ReorderableListType.verticalAvatar:
- listTile = new Container(
- key: new Key(item.value),
+ listTile = Container(
+ key: Key(item.value),
height: 100.0,
width: 100.0,
- child: new CircleAvatar(child: new Text(item.value),
+ child: CircleAvatar(child: Text(item.value),
backgroundColor: Colors.green,
),
);
@@ -152,12 +152,12 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Reorderable list'),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sort_by_alpha),
tooltip: 'Sort',
onPressed: () {
@@ -167,8 +167,8 @@
});
},
),
- new IconButton(
- icon: new Icon(
+ IconButton(
+ icon: Icon(
Theme.of(context).platform == TargetPlatform.iOS
? Icons.more_horiz
: Icons.more_vert,
@@ -178,12 +178,12 @@
),
],
),
- body: new Scrollbar(
- child: new ReorderableListView(
+ body: Scrollbar(
+ child: ReorderableListView(
header: _itemType != _ReorderableListType.threeLine
- ? new Padding(
+ ? Padding(
padding: const EdgeInsets.all(8.0),
- child: new Text('Header of the list', style: Theme.of(context).textTheme.headline))
+ child: Text('Header of the list', style: Theme.of(context).textTheme.headline))
: null,
onReorder: _onReorder,
scrollDirection: _itemType == _ReorderableListType.horizontalAvatar ? Axis.horizontal : Axis.vertical,
diff --git a/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart b/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart
index e6d0dd9..38d6518 100644
--- a/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart
@@ -37,7 +37,7 @@
static const String routeName = '/material/scrollable-tabs';
@override
- ScrollableTabsDemoState createState() => new ScrollableTabsDemoState();
+ ScrollableTabsDemoState createState() => ScrollableTabsDemoState();
}
class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTickerProviderStateMixin {
@@ -48,7 +48,7 @@
@override
void initState() {
super.initState();
- _controller = new TabController(vsync: this, length: _allPages.length);
+ _controller = TabController(vsync: this, length: _allPages.length);
}
@override
@@ -69,7 +69,7 @@
switch(_demoStyle) {
case TabsDemoStyle.iconsAndText:
- return new ShapeDecoration(
+ return ShapeDecoration(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
side: BorderSide(
@@ -86,7 +86,7 @@
);
case TabsDemoStyle.iconsOnly:
- return new ShapeDecoration(
+ return ShapeDecoration(
shape: const CircleBorder(
side: BorderSide(
color: Colors.white24,
@@ -101,7 +101,7 @@
);
case TabsDemoStyle.textOnly:
- return new ShapeDecoration(
+ return ShapeDecoration(
shape: const StadiumBorder(
side: BorderSide(
color: Colors.white24,
@@ -121,11 +121,11 @@
@override
Widget build(BuildContext context) {
final Color iconColor = Theme.of(context).accentColor;
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Scrollable tabs'),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() {
@@ -133,7 +133,7 @@
});
},
),
- new PopupMenuButton<TabsDemoStyle>(
+ PopupMenuButton<TabsDemoStyle>(
onSelected: changeDemoStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<TabsDemoStyle>>[
const PopupMenuItem<TabsDemoStyle>(
@@ -151,7 +151,7 @@
],
),
],
- bottom: new TabBar(
+ bottom: TabBar(
controller: _controller,
isScrollable: true,
indicator: getIndicator(),
@@ -159,28 +159,28 @@
assert(_demoStyle != null);
switch (_demoStyle) {
case TabsDemoStyle.iconsAndText:
- return new Tab(text: page.text, icon: new Icon(page.icon));
+ return Tab(text: page.text, icon: Icon(page.icon));
case TabsDemoStyle.iconsOnly:
- return new Tab(icon: new Icon(page.icon));
+ return Tab(icon: Icon(page.icon));
case TabsDemoStyle.textOnly:
- return new Tab(text: page.text);
+ return Tab(text: page.text);
}
return null;
}).toList(),
),
),
- body: new TabBarView(
+ body: TabBarView(
controller: _controller,
children: _allPages.map((_Page page) {
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new Container(
- key: new ObjectKey(page.icon),
+ child: Container(
+ key: ObjectKey(page.icon),
padding: const EdgeInsets.all(12.0),
- child: new Card(
- child: new Center(
- child: new Icon(
+ child: Card(
+ child: Center(
+ child: Icon(
page.icon,
color: iconColor,
size: 128.0,
diff --git a/examples/flutter_gallery/lib/demo/material/search_demo.dart b/examples/flutter_gallery/lib/demo/material/search_demo.dart
index 8873abb..e22cb26 100644
--- a/examples/flutter_gallery/lib/demo/material/search_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/search_demo.dart
@@ -8,23 +8,23 @@
static const String routeName = '/material/search';
@override
- _SearchDemoState createState() => new _SearchDemoState();
+ _SearchDemoState createState() => _SearchDemoState();
}
class _SearchDemoState extends State<SearchDemo> {
- final _SearchDemoSearchDelegate _delegate = new _SearchDemoSearchDelegate();
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final _SearchDemoSearchDelegate _delegate = _SearchDemoSearchDelegate();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
int _lastIntegerSelected;
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
- leading: new IconButton(
+ appBar: AppBar(
+ leading: IconButton(
tooltip: 'Navigation menu',
- icon: new AnimatedIcon(
+ icon: AnimatedIcon(
icon: AnimatedIcons.menu_arrow,
color: Colors.white,
progress: _delegate.transitionAnimation,
@@ -35,7 +35,7 @@
),
title: const Text('Numbers'),
actions: <Widget>[
- new IconButton(
+ IconButton(
tooltip: 'Search',
icon: const Icon(Icons.search),
onPressed: () async {
@@ -50,9 +50,9 @@
}
},
),
- new IconButton(
+ IconButton(
tooltip: 'More (not implemented)',
- icon: new Icon(
+ icon: Icon(
Theme.of(context).platform == TargetPlatform.iOS
? Icons.more_horiz
: Icons.more_vert,
@@ -61,15 +61,15 @@
),
],
),
- body: new Center(
- child: new Column(
+ body: Center(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
- new MergeSemantics(
- child: new Column(
+ MergeSemantics(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
- new Row(
+ Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
Text('Press the '),
@@ -88,11 +88,11 @@
),
),
const SizedBox(height: 64.0),
- new Text('Last selected integer: ${_lastIntegerSelected ?? 'NONE' }.')
+ Text('Last selected integer: ${_lastIntegerSelected ?? 'NONE' }.')
],
),
),
- floatingActionButton: new FloatingActionButton.extended(
+ floatingActionButton: FloatingActionButton.extended(
tooltip: 'Back', // Tests depend on this label to exit the demo.
onPressed: () {
Navigator.of(context).pop();
@@ -100,8 +100,8 @@
label: const Text('Close demo'),
icon: const Icon(Icons.close),
),
- drawer: new Drawer(
- child: new Column(
+ drawer: Drawer(
+ child: Column(
children: <Widget>[
const UserAccountsDrawerHeader(
accountName: Text('Peter Widget'),
@@ -114,7 +114,7 @@
),
margin: EdgeInsets.zero,
),
- new MediaQuery.removePadding(
+ MediaQuery.removePadding(
context: context,
// DrawerHeader consumes top MediaQuery padding.
removeTop: true,
@@ -131,14 +131,14 @@
}
class _SearchDemoSearchDelegate extends SearchDelegate<int> {
- final List<int> _data = new List<int>.generate(100001, (int i) => i).reversed.toList();
+ final List<int> _data = List<int>.generate(100001, (int i) => i).reversed.toList();
final List<int> _history = <int>[42607, 85604, 66374, 44, 174];
@override
Widget buildLeading(BuildContext context) {
- return new IconButton(
+ return IconButton(
tooltip: 'Back',
- icon: new AnimatedIcon(
+ icon: AnimatedIcon(
icon: AnimatedIcons.menu_arrow,
progress: transitionAnimation,
),
@@ -155,7 +155,7 @@
? _history
: _data.where((int i) => '$i'.startsWith(query));
- return new _SuggestionList(
+ return _SuggestionList(
query: query,
suggestions: suggestions.map((int i) => '$i').toList(),
onSelected: (String suggestion) {
@@ -169,27 +169,27 @@
Widget buildResults(BuildContext context) {
final int searched = int.tryParse(query);
if (searched == null || !_data.contains(searched)) {
- return new Center(
- child: new Text(
+ return Center(
+ child: Text(
'"$query"\n is not a valid integer between 0 and 100,000.\nTry again.',
textAlign: TextAlign.center,
),
);
}
- return new ListView(
+ return ListView(
children: <Widget>[
- new _ResultCard(
+ _ResultCard(
title: 'This integer',
integer: searched,
searchDelegate: this,
),
- new _ResultCard(
+ _ResultCard(
title: 'Next integer',
integer: searched + 1,
searchDelegate: this,
),
- new _ResultCard(
+ _ResultCard(
title: 'Previous integer',
integer: searched - 1,
searchDelegate: this,
@@ -202,14 +202,14 @@
List<Widget> buildActions(BuildContext context) {
return <Widget>[
query.isEmpty
- ? new IconButton(
+ ? IconButton(
tooltip: 'Voice Search',
icon: const Icon(Icons.mic),
onPressed: () {
query = 'TODO: implement voice input';
},
)
- : new IconButton(
+ : IconButton(
tooltip: 'Clear',
icon: const Icon(Icons.clear),
onPressed: () {
@@ -231,17 +231,17 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new GestureDetector(
+ return GestureDetector(
onTap: () {
searchDelegate.close(context, integer);
},
- child: new Card(
- child: new Padding(
+ child: Card(
+ child: Padding(
padding: const EdgeInsets.all(8.0),
- child: new Column(
+ child: Column(
children: <Widget>[
- new Text(title),
- new Text(
+ Text(title),
+ Text(
'$integer',
style: theme.textTheme.headline.copyWith(fontSize: 72.0),
),
@@ -263,18 +263,18 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new ListView.builder(
+ return ListView.builder(
itemCount: suggestions.length,
itemBuilder: (BuildContext context, int i) {
final String suggestion = suggestions[i];
- return new ListTile(
+ return ListTile(
leading: query.isEmpty ? const Icon(Icons.history) : const Icon(null),
- title: new RichText(
- text: new TextSpan(
+ title: RichText(
+ text: TextSpan(
text: suggestion.substring(0, query.length),
style: theme.textTheme.subhead.copyWith(fontWeight: FontWeight.bold),
children: <TextSpan>[
- new TextSpan(
+ TextSpan(
text: suggestion.substring(query.length),
style: theme.textTheme.subhead,
),
diff --git a/examples/flutter_gallery/lib/demo/material/selection_controls_demo.dart b/examples/flutter_gallery/lib/demo/material/selection_controls_demo.dart
index 201d043..a4919a3 100644
--- a/examples/flutter_gallery/lib/demo/material/selection_controls_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/selection_controls_demo.dart
@@ -31,26 +31,26 @@
static const String routeName = '/material/selection-controls';
@override
- _SelectionControlsDemoState createState() => new _SelectionControlsDemoState();
+ _SelectionControlsDemoState createState() => _SelectionControlsDemoState();
}
class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
@override
Widget build(BuildContext context) {
final List<ComponentDemoTabData> demos = <ComponentDemoTabData>[
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'CHECKBOX',
description: _checkboxText,
demoWidget: buildCheckbox(),
exampleCodeTag: _checkboxCode
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'RADIO',
description: _radioText,
demoWidget: buildRadio(),
exampleCodeTag: _radioCode
),
- new ComponentDemoTabData(
+ ComponentDemoTabData(
tabName: 'SWITCH',
description: _switchText,
demoWidget: buildSwitch(),
@@ -58,7 +58,7 @@
)
];
- return new TabbedComponentDemoScaffold(
+ return TabbedComponentDemoScaffold(
title: 'Selection controls',
demos: demos
);
@@ -77,15 +77,15 @@
}
Widget buildCheckbox() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Row(
+ Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Checkbox(
+ Checkbox(
value: checkboxValueA,
onChanged: (bool value) {
setState(() {
@@ -93,7 +93,7 @@
});
},
),
- new Checkbox(
+ Checkbox(
value: checkboxValueB,
onChanged: (bool value) {
setState(() {
@@ -101,7 +101,7 @@
});
},
),
- new Checkbox(
+ Checkbox(
value: checkboxValueC,
tristate: true,
onChanged: (bool value) {
@@ -112,7 +112,7 @@
),
],
),
- new Row(
+ Row(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
// Disabled checkboxes
@@ -127,25 +127,25 @@
}
Widget buildRadio() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new Column(
+ child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Row(
+ Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Radio<int>(
+ Radio<int>(
value: 0,
groupValue: radioValue,
onChanged: handleRadioValueChanged
),
- new Radio<int>(
+ Radio<int>(
value: 1,
groupValue: radioValue,
onChanged: handleRadioValueChanged
),
- new Radio<int>(
+ Radio<int>(
value: 2,
groupValue: radioValue,
onChanged: handleRadioValueChanged
@@ -153,7 +153,7 @@
]
),
// Disabled radio buttons
- new Row(
+ Row(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
Radio<int>(
@@ -179,12 +179,12 @@
}
Widget buildSwitch() {
- return new Align(
+ return Align(
alignment: const Alignment(0.0, -0.2),
- child: new Row(
+ child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Switch(
+ Switch(
value: switchValue,
onChanged: (bool value) {
setState(() {
diff --git a/examples/flutter_gallery/lib/demo/material/slider_demo.dart b/examples/flutter_gallery/lib/demo/material/slider_demo.dart
index 7c8e8c1..5a8d4cc 100644
--- a/examples/flutter_gallery/lib/demo/material/slider_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/slider_demo.dart
@@ -10,11 +10,11 @@
static const String routeName = '/material/slider';
@override
- _SliderDemoState createState() => new _SliderDemoState();
+ _SliderDemoState createState() => _SliderDemoState();
}
Path _triangle(double size, Offset thumbCenter, {bool invert = false}) {
- final Path thumbPath = new Path();
+ final Path thumbPath = Path();
final double height = math.sqrt(3.0) / 2.0;
final double halfSide = size / 2.0;
final double centerHeight = size * height / 3.0;
@@ -35,7 +35,7 @@
return isEnabled ? const Size.fromRadius(_thumbSize) : const Size.fromRadius(_disabledThumbSize);
}
- static final Tween<double> sizeTween = new Tween<double>(
+ static final Tween<double> sizeTween = Tween<double>(
begin: _disabledThumbSize,
end: _thumbSize,
);
@@ -54,13 +54,13 @@
double value,
}) {
final Canvas canvas = context.canvas;
- final ColorTween colorTween = new ColorTween(
+ final ColorTween colorTween = ColorTween(
begin: sliderTheme.disabledThumbColor,
end: sliderTheme.thumbColor,
);
final double size = _thumbSize * sizeTween.evaluate(enableAnimation);
final Path thumbPath = _triangle(size, thumbCenter);
- canvas.drawPath(thumbPath, new Paint()..color = colorTween.evaluate(enableAnimation));
+ canvas.drawPath(thumbPath, Paint()..color = colorTween.evaluate(enableAnimation));
}
}
@@ -71,10 +71,10 @@
@override
Size getPreferredSize(bool isEnabled, bool isDiscrete) {
- return new Size.fromRadius(isEnabled ? _indicatorSize : _disabledIndicatorSize);
+ return Size.fromRadius(isEnabled ? _indicatorSize : _disabledIndicatorSize);
}
- static final Tween<double> sizeTween = new Tween<double>(
+ static final Tween<double> sizeTween = Tween<double>(
begin: _disabledIndicatorSize,
end: _indicatorSize,
);
@@ -93,16 +93,16 @@
double value,
}) {
final Canvas canvas = context.canvas;
- final ColorTween enableColor = new ColorTween(
+ final ColorTween enableColor = ColorTween(
begin: sliderTheme.disabledThumbColor,
end: sliderTheme.valueIndicatorColor,
);
- final Tween<double> slideUpTween = new Tween<double>(
+ final Tween<double> slideUpTween = Tween<double>(
begin: 0.0,
end: _slideUpHeight,
);
final double size = _indicatorSize * sizeTween.evaluate(enableAnimation);
- final Offset slideUpOffset = new Offset(0.0, -slideUpTween.evaluate(activationAnimation));
+ final Offset slideUpOffset = Offset(0.0, -slideUpTween.evaluate(activationAnimation));
final Path thumbPath = _triangle(
size,
thumbCenter + slideUpOffset,
@@ -111,16 +111,16 @@
final Color paintColor = enableColor.evaluate(enableAnimation).withAlpha((255.0 * activationAnimation.value).round());
canvas.drawPath(
thumbPath,
- new Paint()..color = paintColor,
+ Paint()..color = paintColor,
);
canvas.drawLine(
thumbCenter,
thumbCenter + slideUpOffset,
- new Paint()
+ Paint()
..color = paintColor
..style = PaintingStyle.stroke
..strokeWidth = 2.0);
- labelPainter.paint(canvas, thumbCenter + slideUpOffset + new Offset(-labelPainter.width / 2.0, -labelPainter.height - 4.0));
+ labelPainter.paint(canvas, thumbCenter + slideUpOffset + Offset(-labelPainter.width / 2.0, -labelPainter.height - 4.0));
}
}
@@ -131,17 +131,17 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new Scaffold(
- appBar: new AppBar(title: const Text('Sliders')),
- body: new Padding(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Sliders')),
+ body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 40.0),
- child: new Column(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
- new Column(
+ Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Slider(
+ Slider(
value: _value,
min: 0.0,
max: 100.0,
@@ -154,17 +154,17 @@
const Text('Continuous'),
],
),
- new Column(
+ Column(
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
Slider(value: 0.25, onChanged: null),
Text('Disabled'),
],
),
- new Column(
+ Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new Slider(
+ Slider(
value: _discreteValue,
min: 0.0,
max: 200.0,
@@ -179,10 +179,10 @@
const Text('Discrete'),
],
),
- new Column(
+ Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
- new SliderTheme(
+ SliderTheme(
data: theme.sliderTheme.copyWith(
activeTrackColor: Colors.deepPurple,
inactiveTrackColor: Colors.black26,
@@ -191,11 +191,11 @@
overlayColor: Colors.black12,
thumbColor: Colors.deepPurple,
valueIndicatorColor: Colors.deepPurpleAccent,
- thumbShape: new _CustomThumbShape(),
- valueIndicatorShape: new _CustomValueIndicatorShape(),
+ thumbShape: _CustomThumbShape(),
+ valueIndicatorShape: _CustomValueIndicatorShape(),
valueIndicatorTextStyle: theme.accentTextTheme.body2.copyWith(color: Colors.black87),
),
- child: new Slider(
+ child: Slider(
value: _discreteValue,
min: 0.0,
max: 200.0,
diff --git a/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart b/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart
index f349cf1..17fe78d 100644
--- a/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/snack_bar_demo.dart
@@ -22,33 +22,33 @@
static const String routeName = '/material/snack-bar';
@override
- _SnackBarDemoState createState() => new _SnackBarDemoState();
+ _SnackBarDemoState createState() => _SnackBarDemoState();
}
class _SnackBarDemoState extends State<SnackBarDemo> {
int _snackBarIndex = 1;
Widget buildBody(BuildContext context) {
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new ListView(
+ child: ListView(
padding: const EdgeInsets.all(24.0),
children: <Widget>[
const Text(_text1),
const Text(_text2),
- new Center(
- child: new RaisedButton(
+ Center(
+ child: RaisedButton(
child: const Text('SHOW A SNACKBAR'),
onPressed: () {
final int thisSnackBarIndex = _snackBarIndex++;
- Scaffold.of(context).showSnackBar(new SnackBar(
- content: new Text('This is snackbar #$thisSnackBarIndex.'),
- action: new SnackBarAction(
+ Scaffold.of(context).showSnackBar(SnackBar(
+ content: Text('This is snackbar #$thisSnackBarIndex.'),
+ action: SnackBarAction(
label: 'ACTION',
onPressed: () {
- Scaffold.of(context).showSnackBar(new SnackBar(
- content: new Text('You pressed snackbar $thisSnackBarIndex\'s action.')
+ Scaffold.of(context).showSnackBar(SnackBar(
+ content: Text('You pressed snackbar $thisSnackBarIndex\'s action.')
));
}
),
@@ -59,7 +59,7 @@
const Text(_text3),
]
.map((Widget child) {
- return new Container(
+ return Container(
margin: const EdgeInsets.symmetric(vertical: 12.0),
child: child
);
@@ -71,11 +71,11 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Snackbar')
),
- body: new Builder(
+ body: Builder(
// Create an inner BuildContext so that the snackBar onPressed methods
// can refer to the Scaffold with Scaffold.of().
builder: buildBody
diff --git a/examples/flutter_gallery/lib/demo/material/tabs_demo.dart b/examples/flutter_gallery/lib/demo/material/tabs_demo.dart
index ab60990..f32cf85 100644
--- a/examples/flutter_gallery/lib/demo/material/tabs_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/tabs_demo.dart
@@ -25,7 +25,7 @@
}
final Map<_Page, List<_CardData>> _allPages = <_Page, List<_CardData>>{
- new _Page(label: 'HOME'): <_CardData>[
+ _Page(label: 'HOME'): <_CardData>[
const _CardData(
title: 'Flatwear',
imageAsset: 'products/flatwear.png',
@@ -72,7 +72,7 @@
imageAssetPackage: _kGalleryAssetsPackage,
),
],
- new _Page(label: 'APPAREL'): <_CardData>[
+ _Page(label: 'APPAREL'): <_CardData>[
const _CardData(
title: 'Cloud-White Dress',
imageAsset: 'products/dress.png',
@@ -100,30 +100,30 @@
@override
Widget build(BuildContext context) {
- return new Card(
- child: new Padding(
+ return Card(
+ child: Padding(
padding: const EdgeInsets.all(16.0),
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
- new Align(
+ Align(
alignment: page.id == 'H'
? Alignment.centerLeft
: Alignment.centerRight,
- child: new CircleAvatar(child: new Text('${page.id}')),
+ child: CircleAvatar(child: Text('${page.id}')),
),
- new SizedBox(
+ SizedBox(
width: 144.0,
height: 144.0,
- child: new Image.asset(
+ child: Image.asset(
data.imageAsset,
package: data.imageAssetPackage,
fit: BoxFit.contain,
),
),
- new Center(
- child: new Text(
+ Center(
+ child: Text(
data.title,
style: Theme.of(context).textTheme.title,
),
@@ -140,56 +140,56 @@
@override
Widget build(BuildContext context) {
- return new DefaultTabController(
+ return DefaultTabController(
length: _allPages.length,
- child: new Scaffold(
- body: new NestedScrollView(
+ child: Scaffold(
+ body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
- new SliverOverlapAbsorber(
+ SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
- child: new SliverAppBar(
+ child: SliverAppBar(
title: const Text('Tabs and scrolling'),
pinned: true,
expandedHeight: 150.0,
forceElevated: innerBoxIsScrolled,
- bottom: new TabBar(
+ bottom: TabBar(
tabs: _allPages.keys.map(
- (_Page page) => new Tab(text: page.label),
+ (_Page page) => Tab(text: page.label),
).toList(),
),
),
),
];
},
- body: new TabBarView(
+ body: TabBarView(
children: _allPages.keys.map((_Page page) {
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new Builder(
+ child: Builder(
builder: (BuildContext context) {
- return new CustomScrollView(
- key: new PageStorageKey<_Page>(page),
+ return CustomScrollView(
+ key: PageStorageKey<_Page>(page),
slivers: <Widget>[
- new SliverOverlapInjector(
+ SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
),
- new SliverPadding(
+ SliverPadding(
padding: const EdgeInsets.symmetric(
vertical: 8.0,
horizontal: 16.0,
),
- sliver: new SliverFixedExtentList(
+ sliver: SliverFixedExtentList(
itemExtent: _CardDataItem.height,
- delegate: new SliverChildBuilderDelegate(
+ delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
final _CardData data = _allPages[page][index];
- return new Padding(
+ return Padding(
padding: const EdgeInsets.symmetric(
vertical: 8.0,
),
- child: new _CardDataItem(
+ child: _CardDataItem(
page: page,
data: data,
),
diff --git a/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart b/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart
index 62dc8c9..f028601 100644
--- a/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart
@@ -20,27 +20,27 @@
Color get labelColor => colors != null ? colors.shade300 : Colors.grey.shade300;
bool get fabDefined => colors != null && icon != null;
Color get fabColor => colors.shade400;
- Icon get fabIcon => new Icon(icon);
- Key get fabKey => new ValueKey<Color>(fabColor);
+ Icon get fabIcon => Icon(icon);
+ Key get fabKey => ValueKey<Color>(fabColor);
}
final List<_Page> _allPages = <_Page>[
- new _Page(label: 'Blue', colors: Colors.indigo, icon: Icons.add),
- new _Page(label: 'Eco', colors: Colors.green, icon: Icons.create),
- new _Page(label: 'No'),
- new _Page(label: 'Teal', colors: Colors.teal, icon: Icons.add),
- new _Page(label: 'Red', colors: Colors.red, icon: Icons.create),
+ _Page(label: 'Blue', colors: Colors.indigo, icon: Icons.add),
+ _Page(label: 'Eco', colors: Colors.green, icon: Icons.create),
+ _Page(label: 'No'),
+ _Page(label: 'Teal', colors: Colors.teal, icon: Icons.add),
+ _Page(label: 'Red', colors: Colors.red, icon: Icons.create),
];
class TabsFabDemo extends StatefulWidget {
static const String routeName = '/material/tabs-fab';
@override
- _TabsFabDemoState createState() => new _TabsFabDemoState();
+ _TabsFabDemoState createState() => _TabsFabDemoState();
}
class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStateMixin {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
TabController _controller;
_Page _selectedPage;
@@ -49,7 +49,7 @@
@override
void initState() {
super.initState();
- _controller = new TabController(vsync: this, length: _allPages.length);
+ _controller = TabController(vsync: this, length: _allPages.length);
_controller.addListener(_handleTabSelection);
_selectedPage = _allPages[0];
}
@@ -68,28 +68,28 @@
void _showExplanatoryText() {
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
- return new Container(
- decoration: new BoxDecoration(
- border: new Border(top: new BorderSide(color: Theme.of(context).dividerColor))
+ return Container(
+ decoration: BoxDecoration(
+ border: Border(top: BorderSide(color: Theme.of(context).dividerColor))
),
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.all(32.0),
- child: new Text(_explanatoryText, style: Theme.of(context).textTheme.subhead)
+ child: Text(_explanatoryText, style: Theme.of(context).textTheme.subhead)
)
);
});
}
Widget buildTabView(_Page page) {
- return new Builder(
+ return Builder(
builder: (BuildContext context) {
- return new Container(
- key: new ValueKey<String>(page.label),
+ return Container(
+ key: ValueKey<String>(page.label),
padding: const EdgeInsets.fromLTRB(48.0, 48.0, 48.0, 96.0),
- child: new Card(
- child: new Center(
- child: new Text(page.label,
- style: new TextStyle(
+ child: Card(
+ child: Center(
+ child: Text(page.label,
+ style: TextStyle(
color: page.labelColor,
fontSize: 32.0
),
@@ -107,17 +107,17 @@
return null;
if (_extendedButtons) {
- return new FloatingActionButton.extended(
- key: new ValueKey<Key>(page.fabKey),
+ return FloatingActionButton.extended(
+ key: ValueKey<Key>(page.fabKey),
tooltip: 'Show explanation',
backgroundColor: page.fabColor,
icon: page.fabIcon,
- label: new Text(page.label.toUpperCase()),
+ label: Text(page.label.toUpperCase()),
onPressed: _showExplanatoryText
);
}
- return new FloatingActionButton(
+ return FloatingActionButton(
key: page.fabKey,
tooltip: 'Show explanation',
backgroundColor: page.fabColor,
@@ -128,16 +128,16 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('FAB per tab'),
- bottom: new TabBar(
+ bottom: TabBar(
controller: _controller,
- tabs: _allPages.map((_Page page) => new Tab(text: page.label.toUpperCase())).toList(),
+ tabs: _allPages.map((_Page page) => Tab(text: page.label.toUpperCase())).toList(),
),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() {
@@ -148,7 +148,7 @@
],
),
floatingActionButton: buildFloatingActionButton(_selectedPage),
- body: new TabBarView(
+ body: TabBarView(
controller: _controller,
children: _allPages.map(buildTabView).toList()
),
diff --git a/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart b/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
index 457584f..afa9024 100644
--- a/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
@@ -13,7 +13,7 @@
static const String routeName = '/material/text-form-field';
@override
- TextFormFieldDemoState createState() => new TextFormFieldDemoState();
+ TextFormFieldDemoState createState() => TextFormFieldDemoState();
}
class PersonData {
@@ -43,7 +43,7 @@
final ValueChanged<String> onFieldSubmitted;
@override
- _PasswordFieldState createState() => new _PasswordFieldState();
+ _PasswordFieldState createState() => _PasswordFieldState();
}
class _PasswordFieldState extends State<PasswordField> {
@@ -51,26 +51,26 @@
@override
Widget build(BuildContext context) {
- return new TextFormField(
+ return TextFormField(
key: widget.fieldKey,
obscureText: _obscureText,
maxLength: 8,
onSaved: widget.onSaved,
validator: widget.validator,
onFieldSubmitted: widget.onFieldSubmitted,
- decoration: new InputDecoration(
+ decoration: InputDecoration(
border: const UnderlineInputBorder(),
filled: true,
hintText: widget.hintText,
labelText: widget.labelText,
helperText: widget.helperText,
- suffixIcon: new GestureDetector(
+ suffixIcon: GestureDetector(
onTap: () {
setState(() {
_obscureText = !_obscureText;
});
},
- child: new Icon(_obscureText ? Icons.visibility : Icons.visibility_off),
+ child: Icon(_obscureText ? Icons.visibility : Icons.visibility_off),
),
),
);
@@ -78,22 +78,22 @@
}
class TextFormFieldDemoState extends State<TextFormFieldDemo> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
- PersonData person = new PersonData();
+ PersonData person = PersonData();
void showInSnackBar(String value) {
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text(value)
+ _scaffoldKey.currentState.showSnackBar(SnackBar(
+ content: Text(value)
));
}
bool _autovalidate = false;
bool _formWasEdited = false;
- final GlobalKey<FormState> _formKey = new GlobalKey<FormState>();
- final GlobalKey<FormFieldState<String>> _passwordFieldKey = new GlobalKey<FormFieldState<String>>();
- final _UsNumberTextInputFormatter _phoneNumberFormatter = new _UsNumberTextInputFormatter();
+ final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
+ final GlobalKey<FormFieldState<String>> _passwordFieldKey = GlobalKey<FormFieldState<String>>();
+ final _UsNumberTextInputFormatter _phoneNumberFormatter = _UsNumberTextInputFormatter();
void _handleSubmitted() {
final FormState form = _formKey.currentState;
if (!form.validate()) {
@@ -109,7 +109,7 @@
_formWasEdited = true;
if (value.isEmpty)
return 'Name is required.';
- final RegExp nameExp = new RegExp(r'^[A-Za-z ]+$');
+ final RegExp nameExp = RegExp(r'^[A-Za-z ]+$');
if (!nameExp.hasMatch(value))
return 'Please enter only alphabetical characters.';
return null;
@@ -117,7 +117,7 @@
String _validatePhoneNumber(String value) {
_formWasEdited = true;
- final RegExp phoneExp = new RegExp(r'^\(\d\d\d\) \d\d\d\-\d\d\d\d$');
+ final RegExp phoneExp = RegExp(r'^\(\d\d\d\) \d\d\d\-\d\d\d\d$');
if (!phoneExp.hasMatch(value))
return '(###) ###-#### - Enter a US phone number.';
return null;
@@ -141,15 +141,15 @@
return await showDialog<bool>(
context: context,
builder: (BuildContext context) {
- return new AlertDialog(
+ return AlertDialog(
title: const Text('This form has errors'),
content: const Text('Really leave this form?'),
actions: <Widget> [
- new FlatButton(
+ FlatButton(
child: const Text('YES'),
onPressed: () { Navigator.of(context).pop(true); },
),
- new FlatButton(
+ FlatButton(
child: const Text('NO'),
onPressed: () { Navigator.of(context).pop(false); },
),
@@ -161,25 +161,25 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Text fields'),
),
- body: new SafeArea(
+ body: SafeArea(
top: false,
bottom: false,
- child: new Form(
+ child: Form(
key: _formKey,
autovalidate: _autovalidate,
onWillPop: _warnUserAboutInvalidData,
- child: new SingleChildScrollView(
+ child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: new Column(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const SizedBox(height: 24.0),
- new TextFormField(
+ TextFormField(
textCapitalization: TextCapitalization.words,
decoration: const InputDecoration(
border: UnderlineInputBorder(),
@@ -192,7 +192,7 @@
validator: _validateName,
),
const SizedBox(height: 24.0),
- new TextFormField(
+ TextFormField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
filled: true,
@@ -212,7 +212,7 @@
],
),
const SizedBox(height: 24.0),
- new TextFormField(
+ TextFormField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
filled: true,
@@ -224,7 +224,7 @@
onSaved: (String value) { person.email = value; },
),
const SizedBox(height: 24.0),
- new TextFormField(
+ TextFormField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Tell us about yourself',
@@ -234,7 +234,7 @@
maxLines: 3,
),
const SizedBox(height: 24.0),
- new TextFormField(
+ TextFormField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
border: OutlineInputBorder(),
@@ -246,7 +246,7 @@
maxLines: 1,
),
const SizedBox(height: 24.0),
- new PasswordField(
+ PasswordField(
fieldKey: _passwordFieldKey,
helperText: 'No more than 8 characters.',
labelText: 'Password *',
@@ -257,7 +257,7 @@
},
),
const SizedBox(height: 24.0),
- new TextFormField(
+ TextFormField(
enabled: person.password != null && person.password.isNotEmpty,
decoration: const InputDecoration(
border: UnderlineInputBorder(),
@@ -269,14 +269,14 @@
validator: _validatePassword,
),
const SizedBox(height: 24.0),
- new Center(
- child: new RaisedButton(
+ Center(
+ child: RaisedButton(
child: const Text('SUBMIT'),
onPressed: _handleSubmitted,
),
),
const SizedBox(height: 24.0),
- new Text(
+ Text(
'* indicates required field',
style: Theme.of(context).textTheme.caption
),
@@ -300,7 +300,7 @@
final int newTextLength = newValue.text.length;
int selectionIndex = newValue.selection.end;
int usedSubstringIndex = 0;
- final StringBuffer newText = new StringBuffer();
+ final StringBuffer newText = StringBuffer();
if (newTextLength >= 1) {
newText.write('(');
if (newValue.selection.end >= 1)
@@ -324,9 +324,9 @@
// Dump the rest.
if (newTextLength >= usedSubstringIndex)
newText.write(newValue.text.substring(usedSubstringIndex));
- return new TextEditingValue(
+ return TextEditingValue(
text: newText.toString(),
- selection: new TextSelection.collapsed(offset: selectionIndex),
+ selection: TextSelection.collapsed(offset: selectionIndex),
);
}
}
diff --git a/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart b/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart
index 448ef95..b258409 100644
--- a/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/tooltip_demo.dart
@@ -16,34 +16,34 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new Scaffold(
- appBar: new AppBar(
+ return Scaffold(
+ appBar: AppBar(
title: const Text('Tooltips')
),
- body: new Builder(
+ body: Builder(
builder: (BuildContext context) {
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new ListView(
+ child: ListView(
children: <Widget>[
- new Text(_introText, style: theme.textTheme.subhead),
- new Row(
+ Text(_introText, style: theme.textTheme.subhead),
+ Row(
children: <Widget>[
- new Text('Long press the ', style: theme.textTheme.subhead),
- new Tooltip(
+ Text('Long press the ', style: theme.textTheme.subhead),
+ Tooltip(
message: 'call icon',
- child: new Icon(
+ child: Icon(
Icons.call,
size: 18.0,
color: theme.iconTheme.color
)
),
- new Text(' icon.', style: theme.textTheme.subhead)
+ Text(' icon.', style: theme.textTheme.subhead)
]
),
- new Center(
- child: new IconButton(
+ Center(
+ child: IconButton(
iconSize: 48.0,
icon: const Icon(Icons.call),
color: theme.iconTheme.color,
@@ -57,7 +57,7 @@
)
]
.map((Widget widget) {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.only(top: 16.0, left: 16.0, right: 16.0),
child: widget
);
diff --git a/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart b/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart
index effdd92..3f8d9f3 100644
--- a/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/two_level_list_demo.dart
@@ -9,12 +9,12 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- appBar: new AppBar(title: const Text('Expand/collapse list control')),
- body: new ListView(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Expand/collapse list control')),
+ body: ListView(
children: <Widget>[
const ListTile(title: Text('Top')),
- new ExpansionTile(
+ ExpansionTile(
title: const Text('Sublist'),
backgroundColor: Theme.of(context).accentColor.withOpacity(0.025),
children: const <Widget>[
diff --git a/examples/flutter_gallery/lib/demo/pesto_demo.dart b/examples/flutter_gallery/lib/demo/pesto_demo.dart
index bc16884..fec72f7 100644
--- a/examples/flutter_gallery/lib/demo/pesto_demo.dart
+++ b/examples/flutter_gallery/lib/demo/pesto_demo.dart
@@ -11,7 +11,7 @@
static const String routeName = '/pesto';
@override
- Widget build(BuildContext context) => new PestoHome();
+ Widget build(BuildContext context) => PestoHome();
}
@@ -21,9 +21,9 @@
const double _kFabHalfSize = 28.0; // TODO(mpcomplete): needs to adapt to screen size
const double _kRecipePageMaxWidth = 500.0;
-final Set<Recipe> _favoriteRecipes = new Set<Recipe>();
+final Set<Recipe> _favoriteRecipes = Set<Recipe>();
-final ThemeData _kTheme = new ThemeData(
+final ThemeData _kTheme = ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.teal,
accentColor: Colors.redAccent,
@@ -39,7 +39,7 @@
class PestoFavorites extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new RecipeGridPage(recipes: _favoriteRecipes.toList());
+ return RecipeGridPage(recipes: _favoriteRecipes.toList());
}
}
@@ -69,20 +69,20 @@
final List<Recipe> recipes;
@override
- _RecipeGridPageState createState() => new _RecipeGridPageState();
+ _RecipeGridPageState createState() => _RecipeGridPageState();
}
class _RecipeGridPageState extends State<RecipeGridPage> {
- final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
final double statusBarHeight = MediaQuery.of(context).padding.top;
- return new Theme(
+ return Theme(
data: _kTheme.copyWith(platform: Theme.of(context).platform),
- child: new Scaffold(
+ child: Scaffold(
key: scaffoldKey,
- floatingActionButton: new FloatingActionButton(
+ floatingActionButton: FloatingActionButton(
child: const Icon(Icons.edit),
onPressed: () {
scaffoldKey.currentState.showSnackBar(const SnackBar(
@@ -90,7 +90,7 @@
));
},
),
- body: new CustomScrollView(
+ body: CustomScrollView(
slivers: <Widget>[
_buildAppBar(context, statusBarHeight),
_buildBody(context, statusBarHeight),
@@ -101,11 +101,11 @@
}
Widget _buildAppBar(BuildContext context, double statusBarHeight) {
- return new SliverAppBar(
+ return SliverAppBar(
pinned: true,
expandedHeight: _kAppBarHeight,
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.search),
tooltip: 'Search',
onPressed: () {
@@ -115,20 +115,20 @@
},
),
],
- flexibleSpace: new LayoutBuilder(
+ flexibleSpace: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final Size size = constraints.biggest;
final double appBarHeight = size.height - statusBarHeight;
final double t = (appBarHeight - kToolbarHeight) / (_kAppBarHeight - kToolbarHeight);
- final double extraPadding = new Tween<double>(begin: 10.0, end: 24.0).lerp(t);
+ final double extraPadding = Tween<double>(begin: 10.0, end: 24.0).lerp(t);
final double logoHeight = appBarHeight - 1.5 * extraPadding;
- return new Padding(
- padding: new EdgeInsets.only(
+ return Padding(
+ padding: EdgeInsets.only(
top: statusBarHeight + 0.5 * extraPadding,
bottom: extraPadding,
),
- child: new Center(
- child: new PestoLogo(height: logoHeight, t: t.clamp(0.0, 1.0))
+ child: Center(
+ child: PestoLogo(height: logoHeight, t: t.clamp(0.0, 1.0))
),
);
},
@@ -138,24 +138,24 @@
Widget _buildBody(BuildContext context, double statusBarHeight) {
final EdgeInsets mediaPadding = MediaQuery.of(context).padding;
- final EdgeInsets padding = new EdgeInsets.only(
+ final EdgeInsets padding = EdgeInsets.only(
top: 8.0,
left: 8.0 + mediaPadding.left,
right: 8.0 + mediaPadding.right,
bottom: 8.0
);
- return new SliverPadding(
+ return SliverPadding(
padding: padding,
- sliver: new SliverGrid(
+ sliver: SliverGrid(
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: _kRecipePageMaxWidth,
crossAxisSpacing: 8.0,
mainAxisSpacing: 8.0,
),
- delegate: new SliverChildBuilderDelegate(
+ delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
final Recipe recipe = widget.recipes[index];
- return new RecipeCard(
+ return RecipeCard(
recipe: recipe,
onTap: () { showRecipePage(context, recipe); },
);
@@ -167,19 +167,19 @@
}
void showFavoritesPage(BuildContext context) {
- Navigator.push(context, new MaterialPageRoute<void>(
+ Navigator.push(context, MaterialPageRoute<void>(
settings: const RouteSettings(name: '/pesto/favorites'),
- builder: (BuildContext context) => new PestoFavorites(),
+ builder: (BuildContext context) => PestoFavorites(),
));
}
void showRecipePage(BuildContext context, Recipe recipe) {
- Navigator.push(context, new MaterialPageRoute<void>(
+ Navigator.push(context, MaterialPageRoute<void>(
settings: const RouteSettings(name: '/pesto/recipe'),
builder: (BuildContext context) {
- return new Theme(
+ return Theme(
data: _kTheme.copyWith(platform: Theme.of(context).platform),
- child: new RecipePage(recipe: recipe),
+ child: RecipePage(recipe: recipe),
);
},
));
@@ -193,7 +193,7 @@
final double t;
@override
- _PestoLogoState createState() => new _PestoLogoState();
+ _PestoLogoState createState() => _PestoLogoState();
}
class _PestoLogoState extends State<PestoLogo> {
@@ -203,41 +203,41 @@
static const double kImageHeight = 108.0;
static const double kTextHeight = 48.0;
final TextStyle titleStyle = const PestoStyle(fontSize: kTextHeight, fontWeight: FontWeight.w900, color: Colors.white, letterSpacing: 3.0);
- final RectTween _textRectTween = new RectTween(
- begin: new Rect.fromLTWH(0.0, kLogoHeight, kLogoWidth, kTextHeight),
- end: new Rect.fromLTWH(0.0, kImageHeight, kLogoWidth, kTextHeight)
+ final RectTween _textRectTween = RectTween(
+ begin: Rect.fromLTWH(0.0, kLogoHeight, kLogoWidth, kTextHeight),
+ end: Rect.fromLTWH(0.0, kImageHeight, kLogoWidth, kTextHeight)
);
final Curve _textOpacity = const Interval(0.4, 1.0, curve: Curves.easeInOut);
- final RectTween _imageRectTween = new RectTween(
- begin: new Rect.fromLTWH(0.0, 0.0, kLogoWidth, kLogoHeight),
- end: new Rect.fromLTWH(0.0, 0.0, kLogoWidth, kImageHeight),
+ final RectTween _imageRectTween = RectTween(
+ begin: Rect.fromLTWH(0.0, 0.0, kLogoWidth, kLogoHeight),
+ end: Rect.fromLTWH(0.0, 0.0, kLogoWidth, kImageHeight),
);
@override
Widget build(BuildContext context) {
- return new Semantics(
+ return Semantics(
namesRoute: true,
- child: new Transform(
- transform: new Matrix4.identity()..scale(widget.height / kLogoHeight),
+ child: Transform(
+ transform: Matrix4.identity()..scale(widget.height / kLogoHeight),
alignment: Alignment.topCenter,
- child: new SizedBox(
+ child: SizedBox(
width: kLogoWidth,
- child: new Stack(
+ child: Stack(
overflow: Overflow.visible,
children: <Widget>[
- new Positioned.fromRect(
+ Positioned.fromRect(
rect: _imageRectTween.lerp(widget.t),
- child: new Image.asset(
+ child: Image.asset(
_kSmallLogoImage,
package: _kGalleryAssetsPackage,
fit: BoxFit.contain,
),
),
- new Positioned.fromRect(
+ Positioned.fromRect(
rect: _textRectTween.lerp(widget.t),
- child: new Opacity(
+ child: Opacity(
opacity: _textOpacity.transform(widget.t),
- child: new Text('PESTO', style: titleStyle, textAlign: TextAlign.center),
+ child: Text('PESTO', style: titleStyle, textAlign: TextAlign.center),
),
),
],
@@ -260,13 +260,13 @@
@override
Widget build(BuildContext context) {
- return new GestureDetector(
+ return GestureDetector(
onTap: onTap,
- child: new Card(
- child: new Column(
+ child: Card(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Hero(
+ Hero(
tag: 'packages/$_kGalleryAssetsPackage/${recipe.imagePath}',
child: AspectRatio(
aspectRatio: 4.0 / 3.0,
@@ -278,25 +278,25 @@
),
),
),
- new Expanded(
- child: new Row(
+ Expanded(
+ child: Row(
children: <Widget>[
- new Padding(
+ Padding(
padding: const EdgeInsets.all(16.0),
- child: new Image.asset(
+ child: Image.asset(
recipe.ingredientsImagePath,
package: recipe.ingredientsImagePackage,
width: 48.0,
height: 48.0,
),
),
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
- new Text(recipe.name, style: titleStyle, softWrap: false, overflow: TextOverflow.ellipsis),
- new Text(recipe.author, style: authorStyle),
+ Text(recipe.name, style: titleStyle, softWrap: false, overflow: TextOverflow.ellipsis),
+ Text(recipe.author, style: authorStyle),
],
),
),
@@ -317,11 +317,11 @@
final Recipe recipe;
@override
- _RecipePageState createState() => new _RecipePageState();
+ _RecipePageState createState() => _RecipePageState();
}
class _RecipePageState extends State<RecipePage> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
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;
@@ -335,31 +335,31 @@
final Size screenSize = MediaQuery.of(context).size;
final bool fullWidth = screenSize.width < _kRecipePageMaxWidth;
final bool isFavorite = _favoriteRecipes.contains(widget.recipe);
- return new Scaffold(
+ return Scaffold(
key: _scaffoldKey,
- body: new Stack(
+ body: Stack(
children: <Widget>[
- new Positioned(
+ Positioned(
top: 0.0,
left: 0.0,
right: 0.0,
height: appBarHeight + _kFabHalfSize,
- child: new Hero(
+ child: Hero(
tag: 'packages/$_kGalleryAssetsPackage/${widget.recipe.imagePath}',
- child: new Image.asset(
+ child: Image.asset(
widget.recipe.imagePath,
package: widget.recipe.imagePackage,
fit: fullWidth ? BoxFit.fitWidth : BoxFit.cover,
),
),
),
- new CustomScrollView(
+ CustomScrollView(
slivers: <Widget>[
- new SliverAppBar(
+ SliverAppBar(
expandedHeight: appBarHeight - _kFabHalfSize,
backgroundColor: Colors.transparent,
actions: <Widget>[
- new PopupMenuButton<String>(
+ PopupMenuButton<String>(
onSelected: (String item) {},
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
_buildMenuItem(Icons.share, 'Tweet recipe'),
@@ -381,18 +381,18 @@
),
),
),
- new SliverToBoxAdapter(
- child: new Stack(
+ SliverToBoxAdapter(
+ child: Stack(
children: <Widget>[
- new Container(
+ Container(
padding: const EdgeInsets.only(top: _kFabHalfSize),
width: fullWidth ? null : _kRecipePageMaxWidth,
- child: new RecipeSheet(recipe: widget.recipe),
+ child: RecipeSheet(recipe: widget.recipe),
),
- new Positioned(
+ Positioned(
right: 16.0,
- child: new FloatingActionButton(
- child: new Icon(isFavorite ? Icons.favorite : Icons.favorite_border),
+ child: FloatingActionButton(
+ child: Icon(isFavorite ? Icons.favorite : Icons.favorite_border),
onPressed: _toggleFavorite,
),
),
@@ -407,14 +407,14 @@
}
PopupMenuItem<String> _buildMenuItem(IconData icon, String label) {
- return new PopupMenuItem<String>(
- child: new Row(
+ return PopupMenuItem<String>(
+ child: Row(
children: <Widget>[
- new Padding(
+ Padding(
padding: const EdgeInsets.only(right: 24.0),
- child: new Icon(icon, color: Colors.black54)
+ child: Icon(icon, color: Colors.black54)
),
- new Text(label, style: menuItemStyle),
+ Text(label, style: menuItemStyle),
],
),
);
@@ -435,7 +435,7 @@
final TextStyle titleStyle = const PestoStyle(fontSize: 34.0);
final TextStyle descriptionStyle = const PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0);
final TextStyle itemStyle = const PestoStyle(fontSize: 15.0, height: 24.0/15.0);
- final TextStyle itemAmountStyle = new PestoStyle(fontSize: 15.0, color: _kTheme.primaryColor, height: 24.0/15.0);
+ final TextStyle itemAmountStyle = PestoStyle(fontSize: 15.0, color: _kTheme.primaryColor, height: 24.0/15.0);
final TextStyle headingStyle = const PestoStyle(fontSize: 16.0, fontWeight: FontWeight.bold, height: 24.0/15.0);
RecipeSheet({ Key key, this.recipe }) : super(key: key);
@@ -444,22 +444,22 @@
@override
Widget build(BuildContext context) {
- return new Material(
- child: new SafeArea(
+ return Material(
+ child: SafeArea(
top: false,
bottom: false,
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 40.0),
- child: new Table(
+ child: Table(
columnWidths: const <int, TableColumnWidth>{
0: FixedColumnWidth(64.0)
},
children: <TableRow>[
- new TableRow(
+ TableRow(
children: <Widget>[
- new TableCell(
+ TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
- child: new Image.asset(
+ child: Image.asset(
recipe.ingredientsImagePath,
package: recipe.ingredientsImagePackage,
width: 32.0,
@@ -468,27 +468,27 @@
fit: BoxFit.scaleDown
)
),
- new TableCell(
+ TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
- child: new Text(recipe.name, style: titleStyle)
+ child: Text(recipe.name, style: titleStyle)
),
]
),
- new TableRow(
+ TableRow(
children: <Widget>[
const SizedBox(),
- new Padding(
+ Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 4.0),
- child: new Text(recipe.description, style: descriptionStyle)
+ child: Text(recipe.description, style: descriptionStyle)
),
]
),
- new TableRow(
+ TableRow(
children: <Widget>[
const SizedBox(),
- new Padding(
+ Padding(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
- child: new Text('Ingredients', style: headingStyle)
+ child: Text('Ingredients', style: headingStyle)
),
]
),
@@ -497,12 +497,12 @@
return _buildItemRow(ingredient.amount, ingredient.description);
}
))..add(
- new TableRow(
+ TableRow(
children: <Widget>[
const SizedBox(),
- new Padding(
+ Padding(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
- child: new Text('Steps', style: headingStyle)
+ child: Text('Steps', style: headingStyle)
),
]
)
@@ -518,15 +518,15 @@
}
TableRow _buildItemRow(String left, String right) {
- return new TableRow(
+ return TableRow(
children: <Widget>[
- new Padding(
+ Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
- child: new Text(left, style: itemAmountStyle),
+ child: Text(left, style: itemAmountStyle),
),
- new Padding(
+ Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
- child: new Text(right, style: itemStyle),
+ child: Text(right, style: itemStyle),
),
],
);
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart
index a8f9e5f..85dcce3 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_data.dart
@@ -274,5 +274,5 @@
List<Product> allProducts() {
assert(_allProducts.every((Product product) => product.isValid()));
- return new List<Product>.unmodifiable(_allProducts);
+ return List<Product>.unmodifiable(_allProducts);
}
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
index c9f6b40..6e30227 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
@@ -16,7 +16,7 @@
const double unitSize = kToolbarHeight;
-final List<Product> _products = new List<Product>.from(allProducts());
+final List<Product> _products = List<Product>.from(allProducts());
final Map<Product, Order> _shoppingCart = <Product, Order>{};
const int _childrenPerBlock = 8;
@@ -75,7 +75,7 @@
final int row = _rowAtIndex(index);
final int column = _columnAtIndex(index);
final int columnSpan = _columnSpanAtIndex(index);
- return new SliverGridGeometry(
+ return SliverGridGeometry(
scrollOffset: row * rowStride,
crossAxisOffset: column * columnStride,
mainAxisExtent: tileHeight,
@@ -100,7 +100,7 @@
SliverGridLayout getLayout(SliverConstraints constraints) {
final double tileWidth = (constraints.crossAxisExtent - _spacing) / 2.0;
const double tileHeight = 40.0 + 144.0 + 40.0;
- return new _ShrineGridLayout(
+ return _ShrineGridLayout(
tileWidth: tileWidth,
tileHeight: tileHeight,
rowStride: tileHeight + _spacing,
@@ -122,15 +122,15 @@
@override
Widget build(BuildContext context) {
- return new SizedBox(
+ return SizedBox(
height: 24.0,
- child: new Row(
+ child: Row(
children: <Widget>[
- new SizedBox(
+ SizedBox(
width: 24.0,
- child: new ClipRRect(
- borderRadius: new BorderRadius.circular(12.0),
- child: new Image.asset(
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(12.0),
+ child: Image.asset(
vendor.avatarAsset,
package: vendor.avatarAssetPackage,
fit: BoxFit.cover,
@@ -138,8 +138,8 @@
),
),
const SizedBox(width: 8.0),
- new Expanded(
- child: new Text(vendor.name, style: ShrineTheme.of(context).vendorItemStyle),
+ Expanded(
+ child: Text(vendor.name, style: ShrineTheme.of(context).vendorItemStyle),
),
],
),
@@ -159,12 +159,12 @@
Widget buildItem(BuildContext context, TextStyle style, EdgeInsets padding) {
BoxDecoration decoration;
if (_shoppingCart[product] != null)
- decoration = new BoxDecoration(color: ShrineTheme.of(context).priceHighlightColor);
+ decoration = BoxDecoration(color: ShrineTheme.of(context).priceHighlightColor);
- return new Container(
+ return Container(
padding: padding,
decoration: decoration,
- child: new Text(product.priceString, style: style),
+ child: Text(product.priceString, style: style),
);
}
}
@@ -206,34 +206,34 @@
@override
void performLayout(Size size) {
- final Size priceSize = layoutChild(price, new BoxConstraints.loose(size));
- positionChild(price, new Offset(size.width - priceSize.width, 0.0));
+ final Size priceSize = layoutChild(price, BoxConstraints.loose(size));
+ positionChild(price, Offset(size.width - priceSize.width, 0.0));
final double halfWidth = size.width / 2.0;
final double halfHeight = size.height / 2.0;
const double halfUnit = unitSize / 2.0;
const double margin = 16.0;
- final Size imageSize = layoutChild(image, new BoxConstraints.loose(size));
+ final Size imageSize = layoutChild(image, BoxConstraints.loose(size));
final double imageX = imageSize.width < halfWidth - halfUnit
? halfWidth / 2.0 - imageSize.width / 2.0 - halfUnit
: halfWidth - imageSize.width;
- positionChild(image, new Offset(imageX, halfHeight - imageSize.height / 2.0));
+ positionChild(image, Offset(imageX, halfHeight - imageSize.height / 2.0));
final double maxTitleWidth = halfWidth + unitSize - margin;
- final BoxConstraints titleBoxConstraints = new BoxConstraints(maxWidth: maxTitleWidth);
+ final BoxConstraints titleBoxConstraints = BoxConstraints(maxWidth: maxTitleWidth);
final Size titleSize = layoutChild(title, titleBoxConstraints);
final double titleX = halfWidth - unitSize;
final double titleY = halfHeight - titleSize.height;
- positionChild(title, new Offset(titleX, titleY));
+ positionChild(title, Offset(titleX, titleY));
final Size descriptionSize = layoutChild(description, titleBoxConstraints);
final double descriptionY = titleY + titleSize.height + margin;
- positionChild(description, new Offset(titleX, descriptionY));
+ positionChild(description, Offset(titleX, descriptionY));
layoutChild(vendor, titleBoxConstraints);
final double vendorY = descriptionY + descriptionSize.height + margin;
- positionChild(vendor, new Offset(titleX, vendorY));
+ positionChild(vendor, Offset(titleX, vendorY));
}
@override
@@ -254,42 +254,42 @@
Widget build(BuildContext context) {
final Size screenSize = MediaQuery.of(context).size;
final ShrineTheme theme = ShrineTheme.of(context);
- return new MergeSemantics(
- child: new SizedBox(
+ return MergeSemantics(
+ child: SizedBox(
height: screenSize.width > screenSize.height
? (screenSize.height - kToolbarHeight) * 0.85
: (screenSize.height - kToolbarHeight) * 0.70,
- child: new Container(
- decoration: new BoxDecoration(
+ child: Container(
+ decoration: BoxDecoration(
color: theme.cardBackgroundColor,
- border: new Border(bottom: new BorderSide(color: theme.dividerColor)),
+ border: Border(bottom: BorderSide(color: theme.dividerColor)),
),
- child: new CustomMultiChildLayout(
- delegate: new _HeadingLayout(),
+ child: CustomMultiChildLayout(
+ delegate: _HeadingLayout(),
children: <Widget>[
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.price,
- child: new _FeaturePriceItem(product: product),
+ child: _FeaturePriceItem(product: product),
),
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.image,
- child: new Image.asset(
+ child: Image.asset(
product.imageAsset,
package: product.imageAssetPackage,
fit: BoxFit.cover,
),
),
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.title,
- child: new Text(product.featureTitle, style: theme.featureTitleStyle),
+ child: Text(product.featureTitle, style: theme.featureTitleStyle),
),
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.description,
- child: new Text(product.featureDescription, style: theme.featureStyle),
+ child: Text(product.featureDescription, style: theme.featureStyle),
),
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.vendor,
- child: new _VendorItem(vendor: product.vendor),
+ child: _VendorItem(vendor: product.vendor),
),
],
),
@@ -311,38 +311,38 @@
@override
Widget build(BuildContext context) {
- return new MergeSemantics(
- child: new Card(
- child: new Stack(
+ return MergeSemantics(
+ child: Card(
+ child: Stack(
children: <Widget>[
- new Column(
+ Column(
children: <Widget>[
- new Align(
+ Align(
alignment: Alignment.centerRight,
- child: new _ProductPriceItem(product: product),
+ child: _ProductPriceItem(product: product),
),
- new Container(
+ Container(
width: 144.0,
height: 144.0,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
- child: new Hero(
+ child: Hero(
tag: product.tag,
- child: new Image.asset(
+ child: Image.asset(
product.imageAsset,
package: product.imageAssetPackage,
fit: BoxFit.contain,
),
),
),
- new Padding(
+ Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
- child: new _VendorItem(vendor: product.vendor),
+ child: _VendorItem(vendor: product.vendor),
),
],
),
- new Material(
+ Material(
type: MaterialType.transparency,
- child: new InkWell(onTap: onPressed),
+ child: InkWell(onTap: onPressed),
),
],
),
@@ -355,19 +355,19 @@
// of the product items.
class ShrineHome extends StatefulWidget {
@override
- _ShrineHomeState createState() => new _ShrineHomeState();
+ _ShrineHomeState createState() => _ShrineHomeState();
}
class _ShrineHomeState extends State<ShrineHome> {
- static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Home');
- static final _ShrineGridDelegate gridDelegate = new _ShrineGridDelegate();
+ static final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(debugLabel: 'Shrine Home');
+ static final _ShrineGridDelegate gridDelegate = _ShrineGridDelegate();
Future<Null> _showOrderPage(Product product) async {
- final Order order = _shoppingCart[product] ?? new Order(product: product);
- final Order completedOrder = await Navigator.push(context, new ShrineOrderRoute(
+ final Order order = _shoppingCart[product] ?? Order(product: product);
+ final Order completedOrder = await Navigator.push(context, ShrineOrderRoute(
order: order,
builder: (BuildContext context) {
- return new OrderPage(
+ return OrderPage(
order: order,
products: _products,
shoppingCart: _shoppingCart,
@@ -382,21 +382,21 @@
@override
Widget build(BuildContext context) {
final Product featured = _products.firstWhere((Product product) => product.featureDescription != null);
- return new ShrinePage(
+ return ShrinePage(
scaffoldKey: _scaffoldKey,
products: _products,
shoppingCart: _shoppingCart,
- body: new CustomScrollView(
+ body: CustomScrollView(
slivers: <Widget>[
- new SliverToBoxAdapter(child: new _Heading(product: featured)),
- new SliverSafeArea(
+ SliverToBoxAdapter(child: _Heading(product: featured)),
+ SliverSafeArea(
top: false,
minimum: const EdgeInsets.all(16.0),
- sliver: new SliverGrid(
+ sliver: SliverGrid(
gridDelegate: gridDelegate,
- delegate: new SliverChildListDelegate(
+ delegate: SliverChildListDelegate(
_products.map((Product product) {
- return new _ProductItem(
+ return _ProductItem(
product: product,
onPressed: () { _showOrderPage(product); },
);
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
index 5b49ceb..453b16e 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart
@@ -28,30 +28,30 @@
@override
Widget build(BuildContext context) {
final ShrineTheme theme = ShrineTheme.of(context);
- return new Column(
+ return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
- new Text(product.name, style: theme.featureTitleStyle),
+ Text(product.name, style: theme.featureTitleStyle),
const SizedBox(height: 24.0),
- new Text(product.description, style: theme.featureStyle),
+ Text(product.description, style: theme.featureStyle),
const SizedBox(height: 16.0),
- new Padding(
+ Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 88.0),
- child: new DropdownButtonHideUnderline(
- child: new Container(
- decoration: new BoxDecoration(
- border: new Border.all(
+ child: DropdownButtonHideUnderline(
+ child: Container(
+ decoration: BoxDecoration(
+ border: Border.all(
color: const Color(0xFFD9D9D9),
),
),
- child: new DropdownButton<int>(
+ child: DropdownButton<int>(
items: <int>[0, 1, 2, 3, 4, 5].map((int value) {
- return new DropdownMenuItem<int>(
+ return DropdownMenuItem<int>(
value: value,
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.only(left: 8.0),
- child: new Text('Quantity $value', style: theme.quantityMenuStyle),
+ child: Text('Quantity $value', style: theme.quantityMenuStyle),
),
);
}).toList(),
@@ -77,19 +77,19 @@
@override
Widget build(BuildContext context) {
final ShrineTheme theme = ShrineTheme.of(context);
- return new Column(
+ return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
- new SizedBox(
+ SizedBox(
height: 24.0,
- child: new Align(
+ child: Align(
alignment: Alignment.bottomLeft,
- child: new Text(vendor.name, style: theme.vendorTitleStyle),
+ child: Text(vendor.name, style: theme.vendorTitleStyle),
),
),
const SizedBox(height: 16.0),
- new Text(vendor.description, style: theme.vendorStyle),
+ Text(vendor.description, style: theme.vendorStyle),
],
);
}
@@ -110,26 +110,26 @@
const double margin = 56.0;
final bool landscape = size.width > size.height;
final double imageWidth = (landscape ? size.width / 2.0 : size.width) - margin * 2.0;
- final BoxConstraints imageConstraints = new BoxConstraints(maxHeight: 224.0, maxWidth: imageWidth);
+ final BoxConstraints imageConstraints = BoxConstraints(maxHeight: 224.0, maxWidth: imageWidth);
final Size imageSize = layoutChild(image, imageConstraints);
const double imageY = 0.0;
positionChild(image, const Offset(margin, imageY));
final double productWidth = landscape ? size.width / 2.0 : size.width - margin;
- final BoxConstraints productConstraints = new BoxConstraints(maxWidth: productWidth);
+ final BoxConstraints productConstraints = BoxConstraints(maxWidth: productWidth);
final Size productSize = layoutChild(product, productConstraints);
final double productX = landscape ? size.width / 2.0 : margin;
final double productY = landscape ? 0.0 : imageY + imageSize.height + 16.0;
- positionChild(product, new Offset(productX, productY));
+ positionChild(product, Offset(productX, productY));
- final Size iconSize = layoutChild(icon, new BoxConstraints.loose(size));
- positionChild(icon, new Offset(productX - iconSize.width - 16.0, productY + 8.0));
+ final Size iconSize = layoutChild(icon, BoxConstraints.loose(size));
+ positionChild(icon, Offset(productX - iconSize.width - 16.0, productY + 8.0));
final double vendorWidth = landscape ? size.width - margin : productWidth;
- layoutChild(vendor, new BoxConstraints(maxWidth: vendorWidth));
+ layoutChild(vendor, BoxConstraints(maxWidth: vendorWidth));
final double vendorX = landscape ? margin : productX;
final double vendorY = productY + productSize.height + 16.0;
- positionChild(vendor, new Offset(vendorX, vendorY));
+ positionChild(vendor, Offset(vendorX, vendorY));
}
@override
@@ -155,21 +155,21 @@
@override
Widget build(BuildContext context) {
final Size screenSize = MediaQuery.of(context).size;
- return new SizedBox(
+ return SizedBox(
height: (screenSize.height - kToolbarHeight) * 1.35,
- child: new Material(
+ child: Material(
type: MaterialType.card,
elevation: 0.0,
- child: new Padding(
+ child: Padding(
padding: const EdgeInsets.only(left: 16.0, top: 18.0, right: 16.0, bottom: 24.0),
- child: new CustomMultiChildLayout(
- delegate: new _HeadingLayout(),
+ child: CustomMultiChildLayout(
+ delegate: _HeadingLayout(),
children: <Widget>[
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.image,
- child: new Hero(
+ child: Hero(
tag: product.tag,
- child: new Image.asset(
+ child: Image.asset(
product.imageAsset,
package: product.imageAssetPackage,
fit: BoxFit.contain,
@@ -177,7 +177,7 @@
),
),
),
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.icon,
child: const Icon(
Icons.info_outline,
@@ -185,17 +185,17 @@
color: Color(0xFFFFE0E0),
),
),
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.product,
- child: new _ProductItem(
+ child: _ProductItem(
product: product,
quantity: quantity,
onChanged: quantityChanged,
),
),
- new LayoutId(
+ LayoutId(
id: _HeadingLayout.vendor,
- child: new _VendorItem(vendor: product.vendor),
+ child: _VendorItem(vendor: product.vendor),
),
],
),
@@ -221,7 +221,7 @@
final Map<Product, Order> shoppingCart;
@override
- _OrderPageState createState() => new _OrderPageState();
+ _OrderPageState createState() => _OrderPageState();
}
// Displays a product's heading above photos of all of the other products
@@ -233,7 +233,7 @@
@override
void initState() {
super.initState();
- scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Order ${widget.order}');
+ scaffoldKey = GlobalKey<ScaffoldState>(debugLabel: 'Shrine Order ${widget.order}');
}
Order get currentOrder => ShrineOrderRoute.of(context).order;
@@ -253,16 +253,16 @@
}
void showSnackBarMessage(String message) {
- scaffoldKey.currentState.showSnackBar(new SnackBar(content: new Text(message)));
+ scaffoldKey.currentState.showSnackBar(SnackBar(content: Text(message)));
}
@override
Widget build(BuildContext context) {
- return new ShrinePage(
+ return ShrinePage(
scaffoldKey: scaffoldKey,
products: widget.products,
shoppingCart: widget.shoppingCart,
- floatingActionButton: new FloatingActionButton(
+ floatingActionButton: FloatingActionButton(
onPressed: () {
updateOrder(inCart: true);
final int n = currentOrder.quantity;
@@ -277,31 +277,31 @@
color: Colors.black,
),
),
- body: new CustomScrollView(
+ body: CustomScrollView(
slivers: <Widget>[
- new SliverToBoxAdapter(
- child: new _Heading(
+ SliverToBoxAdapter(
+ child: _Heading(
product: widget.order.product,
quantity: currentOrder.quantity,
quantityChanged: (int value) { updateOrder(quantity: value); },
),
),
- new SliverSafeArea(
+ SliverSafeArea(
top: false,
minimum: const EdgeInsets.fromLTRB(8.0, 32.0, 8.0, 8.0),
- sliver: new SliverGrid(
+ sliver: SliverGrid(
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 248.0,
mainAxisSpacing: 8.0,
crossAxisSpacing: 8.0,
),
- delegate: new SliverChildListDelegate(
+ delegate: SliverChildListDelegate(
widget.products
.where((Product product) => product != widget.order.product)
.map((Product product) {
- return new Card(
+ return Card(
elevation: 1.0,
- child: new Image.asset(
+ child: Image.asset(
product.imageAsset,
package: product.imageAssetPackage,
fit: BoxFit.contain,
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
index f920f60..b31cb3d 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
@@ -32,7 +32,7 @@
final Map<Product, Order> shoppingCart;
@override
- ShrinePageState createState() => new ShrinePageState();
+ ShrinePageState createState() => ShrinePageState();
}
/// Defines the Scaffold, AppBar, etc that the demo pages have in common.
@@ -57,13 +57,13 @@
child: Text('The shopping cart is empty')
);
}
- return new ListView(
+ return ListView(
padding: kMaterialListPadding,
children: widget.shoppingCart.values.map((Order order) {
- return new ListTile(
- title: new Text(order.product.name),
- leading: new Text('${order.quantity}'),
- subtitle: new Text(order.product.vendor.name)
+ return ListTile(
+ title: Text(order.product.name),
+ leading: Text('${order.quantity}'),
+ subtitle: Text(order.product.vendor.name)
);
}).toList(),
);
@@ -86,29 +86,29 @@
@override
Widget build(BuildContext context) {
final ShrineTheme theme = ShrineTheme.of(context);
- return new Scaffold(
+ return Scaffold(
key: widget.scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
elevation: _appBarElevation,
backgroundColor: theme.appBarBackgroundColor,
iconTheme: Theme.of(context).iconTheme,
brightness: Brightness.light,
- flexibleSpace: new Container(
- decoration: new BoxDecoration(
- border: new Border(
- bottom: new BorderSide(color: theme.dividerColor)
+ flexibleSpace: Container(
+ decoration: BoxDecoration(
+ border: Border(
+ bottom: BorderSide(color: theme.dividerColor)
)
)
),
- title: new Text('SHRINE', style: ShrineTheme.of(context).appBarTitleStyle),
+ title: Text('SHRINE', style: ShrineTheme.of(context).appBarTitleStyle),
centerTitle: true,
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.shopping_cart),
tooltip: 'Shopping cart',
onPressed: _showShoppingCart
),
- new PopupMenuButton<ShrineAction>(
+ PopupMenuButton<ShrineAction>(
itemBuilder: (BuildContext context) => <PopupMenuItem<ShrineAction>>[
const PopupMenuItem<ShrineAction>(
value: ShrineAction.sortByPrice,
@@ -140,7 +140,7 @@
]
),
floatingActionButton: widget.floatingActionButton,
- body: new NotificationListener<ScrollNotification>(
+ body: NotificationListener<ScrollNotification>(
onNotification: _handleScrollNotification,
child: widget.body
)
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_theme.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_theme.dart
index c95b0f9..8e14634 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_theme.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_theme.dart
@@ -12,15 +12,15 @@
: super(inherit: false, color: color, fontFamily: 'AbrilFatface', fontSize: size, fontWeight: weight, textBaseline: TextBaseline.alphabetic);
}
-TextStyle robotoRegular12(Color color) => new ShrineStyle.roboto(12.0, FontWeight.w500, color);
-TextStyle robotoLight12(Color color) => new ShrineStyle.roboto(12.0, FontWeight.w300, color);
-TextStyle robotoRegular14(Color color) => new ShrineStyle.roboto(14.0, FontWeight.w500, color);
-TextStyle robotoMedium14(Color color) => new ShrineStyle.roboto(14.0, FontWeight.w600, color);
-TextStyle robotoLight14(Color color) => new ShrineStyle.roboto(14.0, FontWeight.w300, color);
-TextStyle robotoRegular16(Color color) => new ShrineStyle.roboto(16.0, FontWeight.w500, color);
-TextStyle robotoRegular20(Color color) => new ShrineStyle.roboto(20.0, FontWeight.w500, color);
-TextStyle abrilFatfaceRegular24(Color color) => new ShrineStyle.abrilFatface(24.0, FontWeight.w500, color);
-TextStyle abrilFatfaceRegular34(Color color) => new ShrineStyle.abrilFatface(34.0, FontWeight.w500, color);
+TextStyle robotoRegular12(Color color) => ShrineStyle.roboto(12.0, FontWeight.w500, color);
+TextStyle robotoLight12(Color color) => ShrineStyle.roboto(12.0, FontWeight.w300, color);
+TextStyle robotoRegular14(Color color) => ShrineStyle.roboto(14.0, FontWeight.w500, color);
+TextStyle robotoMedium14(Color color) => ShrineStyle.roboto(14.0, FontWeight.w600, color);
+TextStyle robotoLight14(Color color) => ShrineStyle.roboto(14.0, FontWeight.w300, color);
+TextStyle robotoRegular16(Color color) => ShrineStyle.roboto(16.0, FontWeight.w500, color);
+TextStyle robotoRegular20(Color color) => ShrineStyle.roboto(20.0, FontWeight.w500, color);
+TextStyle abrilFatfaceRegular24(Color color) => ShrineStyle.abrilFatface(24.0, FontWeight.w500, color);
+TextStyle abrilFatfaceRegular34(Color color) => ShrineStyle.abrilFatface(34.0, FontWeight.w500, color);
/// The TextStyles and Colors used for titles, labels, and descriptions. This
/// InheritedWidget is shared by all of the routes and widgets created for
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart
index e87aeba..884e646 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_types.dart
@@ -80,7 +80,7 @@
final bool inCart;
Order copyWith({ Product product, int quantity, bool inCart }) {
- return new Order(
+ return Order(
product: product ?? this.product,
quantity: quantity ?? this.quantity,
inCart: inCart ?? this.inCart
diff --git a/examples/flutter_gallery/lib/demo/shrine_demo.dart b/examples/flutter_gallery/lib/demo/shrine_demo.dart
index cf21c63..24cd2d8 100644
--- a/examples/flutter_gallery/lib/demo/shrine_demo.dart
+++ b/examples/flutter_gallery/lib/demo/shrine_demo.dart
@@ -11,13 +11,13 @@
// used by the ShrineDemo and by each route pushed from there because this
// isn't a standalone app with its own main() and MaterialApp.
Widget buildShrine(BuildContext context, Widget child) {
- return new Theme(
- data: new ThemeData(
+ return Theme(
+ data: ThemeData(
primarySwatch: Colors.grey,
iconTheme: const IconThemeData(color: Color(0xFF707070)),
platform: Theme.of(context).platform,
),
- child: new ShrineTheme(child: child)
+ child: ShrineTheme(child: child)
);
}
@@ -38,5 +38,5 @@
static const String routeName = '/shrine'; // Used by the Gallery app.
@override
- Widget build(BuildContext context) => buildShrine(context, new ShrineHome());
+ Widget build(BuildContext context) => buildShrine(context, ShrineHome());
}
diff --git a/examples/flutter_gallery/lib/demo/typography_demo.dart b/examples/flutter_gallery/lib/demo/typography_demo.dart
index 3a63ea3..fd2013d 100644
--- a/examples/flutter_gallery/lib/demo/typography_demo.dart
+++ b/examples/flutter_gallery/lib/demo/typography_demo.dart
@@ -23,17 +23,17 @@
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle nameStyle = theme.textTheme.caption.copyWith(color: theme.textTheme.caption.color);
- return new Padding(
+ return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
- child: new Row(
+ child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new SizedBox(
+ SizedBox(
width: 72.0,
- child: new Text(name, style: nameStyle)
+ child: Text(name, style: nameStyle)
),
- new Expanded(
- child: new Text(text, style: style.copyWith(height: 1.0))
+ Expanded(
+ child: Text(text, style: style.copyWith(height: 1.0))
)
]
)
@@ -48,32 +48,32 @@
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
final List<Widget> styleItems = <Widget>[
- new TextStyleItem(name: 'Display 3', style: textTheme.display3, text: 'Regular 56sp'),
- new TextStyleItem(name: 'Display 2', style: textTheme.display2, text: 'Regular 45sp'),
- new TextStyleItem(name: 'Display 1', style: textTheme.display1, text: 'Regular 34sp'),
- new TextStyleItem(name: 'Headline', style: textTheme.headline, text: 'Regular 24sp'),
- new TextStyleItem(name: 'Title', style: textTheme.title, text: 'Medium 20sp'),
- new TextStyleItem(name: 'Subheading', style: textTheme.subhead, text: 'Regular 16sp'),
- new TextStyleItem(name: 'Body 2', style: textTheme.body2, text: 'Medium 14sp'),
- new TextStyleItem(name: 'Body 1', style: textTheme.body1, text: 'Regular 14sp'),
- new TextStyleItem(name: 'Caption', style: textTheme.caption, text: 'Regular 12sp'),
- new TextStyleItem(name: 'Button', style: textTheme.button, text: 'MEDIUM (ALL CAPS) 14sp')
+ TextStyleItem(name: 'Display 3', style: textTheme.display3, text: 'Regular 56sp'),
+ TextStyleItem(name: 'Display 2', style: textTheme.display2, text: 'Regular 45sp'),
+ TextStyleItem(name: 'Display 1', style: textTheme.display1, text: 'Regular 34sp'),
+ TextStyleItem(name: 'Headline', style: textTheme.headline, text: 'Regular 24sp'),
+ TextStyleItem(name: 'Title', style: textTheme.title, text: 'Medium 20sp'),
+ TextStyleItem(name: 'Subheading', style: textTheme.subhead, text: 'Regular 16sp'),
+ TextStyleItem(name: 'Body 2', style: textTheme.body2, text: 'Medium 14sp'),
+ TextStyleItem(name: 'Body 1', style: textTheme.body1, text: 'Regular 14sp'),
+ TextStyleItem(name: 'Caption', style: textTheme.caption, text: 'Regular 12sp'),
+ TextStyleItem(name: 'Button', style: textTheme.button, text: 'MEDIUM (ALL CAPS) 14sp')
];
if (MediaQuery.of(context).size.width > 500.0) {
- styleItems.insert(0, new TextStyleItem(
+ styleItems.insert(0, TextStyleItem(
name: 'Display 4',
style: textTheme.display4,
text: 'Light 112sp'
));
}
- return new Scaffold(
- appBar: new AppBar(title: const Text('Typography')),
- body: new SafeArea(
+ return Scaffold(
+ appBar: AppBar(title: const Text('Typography')),
+ body: SafeArea(
top: false,
bottom: false,
- child: new ListView(children: styleItems),
+ child: ListView(children: styleItems),
),
);
}
diff --git a/examples/flutter_gallery/lib/demo/video_demo.dart b/examples/flutter_gallery/lib/demo/video_demo.dart
index 124e309..ef4b9ff 100644
--- a/examples/flutter_gallery/lib/demo/video_demo.dart
+++ b/examples/flutter_gallery/lib/demo/video_demo.dart
@@ -22,14 +22,14 @@
: super(key: key);
Widget _buildInlineVideo() {
- return new Padding(
+ return Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 30.0),
- child: new Center(
- child: new AspectRatio(
+ child: Center(
+ child: AspectRatio(
aspectRatio: 3 / 2,
- child: new Hero(
+ child: Hero(
tag: controller,
- child: new VideoPlayerLoading(controller),
+ child: VideoPlayerLoading(controller),
),
),
),
@@ -37,16 +37,16 @@
}
Widget _buildFullScreenVideo() {
- return new Scaffold(
- appBar: new AppBar(
- title: new Text(title),
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(title),
),
- body: new Center(
- child: new AspectRatio(
+ body: Center(
+ child: AspectRatio(
aspectRatio: 3 / 2,
- child: new Hero(
+ child: Hero(
tag: controller,
- child: new VideoPlayPause(controller),
+ child: VideoPlayPause(controller),
),
),
),
@@ -61,8 +61,8 @@
}
void pushFullScreenWidget() {
- final TransitionRoute<void> route = new PageRouteBuilder<void>(
- settings: new RouteSettings(name: title, isInitialRoute: false),
+ final TransitionRoute<void> route = PageRouteBuilder<void>(
+ settings: RouteSettings(name: title, isInitialRoute: false),
pageBuilder: fullScreenRoutePageBuilder,
);
@@ -74,14 +74,14 @@
Navigator.of(context).push(route);
}
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new Card(
- child: new Column(
+ child: Card(
+ child: Column(
children: <Widget>[
- new ListTile(title: new Text(title), subtitle: new Text(subtitle)),
- new GestureDetector(
+ ListTile(title: Text(title), subtitle: Text(subtitle)),
+ GestureDetector(
onTap: pushFullScreenWidget,
child: _buildInlineVideo(),
),
@@ -98,7 +98,7 @@
const VideoPlayerLoading(this.controller);
@override
- _VideoPlayerLoadingState createState() => new _VideoPlayerLoadingState();
+ _VideoPlayerLoadingState createState() => _VideoPlayerLoadingState();
}
class _VideoPlayerLoadingState extends State<VideoPlayerLoading> {
@@ -124,11 +124,11 @@
@override
Widget build(BuildContext context) {
if (_initialized) {
- return new VideoPlayer(widget.controller);
+ return VideoPlayer(widget.controller);
}
- return new Stack(
+ return Stack(
children: <Widget>[
- new VideoPlayer(widget.controller),
+ VideoPlayer(widget.controller),
const Center(child: CircularProgressIndicator()),
],
fit: StackFit.expand,
@@ -142,7 +142,7 @@
const VideoPlayPause(this.controller);
@override
- State createState() => new _VideoPlayPauseState();
+ State createState() => _VideoPlayPauseState();
}
class _VideoPlayPauseState extends State<VideoPlayPause> {
@@ -172,12 +172,12 @@
@override
Widget build(BuildContext context) {
- return new Stack(
+ return Stack(
alignment: Alignment.bottomCenter,
fit: StackFit.expand,
children: <Widget>[
- new GestureDetector(
- child: new VideoPlayerLoading(controller),
+ GestureDetector(
+ child: VideoPlayerLoading(controller),
onTap: () {
if (!controller.value.initialized) {
return;
@@ -195,7 +195,7 @@
}
},
),
- new Center(child: imageFadeAnimation),
+ Center(child: imageFadeAnimation),
],
);
}
@@ -211,7 +211,7 @@
});
@override
- _FadeAnimationState createState() => new _FadeAnimationState();
+ _FadeAnimationState createState() => _FadeAnimationState();
}
class _FadeAnimationState extends State<FadeAnimation>
@@ -221,7 +221,7 @@
@override
void initState() {
super.initState();
- animationController = new AnimationController(
+ animationController = AnimationController(
duration: widget.duration,
vsync: this,
);
@@ -256,11 +256,11 @@
@override
Widget build(BuildContext context) {
return animationController.isAnimating
- ? new Opacity(
+ ? Opacity(
opacity: 1.0 - animationController.value,
child: widget.child,
)
- : new Container();
+ : Container();
}
}
@@ -276,7 +276,7 @@
});
@override
- _ConnectivityOverlayState createState() => new _ConnectivityOverlayState();
+ _ConnectivityOverlayState createState() => _ConnectivityOverlayState();
}
class _ConnectivityOverlayState extends State<ConnectivityOverlay> {
@@ -294,7 +294,7 @@
);
Stream<ConnectivityResult> connectivityStream() async* {
- final Connectivity connectivity = new Connectivity();
+ final Connectivity connectivity = Connectivity();
ConnectivityResult previousResult = await connectivity.checkConnectivity();
yield previousResult;
await for (ConnectivityResult result
@@ -341,10 +341,10 @@
static const String routeName = '/video';
@override
- _VideoDemoState createState() => new _VideoDemoState();
+ _VideoDemoState createState() => _VideoDemoState();
}
-final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin();
+final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
Future<bool> isIOSSimulator() async {
return Platform.isIOS && !(await deviceInfoPlugin.iosInfo).isPhysicalDevice;
@@ -353,16 +353,16 @@
class _VideoDemoState extends State<VideoDemo>
with SingleTickerProviderStateMixin {
final VideoPlayerController butterflyController =
- new VideoPlayerController.asset(
+ VideoPlayerController.asset(
'videos/butterfly.mp4',
package: 'flutter_gallery_assets',
);
- final VideoPlayerController beeController = new VideoPlayerController.network(
+ final VideoPlayerController beeController = VideoPlayerController.network(
beeUri,
);
- final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
- final Completer<Null> connectedCompleter = new Completer<Null>();
+ final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
+ final Completer<Null> connectedCompleter = Completer<Null>();
bool isSupported = true;
@override
@@ -395,21 +395,21 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
key: scaffoldKey,
- appBar: new AppBar(
+ appBar: AppBar(
title: const Text('Videos'),
),
body: isSupported
- ? new ConnectivityOverlay(
- child: new ListView(
+ ? ConnectivityOverlay(
+ child: ListView(
children: <Widget>[
- new VideoCard(
+ VideoCard(
title: 'Butterfly',
subtitle: '… flutters by',
controller: butterflyController,
),
- new VideoCard(
+ VideoCard(
title: 'Bee',
subtitle: '… gently buzzing',
controller: beeController,
diff --git a/examples/flutter_gallery/lib/gallery/about.dart b/examples/flutter_gallery/lib/gallery/about.dart
index 141d7b3..7a09a20 100644
--- a/examples/flutter_gallery/lib/gallery/about.dart
+++ b/examples/flutter_gallery/lib/gallery/about.dart
@@ -26,7 +26,7 @@
_LinkTextSpan({ TextStyle style, String url, String text }) : super(
style: style,
text: text ?? url,
- recognizer: new TapGestureRecognizer()..onTap = () {
+ recognizer: TapGestureRecognizer()..onTap = () {
launch(url, forceSafariVC: false);
}
);
@@ -43,12 +43,12 @@
applicationIcon: const FlutterLogo(),
applicationLegalese: '© 2017 The Chromium Authors',
children: <Widget>[
- new Padding(
+ Padding(
padding: const EdgeInsets.only(top: 24.0),
- child: new RichText(
- text: new TextSpan(
+ child: RichText(
+ text: TextSpan(
children: <TextSpan>[
- new TextSpan(
+ TextSpan(
style: aboutTextStyle,
text: 'Flutter is an early-stage, open-source project to help developers '
'build high-performance, high-fidelity, mobile apps for '
@@ -57,20 +57,20 @@
"Flutter's many widgets, behaviors, animations, layouts, "
'and more. Learn more about Flutter at '
),
- new _LinkTextSpan(
+ _LinkTextSpan(
style: linkStyle,
url: 'https://flutter.io',
),
- new TextSpan(
+ TextSpan(
style: aboutTextStyle,
text: '.\n\nTo see the source code for this app, please visit the ',
),
- new _LinkTextSpan(
+ _LinkTextSpan(
style: linkStyle,
url: 'https://goo.gl/iv1p4G',
text: 'flutter github repo',
),
- new TextSpan(
+ TextSpan(
style: aboutTextStyle,
text: '.',
),
diff --git a/examples/flutter_gallery/lib/gallery/app.dart b/examples/flutter_gallery/lib/gallery/app.dart
index 8eba996..f1c6d71 100644
--- a/examples/flutter_gallery/lib/gallery/app.dart
+++ b/examples/flutter_gallery/lib/gallery/app.dart
@@ -36,7 +36,7 @@
final bool testMode;
@override
- _GalleryAppState createState() => new _GalleryAppState();
+ _GalleryAppState createState() => _GalleryAppState();
}
class _GalleryAppState extends State<GalleryApp> {
@@ -47,7 +47,7 @@
// For a different example of how to set up an application routing table
// using named routes, consider the example in the Navigator class documentation:
// https://docs.flutter.io/flutter/widgets/Navigator-class.html
- return new Map<String, WidgetBuilder>.fromIterable(
+ return Map<String, WidgetBuilder>.fromIterable(
kAllGalleryDemos,
key: (dynamic demo) => '${demo.routeName}',
value: (dynamic demo) => demo.buildRoute,
@@ -57,7 +57,7 @@
@override
void initState() {
super.initState();
- _options = new GalleryOptions(
+ _options = GalleryOptions(
theme: kLightGalleryTheme,
textScaleFactor: kAllGalleryTextScaleValues[0],
timeDilation: timeDilation,
@@ -81,7 +81,7 @@
// We delay the time dilation change long enough that the user can see
// that UI has started reacting and then we slam on the brakes so that
// they see that the time is in fact now dilated.
- _timeDilationTimer = new Timer(const Duration(milliseconds: 150), () {
+ _timeDilationTimer = Timer(const Duration(milliseconds: 150), () {
timeDilation = newOptions.timeDilation;
});
} else {
@@ -94,9 +94,9 @@
}
Widget _applyTextScaleFactor(Widget child) {
- return new Builder(
+ return Builder(
builder: (BuildContext context) {
- return new MediaQuery(
+ return MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: _options.textScaleFactor.scale,
),
@@ -108,9 +108,9 @@
@override
Widget build(BuildContext context) {
- Widget home = new GalleryHome(
+ Widget home = GalleryHome(
testMode: widget.testMode,
- optionsPage: new GalleryOptionsPage(
+ optionsPage: GalleryOptionsPage(
options: _options,
onOptionsChanged: _handleOptionsChanged,
onSendFeedback: widget.onSendFeedback ?? () {
@@ -120,13 +120,13 @@
);
if (widget.updateUrlFetcher != null) {
- home = new Updater(
+ home = Updater(
updateUrlFetcher: widget.updateUrlFetcher,
child: home,
);
}
- return new MaterialApp(
+ return MaterialApp(
theme: _options.theme.data.copyWith(platform: _options.platform),
title: 'Flutter Gallery',
color: Colors.grey,
@@ -135,7 +135,7 @@
checkerboardRasterCacheImages: _options.showRasterCacheImagesCheckerboard,
routes: _buildRoutes(),
builder: (BuildContext context, Widget child) {
- return new Directionality(
+ return Directionality(
textDirection: _options.textDirection,
child: _applyTextScaleFactor(child),
);
diff --git a/examples/flutter_gallery/lib/gallery/backdrop.dart b/examples/flutter_gallery/lib/gallery/backdrop.dart
index cea460b..92074f6 100644
--- a/examples/flutter_gallery/lib/gallery/backdrop.dart
+++ b/examples/flutter_gallery/lib/gallery/backdrop.dart
@@ -12,7 +12,7 @@
const double _kBackAppBarHeight = 56.0; // back layer (options) appbar height
// The size of the front layer heading's left and right beveled corners.
-final Tween<BorderRadius> _kFrontHeadingBevelRadius = new BorderRadiusTween(
+final Tween<BorderRadius> _kFrontHeadingBevelRadius = BorderRadiusTween(
begin: const BorderRadius.only(
topLeft: Radius.circular(12.0),
topRight: Radius.circular(12.0),
@@ -35,7 +35,7 @@
final Widget child;
@override
- _TappableWhileStatusIsState createState() => new _TappableWhileStatusIsState();
+ _TappableWhileStatusIsState createState() => _TappableWhileStatusIsState();
}
class _TappableWhileStatusIsState extends State<_TappableWhileStatusIs> {
@@ -65,7 +65,7 @@
@override
Widget build(BuildContext context) {
- return new AbsorbPointer(
+ return AbsorbPointer(
absorbing: !_active,
child: widget.child,
);
@@ -89,30 +89,30 @@
Widget build(BuildContext context) {
final Animation<double> progress = listenable;
- final double opacity1 = new CurvedAnimation(
- parent: new ReverseAnimation(progress),
+ final double opacity1 = CurvedAnimation(
+ parent: ReverseAnimation(progress),
curve: const Interval(0.5, 1.0),
).value;
- final double opacity2 = new CurvedAnimation(
+ final double opacity2 = CurvedAnimation(
parent: progress,
curve: const Interval(0.5, 1.0),
).value;
- return new Stack(
+ return Stack(
alignment: alignment,
children: <Widget>[
- new Opacity(
+ Opacity(
opacity: opacity1,
- child: new Semantics(
+ child: Semantics(
scopesRoute: true,
explicitChildNodes: true,
child: child1,
),
),
- new Opacity(
+ Opacity(
opacity: opacity2,
- child: new Semantics(
+ child: Semantics(
scopesRoute: true,
explicitChildNodes: true,
child: child0,
@@ -138,19 +138,19 @@
@override
Widget build(BuildContext context) {
final List<Widget> children = <Widget>[
- new Container(
+ Container(
alignment: Alignment.center,
width: 56.0,
child: leading,
),
- new Expanded(
+ Expanded(
child: title,
),
];
if (trailing != null) {
children.add(
- new Container(
+ Container(
alignment: Alignment.center,
width: 56.0,
child: trailing,
@@ -162,11 +162,11 @@
return IconTheme.merge(
data: theme.primaryIconTheme,
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
style: theme.primaryTextTheme.title,
- child: new SizedBox(
+ child: SizedBox(
height: _kBackAppBarHeight,
- child: new Row(children: children),
+ child: Row(children: children),
),
),
);
@@ -191,26 +191,26 @@
final Widget backLayer;
@override
- _BackdropState createState() => new _BackdropState();
+ _BackdropState createState() => _BackdropState();
}
class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin {
- final GlobalKey _backdropKey = new GlobalKey(debugLabel: 'Backdrop');
+ final GlobalKey _backdropKey = GlobalKey(debugLabel: 'Backdrop');
AnimationController _controller;
Animation<double> _frontOpacity;
@override
void initState() {
super.initState();
- _controller = new AnimationController(
+ _controller = AnimationController(
duration: const Duration(milliseconds: 300),
value: 1.0,
vsync: this,
);
_frontOpacity =
- new Tween<double>(begin: 0.2, end: 1.0).animate(
- new CurvedAnimation(
+ Tween<double>(begin: 0.2, end: 1.0).animate(
+ CurvedAnimation(
parent: _controller,
curve: const Interval(0.0, 0.4, curve: Curves.easeInOut),
),
@@ -254,35 +254,35 @@
}
Widget _buildStack(BuildContext context, BoxConstraints constraints) {
- final Animation<RelativeRect> frontRelativeRect = new RelativeRectTween(
- begin: new RelativeRect.fromLTRB(0.0, constraints.biggest.height - _kFrontClosedHeight, 0.0, 0.0),
+ final Animation<RelativeRect> frontRelativeRect = RelativeRectTween(
+ begin: RelativeRect.fromLTRB(0.0, constraints.biggest.height - _kFrontClosedHeight, 0.0, 0.0),
end: const RelativeRect.fromLTRB(0.0, _kBackAppBarHeight, 0.0, 0.0),
).animate(_controller);
final List<Widget> layers = <Widget>[
// Back layer
- new Column(
+ Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
- new _BackAppBar(
+ _BackAppBar(
leading: widget.frontAction,
- title: new _CrossFadeTransition(
+ title: _CrossFadeTransition(
progress: _controller,
alignment: AlignmentDirectional.centerStart,
- child0: new Semantics(namesRoute: true, child: widget.frontTitle),
- child1: new Semantics(namesRoute: true, child: widget.backTitle),
+ child0: Semantics(namesRoute: true, child: widget.frontTitle),
+ child1: Semantics(namesRoute: true, child: widget.backTitle),
),
- trailing: new IconButton(
+ trailing: IconButton(
onPressed: _toggleFrontLayer,
tooltip: 'Toggle options page',
- icon: new AnimatedIcon(
+ icon: AnimatedIcon(
icon: AnimatedIcons.close_menu,
progress: _controller,
),
),
),
- new Expanded(
- child: new Visibility(
+ Expanded(
+ child: Visibility(
child: widget.backLayer,
visible: _controller.status != AnimationStatus.completed,
maintainState: true,
@@ -291,16 +291,16 @@
],
),
// Front layer
- new PositionedTransition(
+ PositionedTransition(
rect: frontRelativeRect,
- child: new AnimatedBuilder(
+ child: AnimatedBuilder(
animation: _controller,
builder: (BuildContext context, Widget child) {
- return new PhysicalShape(
+ return PhysicalShape(
elevation: 12.0,
color: Theme.of(context).canvasColor,
- clipper: new ShapeBorderClipper(
- shape: new BeveledRectangleBorder(
+ clipper: ShapeBorderClipper(
+ shape: BeveledRectangleBorder(
borderRadius: _kFrontHeadingBevelRadius.lerp(_controller.value),
),
),
@@ -308,10 +308,10 @@
child: child,
);
},
- child: new _TappableWhileStatusIs(
+ child: _TappableWhileStatusIs(
AnimationStatus.completed,
controller: _controller,
- child: new FadeTransition(
+ child: FadeTransition(
opacity: _frontOpacity,
child: widget.frontLayer,
),
@@ -326,12 +326,12 @@
// with a tap. It may obscure part of the front layer's topmost child.
if (widget.frontHeading != null) {
layers.add(
- new PositionedTransition(
+ PositionedTransition(
rect: frontRelativeRect,
- child: new ExcludeSemantics(
- child: new Container(
+ child: ExcludeSemantics(
+ child: Container(
alignment: Alignment.topLeft,
- child: new GestureDetector(
+ child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: _toggleFrontLayer,
onVerticalDragUpdate: _handleDragUpdate,
@@ -344,7 +344,7 @@
);
}
- return new Stack(
+ return Stack(
key: _backdropKey,
children: layers,
);
@@ -352,6 +352,6 @@
@override
Widget build(BuildContext context) {
- return new LayoutBuilder(builder: _buildStack);
+ return LayoutBuilder(builder: _buildStack);
}
}
diff --git a/examples/flutter_gallery/lib/gallery/demo.dart b/examples/flutter_gallery/lib/gallery/demo.dart
index 40424a6..67cc019 100644
--- a/examples/flutter_gallery/lib/gallery/demo.dart
+++ b/examples/flutter_gallery/lib/gallery/demo.dart
@@ -46,24 +46,24 @@
void _showExampleCode(BuildContext context) {
final String tag = demos[DefaultTabController.of(context).index].exampleCodeTag;
if (tag != null) {
- Navigator.push(context, new MaterialPageRoute<FullScreenCodeDialog>(
- builder: (BuildContext context) => new FullScreenCodeDialog(exampleCodeTag: tag)
+ Navigator.push(context, MaterialPageRoute<FullScreenCodeDialog>(
+ builder: (BuildContext context) => FullScreenCodeDialog(exampleCodeTag: tag)
));
}
}
@override
Widget build(BuildContext context) {
- return new DefaultTabController(
+ return DefaultTabController(
length: demos.length,
- child: new Scaffold(
- appBar: new AppBar(
- title: new Text(title),
+ child: Scaffold(
+ appBar: AppBar(
+ title: Text(title),
actions: (actions ?? <Widget>[])..addAll(
<Widget>[
- new Builder(
+ Builder(
builder: (BuildContext context) {
- return new IconButton(
+ return IconButton(
icon: const Icon(Icons.code),
tooltip: 'Show example code',
onPressed: () {
@@ -74,25 +74,25 @@
)
],
),
- bottom: new TabBar(
+ bottom: TabBar(
isScrollable: true,
- tabs: demos.map((ComponentDemoTabData data) => new Tab(text: data.tabName)).toList(),
+ tabs: demos.map((ComponentDemoTabData data) => Tab(text: data.tabName)).toList(),
),
),
- body: new TabBarView(
+ body: TabBarView(
children: demos.map((ComponentDemoTabData demo) {
- return new SafeArea(
+ return SafeArea(
top: false,
bottom: false,
- child: new Column(
+ child: Column(
children: <Widget>[
- new Padding(
+ Padding(
padding: const EdgeInsets.all(16.0),
- child: new Text(demo.description,
+ child: Text(demo.description,
style: Theme.of(context).textTheme.subhead
)
),
- new Expanded(child: demo.demoWidget)
+ Expanded(child: demo.demoWidget)
],
),
);
@@ -109,7 +109,7 @@
final String exampleCodeTag;
@override
- FullScreenCodeDialogState createState() => new FullScreenCodeDialogState();
+ FullScreenCodeDialogState createState() => FullScreenCodeDialogState();
}
class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
@@ -140,14 +140,14 @@
child: CircularProgressIndicator()
);
} else {
- body = new SingleChildScrollView(
- child: new Padding(
+ body = SingleChildScrollView(
+ child: Padding(
padding: const EdgeInsets.all(16.0),
- child: new RichText(
- text: new TextSpan(
+ child: RichText(
+ text: TextSpan(
style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0),
children: <TextSpan>[
- new DartSyntaxHighlighter(style).format(_exampleCode)
+ DartSyntaxHighlighter(style).format(_exampleCode)
]
)
)
@@ -155,9 +155,9 @@
);
}
- return new Scaffold(
- appBar: new AppBar(
- leading: new IconButton(
+ return Scaffold(
+ appBar: AppBar(
+ leading: IconButton(
icon: const Icon(
Icons.clear,
semanticLabel: 'Close',
diff --git a/examples/flutter_gallery/lib/gallery/demos.dart b/examples/flutter_gallery/lib/gallery/demos.dart
index 338efa3..ee7eeea 100644
--- a/examples/flutter_gallery/lib/gallery/demos.dart
+++ b/examples/flutter_gallery/lib/gallery/demos.dart
@@ -85,23 +85,23 @@
List<GalleryDemo> _buildGalleryDemos() {
final List<GalleryDemo> galleryDemos = <GalleryDemo>[
// Demos
- new GalleryDemo(
+ GalleryDemo(
title: 'Shrine',
subtitle: 'Basic shopping app',
icon: GalleryIcons.shrine,
category: _kDemos,
routeName: ShrineDemo.routeName,
- buildRoute: (BuildContext context) => new ShrineDemo(),
+ buildRoute: (BuildContext context) => ShrineDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Contact profile',
subtitle: 'Address book entry with a flexible appbar',
icon: GalleryIcons.account_box,
category: _kDemos,
routeName: ContactsDemo.routeName,
- buildRoute: (BuildContext context) => new ContactsDemo(),
+ buildRoute: (BuildContext context) => ContactsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Animation',
subtitle: 'Section organizer',
icon: GalleryIcons.animation,
@@ -111,138 +111,138 @@
),
// Style
- new GalleryDemo(
+ GalleryDemo(
title: 'Colors',
subtitle: 'All of the predefined colors',
icon: GalleryIcons.colors,
category: _kStyle,
routeName: ColorsDemo.routeName,
- buildRoute: (BuildContext context) => new ColorsDemo(),
+ buildRoute: (BuildContext context) => ColorsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Typography',
subtitle: 'All of the predefined text styles',
icon: GalleryIcons.custom_typography,
category: _kStyle,
routeName: TypographyDemo.routeName,
- buildRoute: (BuildContext context) => new TypographyDemo(),
+ buildRoute: (BuildContext context) => TypographyDemo(),
),
// Material Components
- new GalleryDemo(
+ GalleryDemo(
title: 'Backdrop',
subtitle: 'Select a front layer from back layer',
icon: GalleryIcons.backdrop,
category: _kMaterialComponents,
routeName: BackdropDemo.routeName,
- buildRoute: (BuildContext context) => new BackdropDemo(),
+ buildRoute: (BuildContext context) => BackdropDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Bottom app bar',
subtitle: 'Optional floating action button notch',
icon: GalleryIcons.bottom_app_bar,
category: _kMaterialComponents,
routeName: BottomAppBarDemo.routeName,
- buildRoute: (BuildContext context) => new BottomAppBarDemo(),
+ buildRoute: (BuildContext context) => BottomAppBarDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Bottom navigation',
subtitle: 'Bottom navigation with cross-fading views',
icon: GalleryIcons.bottom_navigation,
category: _kMaterialComponents,
routeName: BottomNavigationDemo.routeName,
- buildRoute: (BuildContext context) => new BottomNavigationDemo(),
+ buildRoute: (BuildContext context) => BottomNavigationDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Bottom sheet: Modal',
subtitle: 'A dismissable bottom sheet',
icon: GalleryIcons.bottom_sheets,
category: _kMaterialComponents,
routeName: ModalBottomSheetDemo.routeName,
- buildRoute: (BuildContext context) => new ModalBottomSheetDemo(),
+ buildRoute: (BuildContext context) => ModalBottomSheetDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Bottom sheet: Persistent',
subtitle: 'A bottom sheet that sticks around',
icon: GalleryIcons.bottom_sheet_persistent,
category: _kMaterialComponents,
routeName: PersistentBottomSheetDemo.routeName,
- buildRoute: (BuildContext context) => new PersistentBottomSheetDemo(),
+ buildRoute: (BuildContext context) => PersistentBottomSheetDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Buttons',
subtitle: 'Flat, raised, dropdown, and more',
icon: GalleryIcons.generic_buttons,
category: _kMaterialComponents,
routeName: ButtonsDemo.routeName,
- buildRoute: (BuildContext context) => new ButtonsDemo(),
+ buildRoute: (BuildContext context) => ButtonsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Buttons: Floating Action Button',
subtitle: 'FAB with transitions',
icon: GalleryIcons.buttons,
category: _kMaterialComponents,
routeName: TabsFabDemo.routeName,
- buildRoute: (BuildContext context) => new TabsFabDemo(),
+ buildRoute: (BuildContext context) => TabsFabDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Cards',
subtitle: 'Baseline cards with rounded corners',
icon: GalleryIcons.cards,
category: _kMaterialComponents,
routeName: CardsDemo.routeName,
- buildRoute: (BuildContext context) => new CardsDemo(),
+ buildRoute: (BuildContext context) => CardsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Chips',
subtitle: 'Labeled with delete buttons and avatars',
icon: GalleryIcons.chips,
category: _kMaterialComponents,
routeName: ChipDemo.routeName,
- buildRoute: (BuildContext context) => new ChipDemo(),
+ buildRoute: (BuildContext context) => ChipDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Data tables',
subtitle: 'Rows and columns',
icon: GalleryIcons.data_table,
category: _kMaterialComponents,
routeName: DataTableDemo.routeName,
- buildRoute: (BuildContext context) => new DataTableDemo(),
+ buildRoute: (BuildContext context) => DataTableDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Dialogs',
subtitle: 'Simple, alert, and fullscreen',
icon: GalleryIcons.dialogs,
category: _kMaterialComponents,
routeName: DialogDemo.routeName,
- buildRoute: (BuildContext context) => new DialogDemo(),
+ buildRoute: (BuildContext context) => DialogDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Elevations',
subtitle: 'Shadow values on cards',
// TODO(larche): Change to custom icon for elevations when one exists.
icon: GalleryIcons.cupertino_progress,
category: _kMaterialComponents,
routeName: ElevationDemo.routeName,
- buildRoute: (BuildContext context) => new ElevationDemo(),
+ buildRoute: (BuildContext context) => ElevationDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Expand/collapse list control',
subtitle: 'A list with one sub-list level',
icon: GalleryIcons.expand_all,
category: _kMaterialComponents,
routeName: TwoLevelListDemo.routeName,
- buildRoute: (BuildContext context) => new TwoLevelListDemo(),
+ buildRoute: (BuildContext context) => TwoLevelListDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Expansion panels',
subtitle: 'List of expanding panels',
icon: GalleryIcons.expand_all,
category: _kMaterialComponents,
routeName: ExpansionPanelsDemo.routeName,
- buildRoute: (BuildContext context) => new ExpansionPanelsDemo(),
+ buildRoute: (BuildContext context) => ExpansionPanelsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Grid',
subtitle: 'Row and column layout',
icon: GalleryIcons.grid_on,
@@ -250,15 +250,15 @@
routeName: GridListDemo.routeName,
buildRoute: (BuildContext context) => const GridListDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Icons',
subtitle: 'Enabled and disabled icons with opacity',
icon: GalleryIcons.sentiment_very_satisfied,
category: _kMaterialComponents,
routeName: IconsDemo.routeName,
- buildRoute: (BuildContext context) => new IconsDemo(),
+ buildRoute: (BuildContext context) => IconsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Lists',
subtitle: 'Scrolling list layouts',
icon: GalleryIcons.list_alt,
@@ -266,7 +266,7 @@
routeName: ListDemo.routeName,
buildRoute: (BuildContext context) => const ListDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Lists: leave-behind list items',
subtitle: 'List items with hidden actions',
icon: GalleryIcons.lists_leave_behind,
@@ -274,7 +274,7 @@
routeName: LeaveBehindDemo.routeName,
buildRoute: (BuildContext context) => const LeaveBehindDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Lists: reorderable',
subtitle: 'Reorderable lists',
icon: GalleryIcons.list_alt,
@@ -282,7 +282,7 @@
routeName: ReorderableListDemo.routeName,
buildRoute: (BuildContext context) => const ReorderableListDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Menus',
subtitle: 'Menu buttons and simple menus',
icon: GalleryIcons.more_vert,
@@ -290,39 +290,39 @@
routeName: MenuDemo.routeName,
buildRoute: (BuildContext context) => const MenuDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Navigation drawer',
subtitle: 'Navigation drawer with standard header',
icon: GalleryIcons.menu,
category: _kMaterialComponents,
routeName: DrawerDemo.routeName,
- buildRoute: (BuildContext context) => new DrawerDemo(),
+ buildRoute: (BuildContext context) => DrawerDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Pagination',
subtitle: 'PageView with indicator',
icon: GalleryIcons.page_control,
category: _kMaterialComponents,
routeName: PageSelectorDemo.routeName,
- buildRoute: (BuildContext context) => new PageSelectorDemo(),
+ buildRoute: (BuildContext context) => PageSelectorDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Pickers',
subtitle: 'Date and time selection widgets',
icon: GalleryIcons.event,
category: _kMaterialComponents,
routeName: DateAndTimePickerDemo.routeName,
- buildRoute: (BuildContext context) => new DateAndTimePickerDemo(),
+ buildRoute: (BuildContext context) => DateAndTimePickerDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Progress indicators',
subtitle: 'Linear, circular, indeterminate',
icon: GalleryIcons.progress_activity,
category: _kMaterialComponents,
routeName: ProgressIndicatorDemo.routeName,
- buildRoute: (BuildContext context) => new ProgressIndicatorDemo(),
+ buildRoute: (BuildContext context) => ProgressIndicatorDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Pull to refresh',
subtitle: 'Refresh indicators',
icon: GalleryIcons.refresh,
@@ -330,31 +330,31 @@
routeName: OverscrollDemo.routeName,
buildRoute: (BuildContext context) => const OverscrollDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Search',
subtitle: 'Expandable search',
icon: Icons.search,
category: _kMaterialComponents,
routeName: SearchDemo.routeName,
- buildRoute: (BuildContext context) => new SearchDemo(),
+ buildRoute: (BuildContext context) => SearchDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Selection controls',
subtitle: 'Checkboxes, radio buttons, and switches',
icon: GalleryIcons.check_box,
category: _kMaterialComponents,
routeName: SelectionControlsDemo.routeName,
- buildRoute: (BuildContext context) => new SelectionControlsDemo(),
+ buildRoute: (BuildContext context) => SelectionControlsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Sliders',
subtitle: 'Widgets for selecting a value by swiping',
icon: GalleryIcons.sliders,
category: _kMaterialComponents,
routeName: SliderDemo.routeName,
- buildRoute: (BuildContext context) => new SliderDemo(),
+ buildRoute: (BuildContext context) => SliderDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Snackbar',
subtitle: 'Temporary messaging',
icon: GalleryIcons.snackbar,
@@ -362,23 +362,23 @@
routeName: SnackBarDemo.routeName,
buildRoute: (BuildContext context) => const SnackBarDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Tabs',
subtitle: 'Tabs with independently scrollable views',
icon: GalleryIcons.tabs,
category: _kMaterialComponents,
routeName: TabsDemo.routeName,
- buildRoute: (BuildContext context) => new TabsDemo(),
+ buildRoute: (BuildContext context) => TabsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Tabs: Scrolling',
subtitle: 'Tab bar that scrolls',
category: _kMaterialComponents,
icon: GalleryIcons.tabs,
routeName: ScrollableTabsDemo.routeName,
- buildRoute: (BuildContext context) => new ScrollableTabsDemo(),
+ buildRoute: (BuildContext context) => ScrollableTabsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Text fields',
subtitle: 'Single line of editable text and numbers',
icon: GalleryIcons.text_fields_alt,
@@ -386,90 +386,90 @@
routeName: TextFormFieldDemo.routeName,
buildRoute: (BuildContext context) => const TextFormFieldDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Tooltips',
subtitle: 'Short message displayed on long-press',
icon: GalleryIcons.tooltip,
category: _kMaterialComponents,
routeName: TooltipDemo.routeName,
- buildRoute: (BuildContext context) => new TooltipDemo(),
+ buildRoute: (BuildContext context) => TooltipDemo(),
),
// Cupertino Components
- new GalleryDemo(
+ GalleryDemo(
title: 'Activity Indicator',
icon: GalleryIcons.cupertino_progress,
category: _kCupertinoComponents,
routeName: CupertinoProgressIndicatorDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoProgressIndicatorDemo(),
+ buildRoute: (BuildContext context) => CupertinoProgressIndicatorDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Alerts',
icon: GalleryIcons.dialogs,
category: _kCupertinoComponents,
routeName: CupertinoAlertDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoAlertDemo(),
+ buildRoute: (BuildContext context) => CupertinoAlertDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Buttons',
icon: GalleryIcons.generic_buttons,
category: _kCupertinoComponents,
routeName: CupertinoButtonsDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoButtonsDemo(),
+ buildRoute: (BuildContext context) => CupertinoButtonsDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Navigation',
icon: GalleryIcons.bottom_navigation,
category: _kCupertinoComponents,
routeName: CupertinoNavigationDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoNavigationDemo(),
+ buildRoute: (BuildContext context) => CupertinoNavigationDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Pickers',
icon: GalleryIcons.event,
category: _kCupertinoComponents,
routeName: CupertinoPickerDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoPickerDemo(),
+ buildRoute: (BuildContext context) => CupertinoPickerDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Pull to refresh',
icon: GalleryIcons.cupertino_pull_to_refresh,
category: _kCupertinoComponents,
routeName: CupertinoRefreshControlDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoRefreshControlDemo(),
+ buildRoute: (BuildContext context) => CupertinoRefreshControlDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Segmented Control',
icon: GalleryIcons.tabs,
category: _kCupertinoComponents,
routeName: CupertinoSegmentedControlDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoSegmentedControlDemo(),
+ buildRoute: (BuildContext context) => CupertinoSegmentedControlDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Sliders',
icon: GalleryIcons.sliders,
category: _kCupertinoComponents,
routeName: CupertinoSliderDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoSliderDemo(),
+ buildRoute: (BuildContext context) => CupertinoSliderDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Switches',
icon: GalleryIcons.cupertino_switch,
category: _kCupertinoComponents,
routeName: CupertinoSwitchDemo.routeName,
- buildRoute: (BuildContext context) => new CupertinoSwitchDemo(),
+ buildRoute: (BuildContext context) => CupertinoSwitchDemo(),
),
// Media
- new GalleryDemo(
+ GalleryDemo(
title: 'Animated images',
subtitle: 'GIF and WebP animations',
icon: GalleryIcons.animation,
category: _kMedia,
routeName: ImagesDemo.routeName,
- buildRoute: (BuildContext context) => new ImagesDemo(),
+ buildRoute: (BuildContext context) => ImagesDemo(),
),
- new GalleryDemo(
+ GalleryDemo(
title: 'Video',
subtitle: 'Video playback',
icon: GalleryIcons.drive_video,
@@ -483,7 +483,7 @@
// in (release builds) the performance tests.
assert(() {
galleryDemos.insert(0,
- new GalleryDemo(
+ GalleryDemo(
title: 'Pesto',
subtitle: 'Simple recipe browser',
icon: Icons.adjust,
@@ -504,7 +504,7 @@
kAllGalleryDemos.map<GalleryDemoCategory>((GalleryDemo demo) => demo.category).toSet();
final Map<GalleryDemoCategory, List<GalleryDemo>> kGalleryCategoryToDemos =
- new Map<GalleryDemoCategory, List<GalleryDemo>>.fromIterable(
+ Map<GalleryDemoCategory, List<GalleryDemo>>.fromIterable(
kAllGalleryDemoCategories,
value: (dynamic category) {
return kAllGalleryDemos.where((GalleryDemo demo) => demo.category == category).toList();
diff --git a/examples/flutter_gallery/lib/gallery/example_code.dart b/examples/flutter_gallery/lib/gallery/example_code.dart
index c4de62e..595b149 100644
--- a/examples/flutter_gallery/lib/gallery/example_code.dart
+++ b/examples/flutter_gallery/lib/gallery/example_code.dart
@@ -15,7 +15,7 @@
// START buttons_raised
// Create a raised button.
-new RaisedButton(
+RaisedButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
@@ -32,7 +32,7 @@
// Create a button with an icon and a
// title.
-new RaisedButton.icon(
+RaisedButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('BUTTON TITLE'),
onPressed: () {
@@ -43,7 +43,7 @@
// START buttons_outline
// Create an outline button.
-new OutlineButton(
+OutlineButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
@@ -60,7 +60,7 @@
// Create a button with an icon and a
// title.
-new OutlineButton.icon(
+OutlineButton.icon(
icon: const Icon(Icons.add, size: 18.0),
label: const Text('BUTTON TITLE'),
onPressed: () {
@@ -71,7 +71,7 @@
// START buttons_flat
// Create a flat button.
-new FlatButton(
+FlatButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
@@ -93,7 +93,7 @@
String dropdownValue;
// Dropdown button with string values.
-new DropdownButton<String>(
+DropdownButton<String>(
value: dropdownValue,
onChanged: (String newValue) {
// null indicates the user didn't select a
@@ -105,9 +105,9 @@
},
items: <String>['One', 'Two', 'Free', 'Four']
.map((String value) {
- return new DropdownMenuItem<String>(
+ return DropdownMenuItem<String>(
value: value,
- child: new Text(value));
+ child: Text(value));
})
.toList()
);
@@ -119,7 +119,7 @@
bool value;
// Toggleable icon button.
-new IconButton(
+IconButton(
icon: const Icon(Icons.thumb_up),
onPressed: () {
setState(() => value = !value);
@@ -131,8 +131,8 @@
// START buttons_action
// Floating action button in Scaffold.
-new Scaffold(
- appBar: new AppBar(
+Scaffold(
+ appBar: AppBar(
title: const Text('Demo')
),
floatingActionButton: const FloatingActionButton(
@@ -155,7 +155,7 @@
bool checkboxValue = false;
// Create a checkbox.
-new Checkbox(
+Checkbox(
value: checkboxValue,
onChanged: (bool value) {
setState(() {
@@ -165,7 +165,7 @@
);
// Create a tristate checkbox.
-new Checkbox(
+Checkbox(
tristate: true,
value: checkboxValue,
onChanged: (bool value) {
@@ -194,19 +194,19 @@
}
// Creates a set of radio buttons.
-new Row(
+Row(
children: <Widget>[
- new Radio<int>(
+ Radio<int>(
value: 0,
groupValue: radioValue,
onChanged: handleRadioValueChanged
),
- new Radio<int>(
+ Radio<int>(
value: 1,
groupValue: radioValue,
onChanged: handleRadioValueChanged
),
- new Radio<int>(
+ Radio<int>(
value: 2,
groupValue: radioValue,
onChanged: handleRadioValueChanged
@@ -228,7 +228,7 @@
bool switchValue = false;
// Create a switch.
-new Switch(
+Switch(
value: switchValue,
onChanged: (bool value) {
setState(() {
@@ -251,7 +251,7 @@
// START gridlists
// Creates a scrollable grid list with images
// loaded from the web.
-new GridView.count(
+GridView.count(
crossAxisCount: 3,
childAspectRatio: 1.0,
padding: const EdgeInsets.all(4.0),
@@ -264,11 +264,11 @@
'...',
'https://example.com/image-n.jpg'
].map((String url) {
- return new GridTile(
- footer: new GridTileBar(
- title: new Text(url)
+ return GridTile(
+ footer: GridTileBar(
+ title: Text(url)
),
- child: new Image.network(url, fit: BoxFit.cover)
+ child: Image.network(url, fit: BoxFit.cover)
);
}).toList(),
);
@@ -280,7 +280,7 @@
class AnimatedImage {
void animatedImage() {
// START animated_image
-new Image.network('https://example.com/animated-image.gif');
+Image.network('https://example.com/animated-image.gif');
// END
}
}
diff --git a/examples/flutter_gallery/lib/gallery/home.dart b/examples/flutter_gallery/lib/gallery/home.dart
index 7ec60da..8d156f2 100644
--- a/examples/flutter_gallery/lib/gallery/home.dart
+++ b/examples/flutter_gallery/lib/gallery/home.dart
@@ -22,8 +22,8 @@
@override
Widget build(BuildContext context) {
- return new Center(
- child: new Container(
+ return Center(
+ child: Container(
width: 34.0,
height: 34.0,
decoration: const BoxDecoration(
@@ -56,29 +56,29 @@
// This repaint boundary prevents the entire _CategoriesPage from being
// repainted when the button's ink splash animates.
- return new RepaintBoundary(
- child: new RawMaterialButton(
+ return RepaintBoundary(
+ child: RawMaterialButton(
padding: EdgeInsets.zero,
splashColor: theme.primaryColor.withOpacity(0.12),
highlightColor: Colors.transparent,
onPressed: onTap,
- child: new Column(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
- new Padding(
+ Padding(
padding: const EdgeInsets.all(6.0),
- child: new Icon(
+ child: Icon(
category.icon,
size: 60.0,
color: isDark ? Colors.white : _kFlutterBlue,
),
),
const SizedBox(height: 10.0),
- new Container(
+ Container(
height: 48.0,
alignment: Alignment.center,
- child: new Text(
+ child: Text(
category.name,
textAlign: TextAlign.center,
style: theme.textTheme.subhead.copyWith(
@@ -110,14 +110,14 @@
final List<GalleryDemoCategory> categoriesList = categories.toList();
final int columnCount = (MediaQuery.of(context).orientation == Orientation.portrait) ? 2 : 3;
- return new Semantics(
+ return Semantics(
scopesRoute: true,
namesRoute: true,
label: 'categories',
explicitChildNodes: true,
- child: new SingleChildScrollView(
+ child: SingleChildScrollView(
key: const PageStorageKey<String>('categories'),
- child: new LayoutBuilder(
+ child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final double columnWidth = constraints.biggest.width / columnCount.toDouble();
final double rowHeight = math.min(225.0, columnWidth * aspectRatio);
@@ -126,24 +126,24 @@
// This repaint boundary prevents the inner contents of the front layer
// from repainting when the backdrop toggle triggers a repaint on the
// LayoutBuilder.
- return new RepaintBoundary(
- child: new Column(
+ return RepaintBoundary(
+ child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
- children: new List<Widget>.generate(rowCount, (int rowIndex) {
+ children: List<Widget>.generate(rowCount, (int rowIndex) {
final int columnCountForRow = rowIndex == rowCount - 1
? categories.length - columnCount * math.max(0, rowCount - 1)
: columnCount;
- return new Row(
- children: new List<Widget>.generate(columnCountForRow, (int columnIndex) {
+ return Row(
+ children: List<Widget>.generate(columnCountForRow, (int columnIndex) {
final int index = rowIndex * columnCount + columnIndex;
final GalleryDemoCategory category = categoriesList[index];
- return new SizedBox(
+ return SizedBox(
width: columnWidth,
height: rowHeight,
- child: new _CategoryItem(
+ child: _CategoryItem(
category: category,
onTap: () {
onCategoryTap(category);
@@ -184,7 +184,7 @@
final double textScaleFactor = MediaQuery.textScaleFactorOf(context);
final List<Widget> titleChildren = <Widget>[
- new Text(
+ Text(
demo.title,
style: theme.textTheme.subhead.copyWith(
color: isDark ? Colors.white : const Color(0xFF202124),
@@ -193,7 +193,7 @@
];
if (demo.subtitle != null) {
titleChildren.add(
- new Text(
+ Text(
demo.subtitle,
style: theme.textTheme.body1.copyWith(
color: isDark ? Colors.white : const Color(0xFF60646B)
@@ -202,29 +202,29 @@
);
}
- return new RawMaterialButton(
+ return RawMaterialButton(
padding: EdgeInsets.zero,
splashColor: theme.primaryColor.withOpacity(0.12),
highlightColor: Colors.transparent,
onPressed: () {
_launchDemo(context);
},
- child: new Container(
- constraints: new BoxConstraints(minHeight: _kDemoItemHeight * textScaleFactor),
- child: new Row(
+ child: Container(
+ constraints: BoxConstraints(minHeight: _kDemoItemHeight * textScaleFactor),
+ child: Row(
children: <Widget>[
- new Container(
+ Container(
width: 56.0,
height: 56.0,
alignment: Alignment.center,
- child: new Icon(
+ child: Icon(
demo.icon,
size: 24.0,
color: isDark ? Colors.white : _kFlutterBlue,
),
),
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: titleChildren,
@@ -248,18 +248,18 @@
// When overriding ListView.padding, it is necessary to manually handle
// safe areas.
final double windowBottomPadding = MediaQuery.of(context).padding.bottom;
- return new KeyedSubtree(
+ return KeyedSubtree(
key: const ValueKey<String>('GalleryDemoList'), // So the tests can find this ListView
- child: new Semantics(
+ child: Semantics(
scopesRoute: true,
namesRoute: true,
label: category.name,
explicitChildNodes: true,
- child: new ListView(
- key: new PageStorageKey<String>(category.name),
- padding: new EdgeInsets.only(top: 8.0, bottom: windowBottomPadding),
+ child: ListView(
+ key: PageStorageKey<String>(category.name),
+ padding: EdgeInsets.only(top: 8.0, bottom: windowBottomPadding),
children: kGalleryCategoryToDemos[category].map<Widget>((GalleryDemo demo) {
- return new _DemoItem(demo: demo);
+ return _DemoItem(demo: demo);
}).toList(),
),
),
@@ -282,11 +282,11 @@
final bool testMode;
@override
- _GalleryHomeState createState() => new _GalleryHomeState();
+ _GalleryHomeState createState() => _GalleryHomeState();
}
class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStateMixin {
- static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+ static final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
AnimationController _controller;
GalleryDemoCategory _category;
@@ -294,7 +294,7 @@
List<Widget> children = previousChildren;
if (currentChild != null)
children = children.toList()..add(currentChild);
- return new Stack(
+ return Stack(
children: children,
alignment: Alignment.topCenter,
);
@@ -305,7 +305,7 @@
@override
void initState() {
super.initState();
- _controller = new AnimationController(
+ _controller = AnimationController(
duration: const Duration(milliseconds: 600),
debugLabel: 'preview banner',
vsync: this,
@@ -328,50 +328,50 @@
const Curve switchOutCurve = Interval(0.4, 1.0, curve: Curves.fastOutSlowIn);
const Curve switchInCurve = Interval(0.4, 1.0, curve: Curves.fastOutSlowIn);
- Widget home = new Scaffold(
+ Widget home = Scaffold(
key: _scaffoldKey,
backgroundColor: isDark ? _kFlutterBlue : theme.primaryColor,
- body: new SafeArea(
+ body: SafeArea(
bottom: false,
- child: new WillPopScope(
+ child: WillPopScope(
onWillPop: () {
// Pop the category page if Android back button is pressed.
if (_category != null) {
setState(() => _category = null);
- return new Future<bool>.value(false);
+ return Future<bool>.value(false);
}
- return new Future<bool>.value(true);
+ return Future<bool>.value(true);
},
- child: new Backdrop(
+ child: Backdrop(
backTitle: const Text('Options'),
backLayer: widget.optionsPage,
- frontAction: new AnimatedSwitcher(
+ frontAction: AnimatedSwitcher(
duration: _kFrontLayerSwitchDuration,
switchOutCurve: switchOutCurve,
switchInCurve: switchInCurve,
child: _category == null
? const _FlutterLogo()
- : new IconButton(
+ : IconButton(
icon: const BackButtonIcon(),
tooltip: 'Back',
onPressed: () => setState(() => _category = null),
),
),
- frontTitle: new AnimatedSwitcher(
+ frontTitle: AnimatedSwitcher(
duration: _kFrontLayerSwitchDuration,
child: _category == null
? const Text('Flutter gallery')
- : new Text(_category.name),
+ : Text(_category.name),
),
- frontHeading: widget.testMode ? null : new Container(height: 24.0),
- frontLayer: new AnimatedSwitcher(
+ frontHeading: widget.testMode ? null : Container(height: 24.0),
+ frontLayer: AnimatedSwitcher(
duration: _kFrontLayerSwitchDuration,
switchOutCurve: switchOutCurve,
switchInCurve: switchInCurve,
layoutBuilder: centerHome ? _centerHomeLayout : _topHomeLayout,
child: _category != null
- ? new _DemosPage(_category)
- : new _CategoriesPage(
+ ? _DemosPage(_category)
+ : _CategoriesPage(
categories: kAllGalleryDemoCategories,
onCategoryTap: (GalleryDemoCategory category) {
setState(() => _category = category);
@@ -389,12 +389,12 @@
}());
if (GalleryHome.showPreviewBanner) {
- home = new Stack(
+ home = Stack(
fit: StackFit.expand,
children: <Widget>[
home,
- new FadeTransition(
- opacity: new CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
+ FadeTransition(
+ opacity: CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
child: const Banner(
message: 'PREVIEW',
location: BannerLocation.topEnd,
@@ -403,7 +403,7 @@
]
);
}
- home = new AnnotatedRegion<SystemUiOverlayStyle>(
+ home = AnnotatedRegion<SystemUiOverlayStyle>(
child: home,
value: SystemUiOverlayStyle.light
);
diff --git a/examples/flutter_gallery/lib/gallery/options.dart b/examples/flutter_gallery/lib/gallery/options.dart
index 9463066..29e09f2 100644
--- a/examples/flutter_gallery/lib/gallery/options.dart
+++ b/examples/flutter_gallery/lib/gallery/options.dart
@@ -39,7 +39,7 @@
bool showRasterCacheImagesCheckerboard,
bool showOffscreenLayersCheckerboard,
}) {
- return new GalleryOptions(
+ return GalleryOptions(
theme: theme ?? this.theme,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
textDirection: textDirection ?? this.textDirection,
@@ -95,16 +95,16 @@
Widget build(BuildContext context) {
final double textScaleFactor = MediaQuery.textScaleFactorOf(context);
- return new MergeSemantics(
- child: new Container(
- constraints: new BoxConstraints(minHeight: _kItemHeight * textScaleFactor),
+ return MergeSemantics(
+ child: Container(
+ constraints: BoxConstraints(minHeight: _kItemHeight * textScaleFactor),
padding: _kItemPadding,
alignment: AlignmentDirectional.centerStart,
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
style: DefaultTextStyle.of(context).style,
maxLines: 2,
overflow: TextOverflow.fade,
- child: new IconTheme(
+ child: IconTheme(
data: Theme.of(context).primaryIconTheme,
child: child,
),
@@ -126,11 +126,11 @@
@override
Widget build(BuildContext context) {
final bool isDark = Theme.of(context).brightness == Brightness.dark;
- return new _OptionsItem(
- child: new Row(
+ return _OptionsItem(
+ child: Row(
children: <Widget>[
- new Expanded(child: new Text(title)),
- new Switch(
+ Expanded(child: Text(title)),
+ Switch(
key: switchKey,
value: value,
onChanged: onChanged,
@@ -151,10 +151,10 @@
@override
Widget build(BuildContext context) {
- return new _OptionsItem(
- child: new _FlatButton(
+ return _OptionsItem(
+ child: _FlatButton(
onPressed: onTap,
- child: new Text(text),
+ child: Text(text),
),
);
}
@@ -168,10 +168,10 @@
@override
Widget build(BuildContext context) {
- return new FlatButton(
+ return FlatButton(
padding: EdgeInsets.zero,
onPressed: onPressed,
- child: new DefaultTextStyle(
+ child: DefaultTextStyle(
style: Theme.of(context).primaryTextTheme.subhead,
child: child,
),
@@ -187,14 +187,14 @@
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new _OptionsItem(
- child: new DefaultTextStyle(
+ return _OptionsItem(
+ child: DefaultTextStyle(
style: theme.textTheme.body1.copyWith(
fontFamily: 'GoogleSans',
color: theme.accentColor,
),
- child: new Semantics(
- child: new Text(text),
+ child: Semantics(
+ child: Text(text),
header: true,
),
),
@@ -210,7 +210,7 @@
@override
Widget build(BuildContext context) {
- return new _BooleanItem(
+ return _BooleanItem(
'Dark Theme',
options.theme == kDarkGalleryTheme,
(bool value) {
@@ -233,29 +233,29 @@
@override
Widget build(BuildContext context) {
- return new _OptionsItem(
- child: new Row(
+ return _OptionsItem(
+ child: Row(
children: <Widget>[
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Text('Text size'),
- new Text(
+ Text(
'${options.textScaleFactor.label}',
style: Theme.of(context).primaryTextTheme.body1,
),
],
),
),
- new PopupMenuButton<GalleryTextScaleValue>(
+ PopupMenuButton<GalleryTextScaleValue>(
padding: const EdgeInsetsDirectional.only(end: 16.0),
icon: const Icon(Icons.arrow_drop_down),
itemBuilder: (BuildContext context) {
return kAllGalleryTextScaleValues.map((GalleryTextScaleValue scaleValue) {
- return new PopupMenuItem<GalleryTextScaleValue>(
+ return PopupMenuItem<GalleryTextScaleValue>(
value: scaleValue,
- child: new Text(scaleValue.label),
+ child: Text(scaleValue.label),
);
}).toList();
},
@@ -279,7 +279,7 @@
@override
Widget build(BuildContext context) {
- return new _BooleanItem(
+ return _BooleanItem(
'Force RTL',
options.textDirection == TextDirection.rtl,
(bool value) {
@@ -302,7 +302,7 @@
@override
Widget build(BuildContext context) {
- return new _BooleanItem(
+ return _BooleanItem(
'Slow motion',
options.timeDilation != 1.0,
(bool value) {
@@ -338,29 +338,29 @@
@override
Widget build(BuildContext context) {
- return new _OptionsItem(
- child: new Row(
+ return _OptionsItem(
+ child: Row(
children: <Widget>[
- new Expanded(
- child: new Column(
+ Expanded(
+ child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Text('Platform mechanics'),
- new Text(
+ Text(
'${_platformLabel(options.platform)}',
style: Theme.of(context).primaryTextTheme.body1,
),
],
),
),
- new PopupMenuButton<TargetPlatform>(
+ PopupMenuButton<TargetPlatform>(
padding: const EdgeInsetsDirectional.only(end: 16.0),
icon: const Icon(Icons.arrow_drop_down),
itemBuilder: (BuildContext context) {
return TargetPlatform.values.map((TargetPlatform platform) {
- return new PopupMenuItem<TargetPlatform>(
+ return PopupMenuItem<TargetPlatform>(
value: platform,
- child: new Text(_platformLabel(platform)),
+ child: Text(_platformLabel(platform)),
);
}).toList();
},
@@ -403,7 +403,7 @@
if (options.showOffscreenLayersCheckerboard != null) {
items.add(
- new _BooleanItem(
+ _BooleanItem(
'Highlight offscreen layers',
options.showOffscreenLayersCheckerboard,
(bool value) {
@@ -414,7 +414,7 @@
}
if (options.showRasterCacheImagesCheckerboard != null) {
items.add(
- new _BooleanItem(
+ _BooleanItem(
'Highlight raster cache images',
options.showRasterCacheImagesCheckerboard,
(bool value) {
@@ -425,7 +425,7 @@
}
if (options.showPerformanceOverlay != null) {
items.add(
- new _BooleanItem(
+ _BooleanItem(
'Show performance overlay',
options.showPerformanceOverlay,
(bool value) {
@@ -442,29 +442,29 @@
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
- return new DefaultTextStyle(
+ return DefaultTextStyle(
style: theme.primaryTextTheme.subhead,
- child: new ListView(
+ child: ListView(
padding: const EdgeInsets.only(bottom: 124.0),
children: <Widget>[
const _Heading('Display'),
- new _ThemeItem(options, onOptionsChanged),
- new _TextScaleFactorItem(options, onOptionsChanged),
- new _TextDirectionItem(options, onOptionsChanged),
- new _TimeDilationItem(options, onOptionsChanged),
+ _ThemeItem(options, onOptionsChanged),
+ _TextScaleFactorItem(options, onOptionsChanged),
+ _TextDirectionItem(options, onOptionsChanged),
+ _TimeDilationItem(options, onOptionsChanged),
const Divider(),
const _Heading('Platform mechanics'),
- new _PlatformItem(options, onOptionsChanged),
+ _PlatformItem(options, onOptionsChanged),
]..addAll(
_enabledDiagnosticItems(),
)..addAll(
<Widget>[
const Divider(),
const _Heading('Flutter gallery'),
- new _ActionItem('About Flutter Gallery', () {
+ _ActionItem('About Flutter Gallery', () {
showGalleryAboutDialog(context);
}),
- new _ActionItem('Send feedback', onSendFeedback),
+ _ActionItem('Send feedback', onSendFeedback),
],
),
),
diff --git a/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart b/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart
index aef052f..9f9d8df 100644
--- a/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart
+++ b/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart
@@ -18,7 +18,7 @@
});
static SyntaxHighlighterStyle lightThemeStyle() {
- return new SyntaxHighlighterStyle(
+ return SyntaxHighlighterStyle(
baseStyle: const TextStyle(color: Color(0xFF000000)),
numberStyle: const TextStyle(color: Color(0xFF1565C0)),
commentStyle: const TextStyle(color: Color(0xFF9E9E9E)),
@@ -31,7 +31,7 @@
}
static SyntaxHighlighterStyle darkThemeStyle() {
- return new SyntaxHighlighterStyle(
+ return SyntaxHighlighterStyle(
baseStyle: const TextStyle(color: Color(0xFFFFFFFF)),
numberStyle: const TextStyle(color: Color(0xFF1565C0)),
commentStyle: const TextStyle(color: Color(0xFF9E9E9E)),
@@ -87,7 +87,7 @@
@override
TextSpan format(String src) {
_src = src;
- _scanner = new StringScanner(_src);
+ _scanner = StringScanner(_src);
if (_generateSpans()) {
// Successfully parsed the code
@@ -96,20 +96,20 @@
for (_HighlightSpan span in _spans) {
if (currentPosition != span.start)
- formattedText.add(new TextSpan(text: _src.substring(currentPosition, span.start)));
+ formattedText.add(TextSpan(text: _src.substring(currentPosition, span.start)));
- formattedText.add(new TextSpan(style: span.textStyle(_style), text: span.textForSpan(_src)));
+ formattedText.add(TextSpan(style: span.textStyle(_style), text: span.textForSpan(_src)));
currentPosition = span.end;
}
if (currentPosition != _src.length)
- formattedText.add(new TextSpan(text: _src.substring(currentPosition, _src.length)));
+ formattedText.add(TextSpan(text: _src.substring(currentPosition, _src.length)));
- return new TextSpan(style: _style.baseStyle, children: formattedText);
+ return TextSpan(style: _style.baseStyle, children: formattedText);
} else {
// Parsing failed, return with only basic formatting
- return new TextSpan(style: _style.baseStyle, text: src);
+ return TextSpan(style: _style.baseStyle, text: src);
}
}
@@ -118,11 +118,11 @@
while (!_scanner.isDone) {
// Skip White space
- _scanner.scan(new RegExp(r'\s+'));
+ _scanner.scan(RegExp(r'\s+'));
// Block comments
- if (_scanner.scan(new RegExp(r'/\*(.|\n)*\*/'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'/\*(.|\n)*\*/'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.comment,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -136,14 +136,14 @@
bool eof = false;
int endComment;
- if (_scanner.scan(new RegExp(r'.*\n'))) {
+ if (_scanner.scan(RegExp(r'.*\n'))) {
endComment = _scanner.lastMatch.end - 1;
} else {
eof = true;
endComment = _src.length;
}
- _spans.add(new _HighlightSpan(
+ _spans.add(_HighlightSpan(
_HighlightType.comment,
startComment,
endComment
@@ -156,8 +156,8 @@
}
// Raw r"String"
- if (_scanner.scan(new RegExp(r'r".*"'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'r".*"'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -166,8 +166,8 @@
}
// Raw r'String'
- if (_scanner.scan(new RegExp(r"r'.*'"))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r"r'.*'"))) {
+ _spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -176,8 +176,8 @@
}
// Multiline """String"""
- if (_scanner.scan(new RegExp(r'"""(?:[^"\\]|\\(.|\n))*"""'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'"""(?:[^"\\]|\\(.|\n))*"""'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -186,8 +186,8 @@
}
// Multiline '''String'''
- if (_scanner.scan(new RegExp(r"'''(?:[^'\\]|\\(.|\n))*'''"))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r"'''(?:[^'\\]|\\(.|\n))*'''"))) {
+ _spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -196,8 +196,8 @@
}
// "String"
- if (_scanner.scan(new RegExp(r'"(?:[^"\\]|\\.)*"'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'"(?:[^"\\]|\\.)*"'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -206,8 +206,8 @@
}
// 'String'
- if (_scanner.scan(new RegExp(r"'(?:[^'\\]|\\.)*'"))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r"'(?:[^'\\]|\\.)*'"))) {
+ _spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -216,8 +216,8 @@
}
// Double
- if (_scanner.scan(new RegExp(r'\d+\.\d+'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'\d+\.\d+'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.number,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -226,8 +226,8 @@
}
// Integer
- if (_scanner.scan(new RegExp(r'\d+'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'\d+'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.number,
_scanner.lastMatch.start,
_scanner.lastMatch.end)
@@ -236,8 +236,8 @@
}
// Punctuation
- if (_scanner.scan(new RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.punctuation,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -246,8 +246,8 @@
}
// Meta data
- if (_scanner.scan(new RegExp(r'@\w+'))) {
- _spans.add(new _HighlightSpan(
+ if (_scanner.scan(RegExp(r'@\w+'))) {
+ _spans.add(_HighlightSpan(
_HighlightType.keyword,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -256,7 +256,7 @@
}
// Words
- if (_scanner.scan(new RegExp(r'\w+'))) {
+ if (_scanner.scan(RegExp(r'\w+'))) {
_HighlightType type;
String word = _scanner.lastMatch[0];
@@ -273,7 +273,7 @@
type = _HighlightType.constant;
if (type != null) {
- _spans.add(new _HighlightSpan(
+ _spans.add(_HighlightSpan(
type,
_scanner.lastMatch.start,
_scanner.lastMatch.end
@@ -296,7 +296,7 @@
void _simplify() {
for (int i = _spans.length - 2; i >= 0; i -= 1) {
if (_spans[i].type == _spans[i + 1].type && _spans[i].end == _spans[i + 1].start) {
- _spans[i] = new _HighlightSpan(
+ _spans[i] = _HighlightSpan(
_spans[i].type,
_spans[i].start,
_spans[i + 1].end
diff --git a/examples/flutter_gallery/lib/gallery/themes.dart b/examples/flutter_gallery/lib/gallery/themes.dart
index ea69898..5cadd15 100644
--- a/examples/flutter_gallery/lib/gallery/themes.dart
+++ b/examples/flutter_gallery/lib/gallery/themes.dart
@@ -11,8 +11,8 @@
final ThemeData data;
}
-final GalleryTheme kDarkGalleryTheme = new GalleryTheme._('Dark', _buildDarkTheme());
-final GalleryTheme kLightGalleryTheme = new GalleryTheme._('Light', _buildLightTheme());
+final GalleryTheme kDarkGalleryTheme = GalleryTheme._('Dark', _buildDarkTheme());
+final GalleryTheme kLightGalleryTheme = GalleryTheme._('Light', _buildLightTheme());
TextTheme _buildTextTheme(TextTheme base) {
return base.copyWith(
@@ -24,7 +24,7 @@
ThemeData _buildDarkTheme() {
const Color primaryColor = Color(0xFF0175c2);
- final ThemeData base = new ThemeData.dark();
+ final ThemeData base = ThemeData.dark();
return base.copyWith(
primaryColor: primaryColor,
buttonColor: primaryColor,
@@ -45,7 +45,7 @@
ThemeData _buildLightTheme() {
const Color primaryColor = Color(0xFF0175c2);
- final ThemeData base = new ThemeData.light();
+ final ThemeData base = ThemeData.light();
return base.copyWith(
primaryColor: primaryColor,
buttonColor: primaryColor,
diff --git a/examples/flutter_gallery/lib/gallery/updater.dart b/examples/flutter_gallery/lib/gallery/updater.dart
index 7356038..6eac7cd 100644
--- a/examples/flutter_gallery/lib/gallery/updater.dart
+++ b/examples/flutter_gallery/lib/gallery/updater.dart
@@ -19,7 +19,7 @@
final Widget child;
@override
- State createState() => new UpdaterState();
+ State createState() => UpdaterState();
}
class UpdaterState extends State<Updater> {
@@ -33,10 +33,10 @@
Future<void> _checkForUpdates() async {
// Only prompt once a day
if (_lastUpdateCheck != null &&
- new DateTime.now().difference(_lastUpdateCheck) < const Duration(days: 1)) {
+ DateTime.now().difference(_lastUpdateCheck) < const Duration(days: 1)) {
return null; // We already checked for updates recently
}
- _lastUpdateCheck = new DateTime.now();
+ _lastUpdateCheck = DateTime.now();
final String updateUrl = await widget.updateUrlFetcher();
if (updateUrl != null) {
@@ -50,17 +50,17 @@
final ThemeData theme = Theme.of(context);
final TextStyle dialogTextStyle =
theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
- return new AlertDialog(
+ return AlertDialog(
title: const Text('Update Flutter Gallery?'),
- content: new Text('A newer version is available.', style: dialogTextStyle),
+ content: Text('A newer version is available.', style: dialogTextStyle),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('NO THANKS'),
onPressed: () {
Navigator.pop(context, false);
},
),
- new FlatButton(
+ FlatButton(
child: const Text('UPDATE'),
onPressed: () {
Navigator.pop(context, true);
diff --git a/examples/flutter_gallery/test/accessibility_test.dart b/examples/flutter_gallery/test/accessibility_test.dart
index da2f916..c9cbd08 100644
--- a/examples/flutter_gallery/test/accessibility_test.dart
+++ b/examples/flutter_gallery/test/accessibility_test.dart
@@ -6,231 +6,231 @@
group('All material demos meet recommended tap target sizes', () {
testWidgets('backdrop_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new BackdropDemo()));
+ await tester.pumpWidget(MaterialApp(home: BackdropDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('bottom_app_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new BottomAppBarDemo()));
+ await tester.pumpWidget(MaterialApp(home: BottomAppBarDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('bottom_navigation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new BottomNavigationDemo()));
+ await tester.pumpWidget(MaterialApp(home: BottomNavigationDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('buttons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ButtonsDemo()));
+ await tester.pumpWidget(MaterialApp(home: ButtonsDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('cards_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new CardsDemo()));
+ await tester.pumpWidget(MaterialApp(home: CardsDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('chip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ChipDemo()));
+ await tester.pumpWidget(MaterialApp(home: ChipDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('data_table_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DataTableDemo()));
+ await tester.pumpWidget(MaterialApp(home: DataTableDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('date_and_time_picker_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DateAndTimePickerDemo()));
+ await tester.pumpWidget(MaterialApp(home: DateAndTimePickerDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21578
testWidgets('dialog_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DialogDemo()));
+ await tester.pumpWidget(MaterialApp(home: DialogDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('drawer_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DrawerDemo()));
+ await tester.pumpWidget(MaterialApp(home: DrawerDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('elevation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ElevationDemo()));
+ await tester.pumpWidget(MaterialApp(home: ElevationDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('expansion_panels_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ExpansionPanelsDemo()));
+ await tester.pumpWidget(MaterialApp(home: ExpansionPanelsDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('grid_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const GridListDemo()));
+ await tester.pumpWidget(MaterialApp(home: const GridListDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('icons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new IconsDemo()));
+ await tester.pumpWidget(MaterialApp(home: IconsDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('leave_behind_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const LeaveBehindDemo()));
+ await tester.pumpWidget(MaterialApp(home: const LeaveBehindDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const ListDemo()));
+ await tester.pumpWidget(MaterialApp(home: const ListDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('menu_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const MenuDemo()));
+ await tester.pumpWidget(MaterialApp(home: const MenuDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ModalBottomSheetDemo()));
+ await tester.pumpWidget(MaterialApp(home: ModalBottomSheetDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('overscroll_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const OverscrollDemo()));
+ await tester.pumpWidget(MaterialApp(home: const OverscrollDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('page_selector_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new PageSelectorDemo()));
+ await tester.pumpWidget(MaterialApp(home: PageSelectorDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new PersistentBottomSheetDemo()));
+ await tester.pumpWidget(MaterialApp(home: PersistentBottomSheetDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('progress_indicator_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ProgressIndicatorDemo()));
+ await tester.pumpWidget(MaterialApp(home: ProgressIndicatorDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('reorderable_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const ReorderableListDemo()));
+ await tester.pumpWidget(MaterialApp(home: const ReorderableListDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('scrollable_tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ScrollableTabsDemo()));
+ await tester.pumpWidget(MaterialApp(home: ScrollableTabsDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('search_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new SearchDemo()));
+ await tester.pumpWidget(MaterialApp(home: SearchDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('selection_controls_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new SelectionControlsDemo()));
+ await tester.pumpWidget(MaterialApp(home: SelectionControlsDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('slider_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new SliderDemo()));
+ await tester.pumpWidget(MaterialApp(home: SliderDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('snack_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const SnackBarDemo()));
+ await tester.pumpWidget(MaterialApp(home: const SnackBarDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TabsDemo()));
+ await tester.pumpWidget(MaterialApp(home: TabsDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('tabs_fab_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TabsFabDemo()));
+ await tester.pumpWidget(MaterialApp(home: TabsFabDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('text_form_field_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const TextFormFieldDemo()));
+ await tester.pumpWidget(MaterialApp(home: const TextFormFieldDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('tooltip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TooltipDemo()));
+ await tester.pumpWidget(MaterialApp(home: TooltipDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
testWidgets('two_level_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TwoLevelListDemo()));
+ await tester.pumpWidget(MaterialApp(home: TwoLevelListDemo()));
expect(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
@@ -239,231 +239,231 @@
group('All material demos meet text contrast guidelines', () {
testWidgets('backdrop_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new BackdropDemo()));
+ await tester.pumpWidget(MaterialApp(home: BackdropDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('bottom_app_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new BottomAppBarDemo()));
+ await tester.pumpWidget(MaterialApp(home: BottomAppBarDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21651
testWidgets('bottom_navigation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new BottomNavigationDemo()));
+ await tester.pumpWidget(MaterialApp(home: BottomNavigationDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('buttons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ButtonsDemo()));
+ await tester.pumpWidget(MaterialApp(home: ButtonsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21647
testWidgets('cards_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new CardsDemo()));
+ await tester.pumpWidget(MaterialApp(home: CardsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21651
testWidgets('chip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ChipDemo()));
+ await tester.pumpWidget(MaterialApp(home: ChipDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21647
testWidgets('data_table_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DataTableDemo()));
+ await tester.pumpWidget(MaterialApp(home: DataTableDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21647
testWidgets('date_and_time_picker_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DateAndTimePickerDemo()));
+ await tester.pumpWidget(MaterialApp(home: DateAndTimePickerDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21647
testWidgets('dialog_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DialogDemo()));
+ await tester.pumpWidget(MaterialApp(home: DialogDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('drawer_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new DrawerDemo()));
+ await tester.pumpWidget(MaterialApp(home: DrawerDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('elevation_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ElevationDemo()));
+ await tester.pumpWidget(MaterialApp(home: ElevationDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('expansion_panels_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ExpansionPanelsDemo()));
+ await tester.pumpWidget(MaterialApp(home: ExpansionPanelsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('grid_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const GridListDemo()));
+ await tester.pumpWidget(MaterialApp(home: const GridListDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('icons_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new IconsDemo()));
+ await tester.pumpWidget(MaterialApp(home: IconsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21647
testWidgets('leave_behind_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const LeaveBehindDemo()));
+ await tester.pumpWidget(MaterialApp(home: const LeaveBehindDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const ListDemo()));
+ await tester.pumpWidget(MaterialApp(home: const ListDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('menu_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const MenuDemo()));
+ await tester.pumpWidget(MaterialApp(home: const MenuDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ModalBottomSheetDemo()));
+ await tester.pumpWidget(MaterialApp(home: ModalBottomSheetDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('overscroll_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const OverscrollDemo()));
+ await tester.pumpWidget(MaterialApp(home: const OverscrollDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('page_selector_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new PageSelectorDemo()));
+ await tester.pumpWidget(MaterialApp(home: PageSelectorDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new PersistentBottomSheetDemo()));
+ await tester.pumpWidget(MaterialApp(home: PersistentBottomSheetDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('progress_indicator_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ProgressIndicatorDemo()));
+ await tester.pumpWidget(MaterialApp(home: ProgressIndicatorDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('reorderable_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const ReorderableListDemo()));
+ await tester.pumpWidget(MaterialApp(home: const ReorderableListDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('scrollable_tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new ScrollableTabsDemo()));
+ await tester.pumpWidget(MaterialApp(home: ScrollableTabsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('search_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new SearchDemo()));
+ await tester.pumpWidget(MaterialApp(home: SearchDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/21651
testWidgets('selection_controls_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new SelectionControlsDemo()));
+ await tester.pumpWidget(MaterialApp(home: SelectionControlsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('slider_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new SliderDemo()));
+ await tester.pumpWidget(MaterialApp(home: SliderDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('snack_bar_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const SnackBarDemo()));
+ await tester.pumpWidget(MaterialApp(home: const SnackBarDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('tabs_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TabsDemo()));
+ await tester.pumpWidget(MaterialApp(home: TabsDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('tabs_fab_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TabsFabDemo()));
+ await tester.pumpWidget(MaterialApp(home: TabsFabDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('text_form_field_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: const TextFormFieldDemo()));
+ await tester.pumpWidget(MaterialApp(home: const TextFormFieldDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('tooltip_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TooltipDemo()));
+ await tester.pumpWidget(MaterialApp(home: TooltipDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
testWidgets('two_level_list_demo', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(home: new TwoLevelListDemo()));
+ await tester.pumpWidget(MaterialApp(home: TwoLevelListDemo()));
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
diff --git a/examples/flutter_gallery/test/calculator/logic.dart b/examples/flutter_gallery/test/calculator/logic.dart
index 472b006..692bf74 100644
--- a/examples/flutter_gallery/test/calculator/logic.dart
+++ b/examples/flutter_gallery/test/calculator/logic.dart
@@ -8,7 +8,7 @@
void main() {
test('Test order of operations: 12 + 3 * 4 = 24', () {
- CalcExpression expression = new CalcExpression.empty();
+ CalcExpression expression = CalcExpression.empty();
expression = expression.appendDigit(1);
expression = expression.appendDigit(2);
expression = expression.appendOperation(Operation.Addition);
@@ -21,7 +21,7 @@
});
test('Test floating point 0.1 + 0.2 = 0.3', () {
- CalcExpression expression = new CalcExpression.empty();
+ CalcExpression expression = CalcExpression.empty();
expression = expression.appendDigit(0);
expression = expression.appendPoint();
expression = expression.appendDigit(1);
@@ -35,7 +35,7 @@
});
test('Test floating point 1.0/10.0 = 0.1', () {
- CalcExpression expression = new CalcExpression.empty();
+ CalcExpression expression = CalcExpression.empty();
expression = expression.appendDigit(1);
expression = expression.appendPoint();
expression = expression.appendDigit(0);
@@ -50,7 +50,7 @@
});
test('Test 1/0 = Infinity', () {
- CalcExpression expression = new CalcExpression.empty();
+ CalcExpression expression = CalcExpression.empty();
expression = expression.appendDigit(1);
expression = expression.appendOperation(Operation.Division);
expression = expression.appendDigit(0);
@@ -60,7 +60,7 @@
});
test('Test use result in next calculation: 1 + 1 = 2 + 1 = 3 + 1 = 4', () {
- CalcExpression expression = new CalcExpression.empty();
+ CalcExpression expression = CalcExpression.empty();
expression = expression.appendDigit(1);
expression = expression.appendOperation(Operation.Addition);
expression = expression.appendDigit(1);
@@ -76,7 +76,7 @@
});
test('Test minus -3 - -2 = -1', () {
- CalcExpression expression = new CalcExpression.empty();
+ CalcExpression expression = CalcExpression.empty();
expression = expression.appendMinus();
expression = expression.appendDigit(3);
expression = expression.appendMinus();
diff --git a/examples/flutter_gallery/test/calculator/smoke_test.dart b/examples/flutter_gallery/test/calculator/smoke_test.dart
index d13b986..177ac3d 100644
--- a/examples/flutter_gallery/test/calculator/smoke_test.dart
+++ b/examples/flutter_gallery/test/calculator/smoke_test.dart
@@ -14,7 +14,7 @@
// We press the "1" and the "2" buttons and check that the display
// reads "12".
testWidgets('Flutter calculator app smoke test', (WidgetTester tester) async {
- await tester.pumpWidget(new MaterialApp(home: const CalculatorDemo()));
+ await tester.pumpWidget(MaterialApp(home: const CalculatorDemo()));
final Finder oneButton = find.widgetWithText(InkResponse, '1');
expect(oneButton, findsOneWidget);
diff --git a/examples/flutter_gallery/test/demo/material/chip_demo_test.dart b/examples/flutter_gallery/test/demo/material/chip_demo_test.dart
index bb1b98c..ef0b6d1 100644
--- a/examples/flutter_gallery/test/demo/material/chip_demo_test.dart
+++ b/examples/flutter_gallery/test/demo/material/chip_demo_test.dart
@@ -9,9 +9,9 @@
void main() {
testWidgets('Chip demo has semantic labels', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
- await tester.pumpWidget(new MaterialApp(
- theme: new ThemeData(platform: TargetPlatform.iOS),
- home: new ChipDemo(),
+ await tester.pumpWidget(MaterialApp(
+ theme: ThemeData(platform: TargetPlatform.iOS),
+ home: ChipDemo(),
));
expect(tester.getSemanticsData(find.byIcon(Icons.vignette)), matchesSemanticsData(
diff --git a/examples/flutter_gallery/test/demo/material/drawer_demo_test.dart b/examples/flutter_gallery/test/demo/material/drawer_demo_test.dart
index 0f99a6e..8e84fb5 100644
--- a/examples/flutter_gallery/test/demo/material/drawer_demo_test.dart
+++ b/examples/flutter_gallery/test/demo/material/drawer_demo_test.dart
@@ -8,9 +8,9 @@
void main() {
testWidgets('Drawer header does not scroll', (WidgetTester tester) async {
- await tester.pumpWidget(new MaterialApp(
- theme: new ThemeData(platform: TargetPlatform.iOS),
- home: new DrawerDemo(),
+ await tester.pumpWidget(MaterialApp(
+ theme: ThemeData(platform: TargetPlatform.iOS),
+ home: DrawerDemo(),
));
await tester.tap(find.text('Tap here to open the drawer'));
diff --git a/examples/flutter_gallery/test/demo/material/text_form_field_demo_test.dart b/examples/flutter_gallery/test/demo/material/text_form_field_demo_test.dart
index 38ecea0..8ca1a27 100644
--- a/examples/flutter_gallery/test/demo/material/text_form_field_demo_test.dart
+++ b/examples/flutter_gallery/test/demo/material/text_form_field_demo_test.dart
@@ -8,7 +8,7 @@
void main() {
testWidgets('validates name field correctly', (WidgetTester tester) async {
- await tester.pumpWidget(new MaterialApp(home: const TextFormFieldDemo()));
+ await tester.pumpWidget(MaterialApp(home: const TextFormFieldDemo()));
final Finder submitButton = find.widgetWithText(RaisedButton, 'SUBMIT');
expect(submitButton, findsOneWidget);
diff --git a/examples/flutter_gallery/test/drawer_test.dart b/examples/flutter_gallery/test/drawer_test.dart
index c3941fa..afe4bdc 100644
--- a/examples/flutter_gallery/test/drawer_test.dart
+++ b/examples/flutter_gallery/test/drawer_test.dart
@@ -16,7 +16,7 @@
bool hasFeedback = false;
await tester.pumpWidget(
- new GalleryApp(
+ GalleryApp(
testMode: true,
onSendFeedback: () {
hasFeedback = true;
diff --git a/examples/flutter_gallery/test/example_code_parser_test.dart b/examples/flutter_gallery/test/example_code_parser_test.dart
index 2b4476c..dbc6370 100644
--- a/examples/flutter_gallery/test/example_code_parser_test.dart
+++ b/examples/flutter_gallery/test/example_code_parser_test.dart
@@ -11,7 +11,7 @@
void main() {
test('Flutter gallery example code parser test', () async {
- final TestAssetBundle bundle = new TestAssetBundle();
+ final TestAssetBundle bundle = TestAssetBundle();
final String codeSnippet0 = await getExampleCode('test_0', bundle);
expect(codeSnippet0, 'test 0 0\ntest 0 1');
@@ -46,7 +46,7 @@
@override
Future<String> loadString(String key, { bool cache = true }) {
if (key == 'lib/gallery/example_code.dart')
- return new Future<String>.value(testCodeFile);
+ return Future<String>.value(testCodeFile);
return null;
}
diff --git a/examples/flutter_gallery/test/live_smoketest.dart b/examples/flutter_gallery/test/live_smoketest.dart
index 36f95c8..8bab93d 100644
--- a/examples/flutter_gallery/test/live_smoketest.dart
+++ b/examples/flutter_gallery/test/live_smoketest.dart
@@ -44,14 +44,14 @@
// Verify that _kUnsynchronizedDemos and _kSkippedDemos identify
// demos that actually exist.
final List<String> allDemoTitles = kAllGalleryDemos.map((GalleryDemo demo) => demo.title).toList();
- if (!new Set<String>.from(allDemoTitles).containsAll(_kUnsynchronizedDemoTitles))
+ if (!Set<String>.from(allDemoTitles).containsAll(_kUnsynchronizedDemoTitles))
fail('Unrecognized demo titles in _kUnsynchronizedDemosTitles: $_kUnsynchronizedDemoTitles');
- if (!new Set<String>.from(allDemoTitles).containsAll(_kSkippedDemoTitles))
+ if (!Set<String>.from(allDemoTitles).containsAll(_kSkippedDemoTitles))
fail('Unrecognized demo names in _kSkippedDemoTitles: $_kSkippedDemoTitles');
print('Starting app...');
runApp(const GalleryApp(testMode: true));
- final _LiveWidgetController controller = new _LiveWidgetController(WidgetsBinding.instance);
+ final _LiveWidgetController controller = _LiveWidgetController(WidgetsBinding.instance);
for (GalleryDemoCategory category in kAllGalleryDemoCategories) {
print('Tapping "${category.name}" section...');
await controller.tap(find.text(category.name));
@@ -90,7 +90,7 @@
/// Waits until at the end of a frame the provided [condition] is [true].
Future<Null> _waitUntilFrame(bool condition(), [Completer<Null> completer]) {
- completer ??= new Completer<Null>();
+ completer ??= Completer<Null>();
if (!condition()) {
SchedulerBinding.instance.addPostFrameCallback((Duration timestamp) {
_waitUntilFrame(condition, completer);
diff --git a/examples/flutter_gallery/test/smoke_test.dart b/examples/flutter_gallery/test/smoke_test.dart
index 7d9a3c6..df480fc 100644
--- a/examples/flutter_gallery/test/smoke_test.dart
+++ b/examples/flutter_gallery/test/smoke_test.dart
@@ -137,7 +137,7 @@
bool sendFeedbackButtonPressed = false;
await tester.pumpWidget(
- new GalleryApp(
+ GalleryApp(
testMode: true,
onSendFeedback: () {
sendFeedbackButtonPressed = true; // see smokeOptionsPage()
diff --git a/examples/flutter_gallery/test/update_test.dart b/examples/flutter_gallery/test/update_test.dart
index bbd11b3..c7e7568 100644
--- a/examples/flutter_gallery/test/update_test.dart
+++ b/examples/flutter_gallery/test/update_test.dart
@@ -7,7 +7,7 @@
Future<String> mockUpdateUrlFetcher() {
// A real implementation would connect to the network to retrieve this value
- return new Future<String>.value('http://www.example.com/');
+ return Future<String>.value('http://www.example.com/');
}
void main() {
diff --git a/examples/flutter_gallery/test_driver/scroll_perf_test.dart b/examples/flutter_gallery/test_driver/scroll_perf_test.dart
index 0f70b1b..07a0b7f 100644
--- a/examples/flutter_gallery/test_driver/scroll_perf_test.dart
+++ b/examples/flutter_gallery/test_driver/scroll_perf_test.dart
@@ -31,17 +31,17 @@
// Scroll down
for (int i = 0; i < 5; i++) {
await driver.scroll(demoList, 0.0, -300.0, const Duration(milliseconds: 300));
- await new Future<Null>.delayed(const Duration(milliseconds: 500));
+ await Future<Null>.delayed(const Duration(milliseconds: 500));
}
// Scroll up
for (int i = 0; i < 5; i++) {
await driver.scroll(demoList, 0.0, 300.0, const Duration(milliseconds: 300));
- await new Future<Null>.delayed(const Duration(milliseconds: 500));
+ await Future<Null>.delayed(const Duration(milliseconds: 500));
}
});
- new TimelineSummary.summarize(timeline)
+ TimelineSummary.summarize(timeline)
..writeSummaryToFile('home_scroll_perf', pretty: true)
..writeTimelineToFile('home_scroll_perf', pretty: true);
});
diff --git a/examples/flutter_gallery/test_driver/transitions_perf_test.dart b/examples/flutter_gallery/test_driver/transitions_perf_test.dart
index 8e534ef..df1c925 100644
--- a/examples/flutter_gallery/test_driver/transitions_perf_test.dart
+++ b/examples/flutter_gallery/test_driver/transitions_perf_test.dart
@@ -86,7 +86,7 @@
});
if (unexpectedValueCounts.isNotEmpty) {
- final StringBuffer error = new StringBuffer('Some routes recorded wrong number of values (expected 2 values/route):\n\n');
+ final StringBuffer error = StringBuffer('Some routes recorded wrong number of values (expected 2 values/route):\n\n');
unexpectedValueCounts.forEach((String routeName, int count) {
error.writeln(' - $routeName recorded $count values.');
});
@@ -183,7 +183,7 @@
}
// See _handleMessages() in transitions_perf.dart.
- _allDemos = new List<String>.from(const JsonDecoder().convert(await driver.requestData('demoNames')));
+ _allDemos = List<String>.from(const JsonDecoder().convert(await driver.requestData('demoNames')));
if (_allDemos.isEmpty)
throw 'no demo names found';
});
@@ -209,15 +209,15 @@
// Save the duration (in microseconds) of the first timeline Frame event
// that follows a 'Start Transition' event. The Gallery app adds a
// 'Start Transition' event when a demo is launched (see GalleryItem).
- final TimelineSummary summary = new TimelineSummary.summarize(timeline);
+ final TimelineSummary summary = TimelineSummary.summarize(timeline);
await summary.writeSummaryToFile('transitions', pretty: true);
final String histogramPath = path.join(testOutputsDirectory, 'transition_durations.timeline.json');
await saveDurationsHistogram(
- new List<Map<String, dynamic>>.from(timeline.json['traceEvents']),
+ List<Map<String, dynamic>>.from(timeline.json['traceEvents']),
histogramPath);
// Execute the remaining tests.
- final Set<String> unprofiledDemos = new Set<String>.from(_allDemos)..removeAll(kProfiledDemos);
+ final Set<String> unprofiledDemos = Set<String>.from(_allDemos)..removeAll(kProfiledDemos);
await runDemos(unprofiledDemos.toList(), driver);
}, timeout: const Timeout(Duration(minutes: 5)));
diff --git a/examples/flutter_gallery/test_memory/back_button.dart b/examples/flutter_gallery/test_memory/back_button.dart
index bbd0660..c8f2e11 100644
--- a/examples/flutter_gallery/test_memory/back_button.dart
+++ b/examples/flutter_gallery/test_memory/back_button.dart
@@ -30,7 +30,7 @@
Future<void> main() async {
runApp(const GalleryApp());
await endOfAnimation();
- await new Future<Null>.delayed(const Duration(milliseconds: 50));
+ await Future<Null>.delayed(const Duration(milliseconds: 50));
debugPrint('==== MEMORY BENCHMARK ==== READY ====');
- WidgetsBinding.instance.addObserver(new LifecycleObserver());
+ WidgetsBinding.instance.addObserver(LifecycleObserver());
}
diff --git a/examples/flutter_gallery/test_memory/memory_nav.dart b/examples/flutter_gallery/test_memory/memory_nav.dart
index 81ad906..fc64fda 100644
--- a/examples/flutter_gallery/test_memory/memory_nav.dart
+++ b/examples/flutter_gallery/test_memory/memory_nav.dart
@@ -23,8 +23,8 @@
}
Future<void> main() async {
- final Completer<void> ready = new Completer<void>();
- runApp(new GestureDetector(
+ final Completer<void> ready = Completer<void>();
+ runApp(GestureDetector(
onTap: () {
debugPrint('Received tap.');
ready.complete();
@@ -36,14 +36,14 @@
),
));
await SchedulerBinding.instance.endOfFrame;
- await new Future<Null>.delayed(const Duration(milliseconds: 50));
+ await Future<Null>.delayed(const Duration(milliseconds: 50));
debugPrint('==== MEMORY BENCHMARK ==== READY ====');
await ready.future;
debugPrint('Continuing...');
// remove onTap handler, enable pointer events for app
- runApp(new GestureDetector(
+ runApp(GestureDetector(
child: const IgnorePointer(
ignoring: false,
child: GalleryApp(testMode: true),
@@ -51,16 +51,16 @@
));
await SchedulerBinding.instance.endOfFrame;
- final WidgetController controller = new LiveWidgetController(WidgetsBinding.instance);
+ final WidgetController controller = LiveWidgetController(WidgetsBinding.instance);
debugPrint('Navigating...');
await controller.tap(find.text('Material'));
- await new Future<Null>.delayed(const Duration(milliseconds: 150));
+ await Future<Null>.delayed(const Duration(milliseconds: 150));
final Finder demoList = find.byKey(const Key('GalleryDemoList'));
final Finder demoItem = find.text('Text fields');
do {
await controller.drag(demoList, const Offset(0.0, -300.0));
- await new Future<Null>.delayed(const Duration(milliseconds: 20));
+ await Future<Null>.delayed(const Duration(milliseconds: 20));
} while (!demoItem.precache());
// Ensure that the center of the "Text fields" item is visible
@@ -68,7 +68,7 @@
final Rect demoItemBounds = boundsFor(controller, demoItem);
final Rect demoListBounds = boundsFor(controller, demoList);
if (!demoListBounds.contains(demoItemBounds.center)) {
- await controller.drag(demoList, new Offset(0.0, demoListBounds.center.dy - demoItemBounds.center.dy));
+ await controller.drag(demoList, Offset(0.0, demoListBounds.center.dy - demoItemBounds.center.dy));
await endOfAnimation();
}
diff --git a/examples/flutter_view/lib/main.dart b/examples/flutter_view/lib/main.dart
index b20e646..6e03a83 100644
--- a/examples/flutter_view/lib/main.dart
+++ b/examples/flutter_view/lib/main.dart
@@ -7,26 +7,26 @@
import 'package:flutter/services.dart';
void main() {
- runApp(new FlutterView());
+ runApp(FlutterView());
}
class FlutterView extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new MaterialApp(
+ return MaterialApp(
title: 'Flutter View',
- theme: new ThemeData(
+ theme: ThemeData(
primarySwatch: Colors.grey,
),
- home: new MyHomePage(),
+ home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
- _MyHomePageState createState() => new _MyHomePageState();
+ _MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@@ -57,29 +57,29 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
- body: new Column(
+ return Scaffold(
+ body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Expanded(
- child: new Center(
- child: new Text(
+ Expanded(
+ child: Center(
+ child: Text(
'Platform button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
style: const TextStyle(fontSize: 17.0))
),
),
- new Container(
+ Container(
padding: const EdgeInsets.only(bottom: 15.0, left: 5.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new Image.asset('assets/flutter-mark-square-64.png', scale: 1.5),
+ Image.asset('assets/flutter-mark-square-64.png', scale: 1.5),
const Text('Flutter', style: TextStyle(fontSize: 30.0)),
],
),
),
],
),
- floatingActionButton: new FloatingActionButton(
+ floatingActionButton: FloatingActionButton(
onPressed: _sendFlutterIncrement,
child: const Icon(Icons.add),
),
diff --git a/examples/layers/raw/canvas.dart b/examples/layers/raw/canvas.dart
index 6173a4c..bd5d586 100644
--- a/examples/layers/raw/canvas.dart
+++ b/examples/layers/raw/canvas.dart
@@ -13,17 +13,17 @@
// First we create a PictureRecorder to record the commands we're going to
// feed in the canvas. The PictureRecorder will eventually produce a Picture,
// which is an immutable record of those commands.
- final ui.PictureRecorder recorder = new ui.PictureRecorder();
+ final ui.PictureRecorder recorder = ui.PictureRecorder();
// Next, we create a canvas from the recorder. The canvas is an interface
// which can receive drawing commands. The canvas interface is modeled after
// the SkCanvas interface from Skia. The paintBounds establishes a "cull rect"
// for the canvas, which lets the implementation discard any commands that
// are entirely outside this rectangle.
- final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+ final ui.Canvas canvas = ui.Canvas(recorder, paintBounds);
- final ui.Paint paint = new ui.Paint();
- canvas.drawPaint(new ui.Paint()..color = const ui.Color(0xFFFFFFFF));
+ final ui.Paint paint = ui.Paint();
+ canvas.drawPaint(ui.Paint()..color = const ui.Color(0xFFFFFFFF));
final ui.Size size = paintBounds.size;
final ui.Offset mid = size.center(ui.Offset.zero);
@@ -34,22 +34,22 @@
canvas.save();
canvas.translate(-mid.dx / 2.0, logicalSize.height * 2.0);
- canvas.clipRect(new ui.Rect.fromLTRB(0.0, -logicalSize.height, logicalSize.width, radius));
+ canvas.clipRect(ui.Rect.fromLTRB(0.0, -logicalSize.height, logicalSize.width, radius));
canvas.translate(mid.dx, mid.dy);
paint.color = const ui.Color.fromARGB(128, 255, 0, 255);
canvas.rotate(math.pi/4.0);
- final ui.Gradient yellowBlue = new ui.Gradient.linear(
- new ui.Offset(-radius, -radius),
+ final ui.Gradient yellowBlue = ui.Gradient.linear(
+ ui.Offset(-radius, -radius),
const ui.Offset(0.0, 0.0),
<ui.Color>[const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)],
);
- canvas.drawRect(new ui.Rect.fromLTRB(-radius, -radius, radius, radius),
- new ui.Paint()..shader = yellowBlue);
+ canvas.drawRect(ui.Rect.fromLTRB(-radius, -radius, radius, radius),
+ ui.Paint()..shader = yellowBlue);
// Scale x and y by 0.5.
- final Float64List scaleMatrix = new Float64List.fromList(<double>[
+ final Float64List scaleMatrix = Float64List.fromList(<double>[
0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
@@ -72,12 +72,12 @@
ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = ui.window.devicePixelRatio;
- final Float64List deviceTransform = new Float64List(16)
+ final Float64List deviceTransform = Float64List(16)
..[0] = devicePixelRatio
..[5] = devicePixelRatio
..[10] = 1.0
..[15] = 1.0;
- final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+ final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
..pushTransform(deviceTransform)
..addPicture(ui.Offset.zero, picture)
..pop();
diff --git a/examples/layers/raw/hello_world.dart b/examples/layers/raw/hello_world.dart
index 83d3bb5..7a9294a 100644
--- a/examples/layers/raw/hello_world.dart
+++ b/examples/layers/raw/hello_world.dart
@@ -11,24 +11,24 @@
final double devicePixelRatio = ui.window.devicePixelRatio;
final ui.Size logicalSize = ui.window.physicalSize / devicePixelRatio;
- final ui.ParagraphBuilder paragraphBuilder = new ui.ParagraphBuilder(
- new ui.ParagraphStyle(textDirection: ui.TextDirection.ltr),
+ final ui.ParagraphBuilder paragraphBuilder = ui.ParagraphBuilder(
+ ui.ParagraphStyle(textDirection: ui.TextDirection.ltr),
)
..addText('Hello, world.');
final ui.Paragraph paragraph = paragraphBuilder.build()
- ..layout(new ui.ParagraphConstraints(width: logicalSize.width));
+ ..layout(ui.ParagraphConstraints(width: logicalSize.width));
final ui.Rect physicalBounds = ui.Offset.zero & (logicalSize * devicePixelRatio);
- final ui.PictureRecorder recorder = new ui.PictureRecorder();
- final ui.Canvas canvas = new ui.Canvas(recorder, physicalBounds);
+ final ui.PictureRecorder recorder = ui.PictureRecorder();
+ final ui.Canvas canvas = ui.Canvas(recorder, physicalBounds);
canvas.scale(devicePixelRatio, devicePixelRatio);
- canvas.drawParagraph(paragraph, new ui.Offset(
+ canvas.drawParagraph(paragraph, ui.Offset(
(logicalSize.width - paragraph.maxIntrinsicWidth) / 2.0,
(logicalSize.height - paragraph.height) / 2.0
));
final ui.Picture picture = recorder.endRecording();
- final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+ final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
// TODO(abarth): We should be able to add a picture without pushing a
// container layer first.
..pushClipRect(physicalBounds)
diff --git a/examples/layers/raw/spinning_square.dart b/examples/layers/raw/spinning_square.dart
index 1bc64c6..adcbb8d 100644
--- a/examples/layers/raw/spinning_square.dart
+++ b/examples/layers/raw/spinning_square.dart
@@ -20,8 +20,8 @@
// PAINT
final ui.Rect paintBounds = ui.Offset.zero & (ui.window.physicalSize / ui.window.devicePixelRatio);
- final ui.PictureRecorder recorder = new ui.PictureRecorder();
- final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+ final ui.PictureRecorder recorder = ui.PictureRecorder();
+ final ui.Canvas canvas = ui.Canvas(recorder, paintBounds);
canvas.translate(paintBounds.width / 2.0, paintBounds.height / 2.0);
// Here we determine the rotation according to the timeStamp given to us by
@@ -29,19 +29,19 @@
final double t = timeStamp.inMicroseconds / Duration.microsecondsPerMillisecond / 1800.0;
canvas.rotate(math.pi * (t % 1.0));
- canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
- new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
+ canvas.drawRect(ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
+ ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
final ui.Picture picture = recorder.endRecording();
// COMPOSITE
final double devicePixelRatio = ui.window.devicePixelRatio;
- final Float64List deviceTransform = new Float64List(16)
+ final Float64List deviceTransform = Float64List(16)
..[0] = devicePixelRatio
..[5] = devicePixelRatio
..[10] = 1.0
..[15] = 1.0;
- final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+ final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
..pushTransform(deviceTransform)
..addPicture(ui.Offset.zero, picture)
..pop();
diff --git a/examples/layers/raw/text.dart b/examples/layers/raw/text.dart
index 6320822..a54b904 100644
--- a/examples/layers/raw/text.dart
+++ b/examples/layers/raw/text.dart
@@ -12,31 +12,31 @@
ui.Paragraph paragraph;
ui.Picture paint(ui.Rect paintBounds) {
- final ui.PictureRecorder recorder = new ui.PictureRecorder();
- final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+ final ui.PictureRecorder recorder = ui.PictureRecorder();
+ final ui.Canvas canvas = ui.Canvas(recorder, paintBounds);
final double devicePixelRatio = ui.window.devicePixelRatio;
final ui.Size logicalSize = ui.window.physicalSize / devicePixelRatio;
canvas.translate(logicalSize.width / 2.0, logicalSize.height / 2.0);
- canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
- new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
+ canvas.drawRect(ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
+ ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
// The paint method of Paragraph draws the contents of the paragraph onto the
// given canvas.
- canvas.drawParagraph(paragraph, new ui.Offset(-paragraph.width / 2.0, (paragraph.width / 2.0) - 125.0));
+ canvas.drawParagraph(paragraph, ui.Offset(-paragraph.width / 2.0, (paragraph.width / 2.0) - 125.0));
return recorder.endRecording();
}
ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = ui.window.devicePixelRatio;
- final Float64List deviceTransform = new Float64List(16)
+ final Float64List deviceTransform = Float64List(16)
..[0] = devicePixelRatio
..[5] = devicePixelRatio
..[10] = 1.0
..[15] = 1.0;
- final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+ final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
..pushTransform(deviceTransform)
..addPicture(ui.Offset.zero, picture)
..pop();
@@ -52,18 +52,18 @@
void main() {
// To create a paragraph of text, we use ParagraphBuilder.
- final ui.ParagraphBuilder builder = new ui.ParagraphBuilder(
+ final ui.ParagraphBuilder builder = ui.ParagraphBuilder(
// The text below has a primary direction of left-to-right.
// The embedded text has other directions.
// If this was TextDirection.rtl, the "Hello, world" text would end up on
// the other side of the right-to-left text.
- new ui.ParagraphStyle(textDirection: ui.TextDirection.ltr),
+ ui.ParagraphStyle(textDirection: ui.TextDirection.ltr),
)
// We first push a style that turns the text blue.
- ..pushStyle(new ui.TextStyle(color: const ui.Color(0xFF0000FF)))
+ ..pushStyle(ui.TextStyle(color: const ui.Color(0xFF0000FF)))
..addText('Hello, ')
// The next run of text will be bold.
- ..pushStyle(new ui.TextStyle(fontWeight: ui.FontWeight.bold))
+ ..pushStyle(ui.TextStyle(fontWeight: ui.FontWeight.bold))
..addText('world. ')
// The pop() command signals the end of the bold styling.
..pop()
@@ -84,7 +84,7 @@
// Next, we supply a width that the text is permitted to occupy and we ask
// the paragraph to the visual position of each its glyphs as well as its
// overall size, subject to its sizing constraints.
- ..layout(new ui.ParagraphConstraints(width: 180.0));
+ ..layout(ui.ParagraphConstraints(width: 180.0));
// Finally, we register our beginFrame callback and kick off the first frame.
ui.window.onBeginFrame = beginFrame;
diff --git a/examples/layers/raw/touch_input.dart b/examples/layers/raw/touch_input.dart
index 05cf21e..52932b1 100644
--- a/examples/layers/raw/touch_input.dart
+++ b/examples/layers/raw/touch_input.dart
@@ -14,21 +14,21 @@
// First we create a PictureRecorder to record the commands we're going to
// feed in the canvas. The PictureRecorder will eventually produce a Picture,
// which is an immutable record of those commands.
- final ui.PictureRecorder recorder = new ui.PictureRecorder();
+ final ui.PictureRecorder recorder = ui.PictureRecorder();
// Next, we create a canvas from the recorder. The canvas is an interface
// which can receive drawing commands. The canvas interface is modeled after
// the SkCanvas interface from Skia. The paintBounds establishes a "cull rect"
// for the canvas, which lets the implementation discard any commands that
// are entirely outside this rectangle.
- final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
+ final ui.Canvas canvas = ui.Canvas(recorder, paintBounds);
// The commands draw a circle in the center of the screen.
final ui.Size size = paintBounds.size;
canvas.drawCircle(
size.center(ui.Offset.zero),
size.shortestSide * 0.45,
- new ui.Paint()..color = color
+ ui.Paint()..color = color
);
// When we're done issuing painting commands, we end the recording an receive
@@ -46,7 +46,7 @@
final double devicePixelRatio = ui.window.devicePixelRatio;
// This transform scales the x and y coordinates by the devicePixelRatio.
- final Float64List deviceTransform = new Float64List(16)
+ final Float64List deviceTransform = Float64List(16)
..[0] = devicePixelRatio
..[5] = devicePixelRatio
..[10] = 1.0
@@ -56,7 +56,7 @@
// transform that scale its children by the device pixel ratio. This transform
// lets us paint in "logical" pixels which are converted to device pixels by
// this scaling operation.
- final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder()
+ final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
..pushTransform(deviceTransform)
..addPicture(ui.Offset.zero, picture)
..pop();
diff --git a/examples/layers/rendering/custom_coordinate_systems.dart b/examples/layers/rendering/custom_coordinate_systems.dart
index c1dd8ce..208bcf1 100644
--- a/examples/layers/rendering/custom_coordinate_systems.dart
+++ b/examples/layers/rendering/custom_coordinate_systems.dart
@@ -9,17 +9,17 @@
import 'src/sector_layout.dart';
RenderBox buildSectorExample() {
- final RenderSectorRing rootCircle = new RenderSectorRing(padding: 20.0);
- rootCircle.add(new RenderSolidColor(const Color(0xFF00FFFF), desiredDeltaTheta: kTwoPi * 0.15));
- rootCircle.add(new RenderSolidColor(const Color(0xFF0000FF), desiredDeltaTheta: kTwoPi * 0.4));
- final RenderSectorSlice stack = new RenderSectorSlice(padding: 2.0);
- stack.add(new RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20.0));
- stack.add(new RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20.0));
- stack.add(new RenderSolidColor(const Color(0xFF00FF00)));
+ final RenderSectorRing rootCircle = RenderSectorRing(padding: 20.0);
+ rootCircle.add(RenderSolidColor(const Color(0xFF00FFFF), desiredDeltaTheta: kTwoPi * 0.15));
+ rootCircle.add(RenderSolidColor(const Color(0xFF0000FF), desiredDeltaTheta: kTwoPi * 0.4));
+ final RenderSectorSlice stack = RenderSectorSlice(padding: 2.0);
+ stack.add(RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20.0));
+ stack.add(RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20.0));
+ stack.add(RenderSolidColor(const Color(0xFF00FF00)));
rootCircle.add(stack);
- return new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle);
+ return RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle);
}
void main() {
- new RenderingFlutterBinding(root: buildSectorExample());
+ RenderingFlutterBinding(root: buildSectorExample());
}
diff --git a/examples/layers/rendering/flex_layout.dart b/examples/layers/rendering/flex_layout.dart
index 3ed89fe..5965520 100644
--- a/examples/layers/rendering/flex_layout.dart
+++ b/examples/layers/rendering/flex_layout.dart
@@ -10,42 +10,42 @@
import 'src/solid_color_box.dart';
void main() {
- final RenderFlex table = new RenderFlex(direction: Axis.vertical, textDirection: TextDirection.ltr);
+ final RenderFlex table = RenderFlex(direction: Axis.vertical, textDirection: TextDirection.ltr);
void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) {
TextStyle style = const TextStyle(color: Color(0xFF000000));
- final RenderParagraph paragraph = new RenderParagraph(
- new TextSpan(style: style, text: '$crossAxisAlignment'),
+ final RenderParagraph paragraph = RenderParagraph(
+ TextSpan(style: style, text: '$crossAxisAlignment'),
textDirection: TextDirection.ltr,
);
- table.add(new RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
- final RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic, textDirection: TextDirection.ltr);
+ table.add(RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
+ final RenderFlex row = RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic, textDirection: TextDirection.ltr);
style = const TextStyle(fontSize: 15.0, color: Color(0xFF000000));
- row.add(new RenderDecoratedBox(
+ row.add(RenderDecoratedBox(
decoration: const BoxDecoration(color: Color(0x7FFFCCCC)),
- child: new RenderParagraph(
- new TextSpan(style: style, text: 'foo foo foo'),
+ child: RenderParagraph(
+ TextSpan(style: style, text: 'foo foo foo'),
textDirection: TextDirection.ltr,
),
));
style = const TextStyle(fontSize: 10.0, color: Color(0xFF000000));
- row.add(new RenderDecoratedBox(
+ row.add(RenderDecoratedBox(
decoration: const BoxDecoration(color: Color(0x7FCCFFCC)),
- child: new RenderParagraph(
- new TextSpan(style: style, text: 'foo foo foo'),
+ child: RenderParagraph(
+ TextSpan(style: style, text: 'foo foo foo'),
textDirection: TextDirection.ltr,
),
));
- final RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic, textDirection: TextDirection.ltr);
+ final RenderFlex subrow = RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic, textDirection: TextDirection.ltr);
style = const TextStyle(fontSize: 25.0, color: Color(0xFF000000));
- subrow.add(new RenderDecoratedBox(
+ subrow.add(RenderDecoratedBox(
decoration: const BoxDecoration(color: Color(0x7FCCCCFF)),
- child: new RenderParagraph(
- new TextSpan(style: style, text: 'foo foo foo foo'),
+ child: RenderParagraph(
+ TextSpan(style: style, text: 'foo foo foo foo'),
textDirection: TextDirection.ltr,
),
));
- subrow.add(new RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: const Size(30.0, 40.0)));
+ subrow.add(RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: const Size(30.0, 40.0)));
row.add(subrow);
table.add(row);
final FlexParentData rowParentData = row.parentData;
@@ -60,15 +60,15 @@
void addJustificationRow(MainAxisAlignment justify) {
const TextStyle style = TextStyle(color: Color(0xFF000000));
- final RenderParagraph paragraph = new RenderParagraph(
- new TextSpan(style: style, text: '$justify'),
+ final RenderParagraph paragraph = RenderParagraph(
+ TextSpan(style: style, text: '$justify'),
textDirection: TextDirection.ltr,
);
- table.add(new RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
- final RenderFlex row = new RenderFlex(direction: Axis.horizontal, textDirection: TextDirection.ltr);
- row.add(new RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: const Size(80.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: const Size(160.0, 60.0)));
+ table.add(RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0)));
+ final RenderFlex row = RenderFlex(direction: Axis.horizontal, textDirection: TextDirection.ltr);
+ row.add(RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: const Size(80.0, 60.0)));
+ row.add(RenderSolidColorBox(const Color(0xFFCCFFCC), desiredSize: const Size(64.0, 60.0)));
+ row.add(RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: const Size(160.0, 60.0)));
row.mainAxisAlignment = justify;
table.add(row);
final FlexParentData rowParentData = row.parentData;
@@ -81,10 +81,10 @@
addJustificationRow(MainAxisAlignment.spaceBetween);
addJustificationRow(MainAxisAlignment.spaceAround);
- final RenderDecoratedBox root = new RenderDecoratedBox(
+ final RenderDecoratedBox root = RenderDecoratedBox(
decoration: const BoxDecoration(color: Color(0xFFFFFFFF)),
- child: new RenderPadding(child: table, padding: const EdgeInsets.symmetric(vertical: 50.0)),
+ child: RenderPadding(child: table, padding: const EdgeInsets.symmetric(vertical: 50.0)),
);
- new RenderingFlutterBinding(root: root);
+ RenderingFlutterBinding(root: root);
}
diff --git a/examples/layers/rendering/hello_world.dart b/examples/layers/rendering/hello_world.dart
index 8480158..1f49ca7 100644
--- a/examples/layers/rendering/hello_world.dart
+++ b/examples/layers/rendering/hello_world.dart
@@ -9,14 +9,14 @@
void main() {
// We use RenderingFlutterBinding to attach the render tree to the window.
- new RenderingFlutterBinding(
+ RenderingFlutterBinding(
// The root of our render tree is a RenderPositionedBox, which centers its
// child both vertically and horizontally.
- root: new RenderPositionedBox(
+ root: RenderPositionedBox(
alignment: Alignment.center,
// We use a RenderParagraph to display the text 'Hello, world.' without
// any explicit styling.
- child: new RenderParagraph(
+ child: RenderParagraph(
const TextSpan(text: 'Hello, world.'),
// The text is in English so we specify the text direction as
// left-to-right. If the text had been in Hebrew or Arabic, we would
diff --git a/examples/layers/rendering/spinning_square.dart b/examples/layers/rendering/spinning_square.dart
index a611dfa..52f6afb 100644
--- a/examples/layers/rendering/spinning_square.dart
+++ b/examples/layers/rendering/spinning_square.dart
@@ -14,17 +14,17 @@
class NonStopVSync implements TickerProvider {
const NonStopVSync();
@override
- Ticker createTicker(TickerCallback onTick) => new Ticker(onTick);
+ Ticker createTicker(TickerCallback onTick) => Ticker(onTick);
}
void main() {
// We first create a render object that represents a green box.
- final RenderBox green = new RenderDecoratedBox(
+ final RenderBox green = RenderDecoratedBox(
decoration: const BoxDecoration(color: Color(0xFF00FF00))
);
// Second, we wrap that green box in a render object that forces the green box
// to have a specific size.
- final RenderBox square = new RenderConstrainedBox(
+ final RenderBox square = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 200.0, height: 200.0),
child: green
);
@@ -32,29 +32,29 @@
// transform before painting its child. Each frame of the animation, we'll
// update the transform of this render object to cause the green square to
// spin.
- final RenderTransform spin = new RenderTransform(
- transform: new Matrix4.identity(),
+ final RenderTransform spin = RenderTransform(
+ transform: Matrix4.identity(),
alignment: Alignment.center,
child: square
);
// Finally, we center the spinning green square...
- final RenderBox root = new RenderPositionedBox(
+ final RenderBox root = RenderPositionedBox(
alignment: Alignment.center,
child: spin
);
// and attach it to the window.
- new RenderingFlutterBinding(root: root);
+ RenderingFlutterBinding(root: root);
// To make the square spin, we use an animation that repeats every 1800
// milliseconds.
- final AnimationController animation = new AnimationController(
+ final AnimationController animation = AnimationController(
duration: const Duration(milliseconds: 1800),
vsync: const NonStopVSync(),
)..repeat();
// The animation will produce a value between 0.0 and 1.0 each frame, but we
// want to rotate the square using a value between 0.0 and math.pi. To change
// the range of the animation, we use a Tween.
- final Tween<double> tween = new Tween<double>(begin: 0.0, end: math.pi);
+ final Tween<double> tween = Tween<double>(begin: 0.0, end: math.pi);
// We add a listener to the animation, which will be called every time the
// animation ticks.
animation.addListener(() {
@@ -63,6 +63,6 @@
// of the animation. Setting this value will mark a number of dirty bits
// inside the render tree, which cause the render tree to repaint with the
// new transform value this frame.
- spin.transform = new Matrix4.rotationZ(tween.evaluate(animation));
+ spin.transform = Matrix4.rotationZ(tween.evaluate(animation));
});
}
diff --git a/examples/layers/rendering/src/sector_layout.dart b/examples/layers/rendering/src/sector_layout.dart
index 214089a..0cbf123 100644
--- a/examples/layers/rendering/src/sector_layout.dart
+++ b/examples/layers/rendering/src/sector_layout.dart
@@ -60,7 +60,7 @@
SectorConstraints constraints,
{ double deltaRadius = 0.0, double deltaTheta = 0.0 }
) {
- return new SectorDimensions(
+ return SectorDimensions(
deltaRadius: constraints.constrainDeltaRadius(deltaRadius),
deltaTheta: constraints.constrainDeltaTheta(deltaTheta)
);
@@ -80,7 +80,7 @@
@override
void setupParentData(RenderObject child) {
if (child.parentData is! SectorParentData)
- child.parentData = new SectorParentData();
+ child.parentData = SectorParentData();
}
// RenderSectors always use SectorParentData subclasses, as they need to be
@@ -89,7 +89,7 @@
SectorParentData get parentData => super.parentData;
SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
- return new SectorDimensions.withConstraints(constraints);
+ return SectorDimensions.withConstraints(constraints);
}
@override
@@ -124,17 +124,17 @@
}
@override
- Rect get paintBounds => new Rect.fromLTWH(0.0, 0.0, 2.0 * deltaRadius, 2.0 * deltaRadius);
+ Rect get paintBounds => Rect.fromLTWH(0.0, 0.0, 2.0 * deltaRadius, 2.0 * deltaRadius);
@override
- Rect get semanticBounds => new Rect.fromLTWH(-deltaRadius, -deltaRadius, 2.0 * deltaRadius, 2.0 * deltaRadius);
+ Rect get semanticBounds => Rect.fromLTWH(-deltaRadius, -deltaRadius, 2.0 * deltaRadius, 2.0 * deltaRadius);
bool hitTest(HitTestResult result, { double radius, double theta }) {
if (radius < parentData.radius || radius >= parentData.radius + deltaRadius ||
theta < parentData.theta || theta >= parentData.theta + deltaTheta)
return false;
hitTestChildren(result, radius: radius, theta: theta);
- result.add(new HitTestEntry(this));
+ result.add(HitTestEntry(this));
return true;
}
void hitTestChildren(HitTestResult result, { double radius, double theta }) { }
@@ -168,13 +168,13 @@
if (_decoration.color != null) {
final Canvas canvas = context.canvas;
- final Paint paint = new Paint()..color = _decoration.color;
- final Path path = new Path();
+ final Paint paint = Paint()..color = _decoration.color;
+ final Path path = Path();
final double outerRadius = parentData.radius + deltaRadius;
- final Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius);
+ final Rect outerBounds = Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius);
path.arcTo(outerBounds, parentData.theta, deltaTheta, true);
final double innerRadius = parentData.radius;
- final Rect innerBounds = new Rect.fromLTRB(offset.dx-innerRadius, offset.dy-innerRadius, offset.dx+innerRadius, offset.dy+innerRadius);
+ final Rect innerBounds = Rect.fromLTRB(offset.dx-innerRadius, offset.dy-innerRadius, offset.dx+innerRadius, offset.dy+innerRadius);
path.arcTo(innerBounds, parentData.theta + deltaTheta, -deltaTheta, false);
path.close();
canvas.drawPath(path, paint);
@@ -248,7 +248,7 @@
void setupParentData(RenderObject child) {
// TODO(ianh): avoid code duplication
if (child.parentData is! SectorChildListParentData)
- child.parentData = new SectorChildListParentData();
+ child.parentData = SectorChildListParentData();
}
@override
@@ -261,7 +261,7 @@
double remainingDeltaTheta = math.max(0.0, constraints.maxDeltaTheta - (innerTheta + paddingTheta));
RenderSector child = firstChild;
while (child != null) {
- final SectorConstraints innerConstraints = new SectorConstraints(
+ final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: innerDeltaRadius,
maxDeltaTheta: remainingDeltaTheta
);
@@ -275,7 +275,7 @@
remainingDeltaTheta -= paddingTheta;
}
}
- return new SectorDimensions.withConstraints(constraints,
+ return SectorDimensions.withConstraints(constraints,
deltaRadius: outerDeltaRadius,
deltaTheta: innerTheta);
}
@@ -292,7 +292,7 @@
double remainingDeltaTheta = constraints.maxDeltaTheta - (innerTheta + paddingTheta);
RenderSector child = firstChild;
while (child != null) {
- final SectorConstraints innerConstraints = new SectorConstraints(
+ final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: innerDeltaRadius,
maxDeltaTheta: remainingDeltaTheta
);
@@ -362,7 +362,7 @@
void setupParentData(RenderObject child) {
// TODO(ianh): avoid code duplication
if (child.parentData is! SectorChildListParentData)
- child.parentData = new SectorChildListParentData();
+ child.parentData = SectorChildListParentData();
}
@override
@@ -375,7 +375,7 @@
double remainingDeltaRadius = constraints.maxDeltaRadius - (padding * 2.0);
RenderSector child = firstChild;
while (child != null) {
- final SectorConstraints innerConstraints = new SectorConstraints(
+ final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: remainingDeltaRadius,
maxDeltaTheta: innerDeltaTheta
);
@@ -387,7 +387,7 @@
childRadius += padding;
remainingDeltaRadius -= padding;
}
- return new SectorDimensions.withConstraints(constraints,
+ return SectorDimensions.withConstraints(constraints,
deltaRadius: childRadius - parentData.radius,
deltaTheta: outerDeltaTheta);
}
@@ -404,7 +404,7 @@
double remainingDeltaRadius = constraints.maxDeltaRadius - (padding * 2.0);
RenderSector child = firstChild;
while (child != null) {
- final SectorConstraints innerConstraints = new SectorConstraints(
+ final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: remainingDeltaRadius,
maxDeltaTheta: innerDeltaTheta
);
@@ -455,7 +455,7 @@
@override
void setupParentData(RenderObject child) {
if (child.parentData is! SectorParentData)
- child.parentData = new SectorParentData();
+ child.parentData = SectorParentData();
}
@override
@@ -497,9 +497,9 @@
if (!width.isFinite && !height.isFinite)
return Size.zero;
final double maxChildDeltaRadius = math.max(0.0, math.min(width, height) / 2.0 - innerRadius);
- final SectorDimensions childDimensions = child.getIntrinsicDimensions(new SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), innerRadius);
+ final SectorDimensions childDimensions = child.getIntrinsicDimensions(SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), innerRadius);
final double dimension = (innerRadius + childDimensions.deltaRadius) * 2.0;
- return new Size.square(dimension);
+ return Size.square(dimension);
}
@override
@@ -513,9 +513,9 @@
final double maxChildDeltaRadius = math.min(constraints.maxWidth, constraints.maxHeight) / 2.0 - innerRadius;
child.parentData.radius = innerRadius;
child.parentData.theta = 0.0;
- child.layout(new SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), parentUsesSize: true);
+ child.layout(SectorConstraints(maxDeltaRadius: maxChildDeltaRadius), parentUsesSize: true);
final double dimension = (innerRadius + child.deltaRadius) * 2.0;
- size = constraints.constrain(new Size(dimension, dimension));
+ size = constraints.constrain(Size(dimension, dimension));
}
@override
@@ -547,7 +547,7 @@
if (theta > child.deltaTheta)
return false;
child.hitTest(result, radius: radius, theta: theta);
- result.add(new BoxHitTestEntry(this, position));
+ result.add(BoxHitTestEntry(this, position));
return true;
}
@@ -557,7 +557,7 @@
RenderSolidColor(this.backgroundColor, {
this.desiredDeltaRadius = double.infinity,
this.desiredDeltaTheta = kTwoPi
- }) : super(new BoxDecoration(color: backgroundColor));
+ }) : super(BoxDecoration(color: backgroundColor));
double desiredDeltaRadius;
double desiredDeltaTheta;
@@ -565,7 +565,7 @@
@override
SectorDimensions getIntrinsicDimensions(SectorConstraints constraints, double radius) {
- return new SectorDimensions.withConstraints(constraints, deltaTheta: desiredDeltaTheta);
+ return SectorDimensions.withConstraints(constraints, deltaTheta: desiredDeltaTheta);
}
@override
@@ -579,7 +579,7 @@
if (event is PointerDownEvent) {
decoration = const BoxDecoration(color: Color(0xFFFF0000));
} else if (event is PointerUpEvent) {
- decoration = new BoxDecoration(color: backgroundColor);
+ decoration = BoxDecoration(color: backgroundColor);
}
}
}
diff --git a/examples/layers/rendering/src/solid_color_box.dart b/examples/layers/rendering/src/solid_color_box.dart
index b34faac..419d181 100644
--- a/examples/layers/rendering/src/solid_color_box.dart
+++ b/examples/layers/rendering/src/solid_color_box.dart
@@ -10,7 +10,7 @@
final Color backgroundColor;
RenderSolidColorBox(this.backgroundColor, { this.desiredSize = Size.infinite })
- : super(decoration: new BoxDecoration(color: backgroundColor));
+ : super(decoration: BoxDecoration(color: backgroundColor));
@override
double computeMinIntrinsicWidth(double height) {
@@ -42,7 +42,7 @@
if (event is PointerDownEvent) {
decoration = const BoxDecoration(color: Color(0xFFFF0000));
} else if (event is PointerUpEvent) {
- decoration = new BoxDecoration(color: backgroundColor);
+ decoration = BoxDecoration(color: backgroundColor);
}
}
}
diff --git a/examples/layers/rendering/touch_input.dart b/examples/layers/rendering/touch_input.dart
index d766a5e..aa914b9 100644
--- a/examples/layers/rendering/touch_input.dart
+++ b/examples/layers/rendering/touch_input.dart
@@ -20,7 +20,7 @@
/// A simple model object for a dot that reacts to pointer pressure.
class Dot {
- Dot({ Color color }) : _paint = new Paint()..color = color;
+ Dot({ Color color }) : _paint = Paint()..color = color;
final Paint _paint;
Offset position = Offset.zero;
@@ -66,7 +66,7 @@
void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
if (event is PointerDownEvent) {
final Color color = _kColors[event.pointer.remainder(_kColors.length)];
- _dots[event.pointer] = new Dot(color: color)..update(event);
+ _dots[event.pointer] = Dot(color: color)..update(event);
// We call markNeedsPaint to indicate that our painting commands have
// changed and that paint needs to be called before displaying a new frame
// to the user. It's harmless to call markNeedsPaint multiple times
@@ -91,7 +91,7 @@
// Passing offset during the render tree's paint walk is an optimization to
// avoid having to change the origin of the canvas's coordinate system too
// often.
- canvas.drawRect(offset & size, new Paint()..color = const Color(0xFFFFFFFF));
+ canvas.drawRect(offset & size, Paint()..color = const Color(0xFFFFFFFF));
// We iterate through our model and paint each dot.
for (Dot dot in _dots.values)
@@ -101,7 +101,7 @@
void main() {
// Create some styled text to tell the user to interact with the app.
- final RenderParagraph paragraph = new RenderParagraph(
+ final RenderParagraph paragraph = RenderParagraph(
const TextSpan(
style: TextStyle(color: Colors.black87),
text: 'Touch me!',
@@ -111,10 +111,10 @@
// A stack is a render object that layers its children on top of each other.
// The bottom later is our RenderDots object, and on top of that we show the
// text.
- final RenderStack stack = new RenderStack(
+ final RenderStack stack = RenderStack(
textDirection: TextDirection.ltr,
children: <RenderBox>[
- new RenderDots(),
+ RenderDots(),
paragraph,
],
);
@@ -132,5 +132,5 @@
..left = 20.0;
// Finally, we attach the render tree we've built to the screen.
- new RenderingFlutterBinding(root: stack);
+ RenderingFlutterBinding(root: stack);
}
diff --git a/examples/layers/services/isolate.dart b/examples/layers/services/isolate.dart
index c4c7fd2..0536aee 100644
--- a/examples/layers/services/isolate.dart
+++ b/examples/layers/services/isolate.dart
@@ -36,7 +36,7 @@
// Run the computation associated with this Calculator.
void run() {
int i = 0;
- final JsonDecoder decoder = new JsonDecoder(
+ final JsonDecoder decoder = JsonDecoder(
(dynamic key, dynamic value) {
if (key is int && i++ % _NOTIFY_INTERVAL == 0)
onProgressListener(i.toDouble(), _NUM_ITEMS.toDouble());
@@ -54,7 +54,7 @@
}
static String _replicateJson(String data, int count) {
- final StringBuffer buffer = new StringBuffer()..write('[');
+ final StringBuffer buffer = StringBuffer()..write('[');
for (int i = 0; i < count; i++) {
buffer.write(data);
if (i < count - 1)
@@ -88,7 +88,7 @@
CalculationManager({ @required this.onProgressListener, @required this.onResultListener })
: assert(onProgressListener != null),
assert(onResultListener != null),
- _receivePort = new ReceivePort() {
+ _receivePort = ReceivePort() {
_receivePort.listen(_handleMessage);
}
@@ -138,7 +138,7 @@
// loaded.
rootBundle.loadString('services/data.json').then<Null>((String data) {
if (isRunning) {
- final CalculationMessage message = new CalculationMessage(data, _receivePort.sendPort);
+ final CalculationMessage message = CalculationMessage(data, _receivePort.sendPort);
// Spawn an isolate to JSON-parse the file contents. The JSON parsing
// is synchronous, so if done in the main isolate, the UI would block.
Isolate.spawn(_calculate, message).then<Null>((Isolate isolate) {
@@ -178,7 +178,7 @@
// in a separate memory space.
static void _calculate(CalculationMessage message) {
final SendPort sender = message.sendPort;
- final Calculator calculator = new Calculator(
+ final Calculator calculator = Calculator(
onProgressListener: (double completed, double total) {
sender.send(<double>[ completed, total ]);
},
@@ -199,7 +199,7 @@
// the AnimationController for the running animation.
class IsolateExampleWidget extends StatefulWidget {
@override
- IsolateExampleState createState() => new IsolateExampleState();
+ IsolateExampleState createState() => IsolateExampleState();
}
// Main application state.
@@ -215,11 +215,11 @@
@override
void initState() {
super.initState();
- _animation = new AnimationController(
+ _animation = AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,
)..repeat();
- _calculationManager = new CalculationManager(
+ _calculationManager = CalculationManager(
onProgressListener: _handleProgressUpdate,
onResultListener: _handleResult
);
@@ -233,32 +233,32 @@
@override
Widget build(BuildContext context) {
- return new Material(
- child: new Column(
+ return Material(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
- new RotationTransition(
+ RotationTransition(
turns: _animation,
- child: new Container(
+ child: Container(
width: 120.0,
height: 120.0,
color: const Color(0xFF882222),
)
),
- new Opacity(
+ Opacity(
opacity: _calculationManager.isRunning ? 1.0 : 0.0,
- child: new CircularProgressIndicator(
+ child: CircularProgressIndicator(
value: _progress
)
),
- new Text(_status),
- new Center(
- child: new RaisedButton(
- child: new Text(_label),
+ Text(_status),
+ Center(
+ child: RaisedButton(
+ child: Text(_label),
onPressed: _handleButtonPressed
)
),
- new Text(_result)
+ Text(_result)
]
)
);
@@ -303,5 +303,5 @@
}
void main() {
- runApp(new MaterialApp(home: new IsolateExampleWidget()));
+ runApp(MaterialApp(home: IsolateExampleWidget()));
}
diff --git a/examples/layers/services/lifecycle.dart b/examples/layers/services/lifecycle.dart
index 36f3c50..ab3bda2 100644
--- a/examples/layers/services/lifecycle.dart
+++ b/examples/layers/services/lifecycle.dart
@@ -8,7 +8,7 @@
const LifecycleWatcher({ Key key }) : super(key: key);
@override
- _LifecycleWatcherState createState() => new _LifecycleWatcherState();
+ _LifecycleWatcherState createState() => _LifecycleWatcherState();
}
class _LifecycleWatcherState extends State<LifecycleWatcher>
@@ -38,7 +38,7 @@
Widget build(BuildContext context) {
if (_lastLifecycleState == null)
return const Text('This widget has not observed any lifecycle changes.');
- return new Text('The most recent lifecycle state this widget observed was: $_lastLifecycleState.');
+ return Text('The most recent lifecycle state this widget observed was: $_lastLifecycleState.');
}
}
diff --git a/examples/layers/test/gestures_test.dart b/examples/layers/test/gestures_test.dart
index 902385a..c37b1d2 100644
--- a/examples/layers/test/gestures_test.dart
+++ b/examples/layers/test/gestures_test.dart
@@ -9,9 +9,9 @@
void main() {
testWidgets('Tap on center change color', (WidgetTester tester) async {
- await tester.pumpWidget(new Directionality(
+ await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
- child: new GestureDemo(),
+ child: GestureDemo(),
));
final Finder finder = find.byType(GestureDemo);
diff --git a/examples/layers/test/sector_test.dart b/examples/layers/test/sector_test.dart
index 3903e9d..0207f18 100644
--- a/examples/layers/test/sector_test.dart
+++ b/examples/layers/test/sector_test.dart
@@ -13,6 +13,6 @@
});
testWidgets('Sector Sixes', (WidgetTester tester) async {
- await tester.pumpWidget(new SectorApp());
+ await tester.pumpWidget(SectorApp());
});
}
diff --git a/examples/layers/widgets/custom_render_box.dart b/examples/layers/widgets/custom_render_box.dart
index cd7c78b..2a5f832 100644
--- a/examples/layers/widgets/custom_render_box.dart
+++ b/examples/layers/widgets/custom_render_box.dart
@@ -28,9 +28,9 @@
@override
void paint(PaintingContext context, Offset offset) {
final Canvas canvas = context.canvas;
- canvas.drawRect(offset & size, new Paint()..color = const Color(0xFF0000FF));
+ canvas.drawRect(offset & size, Paint()..color = const Color(0xFF0000FF));
- final Paint paint = new Paint()..color = const Color(0xFF00FF00);
+ final Paint paint = Paint()..color = const Color(0xFF00FF00);
for (Offset point in _dots.values)
canvas.drawCircle(point, 50.0, paint);
@@ -42,7 +42,7 @@
const Dots({ Key key, Widget child }) : super(key: key, child: child);
@override
- RenderDots createRenderObject(BuildContext context) => new RenderDots();
+ RenderDots createRenderObject(BuildContext context) => RenderDots();
}
void main() {
diff --git a/examples/layers/widgets/gestures.dart b/examples/layers/widgets/gestures.dart
index c751399..1e884a9 100644
--- a/examples/layers/widgets/gestures.dart
+++ b/examples/layers/widgets/gestures.dart
@@ -29,12 +29,12 @@
void paint(Canvas canvas, Size size) {
final Offset center = size.center(Offset.zero) * zoom + offset;
final double radius = size.width / 2.0 * zoom;
- final Gradient gradient = new RadialGradient(
+ final Gradient gradient = RadialGradient(
colors: forward ? <Color>[swatch.shade50, swatch.shade900]
: <Color>[swatch.shade900, swatch.shade50]
);
- final Paint paint = new Paint()
- ..shader = gradient.createShader(new Rect.fromCircle(
+ final Paint paint = Paint()
+ ..shader = gradient.createShader(Rect.fromCircle(
center: center,
radius: radius,
));
@@ -56,7 +56,7 @@
class GestureDemo extends StatefulWidget {
@override
- GestureDemoState createState() => new GestureDemoState();
+ GestureDemoState createState() => GestureDemoState();
}
class GestureDemoState extends State<GestureDemo> {
@@ -141,17 +141,17 @@
@override
Widget build(BuildContext context) {
- return new Stack(
+ return Stack(
fit: StackFit.expand,
children: <Widget>[
- new GestureDetector(
+ GestureDetector(
onScaleStart: _scaleEnabled ? _handleScaleStart : null,
onScaleUpdate: _scaleEnabled ? _handleScaleUpdate : null,
onTap: _tapEnabled ? _handleColorChange : null,
onDoubleTap: _doubleTapEnabled ? _handleScaleReset : null,
onLongPress: _longPressEnabled ? _handleDirectionChange : null,
- child: new CustomPaint(
- painter: new _GesturePainter(
+ child: CustomPaint(
+ painter: _GesturePainter(
zoom: _zoom,
offset: _offset,
swatch: swatch,
@@ -163,44 +163,44 @@
)
)
),
- new Positioned(
+ Positioned(
bottom: 0.0,
left: 0.0,
- child: new Card(
- child: new Container(
+ child: Card(
+ child: Container(
padding: const EdgeInsets.all(4.0),
- child: new Column(
+ child: Column(
children: <Widget>[
- new Row(
+ Row(
children: <Widget>[
- new Checkbox(
+ Checkbox(
value: _scaleEnabled,
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); }
),
const Text('Scale'),
]
),
- new Row(
+ Row(
children: <Widget>[
- new Checkbox(
+ Checkbox(
value: _tapEnabled,
onChanged: (bool value) { setState(() { _tapEnabled = value; }); }
),
const Text('Tap'),
]
),
- new Row(
+ Row(
children: <Widget>[
- new Checkbox(
+ Checkbox(
value: _doubleTapEnabled,
onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); }
),
const Text('Double Tap'),
]
),
- new Row(
+ Row(
children: <Widget>[
- new Checkbox(
+ Checkbox(
value: _longPressEnabled,
onChanged: (bool value) { setState(() { _longPressEnabled = value; }); }
),
@@ -219,11 +219,11 @@
}
void main() {
- runApp(new MaterialApp(
- theme: new ThemeData.dark(),
- home: new Scaffold(
- appBar: new AppBar(title: const Text('Gestures Demo')),
- body: new GestureDemo()
+ runApp(MaterialApp(
+ theme: ThemeData.dark(),
+ home: Scaffold(
+ appBar: AppBar(title: const Text('Gestures Demo')),
+ body: GestureDemo()
)
));
}
diff --git a/examples/layers/widgets/media_query.dart b/examples/layers/widgets/media_query.dart
index ef929b8..69ed7f3 100644
--- a/examples/layers/widgets/media_query.dart
+++ b/examples/layers/widgets/media_query.dart
@@ -11,15 +11,15 @@
@override
Widget build(BuildContext context) {
- return new Row(
+ return Row(
children: <Widget>[
- new Container(
+ Container(
width: 32.0,
height: 32.0,
margin: const EdgeInsets.all(8.0),
color: Colors.lightBlueAccent.shade100,
),
- new Text(name)
+ Text(name)
]
);
}
@@ -32,20 +32,20 @@
@override
Widget build(BuildContext context) {
- return new Card(
- child: new Column(
+ return Card(
+ child: Column(
children: <Widget>[
- new Expanded(
- child: new Container(
+ Expanded(
+ child: Container(
color: Colors.lightBlueAccent.shade100,
)
),
- new Container(
+ Container(
margin: const EdgeInsets.only(left: 8.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new Expanded(
- child: new Text(name)
+ Expanded(
+ child: Text(name)
),
const IconButton(
icon: Icon(Icons.more_vert),
@@ -72,14 +72,14 @@
@override
Widget build(BuildContext context) {
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
- return new ListView(
+ return ListView(
itemExtent: _kListItemExtent,
- children: names.map((String name) => new AdaptedListItem(name: name)).toList(),
+ children: names.map((String name) => AdaptedListItem(name: name)).toList(),
);
} else {
- return new GridView.extent(
+ return GridView.extent(
maxCrossAxisExtent: _kMaxTileWidth,
- children: names.map((String name) => new AdaptedGridItem(name: name)).toList(),
+ children: names.map((String name) => AdaptedGridItem(name: name)).toList(),
);
}
}
@@ -95,13 +95,13 @@
final List<String> _kNames = _initNames();
void main() {
- runApp(new MaterialApp(
+ runApp(MaterialApp(
title: 'Media Query Example',
- home: new Scaffold(
- appBar: new AppBar(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('Media Query Example')
),
- body: new Material(child: new AdaptiveContainer(names: _kNames))
+ body: Material(child: AdaptiveContainer(names: _kNames))
)
));
}
diff --git a/examples/layers/widgets/sectors.dart b/examples/layers/widgets/sectors.dart
index 85e7de4..b8fae26 100644
--- a/examples/layers/widgets/sectors.dart
+++ b/examples/layers/widgets/sectors.dart
@@ -10,21 +10,21 @@
import '../rendering/src/sector_layout.dart';
RenderBox initCircle() {
- return new RenderBoxToRenderSectorAdapter(
+ return RenderBoxToRenderSectorAdapter(
innerRadius: 25.0,
- child: new RenderSectorRing(padding: 0.0)
+ child: RenderSectorRing(padding: 0.0)
);
}
class SectorApp extends StatefulWidget {
@override
- SectorAppState createState() => new SectorAppState();
+ SectorAppState createState() => SectorAppState();
}
class SectorAppState extends State<SectorApp> {
final RenderBoxToRenderSectorAdapter sectors = initCircle();
- final math.Random rand = new math.Random(1);
+ final math.Random rand = math.Random(1);
List<double> wantedSectorSizes = <double>[];
List<double> actualSectorSizes = <double>[];
@@ -60,19 +60,19 @@
actualSectorSizes.removeLast();
}
while (index < wantedSectorSizes.length) {
- final Color color = new Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080);
- ring.add(new RenderSolidColor(color, desiredDeltaTheta: wantedSectorSizes[index]));
+ final Color color = Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080);
+ ring.add(RenderSolidColor(color, desiredDeltaTheta: wantedSectorSizes[index]));
actualSectorSizes.add(wantedSectorSizes[index]);
index += 1;
}
}
static RenderBox initSector(Color color) {
- final RenderSectorRing ring = new RenderSectorRing(padding: 1.0);
- ring.add(new RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
- ring.add(new RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
- ring.add(new RenderSolidColor(color, desiredDeltaTheta: kTwoPi * 0.2));
- return new RenderBoxToRenderSectorAdapter(
+ final RenderSectorRing ring = RenderSectorRing(padding: 1.0);
+ ring.add(RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
+ ring.add(RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
+ ring.add(RenderSolidColor(color, desiredDeltaTheta: kTwoPi * 0.2));
+ return RenderBoxToRenderSectorAdapter(
innerRadius: 5.0,
child: ring
);
@@ -90,36 +90,36 @@
}
Widget buildBody() {
- return new Column(
+ return Column(
children: <Widget>[
- new Container(
+ Container(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 25.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new RaisedButton(
+ RaisedButton(
onPressed: _enabledAdd ? addSector : null,
- child: new IntrinsicWidth(
- child: new Row(
+ child: IntrinsicWidth(
+ child: Row(
children: <Widget>[
- new Container(
+ Container(
padding: const EdgeInsets.all(4.0),
margin: const EdgeInsets.only(right: 10.0),
- child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
+ child: WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
),
const Text('ADD SECTOR'),
]
)
)
),
- new RaisedButton(
+ RaisedButton(
onPressed: _enabledRemove ? removeSector : null,
- child: new IntrinsicWidth(
- child: new Row(
+ child: IntrinsicWidth(
+ child: Row(
children: <Widget>[
- new Container(
+ Container(
padding: const EdgeInsets.all(4.0),
margin: const EdgeInsets.only(right: 10.0),
- child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
+ child: WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
),
const Text('REMOVE SECTOR'),
]
@@ -130,14 +130,14 @@
mainAxisAlignment: MainAxisAlignment.spaceAround
)
),
- new Expanded(
- child: new Container(
+ Expanded(
+ child: Container(
margin: const EdgeInsets.all(8.0),
- decoration: new BoxDecoration(
- border: new Border.all()
+ decoration: BoxDecoration(
+ border: Border.all()
),
padding: const EdgeInsets.all(8.0),
- child: new WidgetToRenderBoxAdapter(
+ child: WidgetToRenderBoxAdapter(
renderBox: sectors,
onBuild: doUpdates
)
@@ -150,11 +150,11 @@
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- theme: new ThemeData.light(),
+ return MaterialApp(
+ theme: ThemeData.light(),
title: 'Sector Layout',
- home: new Scaffold(
- appBar: new AppBar(
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('Sector Layout in a Widget Tree')
),
body: buildBody()
@@ -164,5 +164,5 @@
}
void main() {
- runApp(new SectorApp());
+ runApp(SectorApp());
}
diff --git a/examples/layers/widgets/spinning_mixed.dart b/examples/layers/widgets/spinning_mixed.dart
index aaf4eb6..4801ac7 100644
--- a/examples/layers/widgets/spinning_mixed.dart
+++ b/examples/layers/widgets/spinning_mixed.dart
@@ -9,7 +9,7 @@
// Solid colour, RenderObject version
void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex = 0 }) {
- final RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
+ final RenderSolidColorBox child = RenderSolidColorBox(backgroundColor);
parent.add(child);
final FlexParentData childParentData = child.parentData;
childParentData.flex = flex;
@@ -23,8 +23,8 @@
@override
Widget build(BuildContext context) {
- return new Expanded(
- child: new Container(
+ return Expanded(
+ child: Container(
color: color,
)
);
@@ -33,27 +33,27 @@
double value;
RenderObjectToWidgetElement<RenderBox> element;
-BuildOwner owner = new BuildOwner();
+BuildOwner owner = BuildOwner();
void attachWidgetTreeToRenderTree(RenderProxyBox container) {
- element = new RenderObjectToWidgetAdapter<RenderBox>(
+ element = RenderObjectToWidgetAdapter<RenderBox>(
container: container,
- child: new Directionality(
+ child: Directionality(
textDirection: TextDirection.ltr,
- child: new Container(
+ child: Container(
height: 300.0,
- child: new Column(
+ child: Column(
children: <Widget>[
const Rectangle(Color(0xFF00FFFF)),
- new Material(
- child: new Container(
+ Material(
+ child: Container(
padding: const EdgeInsets.all(10.0),
margin: const EdgeInsets.all(10.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new RaisedButton(
- child: new Row(
+ RaisedButton(
+ child: Row(
children: <Widget>[
- new Image.network('https://flutter.io/images/favicon.png'),
+ Image.network('https://flutter.io/images/favicon.png'),
const Text('PRESS ME'),
],
),
@@ -62,7 +62,7 @@
attachWidgetTreeToRenderTree(container);
},
),
- new CircularProgressIndicator(value: value),
+ CircularProgressIndicator(value: value),
],
mainAxisAlignment: MainAxisAlignment.spaceAround,
),
@@ -92,16 +92,16 @@
void main() {
final WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
- final RenderProxyBox proxy = new RenderProxyBox();
+ final RenderProxyBox proxy = RenderProxyBox();
attachWidgetTreeToRenderTree(proxy);
- final RenderFlex flexRoot = new RenderFlex(direction: Axis.vertical);
+ final RenderFlex flexRoot = RenderFlex(direction: Axis.vertical);
addFlexChildSolidColor(flexRoot, const Color(0xFFFF00FF), flex: 1);
flexRoot.add(proxy);
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
- transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: Alignment.center);
- final RenderPadding root = new RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
+ transformBox = RenderTransform(child: flexRoot, transform: Matrix4.identity(), alignment: Alignment.center);
+ final RenderPadding root = RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
binding.renderView.child = root;
binding.addPersistentFrameCallback(rotate);
diff --git a/examples/layers/widgets/spinning_square.dart b/examples/layers/widgets/spinning_square.dart
index 81312d6..6539ffc 100644
--- a/examples/layers/widgets/spinning_square.dart
+++ b/examples/layers/widgets/spinning_square.dart
@@ -6,7 +6,7 @@
class SpinningSquare extends StatefulWidget {
@override
- _SpinningSquareState createState() => new _SpinningSquareState();
+ _SpinningSquareState createState() => _SpinningSquareState();
}
class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProviderStateMixin {
@@ -18,7 +18,7 @@
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
// represents an entire turn of the square whereas in the other examples
// we used 0.0 -> math.pi, which is only half a turn.
- _animation = new AnimationController(
+ _animation = AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,
)..repeat();
@@ -32,9 +32,9 @@
@override
Widget build(BuildContext context) {
- return new RotationTransition(
+ return RotationTransition(
turns: _animation,
- child: new Container(
+ child: Container(
width: 200.0,
height: 200.0,
color: const Color(0xFF00FF00),
@@ -44,5 +44,5 @@
}
void main() {
- runApp(new Center(child: new SpinningSquare()));
+ runApp(Center(child: SpinningSquare()));
}
diff --git a/examples/layers/widgets/styled_text.dart b/examples/layers/widgets/styled_text.dart
index e8cf81c..0694aa2 100644
--- a/examples/layers/widgets/styled_text.dart
+++ b/examples/layers/widgets/styled_text.dart
@@ -23,8 +23,8 @@
.map((String line) => line.split(':'))
.toList();
-final TextStyle _kDaveStyle = new TextStyle(color: Colors.indigo.shade400, height: 1.8);
-final TextStyle _kHalStyle = new TextStyle(color: Colors.red.shade400, fontFamily: 'monospace');
+final TextStyle _kDaveStyle = TextStyle(color: Colors.indigo.shade400, height: 1.8);
+final TextStyle _kHalStyle = TextStyle(color: Colors.red.shade400, fontFamily: 'monospace');
const TextStyle _kBold = TextStyle(fontWeight: FontWeight.bold);
const TextStyle _kUnderline = TextStyle(
decoration: TextDecoration.underline,
@@ -34,33 +34,33 @@
Widget toStyledText(String name, String text) {
final TextStyle lineStyle = (name == 'Dave') ? _kDaveStyle : _kHalStyle;
- return new RichText(
- key: new Key(text),
- text: new TextSpan(
+ return RichText(
+ key: Key(text),
+ text: TextSpan(
style: lineStyle,
children: <TextSpan>[
- new TextSpan(
+ TextSpan(
style: _kBold,
children: <TextSpan>[
- new TextSpan(
+ TextSpan(
style: _kUnderline,
text: name
),
const TextSpan(text: ':')
]
),
- new TextSpan(text: text)
+ TextSpan(text: text)
]
)
);
}
-Widget toPlainText(String name, String text) => new Text(name + ':' + text);
+Widget toPlainText(String name, String text) => Text(name + ':' + text);
class SpeakerSeparator extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new Container(
+ return Container(
constraints: const BoxConstraints.expand(height: 0.0),
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 64.0),
decoration: const BoxDecoration(
@@ -74,7 +74,7 @@
class StyledTextDemo extends StatefulWidget {
@override
- _StyledTextDemoState createState() => new _StyledTextDemoState();
+ _StyledTextDemoState createState() => _StyledTextDemoState();
}
class _StyledTextDemoState extends State<StyledTextDemo> {
@@ -102,14 +102,14 @@
for (Widget line in lines) {
children.add(line);
if (line != lines.last)
- children.add(new SpeakerSeparator());
+ children.add(SpeakerSeparator());
}
- return new GestureDetector(
+ return GestureDetector(
onTap: _handleTap,
- child: new Container(
+ child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
- child: new Column(
+ child: Column(
children: children,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start
@@ -120,15 +120,15 @@
}
void main() {
- runApp(new MaterialApp(
- theme: new ThemeData.light(),
- home: new Scaffold(
- appBar: new AppBar(
+ runApp(MaterialApp(
+ theme: ThemeData.light(),
+ home: Scaffold(
+ appBar: AppBar(
title: const Text('Hal and Dave')
),
- body: new Material(
+ body: Material(
color: Colors.grey.shade50,
- child: new StyledTextDemo()
+ child: StyledTextDemo()
)
)
));
diff --git a/examples/platform_channel/lib/main.dart b/examples/platform_channel/lib/main.dart
index 41129cc..8739a01 100644
--- a/examples/platform_channel/lib/main.dart
+++ b/examples/platform_channel/lib/main.dart
@@ -9,7 +9,7 @@
class PlatformChannel extends StatefulWidget {
@override
- _PlatformChannelState createState() => new _PlatformChannelState();
+ _PlatformChannelState createState() => _PlatformChannelState();
}
class _PlatformChannelState extends State<PlatformChannel> {
@@ -55,24 +55,24 @@
@override
Widget build(BuildContext context) {
- return new Material(
- child: new Column(
+ return Material(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
- new Column(
+ Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
- new Text(_batteryLevel, key: const Key('Battery level label')),
- new Padding(
+ Text(_batteryLevel, key: const Key('Battery level label')),
+ Padding(
padding: const EdgeInsets.all(16.0),
- child: new RaisedButton(
+ child: RaisedButton(
child: const Text('Refresh'),
onPressed: _getBatteryLevel,
),
),
],
),
- new Text(_chargingStatus),
+ Text(_chargingStatus),
],
),
);
@@ -80,5 +80,5 @@
}
void main() {
- runApp(new MaterialApp(home: new PlatformChannel()));
+ runApp(MaterialApp(home: PlatformChannel()));
}
diff --git a/examples/platform_channel_swift/lib/main.dart b/examples/platform_channel_swift/lib/main.dart
index 41129cc..8739a01 100644
--- a/examples/platform_channel_swift/lib/main.dart
+++ b/examples/platform_channel_swift/lib/main.dart
@@ -9,7 +9,7 @@
class PlatformChannel extends StatefulWidget {
@override
- _PlatformChannelState createState() => new _PlatformChannelState();
+ _PlatformChannelState createState() => _PlatformChannelState();
}
class _PlatformChannelState extends State<PlatformChannel> {
@@ -55,24 +55,24 @@
@override
Widget build(BuildContext context) {
- return new Material(
- child: new Column(
+ return Material(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
- new Column(
+ Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
- new Text(_batteryLevel, key: const Key('Battery level label')),
- new Padding(
+ Text(_batteryLevel, key: const Key('Battery level label')),
+ Padding(
padding: const EdgeInsets.all(16.0),
- child: new RaisedButton(
+ child: RaisedButton(
child: const Text('Refresh'),
onPressed: _getBatteryLevel,
),
),
],
),
- new Text(_chargingStatus),
+ Text(_chargingStatus),
],
),
);
@@ -80,5 +80,5 @@
}
void main() {
- runApp(new MaterialApp(home: new PlatformChannel()));
+ runApp(MaterialApp(home: PlatformChannel()));
}
diff --git a/examples/platform_view/lib/main.dart b/examples/platform_view/lib/main.dart
index aba8cb9..9a66c01 100644
--- a/examples/platform_view/lib/main.dart
+++ b/examples/platform_view/lib/main.dart
@@ -8,15 +8,15 @@
import 'package:flutter/services.dart';
void main() {
- runApp(new PlatformView());
+ runApp(PlatformView());
}
class PlatformView extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new MaterialApp(
+ return MaterialApp(
title: 'Platform View',
- theme: new ThemeData(
+ theme: ThemeData(
primarySwatch: Colors.grey,
),
home: const MyHomePage(title: 'Platform View'),
@@ -30,7 +30,7 @@
final String title;
@override
- _MyHomePageState createState() => new _MyHomePageState();
+ _MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@@ -54,25 +54,25 @@
}
@override
- Widget build(BuildContext context) => new Scaffold(
- appBar: new AppBar(
- title: new Text(widget.title),
+ Widget build(BuildContext context) => Scaffold(
+ appBar: AppBar(
+ title: Text(widget.title),
),
- body: new Column(
+ body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
- new Expanded(
- child: new Center(
- child: new Column(
+ Expanded(
+ child: Center(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
- new Text(
+ Text(
'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
style: const TextStyle(fontSize: 17.0),
),
- new Padding(
+ Padding(
padding: const EdgeInsets.all(18.0),
- child: new RaisedButton(
+ child: RaisedButton(
child: Platform.isIOS
? const Text('Continue in iOS view')
: const Text('Continue in Android view'),
@@ -82,11 +82,11 @@
),
),
),
- new Container(
+ Container(
padding: const EdgeInsets.only(bottom: 15.0, left: 5.0),
- child: new Row(
+ child: Row(
children: <Widget>[
- new Image.asset('assets/flutter-mark-square-64.png',
+ Image.asset('assets/flutter-mark-square-64.png',
scale: 1.5),
const Text(
'Flutter',
@@ -97,7 +97,7 @@
),
],
),
- floatingActionButton: new FloatingActionButton(
+ floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart
index cab5c17..469e3bb 100644
--- a/examples/stocks/lib/main.dart
+++ b/examples/stocks/lib/main.dart
@@ -35,13 +35,13 @@
class StocksApp extends StatefulWidget {
@override
- StocksAppState createState() => new StocksAppState();
+ StocksAppState createState() => StocksAppState();
}
class StocksAppState extends State<StocksApp> {
StockData stocks;
- StockConfiguration _configuration = new StockConfiguration(
+ StockConfiguration _configuration = StockConfiguration(
stockMode: StockMode.optimistic,
backupMode: BackupMode.enabled,
debugShowGrid: false,
@@ -57,7 +57,7 @@
@override
void initState() {
super.initState();
- stocks = new StockData();
+ stocks = StockData();
}
void configurationUpdater(StockConfiguration value) {
@@ -69,12 +69,12 @@
ThemeData get theme {
switch (_configuration.stockMode) {
case StockMode.optimistic:
- return new ThemeData(
+ return ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.purple
);
case StockMode.pessimistic:
- return new ThemeData(
+ return ThemeData(
brightness: Brightness.dark,
accentColor: Colors.redAccent
);
@@ -100,9 +100,9 @@
// Extract the symbol part of "stock:..." and return a route
// for that symbol.
final String symbol = path[1].substring(6);
- return new MaterialPageRoute<void>(
+ return MaterialPageRoute<void>(
settings: settings,
- builder: (BuildContext context) => new StockSymbolPage(symbol: symbol, stocks: stocks),
+ builder: (BuildContext context) => StockSymbolPage(symbol: symbol, stocks: stocks),
);
}
// The other paths we support are in the routes table.
@@ -119,11 +119,11 @@
debugRepaintRainbowEnabled = _configuration.debugShowRainbow;
return true;
}());
- return new MaterialApp(
+ return MaterialApp(
title: 'Stocks',
theme: theme,
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
- new _StocksLocalizationsDelegate(),
+ _StocksLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
@@ -135,8 +135,8 @@
showPerformanceOverlay: _configuration.showPerformanceOverlay,
showSemanticsDebugger: _configuration.showSemanticsDebugger,
routes: <String, WidgetBuilder>{
- '/': (BuildContext context) => new StockHome(stocks, _configuration, configurationUpdater),
- '/settings': (BuildContext context) => new StockSettings(_configuration, configurationUpdater)
+ '/': (BuildContext context) => StockHome(stocks, _configuration, configurationUpdater),
+ '/settings': (BuildContext context) => StockSettings(_configuration, configurationUpdater)
},
onGenerateRoute: _getRoute,
);
@@ -144,5 +144,5 @@
}
void main() {
- runApp(new StocksApp());
+ runApp(StocksApp());
}
diff --git a/examples/stocks/lib/stock_arrow.dart b/examples/stocks/lib/stock_arrow.dart
index 7f72e43..cbd78f0 100644
--- a/examples/stocks/lib/stock_arrow.dart
+++ b/examples/stocks/lib/stock_arrow.dart
@@ -14,7 +14,7 @@
@override
void paint(Canvas canvas, Size size) {
- final Paint paint = new Paint()..color = color;
+ final Paint paint = Paint()..color = color;
paint.strokeWidth = 1.0;
const double padding = 2.0;
assert(padding > paint.strokeWidth / 2.0); // make sure the circle remains inside the box
@@ -32,7 +32,7 @@
} else {
arrowY = centerX - 1.0;
}
- final Path path = new Path();
+ final Path path = Path();
path.moveTo(centerX, arrowY - h); // top of the arrow
path.lineTo(centerX + w, arrowY + h);
path.lineTo(centerX - w, arrowY + h);
@@ -42,7 +42,7 @@
// Draw a circle that circumscribes the arrow.
paint.style = PaintingStyle.stroke;
- canvas.drawCircle(new Offset(centerX, centerY), r, paint);
+ canvas.drawCircle(Offset(centerX, centerY), r, paint);
}
@override
@@ -71,12 +71,12 @@
@override
Widget build(BuildContext context) {
- return new Container(
+ return Container(
width: 40.0,
height: 40.0,
margin: const EdgeInsets.symmetric(horizontal: 5.0),
- child: new CustomPaint(
- painter: new StockArrowPainter(
+ child: CustomPaint(
+ painter: StockArrowPainter(
// TODO(jackson): This should change colors with the theme
color: _colorForPercentChange(percentChange),
percentChange: percentChange
diff --git a/examples/stocks/lib/stock_data.dart b/examples/stocks/lib/stock_data.dart
index 682223e..be28ad1 100644
--- a/examples/stocks/lib/stock_data.dart
+++ b/examples/stocks/lib/stock_data.dart
@@ -13,7 +13,7 @@
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
-final math.Random _rng = new math.Random();
+final math.Random _rng = math.Random();
class Stock {
String symbol;
@@ -41,7 +41,7 @@
class StockData extends ChangeNotifier {
StockData() {
if (actuallyFetchData) {
- _httpClient = new http.Client();
+ _httpClient = http.Client();
_fetchNextChunk();
}
}
@@ -57,7 +57,7 @@
void add(List<dynamic> data) {
for (List<dynamic> fields in data) {
- final Stock stock = new Stock.fromFields(fields.cast<String>());
+ final Stock stock = Stock.fromFields(fields.cast<String>());
_symbols.add(stock.symbol);
_stocks[stock.symbol] = stock;
}
diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart
index 65daf3f..2f3e71c 100644
--- a/examples/stocks/lib/stock_home.dart
+++ b/examples/stocks/lib/stock_home.dart
@@ -19,26 +19,26 @@
class _NotImplementedDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new AlertDialog(
+ return AlertDialog(
title: const Text('Not Implemented'),
content: const Text('This feature has not yet been implemented.'),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
onPressed: debugDumpApp,
- child: new Row(
+ child: Row(
children: <Widget>[
const Icon(
Icons.dvr,
size: 18.0,
),
- new Container(
+ Container(
width: 8.0,
),
const Text('DUMP APP TO CONSOLE'),
],
),
),
- new FlatButton(
+ FlatButton(
onPressed: () {
Navigator.pop(context, false);
},
@@ -57,17 +57,17 @@
final ValueChanged<StockConfiguration> updater;
@override
- StockHomeState createState() => new StockHomeState();
+ StockHomeState createState() => StockHomeState();
}
class StockHomeState extends State<StockHome> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
- final TextEditingController _searchQuery = new TextEditingController();
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
+ final TextEditingController _searchQuery = TextEditingController();
bool _isSearching = false;
bool _autorefresh = false;
void _handleSearchBegin() {
- ModalRoute.of(context).addLocalHistoryEntry(new LocalHistoryEntry(
+ ModalRoute.of(context).addLocalHistoryEntry(LocalHistoryEntry(
onRemove: () {
setState(() {
_isSearching = false;
@@ -95,7 +95,7 @@
case _StockMenuItem.refresh:
showDialog<void>(
context: context,
- builder: (BuildContext context) => new _NotImplementedDialog(),
+ builder: (BuildContext context) => _NotImplementedDialog(),
);
break;
case _StockMenuItem.speedUp:
@@ -108,8 +108,8 @@
}
Widget _buildDrawer(BuildContext context) {
- return new Drawer(
- child: new ListView(
+ return Drawer(
+ child: ListView(
children: <Widget>[
const DrawerHeader(child: Center(child: Text('Stocks'))),
const ListTile(
@@ -122,7 +122,7 @@
title: Text('Account Balance'),
enabled: false,
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.dvr),
title: const Text('Dump App to Console'),
onTap: () {
@@ -137,10 +137,10 @@
},
),
const Divider(),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.thumb_up),
title: const Text('Optimistic'),
- trailing: new Radio<StockMode>(
+ trailing: Radio<StockMode>(
value: StockMode.optimistic,
groupValue: widget.configuration.stockMode,
onChanged: _handleStockModeChange,
@@ -149,10 +149,10 @@
_handleStockModeChange(StockMode.optimistic);
},
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.thumb_down),
title: const Text('Pessimistic'),
- trailing: new Radio<StockMode>(
+ trailing: Radio<StockMode>(
value: StockMode.pessimistic,
groupValue: widget.configuration.stockMode,
onChanged: _handleStockModeChange,
@@ -162,12 +162,12 @@
},
),
const Divider(),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.settings),
title: const Text('Settings'),
onTap: _handleShowSettings,
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.help),
title: const Text('About'),
onTap: _handleShowAbout,
@@ -186,19 +186,19 @@
}
Widget buildAppBar() {
- return new AppBar(
+ return AppBar(
elevation: 0.0,
- title: new Text(StockStrings.of(context).title()),
+ title: Text(StockStrings.of(context).title()),
actions: <Widget>[
- new IconButton(
+ IconButton(
icon: const Icon(Icons.search),
onPressed: _handleSearchBegin,
tooltip: 'Search',
),
- new PopupMenuButton<_StockMenuItem>(
+ PopupMenuButton<_StockMenuItem>(
onSelected: (_StockMenuItem value) { _handleStockMenu(context, value); },
itemBuilder: (BuildContext context) => <PopupMenuItem<_StockMenuItem>>[
- new CheckedPopupMenuItem<_StockMenuItem>(
+ CheckedPopupMenuItem<_StockMenuItem>(
value: _StockMenuItem.autorefresh,
checked: _autorefresh,
child: const Text('Autorefresh'),
@@ -218,10 +218,10 @@
],
),
],
- bottom: new TabBar(
+ bottom: TabBar(
tabs: <Widget>[
- new Tab(text: StockStrings.of(context).market()),
- new Tab(text: StockStrings.of(context).portfolio()),
+ Tab(text: StockStrings.of(context).market()),
+ Tab(text: StockStrings.of(context).portfolio()),
],
),
);
@@ -235,7 +235,7 @@
Iterable<Stock> _filterBySearchQuery(Iterable<Stock> stocks) {
if (_searchQuery.text.isEmpty)
return stocks;
- final RegExp regexp = new RegExp(_searchQuery.text, caseSensitive: false);
+ final RegExp regexp = RegExp(_searchQuery.text, caseSensitive: false);
return stocks.where((Stock stock) => stock.symbol.contains(regexp));
}
@@ -244,9 +244,9 @@
stock.percentChange = 100.0 * (1.0 / stock.lastSale);
stock.lastSale += 1.0;
});
- _scaffoldKey.currentState.showSnackBar(new SnackBar(
- content: new Text('Purchased ${stock.symbol} for ${stock.lastSale}'),
- action: new SnackBarAction(
+ _scaffoldKey.currentState.showSnackBar(SnackBar(
+ content: Text('Purchased ${stock.symbol} for ${stock.lastSale}'),
+ action: SnackBarAction(
label: 'BUY MORE',
onPressed: () {
_buyStock(stock);
@@ -256,22 +256,22 @@
}
Widget _buildStockList(BuildContext context, Iterable<Stock> stocks, StockHomeTab tab) {
- return new StockList(
+ return StockList(
stocks: stocks.toList(),
onAction: _buyStock,
onOpen: (Stock stock) {
Navigator.pushNamed(context, '/stock:${stock.symbol}');
},
onShow: (Stock stock) {
- _scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) => new StockSymbolBottomSheet(stock: stock));
+ _scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) => StockSymbolBottomSheet(stock: stock));
},
);
}
Widget _buildStockTab(BuildContext context, StockHomeTab tab, List<String> stockSymbols) {
- return new AnimatedBuilder(
- key: new ValueKey<StockHomeTab>(tab),
- animation: new Listenable.merge(<Listenable>[_searchQuery, widget.stocks]),
+ return AnimatedBuilder(
+ key: ValueKey<StockHomeTab>(tab),
+ animation: Listenable.merge(<Listenable>[_searchQuery, widget.stocks]),
builder: (BuildContext context, Widget child) {
return _buildStockList(context, _filterBySearchQuery(_getStockList(widget.stocks, stockSymbols)).toList(), tab);
},
@@ -281,11 +281,11 @@
static const List<String> portfolioSymbols = <String>['AAPL','FIZZ', 'FIVE', 'FLAT', 'ZINC', 'ZNGA'];
Widget buildSearchBar() {
- return new AppBar(
- leading: new BackButton(
+ return AppBar(
+ leading: BackButton(
color: Theme.of(context).accentColor,
),
- title: new TextField(
+ title: TextField(
controller: _searchQuery,
autofocus: true,
decoration: const InputDecoration(
@@ -299,12 +299,12 @@
void _handleCreateCompany() {
showModalBottomSheet<void>(
context: context,
- builder: (BuildContext context) => new _CreateCompanySheet(),
+ builder: (BuildContext context) => _CreateCompanySheet(),
);
}
Widget buildFloatingActionButton() {
- return new FloatingActionButton(
+ return FloatingActionButton(
tooltip: 'Create company',
child: const Icon(Icons.add),
backgroundColor: Theme.of(context).accentColor,
@@ -314,14 +314,14 @@
@override
Widget build(BuildContext context) {
- return new DefaultTabController(
+ return DefaultTabController(
length: 2,
- child: new Scaffold(
+ child: Scaffold(
key: _scaffoldKey,
appBar: _isSearching ? buildSearchBar() : buildAppBar(),
floatingActionButton: buildFloatingActionButton(),
drawer: _buildDrawer(context),
- body: new TabBarView(
+ body: TabBarView(
children: <Widget>[
_buildStockTab(context, StockHomeTab.market, widget.stocks.allSymbols),
_buildStockTab(context, StockHomeTab.portfolio, portfolioSymbols),
@@ -335,7 +335,7 @@
class _CreateCompanySheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return new Column(
+ return Column(
children: const <Widget>[
TextField(
autofocus: true,
diff --git a/examples/stocks/lib/stock_list.dart b/examples/stocks/lib/stock_list.dart
index e9fc311..d61c0c3 100644
--- a/examples/stocks/lib/stock_list.dart
+++ b/examples/stocks/lib/stock_list.dart
@@ -17,12 +17,12 @@
@override
Widget build(BuildContext context) {
- return new ListView.builder(
+ return ListView.builder(
key: const ValueKey<String>('stock-list'),
itemExtent: StockRow.kHeight,
itemCount: stocks.length,
itemBuilder: (BuildContext context, int index) {
- return new StockRow(
+ return StockRow(
stock: stocks[index],
onPressed: onOpen,
onDoubleTap: onShow,
diff --git a/examples/stocks/lib/stock_row.dart b/examples/stocks/lib/stock_row.dart
index f22c5be..00e8843 100644
--- a/examples/stocks/lib/stock_row.dart
+++ b/examples/stocks/lib/stock_row.dart
@@ -15,7 +15,7 @@
this.onPressed,
this.onDoubleTap,
this.onLongPressed
- }) : super(key: new ObjectKey(stock));
+ }) : super(key: ObjectKey(stock));
final Stock stock;
final StockRowActionCallback onPressed;
@@ -34,43 +34,43 @@
String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%';
if (stock.percentChange > 0)
changeInPrice = '+' + changeInPrice;
- return new InkWell(
+ return InkWell(
onTap: _getHandler(onPressed),
onDoubleTap: _getHandler(onDoubleTap),
onLongPress: _getHandler(onLongPressed),
- child: new Container(
+ child: Container(
padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 20.0),
- decoration: new BoxDecoration(
- border: new Border(
- bottom: new BorderSide(color: Theme.of(context).dividerColor)
+ decoration: BoxDecoration(
+ border: Border(
+ bottom: BorderSide(color: Theme.of(context).dividerColor)
)
),
- child: new Row(
+ child: Row(
children: <Widget>[
- new Container(
+ Container(
margin: const EdgeInsets.only(right: 5.0),
- child: new Hero(
+ child: Hero(
tag: stock,
- child: new StockArrow(percentChange: stock.percentChange)
+ child: StockArrow(percentChange: stock.percentChange)
)
),
- new Expanded(
- child: new Row(
+ Expanded(
+ child: Row(
children: <Widget>[
- new Expanded(
+ Expanded(
flex: 2,
- child: new Text(
+ child: Text(
stock.symbol
)
),
- new Expanded(
- child: new Text(
+ Expanded(
+ child: Text(
lastSale,
textAlign: TextAlign.right
)
),
- new Expanded(
- child: new Text(
+ Expanded(
+ child: Text(
changeInPrice,
textAlign: TextAlign.right
)
diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart
index 7390d12..3919096 100644
--- a/examples/stocks/lib/stock_settings.dart
+++ b/examples/stocks/lib/stock_settings.dart
@@ -13,7 +13,7 @@
final ValueChanged<StockConfiguration> updater;
@override
- StockSettingsState createState() => new StockSettingsState();
+ StockSettingsState createState() => StockSettingsState();
}
class StockSettingsState extends State<StockSettings> {
@@ -68,17 +68,17 @@
showDialog<bool>(
context: context,
builder: (BuildContext context) {
- return new AlertDialog(
+ return AlertDialog(
title: const Text('Change mode?'),
content: const Text('Optimistic mode means everything is awesome. Are you sure you can handle that?'),
actions: <Widget>[
- new FlatButton(
+ FlatButton(
child: const Text('NO THANKS'),
onPressed: () {
Navigator.pop(context, false);
}
),
- new FlatButton(
+ FlatButton(
child: const Text('AGREE'),
onPressed: () {
Navigator.pop(context, true);
@@ -98,45 +98,45 @@
}
Widget buildAppBar(BuildContext context) {
- return new AppBar(
+ return AppBar(
title: const Text('Settings')
);
}
Widget buildSettingsPane(BuildContext context) {
final List<Widget> rows = <Widget>[
- new ListTile(
+ ListTile(
leading: const Icon(Icons.thumb_up),
title: const Text('Everything is awesome'),
onTap: _confirmOptimismChange,
- trailing: new Checkbox(
+ trailing: Checkbox(
value: widget.configuration.stockMode == StockMode.optimistic,
onChanged: (bool value) => _confirmOptimismChange(),
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.backup),
title: const Text('Back up stock list to the cloud'),
onTap: () { _handleBackupChanged(!(widget.configuration.backupMode == BackupMode.enabled)); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.backupMode == BackupMode.enabled,
onChanged: _handleBackupChanged,
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.picture_in_picture),
title: const Text('Show rendering performance overlay'),
onTap: () { _handleShowPerformanceOverlayChanged(!widget.configuration.showPerformanceOverlay); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.showPerformanceOverlay,
onChanged: _handleShowPerformanceOverlayChanged,
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.accessibility),
title: const Text('Show semantics overlay'),
onTap: () { _handleShowSemanticsDebuggerChanged(!widget.configuration.showSemanticsDebugger); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.showSemanticsDebugger,
onChanged: _handleShowSemanticsDebuggerChanged,
),
@@ -145,56 +145,56 @@
assert(() {
// material grid and size construction lines are only available in checked mode
rows.addAll(<Widget>[
- new ListTile(
+ ListTile(
leading: const Icon(Icons.border_clear),
title: const Text('Show material grid (for debugging)'),
onTap: () { _handleShowGridChanged(!widget.configuration.debugShowGrid); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.debugShowGrid,
onChanged: _handleShowGridChanged,
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.border_all),
title: const Text('Show construction lines (for debugging)'),
onTap: () { _handleShowSizesChanged(!widget.configuration.debugShowSizes); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.debugShowSizes,
onChanged: _handleShowSizesChanged,
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.format_color_text),
title: const Text('Show baselines (for debugging)'),
onTap: () { _handleShowBaselinesChanged(!widget.configuration.debugShowBaselines); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.debugShowBaselines,
onChanged: _handleShowBaselinesChanged,
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.filter_none),
title: const Text('Show layer boundaries (for debugging)'),
onTap: () { _handleShowLayersChanged(!widget.configuration.debugShowLayers); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.debugShowLayers,
onChanged: _handleShowLayersChanged,
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.mouse),
title: const Text('Show pointer hit-testing (for debugging)'),
onTap: () { _handleShowPointersChanged(!widget.configuration.debugShowPointers); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.debugShowPointers,
onChanged: _handleShowPointersChanged,
),
),
- new ListTile(
+ ListTile(
leading: const Icon(Icons.gradient),
title: const Text('Show repaint rainbow (for debugging)'),
onTap: () { _handleShowRainbowChanged(!widget.configuration.debugShowRainbow); },
- trailing: new Switch(
+ trailing: Switch(
value: widget.configuration.debugShowRainbow,
onChanged: _handleShowRainbowChanged,
),
@@ -202,7 +202,7 @@
]);
return true;
}());
- return new ListView(
+ return ListView(
padding: const EdgeInsets.symmetric(vertical: 20.0),
children: rows,
);
@@ -210,7 +210,7 @@
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
appBar: buildAppBar(context),
body: buildSettingsPane(context)
);
diff --git a/examples/stocks/lib/stock_strings.dart b/examples/stocks/lib/stock_strings.dart
index 344db8a..136d079 100644
--- a/examples/stocks/lib/stock_strings.dart
+++ b/examples/stocks/lib/stock_strings.dart
@@ -20,7 +20,7 @@
static Future<StockStrings> load(Locale locale) {
return initializeMessages(locale.toString())
.then((Object _) {
- return new StockStrings(locale);
+ return StockStrings(locale);
});
}
diff --git a/examples/stocks/lib/stock_symbol_viewer.dart b/examples/stocks/lib/stock_symbol_viewer.dart
index b77cc82..e1f069c 100644
--- a/examples/stocks/lib/stock_symbol_viewer.dart
+++ b/examples/stocks/lib/stock_symbol_viewer.dart
@@ -22,13 +22,13 @@
changeInPrice = '+' + changeInPrice;
final TextStyle headings = Theme.of(context).textTheme.body2;
- return new Container(
+ return Container(
padding: const EdgeInsets.all(20.0),
- child: new Column(
+ child: Column(
children: <Widget>[
- new Row(
+ Row(
children: <Widget>[
- new Text(
+ Text(
'${stock.symbol}',
style: Theme.of(context).textTheme.display2
),
@@ -36,18 +36,18 @@
],
mainAxisAlignment: MainAxisAlignment.spaceBetween
),
- new Text('Last Sale', style: headings),
- new Text('$lastSale ($changeInPrice)'),
- new Container(
+ Text('Last Sale', style: headings),
+ Text('$lastSale ($changeInPrice)'),
+ Container(
height: 8.0
),
- new Text('Market Cap', style: headings),
- new Text('${stock.marketCap}'),
- new Container(
+ Text('Market Cap', style: headings),
+ Text('${stock.marketCap}'),
+ Container(
height: 8.0
),
- new RichText(
- text: new TextSpan(
+ RichText(
+ text: TextSpan(
style: DefaultTextStyle.of(context).style.merge(const TextStyle(fontSize: 8.0)),
text: 'Prices may be delayed by ',
children: const <TextSpan>[
@@ -71,34 +71,34 @@
@override
Widget build(BuildContext context) {
- return new AnimatedBuilder(
+ return AnimatedBuilder(
animation: stocks,
builder: (BuildContext context, Widget child) {
final Stock stock = stocks[symbol];
- return new Scaffold(
- appBar: new AppBar(
- title: new Text(stock?.name ?? symbol)
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(stock?.name ?? symbol)
),
- body: new SingleChildScrollView(
- child: new Container(
+ body: SingleChildScrollView(
+ child: Container(
margin: const EdgeInsets.all(20.0),
- child: new Card(
- child: new AnimatedCrossFade(
+ child: Card(
+ child: AnimatedCrossFade(
duration: const Duration(milliseconds: 300),
firstChild: const Padding(
padding: EdgeInsets.all(20.0),
child: Center(child: CircularProgressIndicator()),
),
secondChild: stock != null
- ? new _StockSymbolView(
+ ? _StockSymbolView(
stock: stock,
- arrow: new Hero(
+ arrow: Hero(
tag: stock,
- child: new StockArrow(percentChange: stock.percentChange),
+ child: StockArrow(percentChange: stock.percentChange),
),
- ) : new Padding(
+ ) : Padding(
padding: const EdgeInsets.all(20.0),
- child: new Center(child: new Text('$symbol not found')),
+ child: Center(child: Text('$symbol not found')),
),
crossFadeState: stock == null && stocks.loading ? CrossFadeState.showFirst : CrossFadeState.showSecond,
),
@@ -118,14 +118,14 @@
@override
Widget build(BuildContext context) {
- return new Container(
+ return Container(
padding: const EdgeInsets.all(10.0),
decoration: const BoxDecoration(
border: Border(top: BorderSide(color: Colors.black26))
),
- child: new _StockSymbolView(
+ child: _StockSymbolView(
stock: stock,
- arrow: new StockArrow(percentChange: stock.percentChange)
+ arrow: StockArrow(percentChange: stock.percentChange)
)
);
}
diff --git a/examples/stocks/lib/stock_types.dart b/examples/stocks/lib/stock_types.dart
index 163628e..7ffe63e 100644
--- a/examples/stocks/lib/stock_types.dart
+++ b/examples/stocks/lib/stock_types.dart
@@ -53,7 +53,7 @@
bool showPerformanceOverlay,
bool showSemanticsDebugger
}) {
- return new StockConfiguration(
+ return StockConfiguration(
stockMode: stockMode ?? this.stockMode,
backupMode: backupMode ?? this.backupMode,
debugShowGrid: debugShowGrid ?? this.debugShowGrid,
diff --git a/examples/stocks/test/icon_color_test.dart b/examples/stocks/test/icon_color_test.dart
index 74a7321..a3ba3fd 100644
--- a/examples/stocks/test/icon_color_test.dart
+++ b/examples/stocks/test/icon_color_test.dart
@@ -35,7 +35,7 @@
return result;
}
-final RegExp materialIconAssetNameColorExtractor = new RegExp(r'[^/]+/ic_.+_(white|black)_[0-9]+dp\.png');
+final RegExp materialIconAssetNameColorExtractor = RegExp(r'[^/]+/ic_.+_(white|black)_[0-9]+dp\.png');
void checkIconColor(WidgetTester tester, String label, Color color) {
final Element listTile = findElementOfExactWidgetTypeGoingUp(tester.element(find.text(label)), ListTile);
@@ -61,8 +61,8 @@
expect(find.text('Account Balance'), findsNothing);
// drag the drawer out
- final Offset left = new Offset(0.0, (ui.window.physicalSize / ui.window.devicePixelRatio).height / 2.0);
- final Offset right = new Offset((ui.window.physicalSize / ui.window.devicePixelRatio).width, left.dy);
+ final Offset left = Offset(0.0, (ui.window.physicalSize / ui.window.devicePixelRatio).height / 2.0);
+ final Offset right = Offset((ui.window.physicalSize / ui.window.devicePixelRatio).width, left.dy);
final TestGesture gesture = await tester.startGesture(left);
await tester.pump();
await gesture.moveTo(right);
diff --git a/examples/stocks/test_driver/scroll_perf_test.dart b/examples/stocks/test_driver/scroll_perf_test.dart
index 8c5f0ca..e8a8591 100644
--- a/examples/stocks/test_driver/scroll_perf_test.dart
+++ b/examples/stocks/test_driver/scroll_perf_test.dart
@@ -29,17 +29,17 @@
// Scroll down
for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, -300.0, const Duration(milliseconds: 300));
- await new Future<Null>.delayed(const Duration(milliseconds: 500));
+ await Future<Null>.delayed(const Duration(milliseconds: 500));
}
// Scroll up
for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, 300.0, const Duration(milliseconds: 300));
- await new Future<Null>.delayed(const Duration(milliseconds: 500));
+ await Future<Null>.delayed(const Duration(milliseconds: 500));
}
});
- final TimelineSummary summary = new TimelineSummary.summarize(timeline);
+ final TimelineSummary summary = TimelineSummary.summarize(timeline);
summary.writeSummaryToFile('stocks_scroll_perf', pretty: true);
summary.writeTimelineToFile('stocks_scroll_perf', pretty: true);
});