ReorderableListView works well when I run it on chrome. However, when I run it on an emulator - I cannot reorder my list.
Does anybody know how to fix this?
class _MyMainAppState extends State<MyMainApp>{
late List<ValueKey> keys;
@override
void initState(){
super.initState();
keys = List.generate(10, (index) => ValueKey(index));
}
@override
Widget build(BuildContext context){
return Scaffold(
appBar: AppBar(
title: const Text('reorder list'),
),
body: ReorderableListView(
onReorder: (oldIndex, newIndex) {},
children: List.generate(
10,
(index)=> ListTile(
key: keys[index],
title: Text("Name $index"),
leading: const CircleAvatar(child: Icon(Icons.person)),
),
),
),
);
}
}
To get ReorderableListView to work on the emulator. You need to add ReorderableDragStartListener widget.