Flutter 解答StackOverflow问题flutter scrollable list below rendered image

 What the questioner meant:

I laid out a list of pictures that can be clicked. There are text and pictures on the list. I tried to add pictures to the list and scrolled. There is no top image moving or at this point, both ways are good. The attempt to build the list throws a viewport error. When shrinkwrap is set to true, a red bar warning is displayed.

shrinkWrap The height of the view seen when the view is not scrolled (whether the content you see determines the scroll range of the list)

shinkWrap=true

 

new RefreshIndicator(
          child: new ListView.builder(
            itemBuilder: _itemBuilder,
            itemCount: listcount,
            shrinkWrap: true,
            scrollDirection: Axis.vertical,
          ),
          onRefresh: _onRefresh,

        ),

 

shinkWrap = false

 

new RefreshIndicator(
          child: new ListView.builder(
            itemBuilder: _itemBuilder,
            itemCount: listcount,
            shrinkWrap: false,
            scrollDirection: Axis.vertical,
          ),
          onRefresh: _onRefresh,

        ),

 

 

  After adding Expanded

Expanded(
        flex: 1,
        child: new RefreshIndicator(
          child: new ListView.builder(
            itemBuilder: _itemBuilder,
            itemCount: listcount,
            shrinkWrap: true,
            scrollDirection: Axis.vertical,
          ),
          onRefresh: _onRefresh,

        ),

      ),

 

Download: flutter_scrollable_list

 

 

Guess you like

Origin blog.csdn.net/u013491829/article/details/108909773