customDropDownImage static method

Widget customDropDownImage(
  1. BuildContext context,
  2. DropdownModel? item, {
  3. String? hint,
})

Implementation

static Widget customDropDownImage(BuildContext context, DropdownModel? item,
    {String? hint}) {
  if (item == null) {
    return ListTile(
      tileColor: Colors.transparent,
      contentPadding: EdgeInsets.zero,
      visualDensity: VisualDensity.compact,
      title: Texts.body2('$hint', color: Get.theme.hintColor),
    );
  }

  return ListTile(
    tileColor: Colors.transparent,
    visualDensity: VisualDensity.compact,
    contentPadding: EdgeInsets.zero,
    leading: item.urlImage == null
        ? null
        : CachedNetworkImage(
            width: 80.w,
            height: 50,
            imageUrl: item.urlImage ?? "",
            placeholder: (context, url) => LoadingBouncingLine.circle(
              backgroundColor: Get.theme.primaryColor,
            ),
            errorWidget: (context, url, error) => const Icon(
              Icons.error,
            ),
          ),
    title: Texts.body2(
      item.name,
      textOverflow: TextOverflow.visible,
    ),
    subtitle: item.subtitle == null
        ? null
        : Texts.overline(
            item.subtitle ?? "-",
            textOverflow: TextOverflow.visible,
          ),
  );
}