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