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: Amit 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: Amit Patil <54329870+Amitpatil215@users.noreply.github.com>

* request changes are complete

* space eroors are fixed

* request changes are completes

Co-authored-by: Amit Patil <54329870+Amitpatil215@users.noreply.github.com>
Co-authored-by: John Ryan <ryjohn@google.com>
This commit is contained in:
Sanjoli Goyal 2020-11-12 00:58:57 +05:30 committed by GitHub
parent 600c99213a
commit 5b19328ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.