-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathlist_property.dart
More file actions
42 lines (38 loc) · 1.07 KB
/
list_property.dart
File metadata and controls
42 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import 'package:dashbook/dashbook.dart';
import 'package:flutter/material.dart';
class ListPropertyWidget<T> extends StatefulWidget {
final ListProperty<T> property;
final PropertyChanged onChanged;
const ListPropertyWidget({
required this.property,
required this.onChanged,
super.key,
});
@override
State<StatefulWidget> createState() => ListPropertyState<T>();
}
class ListPropertyState<T> extends State<ListPropertyWidget<T>> {
@override
Widget build(BuildContext context) {
return PropertyScaffold(
tooltipMessage: widget.property.tooltipMessage,
label: widget.property.name,
child: DropdownButton<T>(
isExpanded: true,
value: widget.property.getValue(),
onChanged: (value) {
widget.property.value = value;
widget.onChanged();
},
items: widget.property.list
.map(
(value) => DropdownMenuItem<T>(
value: value,
child: Text(value.toString()),
),
)
.toList(),
),
);
}
}