@@ -37,6 +37,7 @@ class _ManualTrackingPageState extends State<ManualTrackingPage> {
3737 final controllerFinishDate = TextEditingController ();
3838 final controllerFinishTime = TextEditingController ();
3939 final controllerDuration = TextEditingController ();
40+ final controllerNote = TextEditingController ();
4041 final valueNotifierEnableButtonSave = ValueNotifier (false );
4142
4243 var isLoading = false ;
@@ -412,6 +413,18 @@ class _ManualTrackingPageState extends State<ManualTrackingPage> {
412413 isEnabled: false ,
413414 ),
414415 const SizedBox (height: 24 ),
416+ buildWidgetField (
417+ controllerNote,
418+ label: 'reason' .tr (),
419+ hint: 'why_are_you_adding_manual_track' .tr (),
420+ isEnabled: true ,
421+ readOnly: false ,
422+ maxLength: 100 ,
423+ onChanged: (_) {
424+ doCheckEnableButtonSubmit ();
425+ },
426+ ),
427+ const SizedBox (height: 24 ),
415428 buildWidgetButtonSave (),
416429 ],
417430 ),
@@ -551,6 +564,7 @@ class _ManualTrackingPageState extends State<ManualTrackingPage> {
551564 startDate: formattedStartDateTime,
552565 finishDate: formattedFinishDateTime,
553566 duration: durationInSeconds! ,
567+ note: controllerNote.text.trim (),
554568 );
555569 manualTrackingBloc.add (
556570 CreateManualTrackingEvent (
@@ -612,18 +626,23 @@ class _ManualTrackingPageState extends State<ManualTrackingPage> {
612626 Function ()? onTap,
613627 bool isEnabled = true ,
614628 FormFieldValidator <String >? validator,
629+ bool readOnly = true ,
630+ int ? maxLength,
631+ ValueChanged <String >? onChanged,
615632 }) {
616633 return TextFormField (
617634 controller: controller,
618635 decoration: widgetHelper.setDefaultTextFieldDecoration (
619636 labelText: label,
620637 hintText: hint,
621638 ),
622- readOnly: true ,
639+ readOnly: readOnly ,
623640 mouseCursor: MaterialStateMouseCursor .clickable,
624641 onTap: onTap,
625642 validator: validator,
626643 enabled: isEnabled,
644+ maxLength: maxLength,
645+ onChanged: onChanged,
627646 );
628647 }
629648
@@ -655,22 +674,24 @@ class _ManualTrackingPageState extends State<ManualTrackingPage> {
655674 validator: validator,
656675 autovalidateMode: AutovalidateMode .onUserInteraction,
657676 padding: EdgeInsets .zero,
677+ hint: Text (hintText),
658678 decoration: widgetHelper.setDefaultTextFieldDecoration (
659679 labelText: labelText,
660- hintText: hintText,
661680 floatingLabelBehavior: FloatingLabelBehavior .always,
662681 ),
663682 );
664683 }
665684
666685 void doCheckEnableButtonSubmit () {
667686 var isEnableTemp = false ;
687+ final reason = controllerNote.text.trim ();
668688 if (selectedProject != null &&
669689 selectedTask != null &&
670690 startDate != null &&
671691 finishDate != null &&
672692 durationInSeconds != null &&
673- durationInSeconds! > 0 ) {
693+ durationInSeconds! > 0 &&
694+ reason.isNotEmpty) {
674695 isEnableTemp = true ;
675696 }
676697 if (isEnableTemp != valueNotifierEnableButtonSave.value) {
0 commit comments