Created
October 28, 2019 07:13
-
-
Save ipondroid/883d03dc5982cffab32d1485ceb4d739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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