如何使ListViews一起滚动

时间:2019-12-19 18:38:06

标签: android listview flutter dart flutter-layout

我正在Flutter中开发一个应用程序。我的屏幕上有时间表。我希望它水平和垂直滚动。如何使所有列表查看器一起垂直滚动?

Screenshot of app

到目前为止,这是我的代码:

Widget daysContainer() {
    return Container(
      width: MediaQuery.of(context).size.width * (1- 0.15),
      height: MediaQuery.of(context).size.height,
      child: Stack(
        children: <Widget>[
          ListView(
            scrollDirection: Axis.horizontal,
            children: <Widget>[
              for(int i = 0 ; i < daysList.length ; i ++)
                dayContainer(i),
            ],
          ),
        ],
      ),
    );
  }

  Widget dayContainer(int i){
    Color color1;
    Color color2;

    if((i%2) != 0){
      color1= Color.fromARGB(255,240,240,240);
      color2= Color.fromARGB(255,250,250,250);
    }
    else{
      color2= Color.fromARGB(255,240,240,240);
      color1= Color.fromARGB(255,250,250,250);
    }
    finalBlock=0;

    return Container(
      child: Column(
        children: <Widget>[
          dayHeaderContainer(i, color1),
          blockContainer(i, color2),
        ],
      ),
      alignment: Alignment.topLeft,
      color: color2,
      width: (MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.15)) * 0.3333,
    );
  }

Widget blockContainer(int i, Color color) {
return Container(
  width: MediaQuery.of(context).size.width,
  height: MediaQuery.of(context).size.height * 0.7,
  color: color,
  child: ListView(
    children: <Widget>[
      for(int j = 0; j < widget.talkList.length; j++)
        if(daysList[i].day == widget.talkList[j].dateInitial.day && widget.talkList[j].selected)
          individualTalkBlock(i, j, color, Color.fromARGB(255,247,220,222)),

    ],
  ),
);}

谢谢!

0 个答案:

没有答案