1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

Landing beta changes in master for the new stable release (#747)

This commit is contained in:
Andrew Brogdon
2021-03-03 11:44:35 -08:00
committed by GitHub
parent 6c81510d6e
commit 8c1cd0b049
101 changed files with 1006 additions and 1040 deletions

View File

@@ -15,9 +15,9 @@ class SongsTab extends StatefulWidget {
static const androidIcon = Icon(Icons.music_note);
static const iosIcon = Icon(CupertinoIcons.music_note);
const SongsTab({Key key, this.androidDrawer}) : super(key: key);
const SongsTab({Key? key, this.androidDrawer}) : super(key: key);
final Widget androidDrawer;
final Widget? androidDrawer;
@override
_SongsTabState createState() => _SongsTabState();
@@ -28,8 +28,8 @@ class _SongsTabState extends State<SongsTab> {
final _androidRefreshKey = GlobalKey<RefreshIndicatorState>();
List<MaterialColor> colors;
List<String> songNames;
late List<MaterialColor> colors;
late List<String> songNames;
@override
void initState() {
@@ -51,7 +51,7 @@ class _SongsTabState extends State<SongsTab> {
}
Widget _listBuilder(BuildContext context, int index) {
if (index >= _itemsLength) return null;
if (index >= _itemsLength) return Container();
// Show a slightly different color palette. Show poppy-ier colors on iOS
// due to lighter contrasting bars and tone it down on Android.
@@ -96,7 +96,7 @@ class _SongsTabState extends State<SongsTab> {
// done in a real app but it's done here since this app
// unrealistically toggles the current platform for demonstration
// purposes.
WidgetsBinding.instance.reassembleApplication();
WidgetsBinding.instance!.reassembleApplication();
}
// ===========================================================================
@@ -117,7 +117,8 @@ class _SongsTabState extends State<SongsTab> {
actions: [
IconButton(
icon: Icon(Icons.refresh),
onPressed: () async => await _androidRefreshKey.currentState.show(),
onPressed: () async =>
await _androidRefreshKey.currentState!.show(),
),
IconButton(
icon: Icon(Icons.shuffle),
@@ -131,6 +132,7 @@ class _SongsTabState extends State<SongsTab> {
onRefresh: _refreshData,
child: ListView.builder(
padding: EdgeInsets.symmetric(vertical: 12),
itemCount: _itemsLength,
itemBuilder: _listBuilder,
),
),
@@ -155,7 +157,10 @@ class _SongsTabState extends State<SongsTab> {
sliver: SliverPadding(
padding: EdgeInsets.symmetric(vertical: 12),
sliver: SliverList(
delegate: SliverChildBuilderDelegate(_listBuilder),
delegate: SliverChildBuilderDelegate(
_listBuilder,
childCount: _itemsLength,
),
),
),
),