Adjust style of app dropdown button

This commit is contained in:
Hillel Coren 2023-11-08 16:52:27 +02:00
parent 8dfe0e38d1
commit 5bb5d4ce57
1 changed files with 18 additions and 17 deletions

View File

@ -34,25 +34,26 @@ class AppDropdownButton<T> extends StatelessWidget {
} }
final bool isEmpty = checkedValue == null || checkedValue == ''; final bool isEmpty = checkedValue == null || checkedValue == '';
Widget dropDownButton = DropdownButtonHideUnderline( Widget dropDownButton = DropdownButtonFormField<T>(
child: DropdownButton<T>( decoration: labelText != null
value: checkedValue, ? InputDecoration(label: Text(labelText!))
isExpanded: true, : InputDecoration.collapsed(hintText: ''),
isDense: labelText != null, value: checkedValue == blankValue ? null : checkedValue,
onChanged: enabled ? onChanged : null, isExpanded: true,
selectedItemBuilder: selectedItemBuilder, isDense: labelText != null,
items: [ onChanged: enabled ? onChanged : null,
if (showBlank || isEmpty) selectedItemBuilder: selectedItemBuilder,
DropdownMenuItem<T>( items: [
value: blankValue, if (showBlank || isEmpty)
child: blankLabel == null ? SizedBox() : Text(blankLabel!), DropdownMenuItem<T>(
), value: blankValue,
...items child: blankLabel == null ? SizedBox() : Text(blankLabel!),
], ),
), ...items
],
); );
if (labelText != null) { if (false && labelText != null) {
dropDownButton = InputDecorator( dropDownButton = InputDecorator(
decoration: InputDecoration( decoration: InputDecoration(
labelText: labelText!.isEmpty ? null : labelText, labelText: labelText!.isEmpty ? null : labelText,