1

我的列结构是这样的:

body: new Column(
      children: <Widget>[
        new TabPanel(), // row with all child text
        new UrlButtonPanel(), // row with button
        new Ad(), //rectangle container
        new LatestNewsController(), //container with swith button
        Expanded(child: new LatestNewsList()), // listview

      ],
  )

我想让整个页面可滚动,包括 listView。现在只有 Listview 部分是可滚动的。

如何使整个页面可滚动?

用 ListView 替换 Column 使布局空白。

4

1 回答 1

-2

试试这些改变。它应该在 Scrollable ListView 中为您提供一个 Scrollable List。编辑:在小部件构建方法中添加:

// Get the screen Height
    double screenHeight = MediaQuery.of(context).size.height;
// Get 67% of screen Height
    double containerHeight = screenHeight * 0.67;
// Get the screen Width
    double screenWidth = MediaQuery.of(context).size.width;

这将为您提供屏幕高度和宽度,然后在 Container 中使用 containerHeight。在这种情况下,我使用了 67% 的屏幕高度。

body: new ListView(
    children: <Widget>[
      new TabPanel(), // row with all child text
      new UrlButtonPanel(), // row with button
      new Ad(), //rectangle container
      new LatestNewsController(), //container with swith button
      new Container(height: containerHeight, child: yourList()),
    ],
  ),
于 2018-09-03T00:20:18.853 回答