Skip to content

Instantly share code, notes, and snippets.

@hl3hl3
Last active October 26, 2019 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hl3hl3/15a4e33609b97cb5197b5298c5cdacd6 to your computer and use it in GitHub Desktop.
Save hl3hl3/15a4e33609b97cb5197b5298c5cdacd6 to your computer and use it in GitHub Desktop.
DragTarget example
DragTarget(
builder: (context, candidateData, rejectedData) {
return Container(
width: 200,
height: 200,
color: _acceptedColor,
);
},
onWillAccept: (MaterialColor data) {
debugPrint('onWillAccept()');
return true;
},
onAccept: (MaterialColor data) {
debugPrint('onAccept()');
setState(() {
_acceptedColor = data;
});
},
onLeave: (MaterialColor data) {
debugPrint('onLeave()');
setState(() {
_acceptedColor = Colors.grey;
});
},
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment