mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-18 08:06:21 +08:00
feat: space opus
Closes #833 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
27
lib/models/space_opus/cover.dart
Normal file
27
lib/models/space_opus/cover.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
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.fromJson(Map<String, dynamic> json) {
|
||||
height = json['height'] as int?;
|
||||
url = json['url'] as String?;
|
||||
width = json['width'] as int?;
|
||||
if (height != null && width != null) {
|
||||
ratio = clampDouble(height! / width!, 0.68, 2.7);
|
||||
} else {
|
||||
ratio = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'height': height,
|
||||
'url': url,
|
||||
'width': width,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user