47 lines
1.2 KiB
Dart
47 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:getwidget/getwidget.dart';
|
|
|
|
class DropdownSelect extends StatelessWidget {
|
|
final String value;
|
|
final ValueChanged<String?> onChanged;
|
|
final List<String> items;
|
|
|
|
const DropdownSelect({
|
|
Key? key,
|
|
required this.value,
|
|
required this.onChanged,
|
|
required this.items,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final colors = Theme.of(context).colorScheme;
|
|
|
|
return Container(
|
|
width: 150,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(6),
|
|
border: Border.all(color: colors.primary, width: 1.5),
|
|
),
|
|
child: DropdownButtonHideUnderline(
|
|
child: GFDropdown(
|
|
itemHeight: 32,
|
|
padding: const EdgeInsets.all(0),
|
|
borderRadius: BorderRadius.circular(8),
|
|
value: value,
|
|
onChanged: onChanged,
|
|
items:
|
|
items
|
|
.map(
|
|
(value) => DropdownMenuItem(
|
|
value: value,
|
|
child: Text(value, style: const TextStyle(fontSize: 16)),
|
|
),
|
|
)
|
|
.toList(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|