buildHeadCardCell function
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,
构建头部+卡片
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(),
),
),
],
),
);
}