add missing type parameter on methods (#22096)
This commit is contained in:
committed by
GitHub
parent
48fb726b01
commit
f62afdcf57
@@ -493,7 +493,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
|
||||
}
|
||||
|
||||
Iterable<Widget> _detailItemsFor(Section section) {
|
||||
final Iterable<Widget> detailItems = section.details.map((SectionDetail detail) {
|
||||
final Iterable<Widget> detailItems = section.details.map<Widget>((SectionDetail detail) {
|
||||
return SectionDetailView(detail: detail);
|
||||
});
|
||||
return ListTile.divideTiles(context: context, tiles: detailItems);
|
||||
@@ -591,7 +591,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
|
||||
},
|
||||
child: PageView(
|
||||
controller: _detailsPageController,
|
||||
children: allSections.map((Section section) {
|
||||
children: allSections.map<Widget>((Section section) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: _detailItemsFor(section).toList(),
|
||||
|
||||
@@ -99,7 +99,7 @@ class PaletteTabView extends StatelessWidget {
|
||||
final TextTheme textTheme = Theme.of(context).textTheme;
|
||||
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) {
|
||||
final List<Widget> colorItems = primaryKeys.map<Widget>((int index) {
|
||||
return DefaultTextStyle(
|
||||
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
|
||||
child: ColorItem(index: index, color: colors.primary[index]),
|
||||
@@ -107,7 +107,7 @@ class PaletteTabView extends StatelessWidget {
|
||||
}).toList();
|
||||
|
||||
if (colors.accent != null) {
|
||||
colorItems.addAll(accentKeys.map((int index) {
|
||||
colorItems.addAll(accentKeys.map<Widget>((int index) {
|
||||
return DefaultTextStyle(
|
||||
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
|
||||
child: ColorItem(index: index, color: colors.accent[index], prefix: 'A'),
|
||||
@@ -135,11 +135,11 @@ class ColorsDemo extends StatelessWidget {
|
||||
title: const Text('Colors'),
|
||||
bottom: TabBar(
|
||||
isScrollable: true,
|
||||
tabs: allPalettes.map((Palette swatch) => Tab(text: swatch.name)).toList(),
|
||||
tabs: allPalettes.map<Widget>((Palette swatch) => Tab(text: swatch.name)).toList(),
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: allPalettes.map((Palette colors) {
|
||||
children: allPalettes.map<Widget>((Palette colors) {
|
||||
return PaletteTabView(colors: colors);
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
@@ -54,7 +54,7 @@ class _ContactItem extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData themeData = Theme.of(context);
|
||||
final List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map((String line) => Text(line)).toList();
|
||||
final List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map<Widget>((String line) => Text(line)).toList();
|
||||
columnChildren.add(Text(lines.last, style: themeData.textTheme.caption));
|
||||
|
||||
final List<Widget> rowChildren = <Widget>[
|
||||
|
||||
@@ -58,7 +58,7 @@ class _CupertinoRefreshControlDemoState extends State<CupertinoRefreshControlDem
|
||||
CupertinoSliverRefreshControl(
|
||||
onRefresh: () {
|
||||
return Future<void>.delayed(const Duration(seconds: 2))
|
||||
..then((_) {
|
||||
..then<void>((_) {
|
||||
if (mounted) {
|
||||
setState(() => repopulateList());
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ class _ColorsItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: colors.map((_NamedColor namedColor) {
|
||||
children: colors.map<Widget>((_NamedColor namedColor) {
|
||||
return RawMaterialButton(
|
||||
onPressed: () {
|
||||
onChanged(namedColor.color);
|
||||
|
||||
@@ -194,7 +194,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
|
||||
Widget build(BuildContext context) {
|
||||
final BottomNavigationBar botNavBar = BottomNavigationBar(
|
||||
items: _navigationViews
|
||||
.map((NavigationIconView navigationView) => navigationView.item)
|
||||
.map<BottomNavigationBarItem>((NavigationIconView navigationView) => navigationView.item)
|
||||
.toList(),
|
||||
currentIndex: _currentIndex,
|
||||
type: _type,
|
||||
|
||||
@@ -280,7 +280,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
dropdown1Value = newValue;
|
||||
});
|
||||
},
|
||||
items: <String>['One', 'Two', 'Free', 'Four'].map((String value) {
|
||||
items: <String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
@@ -301,7 +301,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
dropdown2Value = newValue;
|
||||
});
|
||||
},
|
||||
items: <String>['One', 'Two', 'Free', 'Four'].map((String value) {
|
||||
items: <String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
@@ -325,7 +325,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
'One', 'Two', 'Free', 'Four', 'Can', 'I', 'Have', 'A', 'Little',
|
||||
'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'
|
||||
]
|
||||
.map((String value) {
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
@@ -365,7 +365,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||
onPressed: null,
|
||||
)
|
||||
]
|
||||
.map((Widget button) => SizedBox(width: 64.0, height: 64.0, child: button))
|
||||
.map<Widget>((Widget button) => SizedBox(width: 64.0, height: 64.0, child: button))
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -191,7 +191,7 @@ class _CardsDemoState extends State<CardsDemo> {
|
||||
body: ListView(
|
||||
itemExtent: TravelDestinationItem.height,
|
||||
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
|
||||
children: destinations.map((TravelDestination destination) {
|
||||
children: destinations.map<Widget>((TravelDestination destination) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 8.0),
|
||||
child: TravelDestinationItem(
|
||||
|
||||
@@ -92,7 +92,7 @@ class _ChipsTile extends StatelessWidget {
|
||||
];
|
||||
if (children.isNotEmpty) {
|
||||
cardChildren.add(Wrap(
|
||||
children: children.map((Widget chip) {
|
||||
children: children.map<Widget>((Widget chip) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: chip,
|
||||
|
||||
@@ -201,7 +201,7 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
|
||||
_activity = newValue;
|
||||
});
|
||||
},
|
||||
items: _allActivities.map((String value) {
|
||||
items: _allActivities.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
|
||||
@@ -201,7 +201,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
),
|
||||
]
|
||||
// Add a little space between the buttons
|
||||
.map((Widget button) {
|
||||
.map<Widget>((Widget button) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: button
|
||||
|
||||
@@ -159,7 +159,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: _drawerContents.map((String id) {
|
||||
children: _drawerContents.map<Widget>((String id) {
|
||||
return ListTile(
|
||||
leading: CircleAvatar(child: Text(id)),
|
||||
title: Text('Drawer item $id'),
|
||||
|
||||
@@ -25,7 +25,7 @@ class _ElevationDemoState extends State<ElevationDemo> {
|
||||
24.0,
|
||||
];
|
||||
|
||||
return elevations.map((double elevation) {
|
||||
return elevations.map<Widget>((double elevation) {
|
||||
return Center(
|
||||
child: Card(
|
||||
margin: const EdgeInsets.all(20.0),
|
||||
|
||||
@@ -356,7 +356,7 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
|
||||
_demoItems[index].isExpanded = !isExpanded;
|
||||
});
|
||||
},
|
||||
children: _demoItems.map((DemoItem<dynamic> item) {
|
||||
children: _demoItems.map<ExpansionPanel>((DemoItem<dynamic> item) {
|
||||
return ExpansionPanel(
|
||||
isExpanded: item.isExpanded,
|
||||
headerBuilder: item.headerBuilder,
|
||||
|
||||
@@ -251,7 +251,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
)
|
||||
)
|
||||
]
|
||||
.map((Widget child) {
|
||||
.map<Widget>((Widget child) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
height: 96.0,
|
||||
|
||||
@@ -374,7 +374,7 @@ class GridListDemoState extends State<GridListDemo> {
|
||||
crossAxisSpacing: 4.0,
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
childAspectRatio: (orientation == Orientation.portrait) ? 1.0 : 1.3,
|
||||
children: photos.map((Photo photo) {
|
||||
children: photos.map<Widget>((Photo photo) {
|
||||
return GridDemoPhotoItem(
|
||||
photo: photo,
|
||||
tileStyle: _tileStyle,
|
||||
|
||||
@@ -126,7 +126,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
);
|
||||
} else {
|
||||
body = ListView(
|
||||
children: leaveBehindItems.map((LeaveBehindItem item) {
|
||||
children: leaveBehindItems.map<Widget>((LeaveBehindItem item) {
|
||||
return _LeaveBehindListItem(
|
||||
item: item,
|
||||
onArchive: _handleArchive,
|
||||
|
||||
@@ -209,7 +209,7 @@ class _ListDemoState extends State<ListDemo> {
|
||||
break;
|
||||
}
|
||||
|
||||
Iterable<Widget> listTiles = items.map((String item) => buildListTile(context, item));
|
||||
Iterable<Widget> listTiles = items.map<Widget>((String item) => buildListTile(context, item));
|
||||
if (_showDividers)
|
||||
listTiles = ListTile.divideTiles(context: context, tiles: listTiles);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
|
||||
Future<Null> _handleRefresh() {
|
||||
final Completer<Null> completer = Completer<Null>();
|
||||
Timer(const Duration(seconds: 3), () { completer.complete(null); });
|
||||
return completer.future.then((_) {
|
||||
return completer.future.then<Null>((_) {
|
||||
_scaffoldKey.currentState?.showSnackBar(SnackBar(
|
||||
content: const Text('Refresh complete'),
|
||||
action: SnackBarAction(
|
||||
|
||||
@@ -54,7 +54,7 @@ class _PageSelector extends StatelessWidget {
|
||||
color: color,
|
||||
),
|
||||
child: TabBarView(
|
||||
children: icons.map((Icon icon) {
|
||||
children: icons.map<Widget>((Icon icon) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Card(
|
||||
|
||||
@@ -94,7 +94,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
|
||||
];
|
||||
return Column(
|
||||
children: indicators
|
||||
.map((Widget c) => Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
|
||||
.map<Widget>((Widget c) => Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
|
||||
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) => _ListItem(item, false)).toList();
|
||||
].map<_ListItem>((String item) => _ListItem(item, false)).toList();
|
||||
|
||||
void changeItemType(_ReorderableListType type) {
|
||||
setState(() {
|
||||
@@ -191,7 +191,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
|
||||
onReorder: _onReorder,
|
||||
scrollDirection: _itemType == _ReorderableListType.horizontalAvatar ? Axis.horizontal : Axis.vertical,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
children: _items.map(buildListTile).toList(),
|
||||
children: _items.map<Widget>(buildListTile).toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -174,7 +174,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _controller,
|
||||
children: _allPages.map((_Page page) {
|
||||
children: _allPages.map<Widget>((_Page page) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
|
||||
@@ -160,7 +160,7 @@ class _SearchDemoSearchDelegate extends SearchDelegate<int> {
|
||||
|
||||
return _SuggestionList(
|
||||
query: query,
|
||||
suggestions: suggestions.map((int i) => '$i').toList(),
|
||||
suggestions: suggestions.map<String>((int i) => '$i').toList(),
|
||||
onSelected: (String suggestion) {
|
||||
query = suggestion;
|
||||
showResults(context);
|
||||
|
||||
@@ -60,7 +60,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
|
||||
),
|
||||
const Text(_text3),
|
||||
]
|
||||
.map((Widget child) {
|
||||
.map<Widget>((Widget child) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
child: child
|
||||
|
||||
@@ -157,7 +157,7 @@ class TabsDemo extends StatelessWidget {
|
||||
expandedHeight: 150.0,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
bottom: TabBar(
|
||||
tabs: _allPages.keys.map(
|
||||
tabs: _allPages.keys.map<Widget>(
|
||||
(_Page page) => Tab(text: page.label),
|
||||
).toList(),
|
||||
),
|
||||
@@ -166,7 +166,7 @@ class TabsDemo extends StatelessWidget {
|
||||
];
|
||||
},
|
||||
body: TabBarView(
|
||||
children: _allPages.keys.map((_Page page) {
|
||||
children: _allPages.keys.map<Widget>((_Page page) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
|
||||
@@ -136,7 +136,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
|
||||
title: const Text('FAB per tab'),
|
||||
bottom: TabBar(
|
||||
controller: _controller,
|
||||
tabs: _allPages.map((_Page page) => Tab(text: page.label.toUpperCase())).toList(),
|
||||
tabs: _allPages.map<Widget>((_Page page) => Tab(text: page.label.toUpperCase())).toList(),
|
||||
),
|
||||
actions: <Widget>[
|
||||
MaterialDemoDocumentationButton(TabsFabDemo.routeName),
|
||||
@@ -153,7 +153,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
|
||||
floatingActionButton: buildFloatingActionButton(_selectedPage),
|
||||
body: TabBarView(
|
||||
controller: _controller,
|
||||
children: _allPages.map(buildTabView).toList()
|
||||
children: _allPages.map<Widget>(buildTabView).toList()
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class TooltipDemo extends StatelessWidget {
|
||||
)
|
||||
)
|
||||
]
|
||||
.map((Widget widget) {
|
||||
.map<Widget>((Widget widget) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0, left: 16.0, right: 16.0),
|
||||
child: widget
|
||||
|
||||
@@ -492,7 +492,7 @@ class RecipeSheet extends StatelessWidget {
|
||||
),
|
||||
]
|
||||
),
|
||||
]..addAll(recipe.ingredients.map(
|
||||
]..addAll(recipe.ingredients.map<TableRow>(
|
||||
(RecipeIngredient ingredient) {
|
||||
return _buildItemRow(ingredient.amount, ingredient.description);
|
||||
}
|
||||
@@ -506,7 +506,7 @@ class RecipeSheet extends StatelessWidget {
|
||||
),
|
||||
]
|
||||
)
|
||||
)..addAll(recipe.steps.map(
|
||||
)..addAll(recipe.steps.map<TableRow>(
|
||||
(RecipeStep step) {
|
||||
return _buildItemRow(step.duration ?? '', step.description);
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ class _ShrineHomeState extends State<ShrineHome> {
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: gridDelegate,
|
||||
delegate: SliverChildListDelegate(
|
||||
_products.map((Product product) {
|
||||
_products.map<Widget>((Product product) {
|
||||
return _ProductItem(
|
||||
product: product,
|
||||
onPressed: () { _showOrderPage(product); },
|
||||
|
||||
@@ -46,7 +46,7 @@ class _ProductItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: DropdownButton<int>(
|
||||
items: <int>[0, 1, 2, 3, 4, 5].map((int value) {
|
||||
items: <int>[0, 1, 2, 3, 4, 5].map<DropdownMenuItem<int>>((int value) {
|
||||
return DropdownMenuItem<int>(
|
||||
value: value,
|
||||
child: Padding(
|
||||
|
||||
@@ -381,7 +381,7 @@ class _VideoDemoState extends State<VideoDemo>
|
||||
|
||||
initController(butterflyController);
|
||||
initController(beeController);
|
||||
isIOSSimulator().then((bool result) {
|
||||
isIOSSimulator().then<void>((bool result) {
|
||||
isSupported = !result;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
|
||||
),
|
||||
bottom: TabBar(
|
||||
isScrollable: true,
|
||||
tabs: demos.map((ComponentDemoTabData data) => Tab(text: data.tabName)).toList(),
|
||||
tabs: demos.map<Widget>((ComponentDemoTabData data) => Tab(text: data.tabName)).toList(),
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: demos.map((ComponentDemoTabData demo) {
|
||||
children: demos.map<Widget>((ComponentDemoTabData demo) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
|
||||
@@ -104,7 +104,7 @@ DropdownButton<String>(
|
||||
});
|
||||
},
|
||||
items: <String>['One', 'Two', 'Free', 'Four']
|
||||
.map((String value) {
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value));
|
||||
@@ -263,7 +263,7 @@ GridView.count(
|
||||
'https://example.com/image-2.jpg',
|
||||
'...',
|
||||
'https://example.com/image-n.jpg'
|
||||
].map((String url) {
|
||||
].map<Widget>((String url) {
|
||||
return GridTile(
|
||||
footer: GridTileBar(
|
||||
title: Text(url)
|
||||
|
||||
@@ -252,7 +252,7 @@ class _TextScaleFactorItem extends StatelessWidget {
|
||||
padding: const EdgeInsetsDirectional.only(end: 16.0),
|
||||
icon: const Icon(Icons.arrow_drop_down),
|
||||
itemBuilder: (BuildContext context) {
|
||||
return kAllGalleryTextScaleValues.map((GalleryTextScaleValue scaleValue) {
|
||||
return kAllGalleryTextScaleValues.map<PopupMenuItem<GalleryTextScaleValue>>((GalleryTextScaleValue scaleValue) {
|
||||
return PopupMenuItem<GalleryTextScaleValue>(
|
||||
value: scaleValue,
|
||||
child: Text(scaleValue.label),
|
||||
|
||||
Reference in New Issue
Block a user