buildLineCell function

Widget buildLineCell({
  1. required String title,
  2. Widget? titleChild,
  3. Widget? subTitle,
  4. Icon? icon,
  5. String? svgName,
  6. String? iconName,
  7. String? numString,
  8. bool showNext = true,
  9. Color color = Colors.white,
  10. Color titleColor = Colors.black,
  11. bool showLine = false,
  12. VoidCallback? onPressed,
})

Implementation

Widget buildLineCell(
    {required String title,
    Widget? titleChild,
    Widget? subTitle,
    Icon? icon,
    String? svgName,
    String? iconName,
    String? numString,
    bool showNext = true,
    Color color = Colors.white,
    Color titleColor = Colors.black,
    bool showLine = false,
    VoidCallback? onPressed}) {
  Widget iconWidget = icon ??
      (svgName != null
          ? SvgPicture.asset(
              svgName,
              width: 24,
              height: 24,
            )
          : (iconName != null ? Image.asset(iconName) : Container()));

  return Material(
    color: color,
    child: Ink(
      color: color,
      child: InkWell(
        onTap: onPressed,
        child: Column(
          children: <Widget>[
            Container(
              height: 60,
              padding: const EdgeInsets.symmetric(horizontal: 20),
              child: Row(
                children: <Widget>[
                  iconWidget,
                  const SizedBox(width: 11),
                  Expanded(
                    child: titleChild ??
                        Text(
                          title,
                          style: TextStyle(fontSize: 18, color: titleColor),
                          overflow: TextOverflow.ellipsis,
                          softWrap: false,
                        ),
                  ),
                  if (subTitle != null) ...{
                    subTitle,
                  } else if (numString != null) ...{
                    Text(
                      numString,
                      style: const TextStyle(fontSize: 16),
                    ),
                  },
                  if (showNext) ...{
                    Icon(
                      MdiIcons.chevronRight,
                      color: Colors.grey[600],
                    ),
                  },
                ],
              ),
            ),
            Container(
              height: showLine == true ? 1 : 0.0,
              color: MiniColor.lightGray,
              margin: const EdgeInsets.only(left: 60),
            ),
          ],
        ),
      ),
    ),
  );
}