There's a problem. I'm new to flutter. I needed to place a TextFormField in a ReorderableListView, but at the same time I can’t shuffle the fields when I hold it for a long time, since clicking on the TextFormField is triggered.
ReorderableListView.builder(
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(5),
key: Key('$index'),
child: Container(
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
border: Border.all(color: Colors.blueAccent)),
child: Padding(
padding: const EdgeInsets.all(10),
child: TextFormField()),
),
);
},
itemCount: 3,
onReorder: (int oldIndex, int newIndex) {
context.read<MainCubit>().onReorder();
},
shrinkWrap: true,
),
I can move the TextFormField if I wrap it in an AbsorbPointer, but in this case, the TextFormField does not work.
child: AbsorbPointer(
absorbing: true,
child: Padding(
padding: const EdgeInsets.all(10),
child: TextFormField()),
),
What can you do about it? It seems to me that you can disable TextFormField’s response to long presses, but I don’t know how to do this.
Use gesture recognizers along with a custom ReadOnlyEditableText widget to allow users to input text in a TextFormField, but disable long-press actions.