I need help understanding how to use this widget. Right now I am able to get the items to be draggable, but they do not stay on their new spot. I am certain it is because I am using onReorder wrong, but I cannot find an explanation on how. I do not understand or know what it does, and I just kept trying things until it at least could compile.
class MainScreen extends StatefulWidget {
@override
MainScreenState createState() => new MainScreenState();
}
class MainScreenState extends State<MainScreen> {
Widget build(context) {
final List<Widget> reorderList = <Widget>[
Container(key: Key('1'), child: Icon(Icons.ac_unit),),
Container(key: Key('2'), child: Icon(Icons.access_alarm),),
Container(key: Key('3'), child: Icon(Icons.access_time),),
Container(key: Key('4'), child: Icon(Icons.accessibility),),
Container(key: Key('5'), child: Icon(Icons.account_box),),
Container(key: Key('6'), child: Icon(Icons.account_balance),),
];
return Scaffold(
appBar: AppBar(
title: Text('test'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.refresh),
onPressed: () {
setState(() {});
},
)
],
),
drawer: Drawer(child: SideDrawer(context)),
body: ReorderableListView(
onReorder: (reorderList, reorderlist) => reorderList ,
children: reorderList,
));
}
}
The page that leads here for thoroughness is as follows:
class App extends StatelessWidget {
build(context) {
return Provider(
child: MaterialApp(
theme: themeData,
title: '',
home: MainScreen(),
onGenerateRoute: routes,
),
);
}
Any help would be very much appreciated, I do not understand the Documentation for ReorderableListView so please do not just link me there.
Thank you so much for any help, it will all be appreciated.