mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-06 10:07:45 +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/series_details.dart';
|
||||
import 'package:ui/welcome_page.dart';
|
||||
import 'package:ui/widgets/utils.dart';
|
||||
|
||||
import 'widgets.dart';
|
||||
|
||||
@@ -59,7 +60,7 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(""),
|
||||
Row(
|
||||
Wrap(
|
||||
children: [
|
||||
Text("${widget.details.resolution}"),
|
||||
const SizedBox(
|
||||
@@ -70,11 +71,17 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
const SizedBox(
|
||||
width: 30,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${widget.details.mediaType == "tv" ? widget.details.storage!.tvPath : widget.details.storage!.moviePath}"
|
||||
"${widget.details.targetDir}"),
|
||||
)
|
||||
Text(
|
||||
"${widget.details.mediaType == "tv" ? widget.details.storage!.tvPath : widget.details.storage!.moviePath}"
|
||||
"${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),
|
||||
|
||||
@@ -45,7 +45,7 @@ class Utils {
|
||||
}
|
||||
|
||||
extension FileFormatter on num {
|
||||
String readableFileSize({bool base1024 = true}) {
|
||||
String readableFileSize({bool base1024 = false}) {
|
||||
final base = base1024 ? 1024 : 1000;
|
||||
if (this <= 0) return "0";
|
||||
final units = ["B", "kB", "MB", "GB", "TB"];
|
||||
|
||||
Reference in New Issue
Block a user