2022-12-30 05:18:18 +03:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
2022-12-29 08:45:28 +03:00
|
|
|
import 'gallery_album.dart';
|
|
|
|
|
|
|
|
class GalleryMedia {
|
|
|
|
List<GalleryAlbum> albums;
|
|
|
|
GalleryAlbum? get recent {
|
2022-12-31 16:43:05 +03:00
|
|
|
return albums.singleWhere((element) => element.name == "All");
|
2022-12-29 08:45:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
GalleryAlbum? getAlbum(String name) {
|
|
|
|
try {
|
2022-12-31 16:43:05 +03:00
|
|
|
return albums.singleWhere((element) => element.name == name);
|
2022-12-29 08:45:28 +03:00
|
|
|
} catch (e) {
|
2022-12-30 05:18:18 +03:00
|
|
|
if (kDebugMode) {
|
|
|
|
print(e);
|
|
|
|
}
|
2022-12-29 08:45:28 +03:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GalleryMedia(this.albums);
|
|
|
|
}
|