From 5898aebcf15bb33a22fb5bbdfe476f066499f16c Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 10 Mar 2025 14:51:53 +0530 Subject: [PATCH] [mob][photos] max shift setting --- mobile/lib/ui/components/bulk_edit_widget.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mobile/lib/ui/components/bulk_edit_widget.dart b/mobile/lib/ui/components/bulk_edit_widget.dart index 36d4619152..7ef779b989 100644 --- a/mobile/lib/ui/components/bulk_edit_widget.dart +++ b/mobile/lib/ui/components/bulk_edit_widget.dart @@ -24,7 +24,7 @@ class BulkEditDateBottomSheet extends StatefulWidget { class _BulkEditDateBottomSheetState extends State { // Single date or shift date bool showSingleOrShiftChoice = true; - bool singleSelected = true; + bool selectSingleDate = true; bool selectingDate = false; bool selectingTime = false; @@ -64,6 +64,10 @@ class _BulkEditDateBottomSheetState extends State { } final colorScheme = getEnteColorScheme(context); DateTime maxDate = DateTime.now(); + if (!selectSingleDate) { + final maxForward = DateTime.now().difference(endDate); + maxDate = startDate.add(maxForward); + } return Container( decoration: BoxDecoration( @@ -86,12 +90,12 @@ class _BulkEditDateBottomSheetState extends State { SelectDateOrShiftWidget( onSelectOneDate: () { showSingleOrShiftChoice = false; - singleSelected = true; + selectSingleDate = true; setState(() {}); }, onShiftDates: () { showSingleOrShiftChoice = false; - singleSelected = false; + selectSingleDate = false; setState(() {}); }, ), @@ -99,7 +103,7 @@ class _BulkEditDateBottomSheetState extends State { DateAndTimeWidget( key: ValueKey(selectedDate.toString()), dateTime: selectedDate, - selectDate: singleSelected, + selectDate: selectSingleDate, onPressedDate: () { selectingDate = true; selectingTime = false; @@ -139,7 +143,7 @@ class _BulkEditDateBottomSheetState extends State { context, widget.enteFiles, selectedDate, - singleSelected ? null : startDate, + selectSingleDate ? null : startDate, ); Navigator.of(context).pop(); },