import 'package:flutter/material.dart'; import '../../../../entities/plant.dart'; class PlantDrop extends StatelessWidget { final Function(Plant) onPlantDropped; final bool showSpaceRequirement; const PlantDrop({ Key? key, required this.onPlantDropped, required this.showSpaceRequirement, }) : super(key: key); @override Widget build(BuildContext context) { return DragTarget( onAccept: (droppedItem) { onPlantDropped(droppedItem); }, builder: (context, candidateData, rejectedData) { return Container( margin: const EdgeInsets.all(0), height: showSpaceRequirement ? 100 : 100, width: 100, decoration: BoxDecoration( color: Colors.brown, borderRadius: BorderRadius.circular(8), ), padding: const EdgeInsets.all(10), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'lib/assets/layout/planting-64-white.png', ), const Expanded( child: Text('Pflanzen', style: TextStyle( color: Colors.white, )), ), ], ), ); }, ); } }