2024-08-07 10:38:33 +02:00
|
|
|
import "package:flutter/material.dart";
|
2024-06-28 14:17:18 +02:00
|
|
|
|
|
|
|
class FlutterFormInputDropdown extends StatelessWidget {
|
|
|
|
const FlutterFormInputDropdown({
|
|
|
|
this.alignment = AlignmentDirectional.centerStart,
|
|
|
|
this.autofocus = false,
|
|
|
|
this.isExpanded = false,
|
|
|
|
this.isDense = true,
|
|
|
|
this.iconSize = 24,
|
|
|
|
this.elevation = 8,
|
|
|
|
this.items,
|
|
|
|
this.selectedItemBuilder,
|
|
|
|
this.value,
|
|
|
|
this.hint,
|
|
|
|
this.disabledHint,
|
|
|
|
this.onChanged,
|
|
|
|
this.onTap,
|
|
|
|
this.style,
|
|
|
|
this.icon,
|
|
|
|
this.iconDisabledColor,
|
|
|
|
this.iconEnabledColor,
|
|
|
|
this.itemHeight,
|
|
|
|
this.focusColor,
|
|
|
|
this.focusNode,
|
|
|
|
this.dropdownColor,
|
|
|
|
this.decoration,
|
|
|
|
this.onSaved,
|
|
|
|
this.validator,
|
|
|
|
this.autovalidateMode,
|
|
|
|
this.menuMaxHeight,
|
|
|
|
this.enableFeedback,
|
|
|
|
this.borderRadius,
|
|
|
|
this.padding,
|
|
|
|
super.key,
|
|
|
|
});
|
|
|
|
|
|
|
|
final List<DropdownMenuItem<Object?>>? items;
|
|
|
|
final List<Widget> Function(BuildContext)? selectedItemBuilder;
|
|
|
|
final Object? value;
|
|
|
|
final Widget? hint;
|
|
|
|
final Widget? disabledHint;
|
|
|
|
final void Function(Object?)? onChanged;
|
|
|
|
final void Function()? onTap;
|
|
|
|
final int elevation;
|
|
|
|
final TextStyle? style;
|
|
|
|
final Widget? icon;
|
|
|
|
final Color? iconDisabledColor;
|
|
|
|
final Color? iconEnabledColor;
|
|
|
|
final double iconSize;
|
|
|
|
final bool isDense;
|
|
|
|
final bool isExpanded;
|
|
|
|
final double? itemHeight;
|
|
|
|
final Color? focusColor;
|
|
|
|
final FocusNode? focusNode;
|
|
|
|
final bool autofocus;
|
|
|
|
final Color? dropdownColor;
|
|
|
|
final InputDecoration? decoration;
|
|
|
|
final void Function(Object?)? onSaved;
|
|
|
|
final String? Function(Object?)? validator;
|
|
|
|
final AutovalidateMode? autovalidateMode;
|
|
|
|
final double? menuMaxHeight;
|
|
|
|
final bool? enableFeedback;
|
|
|
|
final AlignmentGeometry alignment;
|
|
|
|
final BorderRadius? borderRadius;
|
|
|
|
final EdgeInsetsGeometry? padding;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) => DropdownButtonFormField(
|
|
|
|
items: items,
|
|
|
|
selectedItemBuilder: selectedItemBuilder,
|
|
|
|
value: value,
|
|
|
|
hint: hint,
|
|
|
|
disabledHint: disabledHint,
|
|
|
|
onChanged: (value) => onChanged?.call(value),
|
|
|
|
onTap: () => onTap?.call(),
|
|
|
|
elevation: elevation,
|
|
|
|
style: style,
|
|
|
|
icon: icon,
|
|
|
|
iconDisabledColor: iconDisabledColor,
|
|
|
|
iconEnabledColor: iconEnabledColor,
|
|
|
|
iconSize: iconSize,
|
|
|
|
isDense: isDense,
|
|
|
|
isExpanded: isExpanded,
|
|
|
|
itemHeight: itemHeight,
|
|
|
|
focusColor: focusColor,
|
|
|
|
focusNode: focusNode,
|
|
|
|
autofocus: autofocus,
|
|
|
|
dropdownColor: dropdownColor,
|
|
|
|
decoration: decoration,
|
|
|
|
onSaved: (value) => onSaved?.call(value),
|
|
|
|
validator: (value) => validator?.call(value),
|
|
|
|
autovalidateMode: autovalidateMode,
|
|
|
|
menuMaxHeight: menuMaxHeight,
|
|
|
|
enableFeedback: enableFeedback,
|
|
|
|
alignment: alignment,
|
|
|
|
borderRadius: borderRadius,
|
|
|
|
padding: padding,
|
|
|
|
);
|
|
|
|
}
|