[英]Flutter create special table with button
I have a small task, however, I've been trying to reproduce this in Flutter for 2 days, but can't manage it, unfortunately.我有一个小任务,但是,我一直试图在 Flutter 中重现这个 2 天,但不幸的是无法管理它。 Would ask you to help me a little.
会请你帮我一点忙。 It should be a table with buttons where you can book as a customer at a certain time, but if someone has already booked something in between, you can only book up to the date or after, see the video.
它应该是一个带有按钮的表格,您可以在特定时间以客户身份预订,但如果有人已经预订了两者之间的东西,您只能预订该日期或之后的日期,请参阅视频。 And I'm sorry if this is a bit of an unusual question, however, I'm getting desperate Thank you in advance.
如果这是一个不寻常的问题,我很抱歉,但是,我很绝望 提前谢谢你。
PS: It would be important to mention that the design is not as important as the functionality PS:重要的是要提到设计不如功能重要
You can use the Table widget and ElevatedButton within your Table widget like this:您可以在 Table 小部件中使用Table小部件和ElevatedButton ,如下所示:
Table(
border: TableBorder.all(),
columnWidths: const <int, TableColumnWidth>{
0: FixedColumnWidth(96),
1: FixedColumnWidth(96),
2: FixedColumnWidth(96),
3: FixedColumnWidth(96),
4: FixedColumnWidth(96),
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
children: <TableRow>[
TableRow(
children: <Widget>[
Container(
height: 64,
color: Colors.grey[200],
),
Container(
height: 64,
color: Colors.grey[200],
),
Container(
height: 64,
color: Colors.grey[200],
),
Container(
height: 64,
color: Colors.grey[200],
),
Container(
height: 64,
color: Colors.grey[200],
),
],
),
TableRow(
decoration: const BoxDecoration(
color: Colors.grey,
),
children: <Widget>[
Container(
height: 64,
color: Colors.grey[200],
),
SizedBox(
height: 64,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.orange,
),
child: const Icon(
Icons.check,
color: Colors.white,
),
),
),
SizedBox(
height: 64,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey[400],
),
child: Icon(
Icons.dangerous,
color: Colors.grey[600],
),
),
),
SizedBox(
height: 64,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
),
child: Container(),
),
),
SizedBox(
height: 64,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
),
child: Container(),
),
),
],
),
],
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.