Skip to content

Commit e767f0e

Browse files
committed
Fixes on visual duration on field
1 parent 2e048ae commit e767f0e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

lib/src/inputs/src/general/duration_input.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,13 @@ class _ThemedDurationInputState extends State<ThemedDurationInput> {
142142
padding: const EdgeInsets.all(5),
143143
labelText: visibleValue.translate(i18n),
144144
suffixText: visibleValue.translate(i18n),
145-
value: days,
145+
value: switch (visibleValue) {
146+
ThemedUnits.day => days,
147+
ThemedUnits.hour => hours,
148+
ThemedUnits.minute => minutes,
149+
ThemedUnits.second => seconds,
150+
_ => 0,
151+
},
146152
hideDetails: true,
147153
onChanged: (value) {
148154
if (value == null) return;
@@ -248,11 +254,13 @@ class _ThemedDurationInputState extends State<ThemedDurationInput> {
248254
String _getFormattedDuration(Duration? durationValue) {
249255
if (durationValue == null) return '';
250256

257+
String conjunction = i18n?.t('helpers.and') ?? 'and';
258+
conjunction = ' ${conjunction.trim()} ';
251259
return durationValue.humanize(
252260
options: ThemedHumanizeOptions(
253261
units: visibleValues,
254262
spacer: ' ',
255-
conjunction: i18n?.t('helpers.and') ?? ' and ',
263+
conjunction: conjunction,
256264
),
257265
language: ThemedHumanizedDurationLanguage(i18n: i18n),
258266
);

0 commit comments

Comments
 (0)