Add missing trailing commas (#28673)

* add trailing commas on list/map/parameters

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

* add commas for widget containing widgets

* add trailing commas if instantiation contains trailing comma

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

View File

@@ -157,7 +157,7 @@ class CardItem extends StatelessWidget {
@required this.animation,
this.onTap,
@required this.item,
this.selected = false
this.selected = false,
}) : assert(animation != null),
assert(item != null && item >= 0),
assert(selected != null),

View File

@@ -58,7 +58,7 @@ class AdjustableDropdownListTile extends StatelessWidget {
}).toList(),
),
),
)
),
);
}
@@ -91,7 +91,7 @@ class AdjustableDropdownExampleState extends State<AdjustableDropdownExample> {
'5 seconds',
'15 seconds',
'30 seconds',
'1 minute'
'1 minute',
];
String timeout;

View File

@@ -509,7 +509,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
setState(() {
_maybeScroll(midScrollOffset, index, xOffset);
});
}
},
),
));
}
@@ -614,7 +614,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
tooltip: 'Back',
onPressed: () {
_handleBackButton(appBarMidScrollOffset);
}
},
),
),
),

View File

@@ -116,7 +116,7 @@ class _CalculatorState extends State<Calculator> {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).canvasColor,
elevation: 0.0
elevation: 0.0,
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -124,15 +124,15 @@ class _CalculatorState extends State<Calculator> {
// Give the key-pad 3/5 of the vertical space and the display 2/5.
Expanded(
flex: 2,
child: CalcDisplay(content: _expression.toString())
child: CalcDisplay(content: _expression.toString()),
),
const Divider(height: 1.0),
Expanded(
flex: 3,
child: KeyPad(calcState: this)
)
]
)
child: KeyPad(calcState: this),
),
],
),
);
}
}
@@ -147,8 +147,8 @@ class CalcDisplay extends StatelessWidget {
return Center(
child: Text(
content,
style: const TextStyle(fontSize: 24.0)
)
style: const TextStyle(fontSize: 24.0),
),
);
}
}
@@ -180,25 +180,25 @@ class KeyPad extends StatelessWidget {
KeyRow(<Widget>[
NumberKey(7, calcState),
NumberKey(8, calcState),
NumberKey(9, calcState)
NumberKey(9, calcState),
]),
KeyRow(<Widget>[
NumberKey(4, calcState),
NumberKey(5, calcState),
NumberKey(6, calcState)
NumberKey(6, calcState),
]),
KeyRow(<Widget>[
NumberKey(1, calcState),
NumberKey(2, calcState),
NumberKey(3, calcState)
NumberKey(3, calcState),
]),
KeyRow(<Widget>[
CalcKey('.', calcState.handlePointTap),
NumberKey(0, calcState),
CalcKey('=', calcState.handleEqualsTap),
])
]
)
]),
],
),
),
Expanded(
child: Material(
@@ -209,14 +209,14 @@ class KeyPad extends StatelessWidget {
CalcKey('\u00F7', calcState.handleDivTap),
CalcKey('\u00D7', calcState.handleMultTap),
CalcKey('-', calcState.handleMinusTap),
CalcKey('+', calcState.handlePlusTap)
]
)
)
CalcKey('+', calcState.handlePlusTap),
],
),
),
),
]
)
)
],
),
),
);
}
}
@@ -231,8 +231,8 @@ class KeyRow extends StatelessWidget {
return Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: keys
)
children: keys,
),
);
}
}
@@ -254,10 +254,10 @@ class CalcKey extends StatelessWidget {
text,
style: TextStyle(
fontSize: (orientation == Orientation.portrait) ? 32.0 : 24.0
)
)
)
)
),
),
),
),
);
}
}

View File

@@ -30,9 +30,9 @@ class _ContactCategory extends StatelessWidget {
Container(
padding: const EdgeInsets.symmetric(vertical: 24.0),
width: 72.0,
child: Icon(icon, color: themeData.primaryColor)
child: Icon(icon, color: themeData.primaryColor),
),
Expanded(child: Column(children: children))
Expanded(child: Column(children: children)),
],
),
),
@@ -61,9 +61,9 @@ class _ContactItem extends StatelessWidget {
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: columnChildren
)
)
children: columnChildren,
),
),
];
if (icon != null) {
rowChildren.add(SizedBox(
@@ -71,8 +71,8 @@ class _ContactItem extends StatelessWidget {
child: IconButton(
icon: Icon(icon),
color: themeData.primaryColor,
onPressed: onPressed
)
onPressed: onPressed,
),
));
}
return MergeSemantics(
@@ -80,8 +80,8 @@ class _ContactItem extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: rowChildren
)
children: rowChildren,
),
),
);
}
@@ -125,7 +125,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Edit',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text("Editing isn't supported in this screen.")
content: Text("Editing isn't supported in this screen."),
));
},
),
@@ -138,19 +138,19 @@ class ContactsDemoState extends State<ContactsDemo> {
itemBuilder: (BuildContext context) => <PopupMenuItem<AppBarBehavior>>[
const PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.normal,
child: Text('App bar scrolls away')
child: Text('App bar scrolls away'),
),
const PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.pinned,
child: Text('App bar stays put')
child: Text('App bar stays put'),
),
const PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.floating,
child: Text('App bar floats')
child: Text('App bar floats'),
),
const PopupMenuItem<AppBarBehavior>(
value: AppBarBehavior.snapping,
child: Text('App bar snaps')
child: Text('App bar snaps'),
),
],
),
@@ -193,7 +193,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('Pretend that this opened your SMS application.')
content: Text('Pretend that this opened your SMS application.'),
));
},
lines: const <String>[
@@ -206,7 +206,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('A messaging app appears.')
content: Text('A messaging app appears.'),
));
},
lines: const <String>[
@@ -219,7 +219,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send message',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('Imagine if you will, a messaging application.')
content: Text('Imagine if you will, a messaging application.'),
));
},
lines: const <String>[
@@ -238,7 +238,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send personal e-mail',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('Here, your e-mail application would open.')
content: Text('Here, your e-mail application would open.'),
));
},
lines: const <String>[
@@ -251,7 +251,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Send work e-mail',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('Summon your favorite e-mail application here.')
content: Text('Summon your favorite e-mail application here.'),
));
},
lines: const <String>[
@@ -269,7 +269,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('This would show a map of San Francisco.')
content: Text('This would show a map of San Francisco.'),
));
},
lines: const <String>[
@@ -283,7 +283,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('This would show a map of Mountain View.')
content: Text('This would show a map of Mountain View.'),
));
},
lines: const <String>[
@@ -297,7 +297,7 @@ class ContactsDemoState extends State<ContactsDemo> {
tooltip: 'Open map',
onPressed: () {
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text('This would also show a map, if this was not a demo.')
content: Text('This would also show a map, if this was not a demo.'),
));
},
lines: const <String>[

View File

@@ -178,7 +178,7 @@ class _CupertinoAlertDemoState extends State<CupertinoAlertDemo> {
onPressed: () {
Navigator.pop(context, 'Cancel');
},
)
),
),
);
},

View File

@@ -56,7 +56,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
child: const Text('Cupertino Button'),
onPressed: () {
setState(() { _pressedCount += 1; });
}
},
),
const CupertinoButton(
child: Text('Disabled'),
@@ -70,7 +70,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
child: const Text('With Background'),
onPressed: () {
setState(() { _pressedCount += 1; });
}
},
),
const Padding(padding: EdgeInsets.all(12.0)),
const CupertinoButton.filled(
@@ -83,7 +83,7 @@ class _CupertinoButtonDemoState extends State<CupertinoButtonsDemo> {
],
),
),
)
),
);
}
}

View File

@@ -78,7 +78,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
builder: (BuildContext context) {
return CupertinoDemoTab1(
colorItems: colorItems,
colorNameItems: colorNameItems
colorNameItems: colorNameItems,
);
},
defaultTitle: 'Colors',
@@ -750,7 +750,7 @@ class CupertinoDemoTab3 extends StatelessWidget {
Text(
'Sign in',
style: TextStyle(color: CupertinoTheme.of(context).primaryColor),
)
),
],
),
),

View File

@@ -32,7 +32,7 @@ class _CupertinoRefreshControlDemoState extends State<CupertinoRefreshControlDem
return contacts[random.nextInt(contacts.length)]
// Randomly adds a telephone icon next to the contact or not.
..add(random.nextBool().toString());
}
},
);
}

View File

@@ -46,10 +46,10 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
setState(() {
_value = value;
});
}
},
),
Text('Cupertino Continuous: ${_value.toStringAsFixed(1)}'),
]
],
),
Column(
mainAxisSize: MainAxisSize.min,
@@ -63,10 +63,10 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
setState(() {
_discreteValue = value;
});
}
},
),
Text('Cupertino Discrete: $_discreteValue'),
]
],
),
],
),

View File

@@ -116,7 +116,7 @@ class FruitPage extends StatelessWidget {
Text(
' ¬ ',
// TODO(larche): Replace textTheme.display3.color with a ColorScheme value when known.
style: textTheme.overline.apply(color: textTheme.display3.color)
style: textTheme.overline.apply(color: textTheme.display3.color),
),
Text(
'CULTURE',
@@ -160,7 +160,7 @@ class FruitPage extends StatelessWidget {
fontWeight: FontWeight.w500,
color: Colors.black,
),
)
),
],
),
),
@@ -170,7 +170,7 @@ class FruitPage extends StatelessWidget {
),
],
),
)
),
],
),
),

View File

@@ -34,7 +34,7 @@ class ImagesDemo extends StatelessWidget {
),
),
),
]
],
);
}
}

View File

@@ -256,7 +256,7 @@ class _RadioItem<T> extends StatelessWidget {
),
),
),
]
],
),
),
);
@@ -333,7 +333,7 @@ class _DemoBottomAppBar extends StatelessWidget {
const _DemoBottomAppBar({
this.color,
this.fabLocation,
this.shape
this.shape,
});
final Color color;

View File

@@ -96,7 +96,7 @@ class CustomInactiveIcon extends StatelessWidget {
height: iconTheme.size - 8.0,
decoration: BoxDecoration(
border: Border.all(color: iconTheme.color, width: 2.0),
)
),
);
}
}
@@ -150,7 +150,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
title: 'Event',
color: Colors.pink,
vsync: this,
)
),
];
_navigationViews[_currentIndex].controller.value = 1.0;
@@ -218,13 +218,13 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
const PopupMenuItem<BottomNavigationBarType>(
value: BottomNavigationBarType.shifting,
child: Text('Shifting'),
)
),
],
)
),
],
),
body: Center(
child: _buildTransitionsStack()
child: _buildTransitionsStack(),
),
bottomNavigationBar: botNavBar,
);

View File

@@ -323,7 +323,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
},
items: <String>[
'One', 'Two', 'Free', 'Four', 'Can', 'I', 'Have', 'A', 'Little',
'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'
'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten',
]
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
@@ -363,7 +363,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
semanticLabel: 'Thumbs not up',
),
onPressed: null,
)
),
]
.map<Widget>((Widget button) => SizedBox(width: 64.0, height: 64.0, child: button))
.toList(),

View File

@@ -66,7 +66,7 @@ const List<TravelDestination> destinations = <TravelDestination>[
city: 'Thanjavur',
location: 'Thanjavur, Tamil Nadu',
type: CardDemoType.selectable,
)
),
];
class TravelDestinationItem extends StatelessWidget {
@@ -215,7 +215,7 @@ class _SelectableTravelDestinationItemState extends State<SelectableTravelDestin
Icons.check_circle,
color: _isSelected ? colorScheme.primary : Colors.transparent,
),
)
),
),
],
),
@@ -232,7 +232,7 @@ class _SelectableTravelDestinationItemState extends State<SelectableTravelDestin
class SectionTitle extends StatelessWidget {
const SectionTitle({
Key key,
this.title
this.title,
}) : super(key: key);
final String title;
@@ -277,7 +277,7 @@ class TravelDestinationContent extends StatelessWidget {
image: AssetImage(destination.assetName, package: destination.assetPackage),
fit: BoxFit.cover,
child: Container(),
)
),
),
Positioned(
bottom: 16.0,
@@ -408,8 +408,8 @@ class _CardsDemoState extends State<CardsDemo> {
margin: const EdgeInsets.only(bottom: 8.0),
child: child,
);
}).toList()
)
}).toList(),
),
);
}
}

View File

@@ -117,7 +117,7 @@ class _ChipsTile extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: cardChildren,
)
),
);
}
}
@@ -313,7 +313,7 @@ class _ChipDemoState extends State<ChipDemo> {
});
},
icon: const Icon(Icons.vignette, semanticLabel: 'Update border shape'),
)
),
],
),
body: ChipTheme(

View File

@@ -121,7 +121,7 @@ class DessertDataSource extends DataTableSource {
DataCell(Text('${dessert.sodium}')),
DataCell(Text('${dessert.calcium}%')),
DataCell(Text('${dessert.iron}%')),
]
],
);
}
@@ -185,50 +185,50 @@ class _DataTableDemoState extends State<DataTableDemo> {
columns: <DataColumn>[
DataColumn(
label: const Text('Dessert (100g serving)'),
onSort: (int columnIndex, bool ascending) => _sort<String>((Dessert d) => d.name, columnIndex, ascending)
onSort: (int columnIndex, bool ascending) => _sort<String>((Dessert d) => d.name, columnIndex, ascending),
),
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)
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calories, columnIndex, ascending),
),
DataColumn(
label: const Text('Fat (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.fat, columnIndex, ascending)
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.fat, columnIndex, ascending),
),
DataColumn(
label: const Text('Carbs (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.carbs, columnIndex, ascending)
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.carbs, columnIndex, ascending),
),
DataColumn(
label: const Text('Protein (g)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.protein, columnIndex, ascending)
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.protein, columnIndex, ascending),
),
DataColumn(
label: const Text('Sodium (mg)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.sodium, columnIndex, ascending)
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.sodium, columnIndex, ascending),
),
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)
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.calcium, columnIndex, ascending),
),
DataColumn(
label: const Text('Iron (%)'),
numeric: true,
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.iron, columnIndex, ascending)
onSort: (int columnIndex, bool ascending) => _sort<num>((Dessert d) => d.iron, columnIndex, ascending),
),
],
source: _dessertsDataSource
)
]
)
source: _dessertsDataSource,
),
],
),
);
}
}

View File

@@ -39,7 +39,7 @@ class _InputDropdown extends StatelessWidget {
children: <Widget>[
Text(valueText, style: valueStyle),
Icon(Icons.arrow_drop_down,
color: Theme.of(context).brightness == Brightness.light ? Colors.grey.shade700 : Colors.white70
color: Theme.of(context).brightness == Brightness.light ? Colors.grey.shade700 : Colors.white70,
),
],
),
@@ -55,7 +55,7 @@ class _DateTimePicker extends StatelessWidget {
this.selectedDate,
this.selectedTime,
this.selectDate,
this.selectTime
this.selectTime,
}) : super(key: key);
final String labelText;
@@ -69,7 +69,7 @@ class _DateTimePicker extends StatelessWidget {
context: context,
initialDate: selectedDate,
firstDate: DateTime(2015, 8),
lastDate: DateTime(2101)
lastDate: DateTime(2101),
);
if (picked != null && picked != selectedDate)
selectDate(picked);
@@ -78,7 +78,7 @@ class _DateTimePicker extends StatelessWidget {
Future<void> _selectTime(BuildContext context) async {
final TimeOfDay picked = await showTimePicker(
context: context,
initialTime: selectedTime
initialTime: selectedTime,
);
if (picked != null && picked != selectedTime)
selectTime(picked);

View File

@@ -74,7 +74,7 @@ class DialogDemoState extends State<DialogDemo> {
.then<void>((T value) { // The value passed to Navigator.pop() or null.
if (value != null) {
_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text('You selected: $value')
content: Text('You selected: $value'),
));
}
});
@@ -102,21 +102,21 @@ class DialogDemoState extends State<DialogDemo> {
child: AlertDialog(
content: Text(
_alertWithoutTitleText,
style: dialogTextStyle
style: dialogTextStyle,
),
actions: <Widget>[
FlatButton(
child: const Text('CANCEL'),
onPressed: () { Navigator.pop(context, DialogDemoAction.cancel); }
onPressed: () { Navigator.pop(context, DialogDemoAction.cancel); },
),
FlatButton(
child: const Text('DISCARD'),
onPressed: () { Navigator.pop(context, DialogDemoAction.discard); }
)
]
)
onPressed: () { Navigator.pop(context, DialogDemoAction.discard); },
),
],
),
);
}
},
),
RaisedButton(
child: const Text('ALERT WITH TITLE'),
@@ -127,21 +127,21 @@ class DialogDemoState extends State<DialogDemo> {
title: const Text('Use Google\'s location service?'),
content: Text(
_alertWithTitleText,
style: dialogTextStyle
style: dialogTextStyle,
),
actions: <Widget>[
FlatButton(
child: const Text('DISAGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.disagree); }
onPressed: () { Navigator.pop(context, DialogDemoAction.disagree); },
),
FlatButton(
child: const Text('AGREE'),
onPressed: () { Navigator.pop(context, DialogDemoAction.agree); }
)
]
)
onPressed: () { Navigator.pop(context, DialogDemoAction.agree); },
),
],
),
);
}
},
),
RaisedButton(
child: const Text('SIMPLE'),
@@ -155,40 +155,40 @@ class DialogDemoState extends State<DialogDemo> {
icon: Icons.account_circle,
color: theme.primaryColor,
text: 'username@gmail.com',
onPressed: () { Navigator.pop(context, 'username@gmail.com'); }
onPressed: () { Navigator.pop(context, 'username@gmail.com'); },
),
DialogDemoItem(
icon: Icons.account_circle,
color: theme.primaryColor,
text: 'user02@gmail.com',
onPressed: () { Navigator.pop(context, 'user02@gmail.com'); }
onPressed: () { Navigator.pop(context, 'user02@gmail.com'); },
),
DialogDemoItem(
icon: Icons.add_circle,
text: 'add account',
color: theme.disabledColor
)
]
)
color: theme.disabledColor,
),
],
),
);
}
},
),
RaisedButton(
child: const Text('CONFIRMATION'),
onPressed: () {
showTimePicker(
context: context,
initialTime: _selectedTime
initialTime: _selectedTime,
)
.then<void>((TimeOfDay value) {
if (value != null && value != _selectedTime) {
_selectedTime = value;
_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text('You selected: ${value.format(context)}')
content: Text('You selected: ${value.format(context)}'),
));
}
});
}
},
),
RaisedButton(
child: const Text('FULLSCREEN'),
@@ -197,18 +197,18 @@ class DialogDemoState extends State<DialogDemo> {
builder: (BuildContext context) => FullScreenDialogDemo(),
fullscreenDialog: true,
));
}
},
),
]
// Add a little space between the buttons
.map<Widget>((Widget button) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: button
child: button,
);
})
.toList()
)
.toList(),
),
);
}
}

View File

@@ -73,7 +73,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
void _showNotImplementedMessage() {
Navigator.pop(context); // Dismiss the drawer.
_scaffoldKey.currentState.showSnackBar(const SnackBar(
content: Text("The drawer's items don't do anything")
content: Text("The drawer's items don't do anything"),
));
}

View File

@@ -54,7 +54,7 @@ class _ElevationDemoState extends State<ElevationDemo> {
onPressed: () {
setState(() => _showElevation = !_showElevation);
},
)
),
],
),
body: ListView(

View File

@@ -21,7 +21,7 @@ class DualHeaderWithHint extends StatelessWidget {
this.name,
this.value,
this.hint,
this.showHint
this.showHint,
});
final String name;
@@ -69,11 +69,11 @@ class DualHeaderWithHint extends StatelessWidget {
child: _crossFade(
Text(value, style: textTheme.caption.copyWith(fontSize: 15.0)),
Text(hint, style: textTheme.caption.copyWith(fontSize: 15.0)),
showHint
)
)
)
]
showHint,
),
),
),
],
);
}
}
@@ -83,7 +83,7 @@ class CollapsibleBody extends StatelessWidget {
this.margin = EdgeInsets.zero,
this.child,
this.onSave,
this.onCancel
this.onCancel,
});
final EdgeInsets margin;
@@ -102,14 +102,14 @@ class CollapsibleBody extends StatelessWidget {
margin: const EdgeInsets.only(
left: 24.0,
right: 24.0,
bottom: 24.0
bottom: 24.0,
) - margin,
child: Center(
child: DefaultTextStyle(
style: textTheme.caption.copyWith(fontSize: 15.0),
child: child
)
)
child: child,
),
),
),
const Divider(height: 1.0),
Container(
@@ -124,22 +124,22 @@ class CollapsibleBody extends StatelessWidget {
child: const Text('CANCEL', style: TextStyle(
color: Colors.black54,
fontSize: 15.0,
fontWeight: FontWeight.w500
))
)
fontWeight: FontWeight.w500,
)),
),
),
Container(
margin: const EdgeInsets.only(right: 8.0),
child: FlatButton(
onPressed: onSave,
textTheme: ButtonTextTheme.accent,
child: const Text('SAVE')
)
)
]
)
)
]
child: const Text('SAVE'),
),
),
],
),
),
],
);
}
}
@@ -150,7 +150,7 @@ class DemoItem<T> {
this.value,
this.hint,
this.builder,
this.valueToString
this.valueToString,
}) : textController = TextEditingController(text: valueToString(value));
final String name;
@@ -167,7 +167,7 @@ class DemoItem<T> {
name: name,
value: valueToString(value),
hint: hint,
showHint: isExpanded
showHint: isExpanded,
);
};
}
@@ -269,15 +269,15 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
groupValue: field.value,
onChanged: field.didChange,
),
]
],
);
}
},
),
);
}
)
),
);
}
},
),
DemoItem<double>(
name: 'Sun',
@@ -314,10 +314,10 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
),
);
}
)
),
);
}
)
},
),
];
}
@@ -346,9 +346,9 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
return ExpansionPanel(
isExpanded: item.isExpanded,
headerBuilder: item.headerBuilder,
body: item.build()
body: item.build(),
);
}).toList()
}).toList(),
),
),
),

View File

@@ -27,12 +27,12 @@ class ExpansionTileListDemo extends StatelessWidget {
ListTile(title: Text('Two')),
// https://en.wikipedia.org/wiki/Free_Four
ListTile(title: Text('Free')),
ListTile(title: Text('Four'))
]
ListTile(title: Text('Four')),
],
),
const ListTile(title: Text('Bottom'))
]
)
const ListTile(title: Text('Bottom')),
],
),
);
}
}

View File

@@ -47,7 +47,7 @@ class DateTimeItem extends StatelessWidget {
context: context,
initialDate: date,
firstDate: date.subtract(const Duration(days: 30)),
lastDate: date.add(const Duration(days: 30))
lastDate: date.add(const Duration(days: 30)),
)
.then<void>((DateTime value) {
if (value != null)
@@ -59,10 +59,10 @@ class DateTimeItem extends StatelessWidget {
children: <Widget>[
Text(DateFormat('EEE, MMM d yyyy').format(date)),
const Icon(Icons.arrow_drop_down, color: Colors.black54),
]
)
)
)
],
),
),
),
),
Container(
margin: const EdgeInsets.only(left: 8.0),
@@ -74,7 +74,7 @@ class DateTimeItem extends StatelessWidget {
onTap: () {
showTimePicker(
context: context,
initialTime: time
initialTime: time,
)
.then<void>((TimeOfDay value) {
if (value != null)
@@ -85,12 +85,12 @@ class DateTimeItem extends StatelessWidget {
children: <Widget>[
Text('${time.format(context)}'),
const Icon(Icons.arrow_drop_down, color: Colors.black54),
]
)
)
)
]
)
],
),
),
),
],
),
);
}
}
@@ -123,21 +123,21 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
return AlertDialog(
content: Text(
'Discard new event?',
style: dialogTextStyle
style: dialogTextStyle,
),
actions: <Widget>[
FlatButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop(false); // Pops the confirmation dialog but not the page.
}
},
),
FlatButton(
child: const Text('DISCARD'),
onPressed: () {
Navigator.of(context).pop(true); // Returning true to _onWillPop will pop again.
}
)
},
),
],
);
},
@@ -156,9 +156,9 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
child: Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)),
onPressed: () {
Navigator.pop(context, DismissDialogAction.save);
}
)
]
},
),
],
),
body: Form(
onWillPop: _onWillPop,
@@ -171,7 +171,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
child: TextField(
decoration: const InputDecoration(
labelText: 'Event name',
filled: true
filled: true,
),
style: theme.textTheme.headline,
onChanged: (String value) {
@@ -181,8 +181,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
_eventName = value;
}
});
}
)
},
),
),
Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
@@ -191,14 +191,14 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
decoration: const InputDecoration(
labelText: 'Location',
hintText: 'Where is the event?',
filled: true
filled: true,
),
onChanged: (String value) {
setState(() {
_hasLocation = value.isNotEmpty;
});
}
)
},
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -211,9 +211,9 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
_fromDateTime = value;
_saveNeeded = true;
});
}
)
]
},
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -226,10 +226,10 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
_toDateTime = value;
_saveNeeded = true;
});
}
},
),
const Text('All-day'),
]
],
),
Container(
decoration: BoxDecoration(
@@ -244,22 +244,22 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
_allDayValue = value;
_saveNeeded = true;
});
}
},
),
const Text('All-day'),
]
)
)
],
),
),
]
.map<Widget>((Widget child) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
height: 96.0,
child: child
child: child,
);
})
.toList()
)
.toList(),
),
),
);
}

View File

@@ -121,7 +121,7 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv
final double distance = (Offset.zero & context.size).shortestSide;
_flingAnimation = _controller.drive(Tween<Offset>(
begin: _offset,
end: _clampOffset(_offset + direction * distance)
end: _clampOffset(_offset + direction * distance),
));
_controller
..value = 0.0
@@ -155,7 +155,7 @@ class GridDemoPhotoItem extends StatelessWidget {
Key key,
@required this.photo,
@required this.tileStyle,
@required this.onBannerTap
@required this.onBannerTap,
}) : assert(photo != null && photo.isValid),
assert(tileStyle != null),
assert(onBannerTap != null),
@@ -170,7 +170,7 @@ class GridDemoPhotoItem extends StatelessWidget {
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(photo.title)
title: Text(photo.title),
),
body: SizedBox.expand(
child: Hero(
@@ -194,8 +194,8 @@ class GridDemoPhotoItem extends StatelessWidget {
photo.assetName,
package: photo.assetPackage,
fit: BoxFit.cover,
)
)
),
),
);
final IconData icon = photo.isFavorite ? Icons.star : Icons.star_border;
@@ -382,7 +382,7 @@ class GridListDemoState extends State<GridListDemo> {
setState(() {
photo.isFavorite = !photo.isFavorite;
});
}
},
);
}).toList(),
),

View File

@@ -83,7 +83,7 @@ class _IconsDemoCard extends StatelessWidget {
icon: Icon(icon),
iconSize: iconSize,
tooltip: "${enabled ? 'Enabled' : 'Disabled'} icon button",
onPressed: enabled ? handleIconButtonPress : null
onPressed: enabled ? handleIconButtonPress : null,
);
}

View File

@@ -51,7 +51,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
index: index,
name: 'Item $index Sender',
subject: 'Subject: $index',
body: "[$index] first line of the message's body..."
body: "[$index] first line of the message's body...",
);
});
}
@@ -96,8 +96,8 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
content: Text('You archived item ${item.index}'),
action: SnackBarAction(
label: 'UNDO',
onPressed: () { handleUndo(item); }
)
onPressed: () { handleUndo(item); },
),
));
}
@@ -109,8 +109,8 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
content: Text('You deleted item ${item.index}'),
action: SnackBarAction(
label: 'UNDO',
onPressed: () { handleUndo(item); }
)
onPressed: () { handleUndo(item); },
),
));
}
@@ -133,7 +133,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
onDelete: _handleDelete,
dismissDirection: _dismissDirection,
);
}).toList()
}).toList(),
);
}
@@ -148,27 +148,27 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
itemBuilder: (BuildContext context) => <PopupMenuEntry<LeaveBehindDemoAction>>[
const PopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.reset,
child: Text('Reset the list')
child: Text('Reset the list'),
),
const PopupMenuDivider(),
CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.horizontalSwipe,
checked: _dismissDirection == DismissDirection.horizontal,
child: const Text('Horizontal swipe')
child: const Text('Horizontal swipe'),
),
CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.leftSwipe,
checked: _dismissDirection == DismissDirection.endToStart,
child: const Text('Only swipe left')
child: const Text('Only swipe left'),
),
CheckedPopupMenuItem<LeaveBehindDemoAction>(
value: LeaveBehindDemoAction.rightSwipe,
checked: _dismissDirection == DismissDirection.startToEnd,
child: const Text('Only swipe right')
)
]
)
]
child: const Text('Only swipe right'),
),
],
),
],
),
body: body,
);
@@ -217,24 +217,24 @@ class _LeaveBehindListItem extends StatelessWidget {
background: Container(
color: theme.primaryColor,
child: const ListTile(
leading: Icon(Icons.delete, color: Colors.white, size: 36.0)
)
leading: Icon(Icons.delete, color: Colors.white, size: 36.0),
),
),
secondaryBackground: Container(
color: theme.primaryColor,
child: const ListTile(
trailing: Icon(Icons.archive, color: Colors.white, size: 36.0)
)
trailing: Icon(Icons.archive, color: Colors.white, size: 36.0),
),
),
child: Container(
decoration: BoxDecoration(
color: theme.canvasColor,
border: Border(bottom: BorderSide(color: theme.dividerColor))
border: Border(bottom: BorderSide(color: theme.dividerColor)),
),
child: ListTile(
title: Text(item.name),
subtitle: Text('${item.subject}\n${item.body}'),
isThreeLine: true
isThreeLine: true,
),
),
),

View File

@@ -68,7 +68,7 @@ class _ListDemoState extends State<ListDemo> {
value: _showAvatars ? _MaterialListType.oneLineWithAvatar : _MaterialListType.oneLine,
groupValue: _itemType,
onChanged: changeItemType,
)
),
),
),
MergeSemantics(
@@ -79,7 +79,7 @@ class _ListDemoState extends State<ListDemo> {
value: _MaterialListType.twoLine,
groupValue: _itemType,
onChanged: changeItemType,
)
),
),
),
MergeSemantics(

View File

@@ -38,7 +38,7 @@ class MenuDemoState extends State<MenuDemo> {
void showInSnackBar(String value) {
_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text(value)
content: Text(value),
));
}
@@ -72,15 +72,15 @@ class MenuDemoState extends State<MenuDemo> {
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
const PopupMenuItem<String>(
value: 'Toolbar menu',
child: Text('Toolbar menu')
child: Text('Toolbar menu'),
),
const PopupMenuItem<String>(
value: 'Right here',
child: Text('Right here')
child: Text('Right here'),
),
const PopupMenuItem<String>(
value: 'Hooray!',
child: Text('Hooray!')
child: Text('Hooray!'),
),
],
),
@@ -100,18 +100,18 @@ class MenuDemoState extends State<MenuDemo> {
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
PopupMenuItem<String>(
value: _simpleValue1,
child: const Text('Context menu item one')
child: const Text('Context menu item one'),
),
const PopupMenuItem<String>(
enabled: false,
child: Text('A disabled menu item')
child: Text('A disabled menu item'),
),
PopupMenuItem<String>(
value: _simpleValue3,
child: const Text('Context menu item three')
child: const Text('Context menu item three'),
),
]
)
],
),
),
// Pressing the PopupMenuButton on the right of this item shows
// a menu whose items have text labels and icons and a divider
@@ -126,33 +126,33 @@ class MenuDemoState extends State<MenuDemo> {
value: 'Preview',
child: ListTile(
leading: Icon(Icons.visibility),
title: Text('Preview')
)
title: Text('Preview'),
),
),
const PopupMenuItem<String>(
value: 'Share',
child: ListTile(
leading: Icon(Icons.person_add),
title: Text('Share')
)
title: Text('Share'),
),
),
const PopupMenuItem<String>(
value: 'Get Link',
child: ListTile(
leading: Icon(Icons.link),
title: Text('Get link')
)
title: Text('Get link'),
),
),
const PopupMenuDivider(),
const PopupMenuItem<String>(
value: 'Remove',
child: ListTile(
leading: Icon(Icons.delete),
title: Text('Remove')
)
)
]
)
title: Text('Remove'),
),
),
],
),
),
// This entire list item is a PopupMenuButton. Tapping anywhere shows
// a menu whose current value is highlighted and aligned over the
@@ -163,22 +163,22 @@ class MenuDemoState extends State<MenuDemo> {
onSelected: showMenuSelection,
child: ListTile(
title: const Text('An item with a simple menu'),
subtitle: Text(_simpleValue)
subtitle: Text(_simpleValue),
),
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
PopupMenuItem<String>(
value: _simpleValue1,
child: Text(_simpleValue1)
child: Text(_simpleValue1),
),
PopupMenuItem<String>(
value: _simpleValue2,
child: Text(_simpleValue2)
child: Text(_simpleValue2),
),
PopupMenuItem<String>(
value: _simpleValue3,
child: 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.
@@ -191,29 +191,29 @@ class MenuDemoState extends State<MenuDemo> {
CheckedPopupMenuItem<String>(
value: _checkedValue1,
checked: isChecked(_checkedValue1),
child: Text(_checkedValue1)
child: Text(_checkedValue1),
),
CheckedPopupMenuItem<String>(
value: _checkedValue2,
enabled: false,
checked: isChecked(_checkedValue2),
child: Text(_checkedValue2)
child: Text(_checkedValue2),
),
CheckedPopupMenuItem<String>(
value: _checkedValue3,
checked: isChecked(_checkedValue3),
child: Text(_checkedValue3)
child: Text(_checkedValue3),
),
CheckedPopupMenuItem<String>(
value: _checkedValue4,
checked: isChecked(_checkedValue4),
child: Text(_checkedValue4)
)
]
)
)
]
)
child: Text(_checkedValue4),
),
],
),
),
],
),
);
}
}

View File

@@ -28,15 +28,15 @@ class ModalBottomSheetDemo extends StatelessWidget {
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).accentColor,
fontSize: 24.0
)
)
)
fontSize: 24.0,
),
),
),
);
});
}
)
)
},
),
),
);
}
}

View File

@@ -23,7 +23,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
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'
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
];
Future<void> _handleRefresh() {
@@ -36,8 +36,8 @@ class OverscrollDemoState extends State<OverscrollDemo> {
label: 'RETRY',
onPressed: () {
_refreshIndicatorKey.currentState.show();
}
)
},
),
));
});
}
@@ -55,9 +55,9 @@ class OverscrollDemoState extends State<OverscrollDemo> {
tooltip: 'Refresh',
onPressed: () {
_refreshIndicatorKey.currentState.show();
}
},
),
]
],
),
body: RefreshIndicator(
key: _refreshIndicatorKey,

View File

@@ -34,18 +34,18 @@ class _PageSelector extends StatelessWidget {
icon: const Icon(Icons.chevron_left),
color: color,
onPressed: () { _handleArrowButtonPress(context, -1); },
tooltip: 'Page back'
tooltip: 'Page back',
),
TabPageSelector(controller: controller),
IconButton(
icon: const Icon(Icons.chevron_right),
color: color,
onPressed: () { _handleArrowButtonPress(context, 1); },
tooltip: 'Page forward'
)
tooltip: 'Page forward',
),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween
)
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
),
Expanded(
child: IconTheme(
@@ -63,7 +63,7 @@ class _PageSelector extends StatelessWidget {
),
),
);
}).toList()
}).toList(),
),
),
),

View File

@@ -40,10 +40,10 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
textAlign: TextAlign.center,
style: TextStyle(
color: themeData.accentColor,
fontSize: 24.0
)
)
)
fontSize: 24.0,
),
),
),
);
})
.closed.whenComplete(() {
@@ -66,8 +66,8 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
onPressed: () {
Navigator.pop(context);
},
child: const Text('OK')
)
child: const Text('OK'),
),
],
);
},
@@ -95,9 +95,9 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
body: Center(
child: RaisedButton(
onPressed: _showBottomSheetCallback,
child: const Text('SHOW BOTTOM SHEET')
)
)
child: const Text('SHOW BOTTOM SHEET'),
),
),
);
}
}

View File

@@ -29,7 +29,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
_animation = CurvedAnimation(
parent: _controller,
curve: const Interval(0.0, 0.9, curve: Curves.fastOutSlowIn),
reverseCurve: Curves.fastOutSlowIn
reverseCurve: Curves.fastOutSlowIn,
)..addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.dismissed)
_controller.forward();
@@ -68,7 +68,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
final List<Widget> indicators = <Widget>[
const SizedBox(
width: 200.0,
child: LinearProgressIndicator()
child: LinearProgressIndicator(),
),
const LinearProgressIndicator(),
const LinearProgressIndicator(),
@@ -80,13 +80,13 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
SizedBox(
width: 20.0,
height: 20.0,
child: CircularProgressIndicator(value: _animation.value)
child: CircularProgressIndicator(value: _animation.value),
),
SizedBox(
width: 100.0,
height: 20.0,
child: Text('${(_animation.value * 100.0).toStringAsFixed(1)}%',
textAlign: TextAlign.right
textAlign: TextAlign.right,
),
),
],
@@ -120,7 +120,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
child: AnimatedBuilder(
animation: _animation,
builder: _buildIndicators
builder: _buildIndicators,
),
),
),

View File

@@ -141,15 +141,15 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
itemBuilder: (BuildContext context) => <PopupMenuItem<TabsDemoStyle>>[
const PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsAndText,
child: Text('Icons and text')
child: Text('Icons and text'),
),
const PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsOnly,
child: Text('Icons only')
child: Text('Icons only'),
),
const PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.textOnly,
child: Text('Text only')
child: Text('Text only'),
),
],
),
@@ -193,7 +193,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
),
),
);
}).toList()
}).toList(),
),
);
}

View File

@@ -91,7 +91,7 @@ class _SearchDemoState extends State<SearchDemo> {
),
),
const SizedBox(height: 64.0),
Text('Last selected integer: ${_lastIntegerSelected ?? 'NONE' }.')
Text('Last selected integer: ${_lastIntegerSelected ?? 'NONE' }.'),
],
),
),
@@ -219,7 +219,7 @@ class _SearchDemoSearchDelegate extends SearchDelegate<int> {
query = '';
showSuggestions(context);
},
)
),
];
}
}

View File

@@ -58,12 +58,12 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
demoWidget: buildSwitch(),
exampleCodeTag: _switchCode,
documentationUrl: 'https://docs.flutter.io/flutter/material/Switch-class.html',
)
),
];
return TabbedComponentDemoScaffold(
title: 'Selection controls',
demos: demos
demos: demos,
);
}
@@ -122,10 +122,10 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Checkbox(value: true, onChanged: null),
Checkbox(value: false, onChanged: null),
Checkbox(value: null, tristate: true, onChanged: null),
]
)
]
)
],
),
],
),
);
}
@@ -141,19 +141,19 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Radio<int>(
value: 0,
groupValue: radioValue,
onChanged: handleRadioValueChanged
onChanged: handleRadioValueChanged,
),
Radio<int>(
value: 1,
groupValue: radioValue,
onChanged: handleRadioValueChanged
onChanged: handleRadioValueChanged,
),
Radio<int>(
value: 2,
groupValue: radioValue,
onChanged: handleRadioValueChanged
)
]
onChanged: handleRadioValueChanged,
),
],
),
// Disabled radio buttons
Row(
@@ -162,22 +162,22 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
Radio<int>(
value: 0,
groupValue: 0,
onChanged: null
onChanged: null,
),
Radio<int>(
value: 1,
groupValue: 0,
onChanged: null
onChanged: null,
),
Radio<int>(
value: 2,
groupValue: 0,
onChanged: null
)
]
)
]
)
onChanged: null,
),
],
),
],
),
);
}
@@ -193,7 +193,7 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
setState(() {
switchValue = value;
});
}
},
),
// Disabled switches
const Switch.adaptive(value: true, onChanged: null),

View File

@@ -50,12 +50,12 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
label: 'ACTION',
onPressed: () {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text('You pressed snackbar $thisSnackBarIndex\'s action.')
content: Text('You pressed snackbar $thisSnackBarIndex\'s action.'),
));
}
},
),
));
}
},
),
),
const Text(_text3),
@@ -63,10 +63,10 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
.map<Widget>((Widget child) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 12.0),
child: child
child: child,
);
})
.toList()
.toList(),
),
);
}
@@ -82,7 +82,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
// Create an inner BuildContext so that the snackBar onPressed methods
// can refer to the Scaffold with Scaffold.of().
builder: buildBody
)
),
);
}
}

View File

@@ -76,8 +76,8 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
),
child: Padding(
padding: const EdgeInsets.all(32.0),
child: Text(_explanatoryText, style: Theme.of(context).textTheme.subhead)
)
child: Text(_explanatoryText, style: Theme.of(context).textTheme.subhead),
),
);
});
}
@@ -93,12 +93,12 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
child: Text(page.label,
style: TextStyle(
color: page.labelColor,
fontSize: 32.0
fontSize: 32.0,
),
textAlign: TextAlign.center
)
)
)
textAlign: TextAlign.center,
),
),
),
);
}
);
@@ -115,7 +115,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
backgroundColor: page.fabColor,
icon: page.fabIcon,
label: Text(page.label.toUpperCase()),
onPressed: _showExplanatoryText
onPressed: _showExplanatoryText,
);
}
@@ -124,7 +124,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
tooltip: 'Show explanation',
backgroundColor: page.fabColor,
child: page.fabIcon,
onPressed: _showExplanatoryText
onPressed: _showExplanatoryText,
);
}
@@ -153,7 +153,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
floatingActionButton: buildFloatingActionButton(_selectedPage),
body: TabBarView(
controller: _controller,
children: _allPages.map<Widget>(buildTabView).toList()
children: _allPages.map<Widget>(buildTabView).toList(),
),
);
}

View File

@@ -91,7 +91,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
void showInSnackBar(String value) {
_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text(value)
content: Text(value),
));
}
@@ -251,7 +251,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
labelText: 'Salary',
prefixText: '\$',
suffixText: 'USD',
suffixStyle: TextStyle(color: Colors.green)
suffixStyle: TextStyle(color: Colors.green),
),
maxLines: 1,
),
@@ -288,7 +288,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
const SizedBox(height: 24.0),
Text(
'* indicates required field',
style: Theme.of(context).textTheme.caption
style: Theme.of(context).textTheme.caption,
),
const SizedBox(height: 24.0),
],
@@ -305,7 +305,7 @@ class _UsNumberTextInputFormatter extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue,
TextEditingValue newValue
TextEditingValue newValue,
) {
final int newTextLength = newValue.text.length;
int selectionIndex = newValue.selection.end;

View File

@@ -39,11 +39,11 @@ class TooltipDemo extends StatelessWidget {
child: Icon(
Icons.call,
size: 18.0,
color: theme.iconTheme.color
)
color: theme.iconTheme.color,
),
),
Text(' icon.', style: theme.textTheme.subhead)
]
Text(' icon.', style: theme.textTheme.subhead),
],
),
Center(
child: IconButton(
@@ -53,23 +53,23 @@ class TooltipDemo extends StatelessWidget {
tooltip: 'Place a phone call',
onPressed: () {
Scaffold.of(context).showSnackBar(const SnackBar(
content: Text('That was an ordinary tap.')
content: Text('That was an ordinary tap.'),
));
}
)
)
},
),
),
]
.map<Widget>((Widget widget) {
return Padding(
padding: const EdgeInsets.only(top: 16.0, left: 16.0, right: 16.0),
child: widget
child: widget,
);
})
.toList()
.toList(),
),
);
}
)
),
);
}
}

View File

@@ -129,7 +129,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
bottom: extraPadding,
),
child: Center(
child: PestoLogo(height: logoHeight, t: t.clamp(0.0, 1.0))
child: PestoLogo(height: logoHeight, t: t.clamp(0.0, 1.0)),
),
);
},
@@ -143,7 +143,7 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
top: 8.0,
left: 8.0 + mediaPadding.left,
right: 8.0 + mediaPadding.right,
bottom: 8.0
bottom: 8.0,
);
return SliverPadding(
padding: padding,
@@ -206,7 +206,7 @@ class _PestoLogoState extends State<PestoLogo> {
final TextStyle titleStyle = const PestoStyle(fontSize: kTextHeight, fontWeight: FontWeight.w900, color: Colors.white, letterSpacing: 3.0);
final RectTween _textRectTween = RectTween(
begin: Rect.fromLTWH(0.0, kLogoHeight, kLogoWidth, kTextHeight),
end: Rect.fromLTWH(0.0, kImageHeight, 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 = RectTween(
@@ -398,7 +398,7 @@ class _RecipePageState extends State<RecipePage> {
),
),
],
)
),
),
],
),
@@ -413,7 +413,7 @@ class _RecipePageState extends State<RecipePage> {
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 24.0),
child: Icon(icon, color: Colors.black54)
child: Icon(icon, color: Colors.black54),
),
Text(label, style: menuItemStyle),
],
@@ -453,7 +453,7 @@ class RecipeSheet extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 40.0),
child: Table(
columnWidths: const <int, TableColumnWidth>{
0: FixedColumnWidth(64.0)
0: FixedColumnWidth(64.0),
},
children: <TableRow>[
TableRow(
@@ -466,12 +466,12 @@ class RecipeSheet extends StatelessWidget {
width: 32.0,
height: 32.0,
alignment: Alignment.centerLeft,
fit: BoxFit.scaleDown
)
fit: BoxFit.scaleDown,
),
),
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Text(recipe.name, style: titleStyle)
child: Text(recipe.name, style: titleStyle),
),
]
),
@@ -480,7 +480,7 @@ class RecipeSheet extends StatelessWidget {
const SizedBox(),
Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 4.0),
child: Text(recipe.description, style: descriptionStyle)
child: Text(recipe.description, style: descriptionStyle),
),
]
),
@@ -489,7 +489,7 @@ class RecipeSheet extends StatelessWidget {
const SizedBox(),
Padding(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
child: Text('Ingredients', style: headingStyle)
child: Text('Ingredients', style: headingStyle),
),
]
),
@@ -503,7 +503,7 @@ class RecipeSheet extends StatelessWidget {
const SizedBox(),
Padding(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
child: Text('Steps', style: headingStyle)
child: Text('Steps', style: headingStyle),
),
]
)
@@ -544,7 +544,7 @@ class Recipe {
this.ingredientsImagePath,
this.ingredientsImagePackage,
this.ingredients,
this.steps
this.steps,
});
final String name;
@@ -689,7 +689,7 @@ const List<Recipe> kPestoRecipes = <Recipe>[
steps: <RecipeStep>[
RecipeStep(duration: '10 min', description: 'Prep vegetables'),
RecipeStep(duration: '5 min', description: 'Stir'),
RecipeStep(duration: '1 hr 10 min', description: 'Cook')
RecipeStep(duration: '1 hr 10 min', description: 'Cook'),
],
),
Recipe(
@@ -712,7 +712,7 @@ const List<Recipe> kPestoRecipes = <Recipe>[
RecipeStep(duration: '5 min', description: 'Sauté vegetables'),
RecipeStep(duration: '3 min', description: 'Stir vegetables and other filling ingredients'),
RecipeStep(duration: '10 min', description: 'Fill phyllo squares half-full with filling and fold.'),
RecipeStep(duration: '40 min', description: 'Bake')
RecipeStep(duration: '40 min', description: 'Bake'),
],
),
];

View File

@@ -103,7 +103,7 @@ class _BackdropTitle extends AnimatedWidget {
end: const Offset(1.0, 0.0),
).evaluate(animation),
child: const ImageIcon(AssetImage('packages/shrine_images/diamond.png')),
)
),
]),
),
),
@@ -138,7 +138,7 @@ class _BackdropTitle extends AnimatedWidget {
),
),
],
)
),
]),
);
}

View File

@@ -609,7 +609,7 @@ class _ListModel {
_ListModel({
@required this.listKey,
@required this.removedItemBuilder,
Iterable<int> initialItems
Iterable<int> initialItems,
}) : assert(listKey != null),
assert(removedItemBuilder != null),
_items = List<int>.from(initialItems ?? <int>[]);

View File

@@ -50,7 +50,7 @@ class HomePage extends StatelessWidget {
return Stack(
children: <Widget>[
backdrop,
Align(child: expandingBottomSheet, alignment: Alignment.bottomRight)
Align(child: expandingBottomSheet, alignment: Alignment.bottomRight),
],
);
}

View File

@@ -40,7 +40,7 @@ class _LoginPageState extends State<LoginPage> {
// home screen using onGenerateRoute and so rootNavigator must be
// set to true in order to get out of Shrine completely.
Navigator.of(context, rootNavigator: true).pop();
}
},
),
),
body: SafeArea(

View File

@@ -30,13 +30,13 @@ class TextStyleItem extends StatelessWidget {
children: <Widget>[
SizedBox(
width: 72.0,
child: Text(name, style: nameStyle)
child: Text(name, style: nameStyle),
),
Expanded(
child: Text(text, style: style.copyWith(height: 1.0))
)
]
)
child: Text(text, style: style.copyWith(height: 1.0)),
),
],
),
);
}
}
@@ -64,7 +64,7 @@ class TypographyDemo extends StatelessWidget {
styleItems.insert(0, TextStyleItem(
name: 'Display 4',
style: textTheme.display4,
text: 'Light 112sp'
text: 'Light 112sp',
));
}

View File

@@ -55,7 +55,7 @@ void showGalleryAboutDialog(BuildContext context) {
'${defaultTargetPlatform == TargetPlatform.iOS ? 'multiple platforms' : 'iOS and Android'} '
'from a single codebase. This design lab is a playground '
"and showcase of Flutter's many widgets, behaviors, "
'animations, layouts, and more. Learn more about Flutter at '
'animations, layouts, and more. Learn more about Flutter at ',
),
_LinkTextSpan(
style: linkStyle,

View File

@@ -282,7 +282,7 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
child: widget.backLayer,
visible: _controller.status != AnimationStatus.completed,
maintainState: true,
)
),
),
],
),

View File

@@ -91,7 +91,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
onPressed: () => _showExampleCode(context),
);
},
)
),
],
),
bottom: TabBar(
@@ -109,10 +109,10 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(demo.description,
style: Theme.of(context).textTheme.subhead
)
style: Theme.of(context).textTheme.subhead,
),
),
Expanded(child: demo.demoWidget)
Expanded(child: demo.demoWidget),
],
),
);
@@ -157,7 +157,7 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
Widget body;
if (_exampleCode == null) {
body = const Center(
child: CircularProgressIndicator()
child: CircularProgressIndicator(),
);
} else {
body = SingleChildScrollView(
@@ -167,11 +167,11 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
text: TextSpan(
style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0),
children: <TextSpan>[
DartSyntaxHighlighter(style).format(_exampleCode)
]
)
)
)
DartSyntaxHighlighter(style).format(_exampleCode),
],
),
),
),
);
}
@@ -182,11 +182,11 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
Icons.clear,
semanticLabel: 'Close',
),
onPressed: () { Navigator.pop(context); }
onPressed: () { Navigator.pop(context); },
),
title: const Text('Example code')
title: const Text('Example code'),
),
body: body
body: body,
);
}
}
@@ -207,7 +207,7 @@ class MaterialDemoDocumentationButton extends StatelessWidget {
return IconButton(
icon: const Icon(Icons.library_books),
tooltip: 'API documentation',
onPressed: () => launch(documentationUrl, forceWebView: true)
onPressed: () => launch(documentationUrl, forceWebView: true),
);
}
}
@@ -231,7 +231,7 @@ class CupertinoDemoDocumentationButton extends StatelessWidget {
label: 'API documentation',
child: const Icon(CupertinoIcons.book),
),
onPressed: () => launch(documentationUrl, forceWebView: true)
onPressed: () => launch(documentationUrl, forceWebView: true),
);
}
}

View File

@@ -19,7 +19,7 @@ RaisedButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
}
},
);
// Create a disabled button.
@@ -27,7 +27,7 @@ RaisedButton(
// specified or is null.
const RaisedButton(
child: Text('BUTTON TITLE'),
onPressed: null
onPressed: null,
);
// Create a button with an icon and a
@@ -47,7 +47,7 @@ OutlineButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
}
},
);
// Create a disabled button.
@@ -55,7 +55,7 @@ OutlineButton(
// specified or is null.
const OutlineButton(
child: Text('BUTTON TITLE'),
onPressed: null
onPressed: null,
);
// Create a button with an icon and a
@@ -75,7 +75,7 @@ FlatButton(
child: const Text('BUTTON TITLE'),
onPressed: () {
// Perform some action
}
},
);
// Create a disabled button.
@@ -83,7 +83,7 @@ FlatButton(
// specified or is null.
const FlatButton(
child: Text('BUTTON TITLE'),
onPressed: null
onPressed: null,
);
// END
@@ -109,7 +109,7 @@ DropdownButton<String>(
value: value,
child: Text(value));
})
.toList()
.toList(),
);
// END
@@ -124,7 +124,7 @@ IconButton(
onPressed: () {
setState(() => value = !value);
},
color: value ? Theme.of(context).primaryColor : null
color: value ? Theme.of(context).primaryColor : null,
);
// END
@@ -133,12 +133,12 @@ IconButton(
// Floating action button in Scaffold.
Scaffold(
appBar: AppBar(
title: const Text('Demo')
title: const Text('Demo'),
),
floatingActionButton: const FloatingActionButton(
child: Icon(Icons.add),
onPressed: null
)
onPressed: null,
),
);
// END
}
@@ -199,26 +199,26 @@ Row(
Radio<int>(
value: 0,
groupValue: radioValue,
onChanged: handleRadioValueChanged
onChanged: handleRadioValueChanged,
),
Radio<int>(
value: 1,
groupValue: radioValue,
onChanged: handleRadioValueChanged
onChanged: handleRadioValueChanged,
),
Radio<int>(
value: 2,
groupValue: radioValue,
onChanged: handleRadioValueChanged
)
]
onChanged: handleRadioValueChanged,
),
],
);
// Creates a disabled radio button.
const Radio<int>(
value: 0,
groupValue: 0,
onChanged: null
onChanged: null,
);
// END
@@ -262,13 +262,13 @@ GridView.count(
'https://example.com/image-1.jpg',
'https://example.com/image-2.jpg',
'...',
'https://example.com/image-n.jpg'
'https://example.com/image-n.jpg',
].map<Widget>((String url) {
return GridTile(
footer: GridTileBar(
title: Text(url)
title: Text(url),
),
child: Image.network(url, fit: BoxFit.cover)
child: Image.network(url, fit: BoxFit.cover),
);
}).toList(),
);

View File

@@ -400,14 +400,14 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
child: const Banner(
message: 'PREVIEW',
location: BannerLocation.topEnd,
)
),
),
]
],
);
}
home = AnnotatedRegion<SystemUiOverlayStyle>(
child: home,
value: SystemUiOverlayStyle.light
value: SystemUiOverlayStyle.light,
);
return home;

View File

@@ -408,7 +408,7 @@ class GalleryOptionsPage extends StatelessWidget {
options.showOffscreenLayersCheckerboard,
(bool value) {
onOptionsChanged(options.copyWith(showOffscreenLayersCheckerboard: value));
}
},
),
);
}

View File

@@ -14,7 +14,7 @@ class SyntaxHighlighterStyle {
this.stringStyle,
this.punctuationStyle,
this.classStyle,
this.constantStyle
this.constantStyle,
});
static SyntaxHighlighterStyle lightThemeStyle() {
@@ -26,7 +26,7 @@ class SyntaxHighlighterStyle {
stringStyle: const TextStyle(color: Color(0xFF43A047)),
punctuationStyle: const TextStyle(color: Color(0xFF000000)),
classStyle: const TextStyle(color: Color(0xFF512DA8)),
constantStyle: const TextStyle(color: Color(0xFF795548))
constantStyle: const TextStyle(color: Color(0xFF795548)),
);
}
@@ -39,7 +39,7 @@ class SyntaxHighlighterStyle {
stringStyle: const TextStyle(color: Color(0xFF009688)),
punctuationStyle: const TextStyle(color: Color(0xFFFFFFFF)),
classStyle: const TextStyle(color: Color(0xFF009688)),
constantStyle: const TextStyle(color: Color(0xFF795548))
constantStyle: const TextStyle(color: Color(0xFF795548)),
);
}
@@ -72,11 +72,11 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
'finally', 'for', 'get', 'if', 'implements', 'import', 'in', 'is', 'library',
'new', 'null', 'operator', 'part', 'rethrow', 'return', 'set', 'static',
'super', 'switch', 'sync', 'this', 'throw', 'true', 'try', 'typedef', 'var',
'void', 'while', 'with', 'yield'
'void', 'while', 'with', 'yield',
];
static const List<String> _builtInTypes = <String>[
'int', 'double', 'num', 'bool'
'int', 'double', 'num', 'bool',
];
String _src;
@@ -125,7 +125,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.comment,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -146,7 +146,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.comment,
startComment,
endComment
endComment,
));
if (eof)
@@ -160,7 +160,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -170,7 +170,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -180,7 +180,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -190,7 +190,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -200,7 +200,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -210,7 +210,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.string,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -220,7 +220,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.number,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -240,7 +240,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.punctuation,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -250,7 +250,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
_HighlightType.keyword,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
continue;
}
@@ -276,7 +276,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans.add(_HighlightSpan(
type,
_scanner.lastMatch.start,
_scanner.lastMatch.end
_scanner.lastMatch.end,
));
}
}
@@ -299,7 +299,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
_spans[i] = _HighlightSpan(
_spans[i].type,
_spans[i].start,
_spans[i + 1].end
_spans[i + 1].end,
);
_spans.removeAt(i + 1);
}

View File

@@ -19,8 +19,8 @@ void main() {
child: SizedBox(
width: 450.0,
height: 800.0,
child: GalleryApp(testMode: true)
)
child: GalleryApp(testMode: true),
),
)
);
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865

View File

@@ -20,7 +20,7 @@ void main() {
await tester.pumpWidget(
const GalleryApp(
testMode: true,
updateUrlFetcher: mockUpdateUrlFetcher
updateUrlFetcher: mockUpdateUrlFetcher,
)
);
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865

View File

@@ -65,7 +65,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Center(
child: Text(
'Platform button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
style: const TextStyle(fontSize: 17.0))
style: const TextStyle(fontSize: 17.0)),
),
),
Container(

View File

@@ -24,7 +24,7 @@ void beginFrame(Duration timeStamp) {
canvas.scale(devicePixelRatio, devicePixelRatio);
canvas.drawParagraph(paragraph, ui.Offset(
(logicalSize.width - paragraph.maxIntrinsicWidth) / 2.0,
(logicalSize.height - paragraph.height) / 2.0
(logicalSize.height - paragraph.height) / 2.0,
));
final ui.Picture picture = recorder.endRecording();

View File

@@ -28,7 +28,7 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas.drawCircle(
size.center(ui.Offset.zero),
size.shortestSide * 0.45,
ui.Paint()..color = color
ui.Paint()..color = color,
);
// When we're done issuing painting commands, we end the recording an receive

View File

@@ -24,6 +24,6 @@ void main() {
// particular text direction.
textDirection: TextDirection.ltr,
),
)
),
);
}

View File

@@ -26,7 +26,7 @@ void main() {
// to have a specific size.
final RenderBox square = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 200.0, height: 200.0),
child: green
child: green,
);
// Third, we wrap the sized green square in a render object that applies rotation
// transform before painting its child. Each frame of the animation, we'll
@@ -35,12 +35,12 @@ void main() {
final RenderTransform spin = RenderTransform(
transform: Matrix4.identity(),
alignment: Alignment.center,
child: square
child: square,
);
// Finally, we center the spinning green square...
final RenderBox root = RenderPositionedBox(
alignment: Alignment.center,
child: spin
child: spin,
);
// and attach it to the window.
RenderingFlutterBinding(root: root);

View File

@@ -14,7 +14,7 @@ class SectorConstraints extends Constraints {
this.minDeltaRadius = 0.0,
this.maxDeltaRadius = double.infinity,
this.minDeltaTheta = 0.0,
this.maxDeltaTheta = kTwoPi
this.maxDeltaTheta = kTwoPi,
}) : assert(maxDeltaRadius >= minDeltaRadius),
assert(maxDeltaTheta >= minDeltaTheta);
@@ -46,7 +46,7 @@ class SectorConstraints extends Constraints {
@override
bool debugAssertIsValid({
bool isAppliedConstraint = false,
InformationCollector informationCollector
InformationCollector informationCollector,
}) {
assert(isNormalized);
return isNormalized;
@@ -58,11 +58,11 @@ class SectorDimensions {
factory SectorDimensions.withConstraints(
SectorConstraints constraints,
{ double deltaRadius = 0.0, double deltaTheta = 0.0 }
{ double deltaRadius = 0.0, double deltaTheta = 0.0, }
) {
return SectorDimensions(
deltaRadius: constraints.constrainDeltaRadius(deltaRadius),
deltaTheta: constraints.constrainDeltaTheta(deltaTheta)
deltaTheta: constraints.constrainDeltaTheta(deltaTheta),
);
}
@@ -216,7 +216,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
RenderSectorRing({
BoxDecoration decoration,
double deltaRadius = double.infinity,
double padding = 0.0
double padding = 0.0,
}) : _padding = padding,
assert(deltaRadius >= 0.0),
_desiredDeltaRadius = deltaRadius,
@@ -263,7 +263,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
while (child != null) {
final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: innerDeltaRadius,
maxDeltaTheta: remainingDeltaTheta
maxDeltaTheta: remainingDeltaTheta,
);
final SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
innerTheta += childDimensions.deltaTheta;
@@ -294,7 +294,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
while (child != null) {
final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: innerDeltaRadius,
maxDeltaTheta: remainingDeltaTheta
maxDeltaTheta: remainingDeltaTheta,
);
assert(child.parentData is SectorParentData);
child.parentData.theta = innerTheta;
@@ -334,7 +334,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
RenderSectorSlice({
BoxDecoration decoration,
double deltaTheta = kTwoPi,
double padding = 0.0
double padding = 0.0,
}) : _padding = padding, _desiredDeltaTheta = deltaTheta, super(decoration);
double _desiredDeltaTheta;
@@ -377,7 +377,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
while (child != null) {
final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: remainingDeltaRadius,
maxDeltaTheta: innerDeltaTheta
maxDeltaTheta: innerDeltaTheta,
);
final SectorDimensions childDimensions = child.getIntrinsicDimensions(innerConstraints, childRadius);
childRadius += childDimensions.deltaRadius;
@@ -406,7 +406,7 @@ class RenderSectorSlice extends RenderSectorWithChildren {
while (child != null) {
final SectorConstraints innerConstraints = SectorConstraints(
maxDeltaRadius: remainingDeltaRadius,
maxDeltaTheta: innerDeltaTheta
maxDeltaTheta: innerDeltaTheta,
);
child.parentData.theta = innerTheta;
child.parentData.radius = childRadius;
@@ -488,7 +488,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
Size getIntrinsicDimensions({
double width = double.infinity,
double height = double.infinity
double height = double.infinity,
}) {
assert(child is RenderSector);
assert(child.parentData is SectorParentData);
@@ -556,7 +556,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
class RenderSolidColor extends RenderDecoratedSector {
RenderSolidColor(this.backgroundColor, {
this.desiredDeltaRadius = double.infinity,
this.desiredDeltaTheta = kTwoPi
this.desiredDeltaTheta = kTwoPi,
}) : super(BoxDecoration(color: backgroundColor));
double desiredDeltaRadius;

View File

@@ -183,7 +183,7 @@ class CalculationManager {
sender.send(<double>[ completed, total ]);
},
onResultListener: sender.send,
data: message.data
data: message.data,
);
calculator.run();
}
@@ -221,7 +221,7 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
)..repeat();
_calculationManager = CalculationManager(
onProgressListener: _handleProgressUpdate,
onResultListener: _handleResult
onResultListener: _handleResult,
);
}
@@ -243,24 +243,24 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
width: 120.0,
height: 120.0,
color: const Color(0xFF882222),
)
),
),
Opacity(
opacity: _calculationManager.isRunning ? 1.0 : 0.0,
child: CircularProgressIndicator(
value: _progress
)
),
),
Text(_status),
Center(
child: RaisedButton(
child: Text(_label),
onPressed: _handleButtonPressed
)
onPressed: _handleButtonPressed,
),
),
Text(_result)
]
)
Text(_result),
],
),
);
}

View File

@@ -13,7 +13,7 @@ class _GesturePainter extends CustomPainter {
this.scaleEnabled,
this.tapEnabled,
this.doubleTapEnabled,
this.longPressEnabled
this.longPressEnabled,
});
final double zoom;
@@ -159,9 +159,9 @@ class GestureDemoState extends State<GestureDemo> {
scaleEnabled: _scaleEnabled,
tapEnabled: _tapEnabled,
doubleTapEnabled: _doubleTapEnabled,
longPressEnabled: _longPressEnabled
)
)
longPressEnabled: _longPressEnabled,
),
),
),
Positioned(
bottom: 0.0,
@@ -175,45 +175,45 @@ class GestureDemoState extends State<GestureDemo> {
children: <Widget>[
Checkbox(
value: _scaleEnabled,
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); }
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); },
),
const Text('Scale'),
]
],
),
Row(
children: <Widget>[
Checkbox(
value: _tapEnabled,
onChanged: (bool value) { setState(() { _tapEnabled = value; }); }
onChanged: (bool value) { setState(() { _tapEnabled = value; }); },
),
const Text('Tap'),
]
],
),
Row(
children: <Widget>[
Checkbox(
value: _doubleTapEnabled,
onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); }
onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); },
),
const Text('Double Tap'),
]
],
),
Row(
children: <Widget>[
Checkbox(
value: _longPressEnabled,
onChanged: (bool value) { setState(() { _longPressEnabled = value; }); }
onChanged: (bool value) { setState(() { _longPressEnabled = value; }); },
),
const Text('Long Press'),
]
],
),
],
crossAxisAlignment: CrossAxisAlignment.start
)
)
)
crossAxisAlignment: CrossAxisAlignment.start,
),
),
),
),
]
],
);
}
}
@@ -223,7 +223,7 @@ void main() {
theme: ThemeData.dark(),
home: Scaffold(
appBar: AppBar(title: const Text('Gestures Demo')),
body: GestureDemo()
)
body: GestureDemo(),
),
));
}

View File

@@ -19,8 +19,8 @@ class AdaptedListItem extends StatelessWidget {
margin: const EdgeInsets.all(8.0),
color: Colors.lightBlueAccent.shade100,
),
Text(name)
]
Text(name),
],
);
}
}
@@ -38,24 +38,24 @@ class AdaptedGridItem extends StatelessWidget {
Expanded(
child: Container(
color: Colors.lightBlueAccent.shade100,
)
),
),
Container(
margin: const EdgeInsets.only(left: 8.0),
child: Row(
children: <Widget>[
Expanded(
child: Text(name)
child: Text(name),
),
const IconButton(
icon: Icon(Icons.more_vert),
onPressed: null
)
]
)
)
]
)
onPressed: null,
),
],
),
),
],
),
);
}
}
@@ -99,9 +99,9 @@ void main() {
title: 'Media Query Example',
home: Scaffold(
appBar: AppBar(
title: const Text('Media Query Example')
title: const Text('Media Query Example'),
),
body: Material(child: AdaptiveContainer(names: _kNames))
)
body: Material(child: AdaptiveContainer(names: _kNames)),
),
));
}

View File

@@ -12,7 +12,7 @@ import '../rendering/src/sector_layout.dart';
RenderBox initCircle() {
return RenderBoxToRenderSectorAdapter(
innerRadius: 25.0,
child: RenderSectorRing(padding: 0.0)
child: RenderSectorRing(padding: 0.0),
);
}
@@ -74,7 +74,7 @@ class SectorAppState extends State<SectorApp> {
ring.add(RenderSolidColor(color, desiredDeltaTheta: kTwoPi * 0.2));
return RenderBoxToRenderSectorAdapter(
innerRadius: 5.0,
child: ring
child: ring,
);
}
RenderBoxToRenderSectorAdapter sectorAddIcon = initSector(const Color(0xFF00DD00));
@@ -104,12 +104,12 @@ class SectorAppState extends State<SectorApp> {
Container(
padding: const EdgeInsets.all(4.0),
margin: const EdgeInsets.only(right: 10.0),
child: WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
child: WidgetToRenderBoxAdapter(renderBox: sectorAddIcon),
),
const Text('ADD SECTOR'),
]
)
)
],
),
),
),
RaisedButton(
onPressed: _enabledRemove ? removeSector : null,
@@ -119,16 +119,16 @@ class SectorAppState extends State<SectorApp> {
Container(
padding: const EdgeInsets.all(4.0),
margin: const EdgeInsets.only(right: 10.0),
child: WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
child: WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon),
),
const Text('REMOVE SECTOR'),
]
)
)
],
),
),
),
],
mainAxisAlignment: MainAxisAlignment.spaceAround
)
mainAxisAlignment: MainAxisAlignment.spaceAround,
),
),
Expanded(
child: Container(
@@ -139,12 +139,12 @@ class SectorAppState extends State<SectorApp> {
padding: const EdgeInsets.all(8.0),
child: WidgetToRenderBoxAdapter(
renderBox: sectors,
onBuild: doUpdates
)
)
onBuild: doUpdates,
),
),
),
],
mainAxisAlignment: MainAxisAlignment.spaceBetween
mainAxisAlignment: MainAxisAlignment.spaceBetween,
);
}
@@ -155,10 +155,10 @@ class SectorAppState extends State<SectorApp> {
title: 'Sector Layout',
home: Scaffold(
appBar: AppBar(
title: const Text('Sector Layout in a Widget Tree')
title: const Text('Sector Layout in a Widget Tree'),
),
body: buildBody()
)
body: buildBody(),
),
);
}
}

View File

@@ -26,7 +26,7 @@ class Rectangle extends StatelessWidget {
return Expanded(
child: Container(
color: color,
)
),
);
}
}

View File

@@ -38,7 +38,7 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
width: 200.0,
height: 200.0,
color: const Color(0xFF00FF00),
)
),
);
}
}

View File

@@ -29,7 +29,7 @@ const TextStyle _kBold = TextStyle(fontWeight: FontWeight.bold);
const TextStyle _kUnderline = TextStyle(
decoration: TextDecoration.underline,
decorationColor: Color(0xFF000000),
decorationStyle: TextDecorationStyle.wavy
decorationStyle: TextDecorationStyle.wavy,
);
Widget toStyledText(String name, String text) {
@@ -44,14 +44,14 @@ Widget toStyledText(String name, String text) {
children: <TextSpan>[
TextSpan(
style: _kUnderline,
text: name
text: name,
),
const TextSpan(text: ':')
]
const TextSpan(text: ':'),
],
),
TextSpan(text: text)
]
)
TextSpan(text: text),
],
),
);
}
@@ -67,7 +67,7 @@ class SpeakerSeparator extends StatelessWidget {
border: Border(
bottom: BorderSide(color: Color.fromARGB(24, 0, 0, 0))
)
)
),
);
}
}
@@ -112,9 +112,9 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
child: Column(
children: children,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start
)
)
crossAxisAlignment: CrossAxisAlignment.start,
),
),
);
}
}
@@ -124,12 +124,12 @@ void main() {
theme: ThemeData.light(),
home: Scaffold(
appBar: AppBar(
title: const Text('Hal and Dave')
title: const Text('Hal and Dave'),
),
body: Material(
color: Colors.grey.shade50,
child: StyledTextDemo()
)
)
child: StyledTextDemo(),
),
),
));
}

View File

@@ -21,6 +21,6 @@ class MessageLookup extends MessageLookupByLibrary {
static _notInlinedMessages(_) => <String, Function> {
"market" : MessageLookupByLibrary.simpleMessage("MARKET"),
"portfolio" : MessageLookupByLibrary.simpleMessage("PORTFOLIO"),
"title" : MessageLookupByLibrary.simpleMessage("Stocks")
"title" : MessageLookupByLibrary.simpleMessage("Stocks"),
};
}

View File

@@ -21,6 +21,6 @@ class MessageLookup extends MessageLookupByLibrary {
static _notInlinedMessages(_) => <String, Function> {
"market" : MessageLookupByLibrary.simpleMessage("MERCADO"),
"portfolio" : MessageLookupByLibrary.simpleMessage("CARTERA"),
"title" : MessageLookupByLibrary.simpleMessage("Acciones")
"title" : MessageLookupByLibrary.simpleMessage("Acciones"),
};
}

View File

@@ -51,7 +51,7 @@ class StocksAppState extends State<StocksApp> {
debugShowPointers: false,
debugShowRainbow: false,
showPerformanceOverlay: false,
showSemanticsDebugger: false
showSemanticsDebugger: false,
);
@override
@@ -71,12 +71,12 @@ class StocksAppState extends State<StocksApp> {
case StockMode.optimistic:
return ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.purple
primarySwatch: Colors.purple,
);
case StockMode.pessimistic:
return ThemeData(
brightness: Brightness.dark,
accentColor: Colors.redAccent
accentColor: Colors.redAccent,
);
}
assert(_configuration.stockMode != null);
@@ -122,7 +122,7 @@ class StocksAppState extends State<StocksApp> {
showSemanticsDebugger: _configuration.showSemanticsDebugger,
routes: <String, WidgetBuilder>{
'/': (BuildContext context) => StockHome(stocks, _configuration, configurationUpdater),
'/settings': (BuildContext context) => StockSettings(_configuration, configurationUpdater)
'/settings': (BuildContext context) => StockSettings(_configuration, configurationUpdater),
},
onGenerateRoute: _getRoute,
);

View File

@@ -79,9 +79,9 @@ class StockArrow extends StatelessWidget {
painter: StockArrowPainter(
// TODO(jackson): This should change colors with the theme
color: _colorForPercentChange(percentChange),
percentChange: percentChange
)
)
percentChange: percentChange,
),
),
);
}
}

View File

@@ -26,7 +26,7 @@ class StockList extends StatelessWidget {
stock: stocks[index],
onPressed: onOpen,
onDoubleTap: onShow,
onLongPressed: onAction
onLongPressed: onAction,
);
},
);

View File

@@ -14,7 +14,7 @@ class StockRow extends StatelessWidget {
this.stock,
this.onPressed,
this.onDoubleTap,
this.onLongPressed
this.onLongPressed,
}) : super(key: ObjectKey(stock));
final Stock stock;
@@ -51,8 +51,8 @@ class StockRow extends StatelessWidget {
margin: const EdgeInsets.only(right: 5.0),
child: Hero(
tag: stock,
child: StockArrow(percentChange: stock.percentChange)
)
child: StockArrow(percentChange: stock.percentChange),
),
),
Expanded(
child: Row(
@@ -61,28 +61,28 @@ class StockRow extends StatelessWidget {
flex: 2,
child: Text(
stock.symbol
)
),
),
Expanded(
child: Text(
lastSale,
textAlign: TextAlign.right
)
textAlign: TextAlign.right,
),
),
Expanded(
child: Text(
changeInPrice,
textAlign: TextAlign.right
)
textAlign: TextAlign.right,
),
),
],
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: DefaultTextStyle.of(context).style.textBaseline
)
textBaseline: DefaultTextStyle.of(context).style.textBaseline,
),
),
]
)
)
],
),
),
);
}
}

View File

@@ -76,13 +76,13 @@ class StockSettingsState extends State<StockSettings> {
child: const Text('NO THANKS'),
onPressed: () {
Navigator.pop(context, false);
}
},
),
FlatButton(
child: const Text('AGREE'),
onPressed: () {
Navigator.pop(context, true);
}
},
),
],
);
@@ -99,7 +99,7 @@ class StockSettingsState extends State<StockSettings> {
Widget buildAppBar(BuildContext context) {
return AppBar(
title: const Text('Settings')
title: const Text('Settings'),
);
}
@@ -212,7 +212,7 @@ class StockSettingsState extends State<StockSettings> {
Widget build(BuildContext context) {
return Scaffold(
appBar: buildAppBar(context),
body: buildSettingsPane(context)
body: buildSettingsPane(context),
);
}
}

View File

@@ -30,11 +30,11 @@ class _StockSymbolView extends StatelessWidget {
children: <Widget>[
Text(
'${stock.symbol}',
style: Theme.of(context).textTheme.display2
style: Theme.of(context).textTheme.display2,
),
arrow,
],
mainAxisAlignment: MainAxisAlignment.spaceBetween
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
Text('Last Sale', style: headings),
Text('$lastSale ($changeInPrice)'),
@@ -53,12 +53,12 @@ class _StockSymbolView extends StatelessWidget {
children: const <TextSpan>[
TextSpan(text: 'several', style: TextStyle(fontStyle: FontStyle.italic)),
TextSpan(text: ' years.'),
]
)
],
),
),
],
mainAxisSize: MainAxisSize.min
)
mainAxisSize: MainAxisSize.min,
),
);
}
}
@@ -77,7 +77,7 @@ class StockSymbolPage extends StatelessWidget {
final Stock stock = stocks[symbol];
return Scaffold(
appBar: AppBar(
title: Text(stock?.name ?? symbol)
title: Text(stock?.name ?? symbol),
),
body: SingleChildScrollView(
child: Container(
@@ -102,9 +102,9 @@ class StockSymbolPage extends StatelessWidget {
),
crossFadeState: stock == null && stocks.loading ? CrossFadeState.showFirst : CrossFadeState.showSecond,
),
)
)
)
),
),
),
);
},
);
@@ -125,8 +125,8 @@ class StockSymbolBottomSheet extends StatelessWidget {
),
child: _StockSymbolView(
stock: stock,
arrow: StockArrow(percentChange: stock.percentChange)
)
arrow: StockArrow(percentChange: stock.percentChange),
),
);
}
}

View File

@@ -18,7 +18,7 @@ class StockConfiguration {
@required this.debugShowPointers,
@required this.debugShowRainbow,
@required this.showPerformanceOverlay,
@required this.showSemanticsDebugger
@required this.showSemanticsDebugger,
}) : assert(stockMode != null),
assert(backupMode != null),
assert(debugShowGrid != null),
@@ -51,7 +51,7 @@ class StockConfiguration {
bool debugShowPointers,
bool debugShowRainbow,
bool showPerformanceOverlay,
bool showSemanticsDebugger
bool showSemanticsDebugger,
}) {
return StockConfiguration(
stockMode: stockMode ?? this.stockMode,
@@ -63,7 +63,7 @@ class StockConfiguration {
debugShowPointers: debugShowPointers ?? this.debugShowPointers,
debugShowRainbow: debugShowRainbow ?? this.debugShowRainbow,
showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay,
showSemanticsDebugger: showSemanticsDebugger ?? this.showSemanticsDebugger
showSemanticsDebugger: showSemanticsDebugger ?? this.showSemanticsDebugger,
);
}
}