32 lines
704 B
Dart
32 lines
704 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class CustomDropdown extends StatelessWidget {
|
|
late List<String>? items;
|
|
late VoidCallback onChanged;
|
|
String? hint;
|
|
CustomDropdown(
|
|
{super.key,
|
|
required items,
|
|
required hint,
|
|
required Null Function() onChanged});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: 200,
|
|
child: DropdownButton<String>(
|
|
hint: Text(hint!),
|
|
items: items!.map((String value) {
|
|
return DropdownMenuItem<String>(
|
|
value: value,
|
|
child: Text(value),
|
|
);
|
|
}).toList(),
|
|
onChanged: (value) {
|
|
onChanged();
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|