Abhilash-Chandran / number_inc_dec

A flutter widget to accept numeric inputs with button to increment and decrement.

Home Page:https://pub.dev/packages/number_inc_dec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Cursor position is not proper after using inc/dec buttons

GAM3RG33K opened this issue ยท comments

Issue:
I am using this plugin to take user input for a demo.

What I have observed is that once the input field gets focus it shows cursor properly. But after the cursor is visible if you use the increment & decrement buttons then the cursor moves in the center of the text.

It seems that it can be solved by removing the focus from text field when user clicks any of the buttons.
This is my take on the solution, but I do not know the reason behind this, so this might be the exact solution.

If you need more details regarding this issue then please tag me in the comments of this issue, I'll try to get back to you as soon as possible.

Code I used to create the input field with customizations:

NumberInputWithIncrementDecrement(
  controller: _controller,
  initialValue: _units,
  isInt: true,
  widgetContainerDecoration: BoxDecoration(
     borderRadius: BorderRadius.circular(5.0),
     border: Border.all(
     color: Color(0xFFE0E0E0),
     width: 2.0,
    ),
  ),
  onIncrement: _updateUnits,
  onDecrement: _updateUnits,
  autovalidate: true,
  validator: (value) {
            // code omitted
  },
 ),

Please check the attached video for reproduction steps:

signal-2021-04-16-124902.mp4

@GAM3RG33K Thanks lot for reporting this issue ๐Ÿ’ฏ ๐Ÿ‘ . I have already found and fixed this issue couple of months ago ๐Ÿ˜„ .

// Sets the text to the controller and corrects the cursor position.

I haven't released this yet as I am busy with my thesis and also one major issue is pending for that release which involve increment based on steps and validation. However I will be free by end of May and will push a major release as early as possible. Hope its ok.

@Abhilash-Chandran

Hi, thanks for the quick response, If you have already resolved this issue then would you recommend using the master branch checkout?

I need to resolve this for my app demo to client.

I will move to latest stable release of the plugin by next update.

Unfortunately its in a different branch. So switching to Master won't help and I wouldn't recommend to switching to the branch with the fix either. Cause that has other issue merged in it. I am sorry about that ๐Ÿ˜ž

ok then, I'll wait for the plugin update.

Anyway, thanks for creating this plugin it has saved me a significant amount time, I really appreciate it.

Great job.