mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
chore: sleep timer custom hour format
This commit is contained in:
parent
b78e7f57a0
commit
c93c229b0f
@ -171,7 +171,7 @@ class PlayerActions extends HookConsumerWidget {
|
|||||||
title: Text(
|
title: Text(
|
||||||
customHoursEnabled
|
customHoursEnabled
|
||||||
? context.l10n.custom_hours
|
? context.l10n.custom_hours
|
||||||
: sleepTimer.toHumanReadableString(),
|
: sleepTimer.format(abbreviated: true),
|
||||||
),
|
),
|
||||||
// only enabled when there's no preset timers selected
|
// only enabled when there's no preset timers selected
|
||||||
enabled: customHoursEnabled,
|
enabled: customHoursEnabled,
|
||||||
|
@ -1,6 +1,28 @@
|
|||||||
|
import 'package:duration/locale.dart';
|
||||||
import 'package:spotube/utils/primitive_utils.dart';
|
import 'package:spotube/utils/primitive_utils.dart';
|
||||||
|
import 'package:duration/duration.dart';
|
||||||
|
|
||||||
extension DurationToHumanReadableString on Duration {
|
extension DurationToHumanReadableString on Duration {
|
||||||
String toHumanReadableString() =>
|
String toHumanReadableString() =>
|
||||||
"${inMinutes.remainder(60)}:${PrimitiveUtils.zeroPadNumStr(inSeconds.remainder(60))}";
|
"${inMinutes.remainder(60)}:${PrimitiveUtils.zeroPadNumStr(inSeconds.remainder(60))}";
|
||||||
|
|
||||||
|
String format({
|
||||||
|
DurationTersity tersity = DurationTersity.second,
|
||||||
|
DurationTersity upperTersity = DurationTersity.week,
|
||||||
|
DurationLocale locale = const EnglishDurationLocale(),
|
||||||
|
String? spacer,
|
||||||
|
String? delimiter,
|
||||||
|
String? conjugation,
|
||||||
|
bool abbreviated = false,
|
||||||
|
}) =>
|
||||||
|
printDuration(
|
||||||
|
this,
|
||||||
|
tersity: tersity,
|
||||||
|
upperTersity: upperTersity,
|
||||||
|
locale: locale,
|
||||||
|
spacer: spacer,
|
||||||
|
delimiter: delimiter,
|
||||||
|
conjugation: conjugation,
|
||||||
|
abbreviated: abbreviated,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -474,6 +474,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.0"
|
||||||
|
duration:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: duration
|
||||||
|
sha256: d0b29d0a345429e3986ac56d60e4aef65b37d11e653022b2b9a4b361332b777f
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.12"
|
||||||
envied:
|
envied:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -103,6 +103,7 @@ dependencies:
|
|||||||
media_kit_native_event_loop: ^1.0.4
|
media_kit_native_event_loop: ^1.0.4
|
||||||
dbus: ^0.7.8
|
dbus: ^0.7.8
|
||||||
background_downloader: ^7.4.0
|
background_downloader: ^7.4.0
|
||||||
|
duration: ^3.0.12
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.3.2
|
build_runner: ^2.3.2
|
||||||
|
Loading…
Reference in New Issue
Block a user