From c70dd411dcc651b7ee267845dc00e15b82f082d5 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Sun, 20 Sep 2020 16:04:55 +0800 Subject: [PATCH] rename collection to album in example app --- example/lib/main.dart | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index fe1c76a..e13e47f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -18,7 +18,7 @@ class MyApp extends StatefulWidget { } class _MyAppState extends State { - List _collections; + List _albums; bool _loading = false; @override @@ -30,10 +30,10 @@ class _MyAppState extends State { Future initAsync() async { if (await _promptPermissionSetting()) { - List collections = + List albums = await PhotoGallery.listAlbums(mediumType: MediumType.image); setState(() { - _collections = collections; + _albums = albums; _loading = false; }); } @@ -76,12 +76,11 @@ class _MyAppState extends State { mainAxisSpacing: 5.0, crossAxisSpacing: 5.0, children: [ - ...?_collections?.map( - (collection) => GestureDetector( + ...?_albums?.map( + (album) => GestureDetector( onTap: () => Navigator.of(context).push( MaterialPageRoute( - builder: (context) => - CollectionPage(collection))), + builder: (context) => AlbumPage(album))), child: Column( children: [ ClipRRect( @@ -95,7 +94,7 @@ class _MyAppState extends State { placeholder: MemoryImage(kTransparentImage), image: AlbumThumbnailProvider( - albumId: collection.id, + albumId: album.id, highQuality: true, ), ), @@ -105,7 +104,7 @@ class _MyAppState extends State { alignment: Alignment.topLeft, padding: EdgeInsets.only(left: 2.0), child: Text( - collection.name, + album.name, maxLines: 1, textAlign: TextAlign.start, style: TextStyle( @@ -118,7 +117,7 @@ class _MyAppState extends State { alignment: Alignment.topLeft, padding: EdgeInsets.only(left: 2.0), child: Text( - collection.count.toString(), + album.count.toString(), textAlign: TextAlign.start, style: TextStyle( height: 1.2, @@ -140,16 +139,16 @@ class _MyAppState extends State { } } -class CollectionPage extends StatefulWidget { - final Album collection; +class AlbumPage extends StatefulWidget { + final Album album; - CollectionPage(Album collection) : collection = collection; + AlbumPage(Album album) : album = album; @override - State createState() => CollectionPageState(); + State createState() => AlbumPageState(); } -class CollectionPageState extends State { +class AlbumPageState extends State { List _media; @override @@ -159,7 +158,7 @@ class CollectionPageState extends State { } void initAsync() async { - MediaPage mediaPage = await widget.collection.listMedia(); + MediaPage mediaPage = await widget.album.listMedia(); setState(() { _media = mediaPage.items; }); @@ -174,7 +173,7 @@ class CollectionPageState extends State { icon: Icon(Icons.arrow_back_ios), onPressed: () => Navigator.of(context).pop(), ), - title: Text(widget.collection.name), + title: Text(widget.album.name), ), body: GridView.count( crossAxisCount: 3,