Unverified Commit ee5c080d authored by Jivansh Sharma's avatar Jivansh Sharma Committed by GitHub

Update Draggable API Docs (#69527)

parent 50970cd7
......@@ -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]
......
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