Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to edit particular digit and change it to new value without deleting other digits? #92

Closed
Aashutosh3804 opened this issue May 29, 2022 · 11 comments

Comments

@Aashutosh3804
Copy link

Aashutosh3804 commented May 29, 2022

I want user to be able to edit any value in-between that is they should be able to click on particular field and edit it rather than deleting all the previous values to edit that place
How I can achieve this ?

@Tkko
Copy link
Owner

Tkko commented May 29, 2022

Hi, good idea, but that's not possible with current implementation.

@Aashutosh3804
Copy link
Author

Hi, good idea, but that's not possible with current implementation.

Any workaround you can suggest, to change in library to accomplish it? it will be really helpful just any hint

@Tkko
Copy link
Owner

Tkko commented May 30, 2022

selected index should return the position of the cursor

int get selectedIndex => pin.length;

int get selectedIndex => _effectiveController.selection.baseOffset;

And when you tap on individual boxes you have to change the cursor position respectively

_effectiveController.selection = TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

@Aashutosh3804
Copy link
Author

Aashutosh3804 commented May 30, 2022

TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

Thank you very much for such prompt reply
just one last thing tappedPinIndex how would I get that as in _semanticsOnTap I did'nt get any index

_effectiveController.selection = TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

this line should changed in _semanticsOnTap right ? just tell me how to get the tapped index

@Tkko
Copy link
Owner

Tkko commented May 30, 2022

TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

Thank you very much for such prompt reply just one last thing tappedPinIndex how would I get that as in _semanticsOnTap I did'nt get any index

_effectiveController.selection = TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

this line should changed in _semanticsOnTap right ? just tell me how to get the tapped index

Nope, you should add onTap callback in _PinItem with GestureDetector

return _PinItem(state: this, index: index);

@Aashutosh3804
Copy link
Author

Aashutosh3804 commented May 30, 2022

TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

Thank you very much for such prompt reply just one last thing tappedPinIndex how would I get that as in _semanticsOnTap I did'nt get any index
_effectiveController.selection = TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));
this line should changed in _semanticsOnTap right ? just tell me how to get the tapped index

Nope, you should add onTap callback in _PinItem with GestureDetector

return _PinItem(state: this, index: index);

Its not working. Firstly I want to be able to select any field and change its value. So when its empty it showing error as there no text yet written.
Is there a way to do that

@Tkko
Copy link
Owner

Tkko commented May 30, 2022

TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

Thank you very much for such prompt reply just one last thing tappedPinIndex how would I get that as in _semanticsOnTap I did'nt get any index
_effectiveController.selection = TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));
this line should changed in _semanticsOnTap right ? just tell me how to get the tapped index

Nope, you should add onTap callback in _PinItem with GestureDetector

return _PinItem(state: this, index: index);

Its not working. Firstly I want to be able to select any field and change its value. So when its empty it showing error as there no text yet written. Is there a way to do that

What I wrote was not the whole solution, just the way I imagined implementing it, I will to add the feature ASAP, but can't tell you the deadline RN.

Update:
Just tried it a bit and I can say it will introduce new problems to solve, so it's not an easy feature to add

@Aashutosh3804
Copy link
Author

TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));

Thank you very much for such prompt reply just one last thing tappedPinIndex how would I get that as in _semanticsOnTap I did'nt get any index
_effectiveController.selection = TextSelection.fromPosition(TextPosition(offset: tappedPinIndex));
this line should changed in _semanticsOnTap right ? just tell me how to get the tapped index

Nope, you should add onTap callback in _PinItem with GestureDetector

return _PinItem(state: this, index: index);

Its not working. Firstly I want to be able to select any field and change its value. So when its empty it showing error as there no text yet written. Is there a way to do that

What I wrote was not the whole solution, just the way I imagined implementing it, I will to add the feature ASAP, but can't tell you the deadline RN.

Update: Just tried it a bit and I can say it will introduce new problems to solve, so it's not an easy feature to add

Oh ok , thanks for trying will think of different way

@nicks258
Copy link

Any update on this feature? @Tkko ?

@Tkko
Copy link
Owner

Tkko commented Apr 10, 2023

@nicks258 Nothing so far, my weekends are pretty busy these days 🫢, If anyone is available to implement this feature I'd be happy review and merge the PR

@Ssiswent
Copy link

Ssiswent commented Oct 11, 2023

How about now? Thanks.@Tkko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants