Home > other >  Flutter - How to implement inline editing?
Flutter - How to implement inline editing?

Time:04-29

I found a similar behaviour on Safari:

enter image description here

CodePudding user response:

This can be done by having a StatefulWidget that keeps track of the state, by using a boolean for example. Let's say this bool is named editing. When editing == false you display a Text widget with the text to display, wrapped within a handler for the tap, such as a GestureDetector. When the user taps, the state is changed to editing = true. In this state you'll display a TextField with this value. You can use a TextEditingController within in this StatefulWidget and update its value there. This would allow you to up have all text selected when the user taps and changes to the editing state

CodePudding user response:

The problem statement is that on tap of normal text, the text field should be editable and we can able to edit the text.

answer

  • Related