renderInput method
Implementation
@override
Widget renderInput() {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
DropdownButton<String>(
value:
_selectedValue != null && _optionExists(_selectedValue!)
? _selectedValue
: null,
hint: Text(widget.placeholder ?? 'Select an option'),
isExpanded: true,
onChanged: (String? newValue) {
setState(() => _selectedValue = newValue);
},
items:
_options.map((option) {
return DropdownMenuItem<String>(
value: option.value,
child: Text(option.label),
);
}).toList(),
),
const SizedBox(height: 12),
ElevatedButton(
onPressed: _selectedValue != null ? handleSubmit : null,
child: const Text('Submit'),
),
],
);
}