Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
9a7eae0c
Unverified
Commit
9a7eae0c
authored
Apr 07, 2021
by
Mahesh Jamdade
Committed by
GitHub
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: add an example to ReorderableListView.builder (#79193)
docs: add an example to ReorderableListView.builder.
parent
a637fcd3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
reorderable_list.dart
packages/flutter/lib/src/material/reorderable_list.dart
+38
-0
No files found.
packages/flutter/lib/src/material/reorderable_list.dart
View file @
9a7eae0c
...
@@ -121,6 +121,44 @@ class ReorderableListView extends StatefulWidget {
...
@@ -121,6 +121,44 @@ class ReorderableListView extends StatefulWidget {
/// constructor. Even more efficient, however, is to create the instances
/// constructor. Even more efficient, however, is to create the instances
/// on demand using this constructor's `itemBuilder` callback.
/// on demand using this constructor's `itemBuilder` callback.
///
///
/// This example creates a list using the
/// [ReorderableListView.builder] constructor. Using the [IndexedWidgetBuilder], The
/// list items are built lazily on demand.
/// {@tool dartpad --template=stateful_widget_material}
///
/// ```dart
/// final List<int> _items = List<int>.generate(50, (int index) => index);
///
/// @override
/// Widget build(BuildContext context) {
/// final ColorScheme colorScheme = Theme.of(context).colorScheme;
/// final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
/// final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
///
/// return ReorderableListView.builder(
/// padding: const EdgeInsets.symmetric(horizontal: 40),
/// itemCount:_items.length,
/// itemBuilder: (BuildContext context, int index) {
/// return ListTile(
/// key: Key('$index'),
/// tileColor: _items[index].isOdd ? oddItemColor : evenItemColor,
/// title: Text('Item ${_items[index]}'),
/// );
/// },
/// onReorder: (int oldIndex, int newIndex) {
/// setState(() {
/// if (oldIndex < newIndex) {
/// newIndex -= 1;
/// }
/// final int item = _items.removeAt(oldIndex);
/// _items.insert(newIndex, item);
/// });
/// },
/// );
/// }
///
/// ```
/// {@end-tool}
/// See also:
/// See also:
///
///
/// * [ReorderableListView], which allows you to build a reorderable
/// * [ReorderableListView], which allows you to build a reorderable
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment