add light weight support in Album and MediaPage
This commit is contained in:
parent
2db4d8901e
commit
185628470a
@ -36,11 +36,13 @@ class Album {
|
|||||||
Future<MediaPage> listMedia({
|
Future<MediaPage> listMedia({
|
||||||
int? skip,
|
int? skip,
|
||||||
int? take,
|
int? take,
|
||||||
|
bool? lightWeight,
|
||||||
}) {
|
}) {
|
||||||
return PhotoGallery._listMedia(
|
return PhotoGallery._listMedia(
|
||||||
album: this,
|
album: this,
|
||||||
skip: skip,
|
skip: skip,
|
||||||
take: take,
|
take: take,
|
||||||
|
lightWeight: lightWeight,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ class MediaPage {
|
|||||||
/// The current items.
|
/// The current items.
|
||||||
final List<Medium> items;
|
final List<Medium> items;
|
||||||
|
|
||||||
|
final bool? lightWeight;
|
||||||
|
|
||||||
/// The end index in the album.
|
/// The end index in the album.
|
||||||
int get end => start + items.length;
|
int get end => start + items.length;
|
||||||
|
|
||||||
@ -18,7 +20,7 @@ class MediaPage {
|
|||||||
bool get isLast => end >= album.count;
|
bool get isLast => end >= album.count;
|
||||||
|
|
||||||
/// Creates a range of media from platform channel protocol.
|
/// Creates a range of media from platform channel protocol.
|
||||||
MediaPage.fromJson(this.album, dynamic json)
|
MediaPage.fromJson(this.album, dynamic json, {this.lightWeight})
|
||||||
: start = json['start'] ?? 0,
|
: start = json['start'] ?? 0,
|
||||||
items = json['items'].map<Medium>((x) => Medium.fromJson(x)).toList();
|
items = json['items'].map<Medium>((x) => Medium.fromJson(x)).toList();
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ class MediaPage {
|
|||||||
album: album,
|
album: album,
|
||||||
skip: end,
|
skip: end,
|
||||||
take: items.length,
|
take: items.length,
|
||||||
|
lightWeight: lightWeight
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +45,7 @@ class MediaPage {
|
|||||||
listEquals(items, other.items);
|
listEquals(items, other.items);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => album.hashCode ^ start.hashCode ^ items.hashCode;
|
||||||
album.hashCode ^ start.hashCode ^ items.hashCode;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user