Skip to content

Instantly share code, notes, and snippets.

Animation _animation = Tween(begin: 0.0, end: 1.0).animate(type_of_animation);
Animation transformAnimation = BorderRadiusTween(
begin: BorderRadius.circular(125.0),
end: BorderRadius.circular(0.0).animate(type_of_animation);
/////////////// OR ///////////////
Animation transformAnimation = Tween<BorderRadius>(
begin: BorderRadius.circular(125.0),
end: BorderRadius.circular(0.0).animate(type_of_animation);
AnimationController _animationController =
AnimationController(vsync: this, duration: Duration(seconds: 1));
Animation _animation = Tween(begin: 0.0, end: -0.15).animate(
CurvedAnimation(curve: Curves.ease, parent: _animationController));
Draggable(
data: 'Flutter',
child: FlutterLogo(
size: 100.0,
),
feedback: FlutterLogo(
size: 100.0,
),
childWhenDragging: Container(),
)
DragTarget(
builder: (context, List<String> candidateData, rejectedData) {
return Center(
child: isSuccessful
? Padding(
padding: EdgeInsets.only(top: 100.0),
child: Container(
color: Colors.yellow,
height: 200.0,
width: 200.0,
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Drag and Drop Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.green),
routes: <String, WidgetBuilder>{
const Color GRAY_COLOR = Colors.grey;
const Color BROWN_COLOR = Colors.brown;
const Color RED_COLOR = Colors.red;
const Color ORANGE_COLOR = Colors.orange;
const Color BLUE_COLOR = Colors.blue;
const Color GREEN_COLOR = Colors.green;
const Color WHITE_COLOR = Colors.white;
const String APP_BAR_TITLE = 'Drag & Drop Demo';
const String NO_ITEMS_LEFT = 'No Items Left';
const String JAVA = 'Java';
const String PHP = 'PHP';
const String KOTLIN = 'Kotlin';
const String FLUTTER = 'Flutter';
const String NODEJS = 'Nodejs';
const DROP_ITEMS_HERE = 'Drop Items Here';
class CardItem {
String content;
Color cardColor;
double margin;
CardItem({this.content, this.cardColor, this.margin});
}
class Constants{
static String SPLASH_SCREEN='SPLASH_SCREEN';
static String HOME_SCREEN='HOME_SCREEN';
static List<CardItem> initializeList(List<CardItem> itemList){
itemList = [
CardItem(content: JAVA, cardColor: BROWN_COLOR),
CardItem(content: PHP, cardColor: RED_COLOR),