|
@@ -65,7 +65,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
super.build(context);
|
|
super.build(context);
|
|
_logger.info("Building, trigger: $_loadReason");
|
|
_logger.info("Building, trigger: $_loadReason");
|
|
- return FutureBuilder<CollectionItems>(
|
|
|
|
|
|
+ return FutureBuilder<List<CollectionWithThumbnail>>(
|
|
future: _getCollections(),
|
|
future: _getCollections(),
|
|
builder: (context, snapshot) {
|
|
builder: (context, snapshot) {
|
|
if (snapshot.hasData) {
|
|
if (snapshot.hasData) {
|
|
@@ -79,12 +79,9 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- Future<CollectionItems> _getCollections() async {
|
|
|
|
- final filesDB = FilesDB.instance;
|
|
|
|
|
|
+ Future<List<CollectionWithThumbnail>> _getCollections() async {
|
|
final collectionsService = CollectionsService.instance;
|
|
final collectionsService = CollectionsService.instance;
|
|
final userID = Configuration.instance.getUserID();
|
|
final userID = Configuration.instance.getUserID();
|
|
- final List<DeviceCollection> deviceCollections =
|
|
|
|
- await filesDB.getDeviceCollections(includeCoverThumbnail: true);
|
|
|
|
final List<CollectionWithThumbnail> collectionsWithThumbnail = [];
|
|
final List<CollectionWithThumbnail> collectionsWithThumbnail = [];
|
|
final latestCollectionFiles =
|
|
final latestCollectionFiles =
|
|
await collectionsService.getLatestCollectionFiles();
|
|
await collectionsService.getLatestCollectionFiles();
|
|
@@ -108,10 +105,12 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
|
|
}
|
|
}
|
|
},
|
|
},
|
|
);
|
|
);
|
|
- return CollectionItems(deviceCollections, collectionsWithThumbnail);
|
|
|
|
|
|
+ return collectionsWithThumbnail;
|
|
}
|
|
}
|
|
|
|
|
|
- Widget _getCollectionsGalleryWidget(CollectionItems items) {
|
|
|
|
|
|
+ Widget _getCollectionsGalleryWidget(
|
|
|
|
+ List<CollectionWithThumbnail> collections,
|
|
|
|
+ ) {
|
|
final TextStyle trashAndHiddenTextStyle = Theme.of(context)
|
|
final TextStyle trashAndHiddenTextStyle = Theme.of(context)
|
|
.textTheme
|
|
.textTheme
|
|
.subtitle1
|
|
.subtitle1
|
|
@@ -127,12 +126,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
|
|
const SizedBox(height: 12),
|
|
const SizedBox(height: 12),
|
|
const SectionTitle("On device"),
|
|
const SectionTitle("On device"),
|
|
const SizedBox(height: 12),
|
|
const SizedBox(height: 12),
|
|
- items.deviceCollections.isEmpty
|
|
|
|
- ? const Padding(
|
|
|
|
- padding: EdgeInsets.all(22),
|
|
|
|
- child: EmptyState(),
|
|
|
|
- )
|
|
|
|
- : DeviceFoldersGridViewWidget(items.deviceCollections),
|
|
|
|
|
|
+ const DeviceFoldersGridViewWidget(),
|
|
const Padding(padding: EdgeInsets.all(4)),
|
|
const Padding(padding: EdgeInsets.all(4)),
|
|
const Divider(),
|
|
const Divider(),
|
|
Row(
|
|
Row(
|
|
@@ -145,7 +139,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
const SizedBox(height: 12),
|
|
Configuration.instance.hasConfiguredAccount()
|
|
Configuration.instance.hasConfiguredAccount()
|
|
- ? RemoteCollectionsGridViewWidget(items.collections)
|
|
|
|
|
|
+ ? RemoteCollectionsGridViewWidget(collections)
|
|
: const EmptyState(),
|
|
: const EmptyState(),
|
|
const SizedBox(height: 10),
|
|
const SizedBox(height: 10),
|
|
const Divider(),
|
|
const Divider(),
|