mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: suggestions
This commit is contained in:
@@ -29,13 +29,9 @@ sealed class Option<T> {
|
|||||||
None() => const Option.none(),
|
None() => const Option.none(),
|
||||||
};
|
};
|
||||||
|
|
||||||
void ifSome(void Function(T value) action) {
|
void ifPresent(void Function(T value) f) {
|
||||||
switch (this) {
|
if (this case Some(:final value)) {
|
||||||
case Some(:final value):
|
f(value);
|
||||||
action(value);
|
|
||||||
break;
|
|
||||||
case None():
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ class MapTimeRange extends StatelessWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: Text(context.t.date_after),
|
title: Text(context.t.date_after),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
timeRange.from.fold((from) => DateFormat.yMMMd().add_jm().format(from), () => context.t.not_set),
|
timeRange.from.fold(
|
||||||
|
(from) => DateFormat.yMMMd(context.locale).add_jm().format(from),
|
||||||
|
() => context.t.not_set,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
trailing: timeRange.from.isSome
|
trailing: timeRange.from.isSome
|
||||||
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearFrom()))
|
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearFrom()))
|
||||||
@@ -43,7 +46,10 @@ class MapTimeRange extends StatelessWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: Text(context.t.date_before),
|
title: Text(context.t.date_before),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
timeRange.to.fold<String>((to) => DateFormat.yMMMd().add_jm().format(to), () => context.t.not_set),
|
timeRange.to.fold<String>(
|
||||||
|
(to) => DateFormat.yMMMd(context.locale).add_jm().format(to),
|
||||||
|
() => context.t.not_set,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
trailing: timeRange.to.isSome
|
trailing: timeRange.to.isSome
|
||||||
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearTo()))
|
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearTo()))
|
||||||
|
|||||||
Reference in New Issue
Block a user