Files
PiliPlus/lib/models_new/space/space_opus/cover.dart
bggRGjQaUbCoE b960359a39 opt models
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-06-05 14:44:56 +08:00

22 lines
484 B
Dart

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;
}
}
}