Line data Source code
1 : import 'package:amadeus_proto/constants.dart';
2 : import 'package:flutter/material.dart';
3 : import 'theory_dragtarget_item.dart';
4 :
5 : /// Widget to create a Dragable Target Item
6 : ///
7 : /// - [imagePath] is a [String] that corresponds to the image filepath
8 : /// - [answer] is the [String] that corresponds to the data of this item
9 : ///
10 : /// This widget will display image, loaded from the [imagePath], and need to be
11 : /// drop on a [DragTargetItem].
12 : class DragableItem extends StatelessWidget {
13 0 : const DragableItem({super.key, required this.imagePath, required this.data});
14 :
15 : final String imagePath;
16 : final String data;
17 :
18 0 : @override
19 : Widget build(BuildContext context) {
20 0 : return Draggable(
21 0 : data: data,
22 0 : feedback: Image.asset(imagePath, width: 25),
23 : childWhenDragging:
24 0 : Container(
25 : height: 50,
26 : width: 50,
27 : decoration: const BoxDecoration(
28 : color: Color.fromARGB(255, 235, 239, 255),
29 : borderRadius: BorderRadius.all(Radius.circular(smallBorderRadius)),
30 : boxShadow: [
31 : BoxShadow(
32 : color: Colors.black54,
33 : blurRadius: 2,
34 : offset: Offset(0, 5),
35 : blurStyle: BlurStyle.solid)
36 : ]),
37 0 : child: Image.asset(imagePath, width: 50,),
38 : ),
39 0 : child: Container(
40 : height: 50,
41 : width: 50,
42 : decoration: const BoxDecoration(
43 : color: Color.fromARGB(255, 235, 239, 255),
44 : borderRadius: BorderRadius.all(Radius.circular(smallBorderRadius)),
45 : boxShadow: [
46 : BoxShadow(
47 : color: Colors.black54,
48 : blurRadius: 2,
49 : offset: Offset(0, 5),
50 : blurStyle: BlurStyle.solid)
51 : ]),
52 0 : child: Image.asset(imagePath, width: 50,),
53 : )
54 : );
55 : }
56 : }
|