I want to create a Text widget that has on top left an icon that will allow the Text to be edited by the user, but I can't manage to put the icon on the top left of the Text, like in the photo attached below for the text "Home". I've searched similar questions, but I've did not encountered anything similar.
Do you have any idea how can I achieve what I desire?
You can achieve this using Stack
:
Stack(
clipBehavior: Clip.none,
children: [
const Text("1. Home", style: TextStyle(color: Colors.black,
fontSize: 16, fontWeight: FontWeight.bold),),
Positioned(
top: -2.5, right: -10,
child: GestureDetector(
onTap: (){
print("edit pressed");
},
child: const Icon(Icons.edit, size: 12,),
)
)
],
)