ktextItem function

Widget ktextItem(
  1. String title, {
  2. String? text,
  3. TextStyle? titleStyle,
  4. TextStyle? textStyle,
  5. Widget? leftWidget,
  6. Widget? rightWidget,
  7. int? height,
  8. EdgeInsetsGeometry? padding,
  9. EdgeInsetsGeometry? margin,
  10. Decoration? decoration,
  11. Function? onTap,
})

左侧Widget+标题+提示+右侧Widget 标题整行延伸

Implementation

Widget ktextItem(
  String title, {
  String? text,
  TextStyle? titleStyle,
  TextStyle? textStyle,
  Widget? leftWidget,
  Widget? rightWidget,
  int? height,
  EdgeInsetsGeometry? padding,
  EdgeInsetsGeometry? margin,
  Decoration? decoration,
  Function? onTap,
}) {
  return GestureDetector(
    behavior: HitTestBehavior.translucent,
    onTap: () => {onTap?.call()},
    child: Container(
      padding: padding,
      margin: margin,
      height: height?.h,
      decoration: decoration,
      alignment: Alignment.center,
      child: Row(
        children: [
          leftWidget ?? Container(),
          kWidth(10).kshow(leftWidget != null),
          Expanded(
              flex: 1,
              child: Text(
                title,
                style: titleStyle,
              )),
          Text(
            text ?? "",
            style: textStyle,
          ).kshow(text.kisNotBlank()),
          rightWidget ?? Container(),
        ],
      ),
    ),
  );
}