remove MediumType attribute in MediaPage, and remove MediumType parameter in listMedia method
This commit is contained in:
parent
d66f13b276
commit
04249eeab3
@ -35,7 +35,6 @@ class PhotoGallery {
|
||||
|
||||
static Future<MediaPage> _listMedia({
|
||||
@required Album album,
|
||||
@required MediumType mediumType,
|
||||
@required int total,
|
||||
int skip,
|
||||
int take,
|
||||
@ -43,12 +42,12 @@ class PhotoGallery {
|
||||
assert(album.id != null);
|
||||
final json = await _channel.invokeMethod('listMedia', {
|
||||
'albumId': album.id,
|
||||
'mediumType': mediumTypeToJson(mediumType),
|
||||
'mediumType': mediumTypeToJson(album.mediumType),
|
||||
'total': total,
|
||||
'skip': skip,
|
||||
'take': take,
|
||||
});
|
||||
return MediaPage.fromJson(album, mediumType, json);
|
||||
return MediaPage.fromJson(album, json);
|
||||
}
|
||||
|
||||
static Future<Medium> getMedium({
|
||||
|
@ -35,7 +35,6 @@ class Album {
|
||||
}) {
|
||||
return PhotoGallery._listMedia(
|
||||
album: this,
|
||||
mediumType: this.mediumType,
|
||||
total: this.count,
|
||||
skip: skip,
|
||||
take: take,
|
||||
|
@ -5,9 +5,6 @@ part of photogallery;
|
||||
class MediaPage {
|
||||
final Album album;
|
||||
|
||||
/// The medium type of [items].
|
||||
final MediumType mediumType;
|
||||
|
||||
/// The start offset for those media.
|
||||
final int start;
|
||||
|
||||
@ -24,7 +21,7 @@ class MediaPage {
|
||||
bool get isLast => end >= total;
|
||||
|
||||
/// Creates a range of media from platform channel protocol.
|
||||
MediaPage.fromJson(this.album, this.mediumType, dynamic json)
|
||||
MediaPage.fromJson(this.album, dynamic json)
|
||||
: start = json['start'],
|
||||
total = json['total'],
|
||||
items = json['items'].map<Medium>((x) => Medium.fromJson(x)).toList();
|
||||
@ -34,7 +31,6 @@ class MediaPage {
|
||||
assert(!isLast);
|
||||
return PhotoGallery._listMedia(
|
||||
album: album,
|
||||
mediumType: mediumType,
|
||||
total: total,
|
||||
skip: end,
|
||||
take: items.length,
|
||||
@ -47,23 +43,17 @@ class MediaPage {
|
||||
other is MediaPage &&
|
||||
runtimeType == other.runtimeType &&
|
||||
album == other.album &&
|
||||
mediumType == other.mediumType &&
|
||||
start == other.start &&
|
||||
total == other.total &&
|
||||
listEquals(items, other.items);
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
album.hashCode ^
|
||||
mediumType.hashCode ^
|
||||
start.hashCode ^
|
||||
total.hashCode ^
|
||||
items.hashCode;
|
||||
album.hashCode ^ start.hashCode ^ total.hashCode ^ items.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MediaPage{album: $album, '
|
||||
'mediumType: $mediumType, '
|
||||
'start: $start, '
|
||||
'total: $total, '
|
||||
'items: $items}';
|
||||
|
Loading…
x
Reference in New Issue
Block a user