Skip to content

Instantly share code, notes, and snippets.

@ipondroid
Created October 28, 2019 07:13
Show Gist options
  • Save ipondroid/883d03dc5982cffab32d1485ceb4d739 to your computer and use it in GitHub Desktop.
Save ipondroid/883d03dc5982cffab32d1485ceb4d739 to your computer and use it in GitHub Desktop.
DragTarget(
builder: (context, List<FlutterLogoColor> candidateData, rejectedData) {
return Container(
height: 50.0,
width: 50.0,
decoration: BoxDecoration(
color: Colors.yellow[600],
shape: BoxShape.circle
),
child: Icon(Icons.delete, size: 40, color: Colors.white70,),
);
},
onWillAccept: (data) {
if (data == FlutterLogoColor.red) {
return true;
} else {
_scaffoldKey.currentState.showSnackBar(
SnackBar(
content: Text("Not Allowed!"),
duration: Duration(seconds: 1),
));
return false;
}
},
onAccept: (data) {
_scaffoldKey.currentState.showSnackBar(
SnackBar(
content: Text("Deleted!"),
duration: Duration(seconds: 1),
backgroundColor: Colors.red,
));
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment