56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'spaces.dart';
|
|
|
|
class CustomDropdown extends StatelessWidget {
|
|
final String? value;
|
|
final List<String> items;
|
|
final String label;
|
|
final Function(String? value)? onChanged;
|
|
|
|
const CustomDropdown({
|
|
super.key,
|
|
required this.value,
|
|
required this.items,
|
|
required this.label,
|
|
this.onChanged,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
const SpaceHeight(12.0),
|
|
DropdownButtonFormField<String>(
|
|
value: value,
|
|
onChanged: onChanged,
|
|
items: items.map((String item) {
|
|
return DropdownMenuItem<String>(
|
|
value: item,
|
|
child: Text(item),
|
|
);
|
|
}).toList(),
|
|
decoration: InputDecoration(
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16.0),
|
|
borderSide: const BorderSide(color: Colors.grey),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(16.0),
|
|
borderSide: const BorderSide(color: Colors.grey),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|