imageSearchDropdown static method
Widget
imageSearchDropdown({
- Key? key,
- required SearchDropdownController searchDropdownController,
- EdgeInsetsGeometry padding = const EdgeInsets.symmetric(vertical: 5),
- Mode mode = Mode.BOTTOM_SHEET,
Implementation
static Widget imageSearchDropdown({
Key? key,
required SearchDropdownController searchDropdownController,
EdgeInsetsGeometry padding = const EdgeInsets.symmetric(vertical: 5),
Mode mode = Mode.BOTTOM_SHEET,
}) {
return AnimatedSize(
duration: const Duration(milliseconds: 300),
child: Padding(
padding: padding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DropdownSearch<DropdownModel>(
mode: mode,
compareFn: (item, selectedItem) => item?.id == selectedItem?.id,
items: searchDropdownController.items,
onChanged: searchDropdownController.onChange,
selectedItem: searchDropdownController.selectedItem,
dropdownBuilder: (context, selectedItem) => customDropDownImage(
context, selectedItem,
hint: 'Pilih ${searchDropdownController.label}'),
popupItemBuilder: customPopupItemBuilderImage,
popupTitle: Center(
child: Padding(
padding: EdgeInsets.all(15.0.spMin),
child: Texts.headline6(searchDropdownController.label),
),
),
popupShape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.r),
topRight: Radius.circular(10.r),
),
),
showSelectedItems: true,
dropdownSearchDecoration: InputDecoration(
hintText: 'Pilih ${searchDropdownController.label}',
enabledBorder: OutlineInputBorder(
// width: 0.w.0 produces a thin "hairline" border
borderSide: BorderSide(
color: !searchDropdownController.isValid
? Get.theme.colorScheme.error
: Get.theme.shadowColor,
width: 1.w,
),
borderRadius: BorderRadius.all(
Radius.circular(10.r),
),
),
focusedBorder: OutlineInputBorder(
// width: 0.w.0 produces a thin "hairline" border
borderSide: BorderSide(
color: Get.theme.primaryColor,
width: 1.w,
),
borderRadius: BorderRadius.all(
Radius.circular(10.r),
),
),
border: const OutlineInputBorder(),
contentPadding: const EdgeInsets.only(
top: 5,
bottom: 5,
left: 25,
),
filled: true,
fillColor: Get.theme.colorScheme.background,
),
),
AnimatedSize(
duration: const Duration(milliseconds: 300),
child: !searchDropdownController.isValid
? Padding(
padding: EdgeInsets.all(8.0.spMin),
child: Texts.caption(
"Wajib disertakan",
color: Get.theme.colorScheme.error,
),
)
: const SizedBox(),
),
],
),
),
);
}