恒定大小的容器抖动网络中的滚动小部件

时间:2020-07-21 15:57:23

标签: flutter responsive-design progressive-web-apps flutter-web

所有开发人员,

我正在使用Flutter Web SDK在Flutter中开发一个响应式网页,但是我被困在页面的一部分中,在该行中我在行内有行,我有2个容器,其中我希望第一个容器可滚动,第二个容器的大小不变(不可滚动),就像whatsapp网络用户界面中的联系人列表不断滚动,而聊天端和页面的其余部分却没有滚动。

请帮助我, 预先感谢...

1 个答案:

答案 0 :(得分:0)

这应该可以工作。您需要一个固定大小的容器,并确保其中包含可滚动的小部件。现在,可以使用Media Query Parameters来使尺寸响应,下面的代码只需要调整空间和大小即可,它可以正常工作。

Row(
              //Your parent Row
              children: [
                Container(
                  //static non scrollable container
                  child: Column(
                    children: [
                      //Children you want to add 
                      //this wont be scrollable 
                      //It is also preferred that you give this some height or width too
                    ],
                  ),
                ),
                Container(
                  //Scrollable container
                  //Please adjust height and width yourself 
                  //You can use media query parameters to make it responsive
                  width: 200,
                  height: 500,
                  child: SingleChildScrollView(
                    //You can also change the scroll direction
                    child: Column(
                      //Add children you want to be in
                      //Scrollable column
                      
                    ),
                  ),
                )
              ],
            ),