我真的不明白出了什么问题以及如何解决
我想在屏幕上连续显示 2 个按钮
我有无状态小部件 MainPage:
class MainPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Person(),
History()
],
),
);
}
}
我有 2 个按钮:Person 和 History 有类 Person 和 History:
class Person extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: RaisedButton(
child: Container(
width: 100,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Person"),
Icon(Icons.person)
],
),
),
),
),
);
}
}
class History extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: RaisedButton(
child: Container(
width: 100,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("History"),
Icon(Icons.history)
],
),
),
),
),
);
}
}
但是我收到一个错误:右侧的无限像素溢出了 RenderFlex。 我哪里错了?