From ff7fffb60bfeab3b287230bffaa72f654c7c6e08 Mon Sep 17 00:00:00 2001 From: sanat Date: Tue, 6 Jan 2026 22:19:08 +0530 Subject: [PATCH 1/4] Dropdown selection for Date type --- .../add_task_dialogue/date_picker_input.dart | 125 ++++++------------ 1 file changed, 42 insertions(+), 83 deletions(-) diff --git a/lib/app/utils/add_task_dialogue/date_picker_input.dart b/lib/app/utils/add_task_dialogue/date_picker_input.dart index 50475052..c37cd007 100644 --- a/lib/app/utils/add_task_dialogue/date_picker_input.dart +++ b/lib/app/utils/add_task_dialogue/date_picker_input.dart @@ -22,22 +22,6 @@ class _AddTaskDatePickerInputState extends State { final int length = 4; int currentIndex = 0; - int getNextIndex() => (currentIndex + 1) % length; - - int getPreviousIndex() => (currentIndex - 1) % length; - - void _showNextItem() { - setState(() { - currentIndex = getNextIndex(); - }); - } - - void _showPreviousItem() { - setState(() { - currentIndex = getPreviousIndex(); - }); - } - @override void dispose() { for (var controller in _controllers) { @@ -48,75 +32,48 @@ class _AddTaskDatePickerInputState extends State { @override Widget build(BuildContext context) { - TaskwarriorColorTheme tColors = - Theme.of(context).extension()!; - bool isNextDateSelected = _selectedDates[getNextIndex()] != null; - bool isPreviousDateSelected = _selectedDates[getPreviousIndex()] != null; - String nextDateText = isNextDateSelected - ? "${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.change} ${dateLabels[getNextIndex()]} ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.date}" - : "${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.add} ${dateLabels[getNextIndex()]} ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.date}"; - - String prevDateText = isPreviousDateSelected - ? "${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.change} ${dateLabels[getPreviousIndex()]} ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.date}" - : "${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.add} ${dateLabels[getPreviousIndex()]} ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.date}"; - return Column( - mainAxisSize: MainAxisSize.min, + return Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Display the current input field - Flexible( - child: buildDatePicker(context, currentIndex), - ), - // Navigation buttons - Visibility( - visible: !widget.onlyDueDate, - child: Row( - children: [ - Expanded( - child: TextButton.icon( - onPressed: _showPreviousItem, - label: Text( - prevDateText, - style: TextStyle( - fontSize: 12, - decoration: isPreviousDateSelected - ? TextDecoration.none - : TextDecoration.underline, - decorationStyle: TextDecorationStyle.wavy, - ), - ), - icon: Icon( - Icons.arrow_back_ios_rounded, - size: 12, - color: tColors.primaryTextColor, - ), - iconAlignment: IconAlignment.start, - ), - ), - const SizedBox(width: 8), // Space between buttons - Expanded( - child: TextButton.icon( - onPressed: _showNextItem, - label: Text( - nextDateText, - style: TextStyle( - fontSize: 12, - decoration: isNextDateSelected - ? TextDecoration.none - : TextDecoration.underline, - decorationStyle: TextDecorationStyle.wavy, + // Dropdown for date type selection + if (!widget.onlyDueDate) + Container( + margin: const EdgeInsets.only(right: 8), + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: currentIndex, + items: List.generate(length, (index) { + bool hasDate = _selectedDates[index] != null; + return DropdownMenuItem( + value: index, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text(dateLabels[index]), + if (hasDate) + const Padding( + padding: EdgeInsets.only(left: 4), + child: Icon(Icons.check_circle, + size: 14, color: Colors.green), + ), + ], ), - ), - icon: Icon( - Icons.arrow_forward_ios_rounded, - size: 12, - color: tColors.primaryTextColor, - ), - iconAlignment: IconAlignment.end, - ), + ); + }), + onChanged: (value) { + if (value != null) { + setState(() { + currentIndex = value; + }); + } + }, ), - ], + ), ), - ) + // Date picker field + Expanded( + child: buildDatePicker(context, currentIndex), + ), ], ); } @@ -130,9 +87,11 @@ class _AddTaskDatePickerInputState extends State { controller: _controllers[forIndex], decoration: InputDecoration( labelText: - '${dateLabels[forIndex]} ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.date}', + SentenceManager(currentLanguage: AppSettings.selectedLanguage) + .sentences + .date, hintText: - '${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.select} ${dateLabels[forIndex]}', + '${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.select} ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.date}', suffixIcon: const Icon(Icons.calendar_today), border: const OutlineInputBorder(), ), From a9229764fc774f031b9feefe8b3967eec165b41a Mon Sep 17 00:00:00 2001 From: sanat Date: Wed, 7 Jan 2026 10:52:25 +0530 Subject: [PATCH 2/4] Check Icon colour and position fix --- lib/app/utils/add_task_dialogue/date_picker_input.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/app/utils/add_task_dialogue/date_picker_input.dart b/lib/app/utils/add_task_dialogue/date_picker_input.dart index c37cd007..36194ef6 100644 --- a/lib/app/utils/add_task_dialogue/date_picker_input.dart +++ b/lib/app/utils/add_task_dialogue/date_picker_input.dart @@ -49,13 +49,13 @@ class _AddTaskDatePickerInputState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(dateLabels[index]), if (hasDate) const Padding( - padding: EdgeInsets.only(left: 4), + padding: EdgeInsets.only(right: 4), child: Icon(Icons.check_circle, - size: 14, color: Colors.green), + size: 14, color: Colors.white), ), + Text(dateLabels[index]), ], ), ); From ece47abd3c6ca567b56d09d0729301a207494b2e Mon Sep 17 00:00:00 2001 From: sanat Date: Thu, 8 Jan 2026 20:36:36 +0530 Subject: [PATCH 3/4] Square Checkbox icons --- .../add_task_dialogue/date_picker_input.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/app/utils/add_task_dialogue/date_picker_input.dart b/lib/app/utils/add_task_dialogue/date_picker_input.dart index 36194ef6..65a83a54 100644 --- a/lib/app/utils/add_task_dialogue/date_picker_input.dart +++ b/lib/app/utils/add_task_dialogue/date_picker_input.dart @@ -49,12 +49,15 @@ class _AddTaskDatePickerInputState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - if (hasDate) - const Padding( - padding: EdgeInsets.only(right: 4), - child: Icon(Icons.check_circle, - size: 14, color: Colors.white), - ), + Padding( + padding: const EdgeInsets.only(right: 4), + child: Icon( + hasDate + ? Icons.check_box + : Icons.check_box_outline_blank, + size: 14, + color: Colors.white), + ), Text(dateLabels[index]), ], ), From 7222796848718e8644c1ac51ef3da14e6b2c1cc9 Mon Sep 17 00:00:00 2001 From: sanat Date: Sun, 11 Jan 2026 14:23:16 +0530 Subject: [PATCH 4/4] circular icon alignment --- lib/app/utils/add_task_dialogue/date_picker_input.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/app/utils/add_task_dialogue/date_picker_input.dart b/lib/app/utils/add_task_dialogue/date_picker_input.dart index 36194ef6..fe1d6f13 100644 --- a/lib/app/utils/add_task_dialogue/date_picker_input.dart +++ b/lib/app/utils/add_task_dialogue/date_picker_input.dart @@ -42,20 +42,22 @@ class _AddTaskDatePickerInputState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( value: currentIndex, + itemHeight: null, items: List.generate(length, (index) { bool hasDate = _selectedDates[index] != null; return DropdownMenuItem( value: index, child: Row( - mainAxisSize: MainAxisSize.min, + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Text(dateLabels[index]), if (hasDate) const Padding( - padding: EdgeInsets.only(right: 4), + padding: EdgeInsets.only(left: 12), child: Icon(Icons.check_circle, size: 14, color: Colors.white), ), - Text(dateLabels[index]), ], ), );