listViewOfListTile method

YYDialog listViewOfListTile({
  1. List<ListTileItem>? items,
  2. double? height,
  3. dynamic isClickAutoDismiss = true,
  4. dynamic onClickItemListener(
    1. int
    )?,
})

Implementation

YYDialog listViewOfListTile({
  List<ListTileItem>? items,
  double? height,
  isClickAutoDismiss = true,
  Function(int)? onClickItemListener,
}) {
  return this.widget(
    Container(
      height: height,
      child: ListView.builder(
        padding: EdgeInsets.all(0.0),
        shrinkWrap: true,
        itemCount: items?.length ?? 0,
        itemBuilder: (BuildContext context, int index) {
          return Material(
            color: Colors.white,
            child: InkWell(
              child: ListTile(
                onTap: () {
                  if (onClickItemListener != null) {
                    onClickItemListener(index);
                  }
                  if (isClickAutoDismiss) {
                    dismiss();
                  }
                },
                contentPadding: items?[index].padding,
                leading: items?[index].leading,
                title: Text(
                  items?[index].text ?? "",
                  style: TextStyle(
                    color: items?[index].color,
                    fontSize: items?[index].fontSize,
                    fontWeight: items?[index].fontWeight,
                    fontFamily: items?[index].fontFamily,
                  ),
                ),
              ),
            ),
          );
        },
      ),
    ),
  );
}