Widget td(int flex, {String title = '', bool isLabel = false, bool isLeft = false, bool isBottom = false, bool isCustom = false, Widget customContent}) {
return Expanded(
flex: flex,
child: Container(
padding: EdgeInsets.symmetric(vertical: setSize(10), horizontal: setSize(5)),
decoration: BoxDecoration(
border: Border(
top: BorderSide(width: setSize(1), color: Color(0xffeaeaea)),
right: BorderSide(width: setSize(1), color: Color(0xffeaeaea)),
left: isLeft ? BorderSide(width: setSize(1), color: Color(0xffeaeaea)) : BorderSide.none,
bottom: isBottom ? BorderSide(width: setSize(1), color: Color(0xffeaeaea)) : BorderSide.none,
)
),
alignment: Alignment.center,
child: !isCustom ? Text(title, style: TextStyle(fontSize: setFont(14), color: Color(isLabel ? 0xff62AAFF : 0xff333333), fontWeight: FontWeight.w600),) : customContent,
),
);
}
// IntrinsicHeight 是关键, 这里模拟table使用场景
IntrinsicHeight(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
td(1, title: '姓名', isLabel: true, isLeft: true),
td(1, title: ''),
td(1, title: '姓别', isLabel: true),
td(1, title: ''),
td(1, title: '性格', isLabel: true),
td(1, title: ''),
td(1, title: '出生年月', isLabel: true),
td(1, title: ''),
td(1, title: '电话', isLabel: true),
td(1, title: ''),
],
),
),