mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-01 23:47:50 +08:00
feat: add size display
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:ui/providers/APIs.dart';
|
import 'package:ui/providers/APIs.dart';
|
||||||
import 'package:ui/providers/series_details.dart';
|
import 'package:ui/providers/series_details.dart';
|
||||||
import 'package:ui/welcome_page.dart';
|
import 'package:ui/welcome_page.dart';
|
||||||
|
import 'package:ui/widgets/utils.dart';
|
||||||
|
|
||||||
import 'widgets.dart';
|
import 'widgets.dart';
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Text(""),
|
const Text(""),
|
||||||
Row(
|
Wrap(
|
||||||
children: [
|
children: [
|
||||||
Text("${widget.details.resolution}"),
|
Text("${widget.details.resolution}"),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@@ -70,11 +71,17 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 30,
|
width: 30,
|
||||||
),
|
),
|
||||||
Expanded(
|
Text(
|
||||||
child: Text(
|
|
||||||
"${widget.details.mediaType == "tv" ? widget.details.storage!.tvPath : widget.details.storage!.moviePath}"
|
"${widget.details.mediaType == "tv" ? widget.details.storage!.tvPath : widget.details.storage!.moviePath}"
|
||||||
"${widget.details.targetDir}"),
|
"${widget.details.targetDir}"),
|
||||||
)
|
const SizedBox(
|
||||||
|
width: 30,
|
||||||
|
),
|
||||||
|
widget.details.limiter != null &&
|
||||||
|
widget.details.limiter!.sizeMax > 0
|
||||||
|
? Text(
|
||||||
|
"${(widget.details.limiter!.sizeMin * 1000 * 1000).readableFileSize()} - ${(widget.details.limiter!.sizeMax * 1000 * 1000).readableFileSize()}")
|
||||||
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Divider(thickness: 1, height: 1),
|
const Divider(thickness: 1, height: 1),
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension FileFormatter on num {
|
extension FileFormatter on num {
|
||||||
String readableFileSize({bool base1024 = true}) {
|
String readableFileSize({bool base1024 = false}) {
|
||||||
final base = base1024 ? 1024 : 1000;
|
final base = base1024 ? 1024 : 1000;
|
||||||
if (this <= 0) return "0";
|
if (this <= 0) return "0";
|
||||||
final units = ["B", "kB", "MB", "GB", "TB"];
|
final units = ["B", "kB", "MB", "GB", "TB"];
|
||||||
|
|||||||
Reference in New Issue
Block a user