refactor: rename customtimerange variables

This commit is contained in:
Yaros
2026-02-19 14:08:50 +01:00
parent b0f6d5cf38
commit 733100f6ec
5 changed files with 35 additions and 45 deletions
@@ -3,10 +3,10 @@ import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/map/map.state.dart';
import 'package:intl/intl.dart';
class MapCustomTimeRange extends StatelessWidget {
const MapCustomTimeRange({super.key, required this.customTimeRange, required this.onChanged});
class MapTimeRange extends StatelessWidget {
const MapTimeRange({super.key, required this.timeRange, required this.onChanged});
final TimeRange customTimeRange;
final TimeRange timeRange;
final Function(TimeRange) onChanged;
@override
@@ -17,44 +17,42 @@ class MapCustomTimeRange extends StatelessWidget {
ListTile(
title: Text("date_after".t(context: context)),
subtitle: Text(
customTimeRange.from != null
? DateFormat.yMMMd().add_jm().format(customTimeRange.from!)
timeRange.from != null
? DateFormat.yMMMd().add_jm().format(timeRange.from!)
: "not_set".t(context: context),
),
trailing: customTimeRange.from != null
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(customTimeRange.clearFrom()))
trailing: timeRange.from != null
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearFrom()))
: null,
onTap: () async {
final picked = await showDatePicker(
context: context,
initialDate: customTimeRange.from ?? DateTime.now(),
initialDate: timeRange.from ?? DateTime.now(),
firstDate: DateTime(1970),
lastDate: DateTime.now(),
);
if (picked != null) {
onChanged(customTimeRange.copyWith(from: picked));
onChanged(timeRange.copyWith(from: picked));
}
},
),
ListTile(
title: Text("date_before".t(context: context)),
subtitle: Text(
customTimeRange.to != null
? DateFormat.yMMMd().add_jm().format(customTimeRange.to!)
: "not_set".t(context: context),
timeRange.to != null ? DateFormat.yMMMd().add_jm().format(timeRange.to!) : "not_set".t(context: context),
),
trailing: customTimeRange.to != null
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(customTimeRange.clearTo()))
trailing: timeRange.to != null
? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearTo()))
: null,
onTap: () async {
final picked = await showDatePicker(
context: context,
initialDate: customTimeRange.to ?? DateTime.now(),
initialDate: timeRange.to ?? DateTime.now(),
firstDate: DateTime(1970),
lastDate: DateTime.now(),
);
if (picked != null) {
onChanged(customTimeRange.copyWith(to: picked));
onChanged(timeRange.copyWith(to: picked));
}
},
),