|
|
|
@ -28,8 +28,11 @@ class DropdownField extends StatefulWidget {
|
|
|
|
|
final Function(DropValue) onSelect;
|
|
|
|
|
final bool showAppointmentPickerVariant;
|
|
|
|
|
final TextStyle? textStyle;
|
|
|
|
|
final bool isSelectAble;
|
|
|
|
|
|
|
|
|
|
const DropdownField(this.onSelect, {Key? key, this.hint, this.list, this.dropdownValue, this.errorValue = "", this.showAppointmentPickerVariant = false, this.textStyle}) : super(key: key);
|
|
|
|
|
const DropdownField(this.onSelect,
|
|
|
|
|
{Key? key, this.hint, this.list, this.dropdownValue, this.errorValue = "", this.showAppointmentPickerVariant = false, this.textStyle, this.isSelectAble = true})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<DropdownField> createState() => _DropdownFieldState();
|
|
|
|
@ -53,7 +56,9 @@ class _DropdownFieldState extends State<DropdownField> {
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: widget.showAppointmentPickerVariant ? null : Utils.containerColorRadiusBorderWidth(MyColors.white, 0, MyColors.darkPrimaryColor, 2),
|
|
|
|
|
decoration: widget.showAppointmentPickerVariant ? null : Utils
|
|
|
|
|
.containerColorRadiusBorderWidth(
|
|
|
|
|
MyColors.white, 0, MyColors.darkPrimaryColor, 2),
|
|
|
|
|
margin: const EdgeInsets.all(0),
|
|
|
|
|
padding: const EdgeInsets.only(left: 8, right: 8),
|
|
|
|
|
width: widget.showAppointmentPickerVariant ? 170 : null,
|
|
|
|
@ -65,8 +70,15 @@ class _DropdownFieldState extends State<DropdownField> {
|
|
|
|
|
iconEnabledColor: borderColor,
|
|
|
|
|
iconDisabledColor: borderColor,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
style: widget.showAppointmentPickerVariant ? widget.textStyle : const TextStyle(color: Colors.black, fontWeight: FontWeight.w600, fontSize: 15),
|
|
|
|
|
hint: (widget.hint ?? "").toText(color: widget.showAppointmentPickerVariant ? Colors.black : borderColor, fontSize: widget.showAppointmentPickerVariant ? 18 : 15),
|
|
|
|
|
style: widget.showAppointmentPickerVariant
|
|
|
|
|
? widget.textStyle
|
|
|
|
|
: const TextStyle(
|
|
|
|
|
color: Colors.black, fontWeight: FontWeight.w600, fontSize: 15),
|
|
|
|
|
hint: (widget.hint ?? "").toText(
|
|
|
|
|
color: widget.showAppointmentPickerVariant
|
|
|
|
|
? Colors.black
|
|
|
|
|
: borderColor,
|
|
|
|
|
fontSize: widget.showAppointmentPickerVariant ? 18 : 15),
|
|
|
|
|
underline: Container(height: 0),
|
|
|
|
|
onChanged: (DropValue? newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
@ -75,11 +87,12 @@ class _DropdownFieldState extends State<DropdownField> {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
items: (widget.list ?? defaultV).map<DropdownMenuItem<DropValue>>(
|
|
|
|
|
(DropValue value) {
|
|
|
|
|
(DropValue value) {
|
|
|
|
|
return DropdownMenuItem<DropValue>(
|
|
|
|
|
value: value,
|
|
|
|
|
enabled: value.isEnabled ?? true,
|
|
|
|
|
child: value.value.toText(fontSize: 15, color: value.isEnabled == false ? Colors.black38 : null),
|
|
|
|
|
child: value.value.toText(fontSize: 15,
|
|
|
|
|
color: value.isEnabled == false ? Colors.black38 : null),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
).toList(),
|
|
|
|
|