mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: restrict selection
This commit is contained in:
@@ -28,12 +28,13 @@ class MapTimeRange extends StatelessWidget {
|
|||||||
: null,
|
: null,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final initial = timeRange.from.unwrapOrNull ?? DateTime.now();
|
final initial = timeRange.from.unwrapOrNull ?? DateTime.now();
|
||||||
|
final currentTo = timeRange.to.unwrapOrNull;
|
||||||
|
|
||||||
final picked = await showDatePicker(
|
final picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: initial,
|
initialDate: currentTo != null && initial.isAfter(currentTo) ? currentTo : initial,
|
||||||
firstDate: DateTime(1970),
|
firstDate: DateTime(1970),
|
||||||
lastDate: DateTime.now(),
|
lastDate: currentTo ?? DateTime.now(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
@@ -41,7 +42,6 @@ class MapTimeRange extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(context.t.date_before),
|
title: Text(context.t.date_before),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
@@ -55,11 +55,12 @@ class MapTimeRange extends StatelessWidget {
|
|||||||
: null,
|
: null,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final initial = timeRange.to.unwrapOrNull ?? DateTime.now();
|
final initial = timeRange.to.unwrapOrNull ?? DateTime.now();
|
||||||
|
final currentFrom = timeRange.from.unwrapOrNull;
|
||||||
|
|
||||||
final picked = await showDatePicker(
|
final picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: initial,
|
initialDate: currentFrom != null && initial.isBefore(currentFrom) ? currentFrom : initial,
|
||||||
firstDate: DateTime(1970),
|
firstDate: currentFrom ?? DateTime(1970),
|
||||||
lastDate: DateTime.now(),
|
lastDate: DateTime.now(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user