Skip to content

Commit

Permalink
Added an idea to fix the Cursor and HintText issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
IVLIVS-III authored and TinoGuo committed Sep 9, 2022
1 parent 1f03db7 commit 417aa7b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/src/cursor/cursor_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 417aa7b

Please sign in to comment.