buildHeadCardCell function

Widget buildHeadCardCell({
  1. String? headText,
  2. String? rightHeadText,
  3. TextStyle? headTextStyle,
  4. TextStyle? rightHeadTextStyle,
  5. BuildContext? context,
  6. Widget? headChild,
  7. Widget? child,
  8. List? values,
  9. Color color = Colors.white,
  10. double tagWidth = 80,
  11. double miniHeight = 30,
  12. double fontSize = 16,
  13. EdgeInsetsGeometry valuePadding = const EdgeInsets.all(1),
  14. EdgeInsetsGeometry childPadding = const EdgeInsets.all(5),
  15. double paddingRight = 0.0,
  16. VoidCallback? onMoreTop,
  17. VoidCallback? onMoreLongPress,
})

构建头部+卡片

Implementation

Widget buildHeadCardCell(
    {String? headText,
    String? rightHeadText,
    TextStyle? headTextStyle,
    TextStyle? rightHeadTextStyle,
    BuildContext? context,
    Widget? headChild,
    Widget? child,
    List? values,
    Color color = Colors.white,
    double tagWidth = 80,
    double miniHeight = 30,
    double fontSize = 16,
    EdgeInsetsGeometry valuePadding = const EdgeInsets.all(1),
    EdgeInsetsGeometry childPadding = const EdgeInsets.all(5),
    double paddingRight = 0.0,
    VoidCallback? onMoreTop,
    VoidCallback? onMoreLongPress}) {
  values ??= [];
  return Container(
    margin: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0),
    padding: const EdgeInsets.all(8.0),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(8.0),
      color: Colors.white,
    ),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        headChild ??
            buildHeaderCell(
                title: headText ?? '',
                title2: rightHeadText ?? '',
                onMoreLongPress: onMoreLongPress,
                textStyle: headTextStyle,
                textStyle2: rightHeadTextStyle,
                onMoreTop: onMoreTop),
        const Divider(indent: 10, endIndent: 10),
        Container(
          color: color,
          width: double.infinity,
          padding: childPadding,
          child: child ??
              Column(
                children: values.map((data) {
                  if (data is TagValueModel) {
                    return TagValueCell(
                        data: data,
                        fontSize: fontSize,
                        padding: valuePadding,
                        paddingRight: paddingRight,
                        tagWidth: tagWidth,
                        miniHeight: miniHeight,
                        context: context);
                  }
                  if (data is EditValueModel) {
                    data.tagWidth = tagWidth;
                    return EditCell(
                        data: data,
                        minHeight: miniHeight,
                        padding: valuePadding);
                  }
                  if (data is Widget) {
                    return data;
                  }
                  return Container();
                }).toList(),
              ),
        ),
      ],
    ),
  );
}