From ed646ccba2b4760cca34d8489cfd304ff4e6866e Mon Sep 17 00:00:00 2001 From: Mathias Mogensen <42929161+Xazin@users.noreply.github.com> Date: Sun, 5 Jan 2025 14:02:29 +0100 Subject: [PATCH] chore: add loose restrictions to date time text field (#7024) * chore: add loose restrictions to date time text field * chore: remove date formatter --- .../date_picker/widgets/date_time_text_field.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart index acd50ce764..553ffb4c0d 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_time_text_field.dart @@ -301,6 +301,14 @@ class _DateTimeTextFieldState extends State { focusNode: timeFocusNode, controller: timeTextController, style: Theme.of(context).textTheme.bodyMedium, + maxLength: widget.timeFormat == TimeFormatPB.TwelveHour + ? 8 // 12:34 PM = 8 characters + : 5, // 12:34 = 5 characters + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[0-9:AaPpMm]'), + ), + ], decoration: getInputDecoration( const EdgeInsetsDirectional.fromSTEB(6, 6, 12, 6), timeFormat.format(hintDate), @@ -359,6 +367,7 @@ class _DateTimeTextFieldState extends State { isCollapsed: true, isDense: true, hintText: widget.showHint ? hintText : null, + counterText: "", hintStyle: Theme.of(context) .textTheme .bodyMedium