mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 19:28:27 +08:00
@@ -1,19 +1,17 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class Cover {
|
||||
int? height;
|
||||
String? url;
|
||||
int? width;
|
||||
late double ratio;
|
||||
|
||||
Cover({this.height, this.url, this.width, required this.ratio});
|
||||
Cover({required this.ratio});
|
||||
|
||||
Cover.fromJson(Map<String, dynamic> json) {
|
||||
height = json['height'] as int?;
|
||||
url = json['url'] as String?;
|
||||
width = json['width'] as int?;
|
||||
final height = json['height'] as int?;
|
||||
final width = json['width'] as int?;
|
||||
if (height != null && width != null) {
|
||||
ratio = clampDouble(height! / width!, 0.68, 2.7);
|
||||
ratio = clampDouble(height / width, 0.68, 2.7);
|
||||
} else {
|
||||
ratio = 1;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@ class SpaceOpusData {
|
||||
bool? hasMore;
|
||||
List<SpaceOpusItemModel>? items;
|
||||
String? offset;
|
||||
int? updateNum;
|
||||
|
||||
SpaceOpusData({this.hasMore, this.items, this.offset, this.updateNum});
|
||||
SpaceOpusData({this.hasMore, this.items, this.offset});
|
||||
|
||||
factory SpaceOpusData.fromJson(Map<String, dynamic> json) => SpaceOpusData(
|
||||
hasMore: json['has_more'] as bool?,
|
||||
@@ -14,6 +13,5 @@ class SpaceOpusData {
|
||||
?.map((e) => SpaceOpusItemModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
offset: json['offset'] as String?,
|
||||
updateNum: json['update_num'] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,14 +3,12 @@ import 'package:PiliPlus/models_new/space/space_opus/stat.dart';
|
||||
|
||||
class SpaceOpusItemModel {
|
||||
String? content;
|
||||
String? jumpUrl;
|
||||
String? opusId;
|
||||
Stat? stat;
|
||||
Cover? cover;
|
||||
|
||||
SpaceOpusItemModel({
|
||||
this.content,
|
||||
this.jumpUrl,
|
||||
this.opusId,
|
||||
this.stat,
|
||||
this.cover,
|
||||
@@ -19,7 +17,6 @@ class SpaceOpusItemModel {
|
||||
factory SpaceOpusItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
SpaceOpusItemModel(
|
||||
content: json['content'] as String?,
|
||||
jumpUrl: json['jump_url'] as String?,
|
||||
opusId: json['opus_id'] as String?,
|
||||
stat: json['stat'] == null
|
||||
? null
|
||||
|
||||
Reference in New Issue
Block a user