71 lines
1.9 KiB
Dart
71 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'plant.dart';
|
|
|
|
class Sidebar extends StatelessWidget {
|
|
List<Plant> sidebarItems = [
|
|
Plant(
|
|
name: 'Pflanze 1',
|
|
waterRequirement: 3,
|
|
horizontalSpace: 2,
|
|
verticalSpace: 2,
|
|
),
|
|
Plant(
|
|
name: 'Pflanze 2',
|
|
waterRequirement: 5,
|
|
horizontalSpace: 1,
|
|
verticalSpace: 3,
|
|
),
|
|
Plant(
|
|
name: 'Pflanze 3',
|
|
waterRequirement: 2,
|
|
horizontalSpace: 3,
|
|
verticalSpace: 1,
|
|
),
|
|
];
|
|
|
|
Sidebar({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
for (var plant in sidebarItems)
|
|
Draggable<Plant>(
|
|
data: plant,
|
|
child: Container(
|
|
padding: EdgeInsets.all(8),
|
|
margin: EdgeInsets.all(4),
|
|
color: Colors.white,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(plant.name),
|
|
Text('Wasserbedarf: ${plant.waterRequirement}'),
|
|
Text('Platzbedarf: ${plant.horizontalSpace} x ${plant
|
|
.verticalSpace}'),
|
|
],
|
|
),
|
|
),
|
|
feedback: Container(
|
|
padding: EdgeInsets.all(8),
|
|
margin: EdgeInsets.all(4),
|
|
color: Colors.blue[200],
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(plant.name),
|
|
Text('Wasserbedarf: ${plant.waterRequirement}'),
|
|
Text('Platzbedarf: ${plant.horizontalSpace} x ${plant
|
|
.verticalSpace}'),
|
|
],
|
|
),
|
|
),
|
|
childWhenDragging: Container(),
|
|
)
|
|
]
|
|
);
|
|
}
|
|
}
|