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
ee5c080d
Unverified
Commit
ee5c080d
authored
Nov 02, 2020
by
Jivansh Sharma
Committed by
GitHub
Nov 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Draggable API Docs (#69527)
parent
50970cd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
drag_target.dart
packages/flutter/lib/src/widgets/drag_target.dart
+67
-0
No files found.
packages/flutter/lib/src/widgets/drag_target.dart
View file @
ee5c080d
...
...
@@ -99,6 +99,73 @@ enum DragAnchor {
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=QzA4c4QHZCY}
///
/// {@tool dartpad --template=stateful_widget_material}
///
/// The following example has a [Draggable] widget along with a [DragTarget]
/// in a row demonstrating an incremented `acceptedData` integer value when
/// you drag the element to the target.
///
/// ```dart
/// int acceptedData = 0;
/// Widget build(BuildContext context) {
/// return Row(
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
/// children: [
/// Draggable<int>(
/// // Data is the value this Draggable stores.
/// data: 10,
/// child: Container(
/// height: 100.0,
/// width: 100.0,
/// color: Colors.lightGreenAccent,
/// child: Center(
/// child: Text("Draggable"),
/// ),
/// ),
/// feedback: Container(
/// color: Colors.deepOrange,
/// height: 100,
/// width: 100,
/// child: Icon(Icons.directions_run),
/// ),
/// childWhenDragging: Container(
/// height: 100.0,
/// width: 100.0,
/// color: Colors.pinkAccent,
/// child: Center(
/// child: Text("Child When Dragging"),
/// ),
/// ),
/// ),
/// DragTarget(
/// builder: (
/// BuildContext context,
/// List<dynamic> accepted,
/// List<dynamic> rejected,
/// ) {
/// return Container(
/// height: 100.0,
/// width: 100.0,
/// color: Colors.cyan,
/// child: Center(
/// child: Text("Value is updated to: $acceptedData"),
/// ),
/// );
/// },
/// onAccept: (int data) {
/// setState(() {
/// acceptedData += data;
/// });
/// },
/// ),
/// ],
/// );
/// }
///
/// ```
///
/// {@end-tool}
///
/// See also:
///
/// * [DragTarget]
...
...
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