Unverified Commit 5b19328f authored by Sanjoli Goyal's avatar Sanjoli Goyal Committed by GitHub

Update ReorderableListView API docs (#69650)

* Update ReorderableListView API docs

* fixed dart fmt

* added dartpad instead of code sample

* fixed parenthesis error

* Update packages/flutter/lib/src/material/reorderable_list.dart
Co-authored-by: 's avatarAmit Patil <54329870+Amitpatil215@users.noreply.github.com>

* using reference List.generate instead of generate

* request changes are complete

* space eroors are fixed

* Update ReorderableListView API docs

* fixed dart fmt

* added dartpad instead of code sample

* fixed parenthesis error

* using reference List.generate instead of generate

* Update packages/flutter/lib/src/material/reorderable_list.dart
Co-authored-by: 's avatarAmit Patil <54329870+Amitpatil215@users.noreply.github.com>

* request changes are complete

* space eroors are fixed

* request changes are completes
Co-authored-by: 's avatarAmit Patil <54329870+Amitpatil215@users.noreply.github.com>
Co-authored-by: 's avatarJohn Ryan <ryjohn@google.com>
parent 600c9921
......@@ -54,6 +54,42 @@ typedef ReorderCallback = void Function(int oldIndex, int newIndex);
/// All [children] must have a key.
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=3fB1mxOsqJE}
///
/// This sample shows by dragging the user can reorder the items of the list.
/// The [onReorder] parameter is required and will be called when a child
/// widget is dragged to a new position.
///
/// {@tool dartpad --template=stateful_widget_scaffold}
///
/// ```dart
/// List<String> _list = List.generate(5, (i) => "${i}");
///
/// Widget build(BuildContext context){
/// return ReorderableListView(
/// padding : const EdgeInsets.symmetric(horizontal:40),
/// children:[
/// for(var i=0 ; i<_list.length ; i++)
/// ListTile(
/// key:Key('$i'),
/// title: Text(_list[i]),
/// ),
/// ],
/// onReorder: (oldIndex, newIndex){
/// setState((){
/// if(oldIndex < newIndex){
/// newIndex-=1;
/// }
/// final element = _list.removeAt(oldIndex);
/// _list.insert(newIndex, element);
/// });
/// },
/// );
/// }
///
/// ```
///
///{@end-tool}
///
class ReorderableListView extends StatefulWidget {
/// Creates a reorderable list.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment