buildHeaderCell function

Widget buildHeaderCell({
  1. String? imagePath,
  2. Widget? ledging,
  3. String? title = '',
  4. String? title2 = '',
  5. TextStyle? textStyle,
  6. TextStyle? textStyle2,
  7. EdgeInsetsGeometry padding = const EdgeInsets.all(10),
  8. BuildContext? context,
  9. VoidCallback? onMoreTop,
  10. VoidCallback? onMoreLongPress,
})

抬头

Implementation

Widget buildHeaderCell(
    {String? imagePath,
    Widget? ledging,
    String? title = '',
    String? title2 = '',
    TextStyle? textStyle,
    TextStyle? textStyle2,
    EdgeInsetsGeometry padding = const EdgeInsets.all(10),
    BuildContext? context,
    VoidCallback? onMoreTop,
    VoidCallback? onMoreLongPress}) {
  textStyle =
      textStyle ?? const TextStyle(fontWeight: FontWeight.bold, fontSize: 16);
  textStyle2 = textStyle2 ??
      (onMoreTop == null ? MiniStyle.textNormal : MiniStyle.textUrl);
  return Padding(
    padding: padding,
    child: Stack(
      alignment: AlignmentDirectional.bottomStart,
      children: <Widget>[
        Container(
          padding: const EdgeInsets.only(left: 5, right: 5),
          width: 30,
          alignment: Alignment.centerLeft,
          child: ledging ??
              (imagePath != null
                  ? UrlUtil.isUrl(imagePath)
                      ? Image.network(imagePath, height: 20, width: 20)
                      : Image.asset(imagePath, height: 20, width: 20)
                  : Container()),
        ),
        Container(
            padding: EdgeInsets.only(
                left: (imagePath == null && ledging == null) ? 0 : 30),
            alignment: Alignment.centerLeft,
            child: Text(title ?? '',
                style: textStyle, overflow: TextOverflow.ellipsis)),
        Container(
          padding: const EdgeInsets.only(left: 5),
          alignment: Alignment.centerRight,
          child: Container(
            width: 200,
            alignment: Alignment.bottomRight,
            child: GestureDetector(
                onLongPress: onMoreLongPress,
                onTap: onMoreTop,
                child: Text(
                  title2 ?? '',
                  style: textStyle2,
                  overflow: TextOverflow.ellipsis,
                )),
          ),
        ),
      ],
    ),
  );
}