mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 18:54:55 +00:00
push dragging
This commit is contained in:
@ -9,14 +9,28 @@ class DraggableCard extends StatelessWidget {
|
||||
required this.imagePath,
|
||||
required this.title,
|
||||
this.titleColor,
|
||||
this.isDragged = false,
|
||||
});
|
||||
|
||||
final String imagePath;
|
||||
final String title;
|
||||
final Color? titleColor;
|
||||
final bool isDragged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Draggable<Map<String, String>>(
|
||||
data: {'key': UniqueKey().toString(), 'imagePath': imagePath, 'title': title},
|
||||
feedback: Transform.rotate(
|
||||
angle: -0.1,
|
||||
child: _buildCardContent(context),
|
||||
),
|
||||
childWhenDragging: _buildGreyContainer(),
|
||||
child: isDragged ? _buildGreyContainer() : _buildCardContent(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCardContent(BuildContext context) {
|
||||
return Card(
|
||||
color: ColorsManager.whiteColors,
|
||||
child: SizedBox(
|
||||
@ -60,4 +74,15 @@ class DraggableCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGreyContainer() {
|
||||
return Container(
|
||||
height: 123,
|
||||
width: 90,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[100],
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user