OverPoweredDev / Junior

A bookmarking app specialised towards online webnovels. Built in Flutter and Dart.
GNU General Public License v3.0
26 stars 9 forks source link

Select all text for certain TextFields #6

Closed OverPoweredDev closed 3 years ago

OverPoweredDev commented 3 years ago

Is your feature request related to a problem? Please describe. When updating chapter numbers and all, selecting the text box puts down a caret right where you press it. This is useful for the notes and title section maybe but all the other textfields (currChapter, totalChapters and novelLink) seem like they need to be selected all at once when pressed.

Describe the solution you'd like Simply make it so onPress on these textfields (currChapter, totalChapters and novelLink) selects all the text within

Additional context This stackoverflow answer seems like a good place to start. But if you can do it without passing a textController, that's be best. Something like what I've done here by creating a new one for specifically for that function.

https://github.com/OverPoweredDev/Junior/blob/b7c74dce5f92749941b8a685e83f6b73f0418cd8/src/lib/details_page/components/chapter_progress.dart#L74-L78

Samdid commented 3 years ago

Hey @OverPoweredDev, can you please assign it to me, I would like to contribute to this?

OverPoweredDev commented 3 years ago

Sure!

OverPoweredDev commented 3 years ago

@Samdid If you haven't started yet, update your fork asap. There's been a buncha updates and it's best you fetch now to avoid merge conflicts.

Also the work you'll be doing still remains the same, don't worry. You just need to edit class ChapterInputField so it selects all text on an OnTap()

https://github.com/OverPoweredDev/Junior/blob/37aff09c78b6a9781059b3073c81650859245046/src/lib/details_page/components/chapter_progress.dart#L226-L259

Samdid commented 3 years ago

Okay

Samdid commented 3 years ago

Is your feature request related to a problem? Please describe. When updating chapter numbers and all, selecting the text box puts down a caret right where you press it. This is useful for the notes and title section maybe but all the other textfields (currChapter, totalChapters and novelLink) seem like they need to be selected all at once when pressed.

Describe the solution you'd like Simply make it so onPress on these textfields (currChapter, totalChapters and novelLink) selects all the text within

Additional context This stackoverflow answer seems like a good place to start. But if you can do it without passing a textController, that's be best. Something like what I've done here by creating a new one for specifically for that function.

https://github.com/OverPoweredDev/Junior/blob/b7c74dce5f92749941b8a685e83f6b73f0418cd8/src/lib/details_page/components/chapter_progress.dart#L74-L78

I think just giving value of 'TextEditingController()' to controller will not allow to enter text in that textfield. I just tried doing that but when I type something, it doesn't show any text in textfield. I think we have to give a seperate controller to the textfield

OverPoweredDev commented 3 years ago

If you have to create a separate controller, that's fine too.

also the TextEditingController() is not there to enter text, I only wanted to preset text to the value in our database so I had to use the TextEditingController.text property

Just ensure that the existing features are still maintained (such as not displaying anything when the chapterNum == 0). Ultimately all we want is that on Tapping the textfield, it should select everything, not just put down a cursor on the tap location

Samdid commented 3 years ago

Yeah okay