试试这个
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Center(child: TextButton(...))),
VerticalDivider(width: 1.0),
Expanded(child: Center(child: TextButton(...))),
],
),
就我而言,我尝试过这样
@override
Widget build(BuildContext context) {
final _screen = MediaQuery.of(context).size;
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: _screen.width * 0.45,
child: ...
),
VerticalDivider(width: 1.0),
Container(
width: _screen.width * 0.45,
child: ...
),
]
),
],
);
}
这对我有用:
IntrinsicHeight (
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: Center(child: TextButton(...))),
VerticalDivider(thickness: 1.3, color: Colors.red),
Expanded(child: Center(child: TextButton(...))),
],
))