From 417aa7baa63a525b170e85cba0495e301c3d6249 Mon Sep 17 00:00:00 2001 From: Julius Bredemeyer <48645716+IVLIVS-III@users.noreply.github.com> Date: Wed, 29 Jun 2022 13:45:40 +0200 Subject: [PATCH] Added an idea to fix the Cursor and HintText issue. --- lib/src/cursor/cursor_painter.dart | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/src/cursor/cursor_painter.dart b/lib/src/cursor/cursor_painter.dart index 9a407c2..8d355de 100644 --- a/lib/src/cursor/cursor_painter.dart +++ b/lib/src/cursor/cursor_painter.dart @@ -7,6 +7,33 @@ abstract class ICursorPaint { } mixin CursorPaint implements ICursorPaint { + /* Try and fix [Cursor] overriding [HintText] due to them being + * displayed in the same location on screen (both entered in the box). + * Idea: + * - [Cursor] and [HintText] should coexist and be displayed at the + * same time + * - for visual integrity, entering a character and changing visual + * focus to the next pin field should lead to only minimal changes + * -> [HintText] should not have a different position with/without + * [Cursor] + * -> [HintText] should be displayed in the center of the box + * -> [Cursor] should not be displayed in the center of the box if a + * [HintText] is also present + * -> [Cursor] should be displayed in front of [HintText] or behind + * - [Cursor] typically is (on input fields with left-justified text) after + * already typed characters + * - [HintText] typically is displayed only when no characters have been + * entered yet + * -> [Cursor] should be displayed in front of the [HintText] at least + * with TextDirection.LTR + * - for minimal disruption in the existing codebase, this fix proposes to + * add an optional positional or named Parameter [Offset] offset with a + * default value of Offset.zero + * - the offset would be added to the location given by rect prior to + * drawing + * - this function can then be called offsetting the [Cursor] to be drawn + * to the left or right of [HintText] + */ @override void drawCursor(Canvas canvas, Size size, Rect rect, Cursor cursor) { Paint paint = Paint()