我需要有关此图形的帮助

时间:2019-04-09 08:26:00

标签: dart flutter

我对此图形有疑问, 可以做到吗?

打开图像以查看Visual Designer示例

Visual designer sample

My programming result

这是我的代码,我使用listView.separeted。

是否可以确定宽度而不影响其所在容器的尺寸?

ListView.separated(
                separatorBuilder: (BuildContext context, int index) {
                  return Container(
                    width: 0,
                    child: Text(
                      "${listString[index]}",
                      textAlign: TextAlign.center,
                      style:
                      TextStyle(fontSize: 10, color: Colors.black),
                    ),
                    transform: Matrix4.translationValues(0, 105, 0),
                  );
                  /*return Column(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[

                    ],
                  );*/
                },
                scrollDirection: Axis.horizontal,
                itemCount: 36,
                itemBuilder: (BuildContext context, int index) {
                  return Row(
                    children: <Widget>[
                      firstElement(index),
                      Container(
                        width: 80,
                        height: 80,
                        child: Center(
                          child: ListTile(
                            title: Icon(
                              Icons.add_circle,
                              color: Colors.black,
                            ),
                            onTap: () {
                              setState(() {
                                if (listBooking[index].book != true) {
                                  if (listBooking[index].isChecked) {
                                    listBooking[index].isChecked = false;
                                    listBooking[index].color =
                                        Colors.transparent;
                                  } else {
                                    listBooking[index].isChecked = true;
                                    listBooking[index].color = Colors.green;
                                  }
                                }
                              });
                            },
                            selected: listBooking[index].isChecked,
                          ),
                        ),
                        margin: EdgeInsets.fromLTRB(1, 0, 1, 0),
                        color: listBooking[index].color,
                      ),
                      lastElement(index),
                    ],
                  );
                }),

0 个答案:

没有答案