Flutter ListView.Builder() in scrollable Column with other widgets

前端 未结 12 587
情书的邮戳
情书的邮戳 2020-12-24 10:58

I have a TabBarView() with an amount of different views. I want of them to be a Column with a TextField at top and a ListView.Builder() below, but both widgets should be in

12条回答
  •  离开以前
    2020-12-24 11:47

    Solution

    SingleChildScrollView(
              child: Column(
                children: [
                          ListView.builder(
                          shrinkWrap: true,
                          physics: NeverScrollableScrollPhysics(),
    

    Two properties used here

    shrinkWrap: true
    

    only occupies the space it needs (it will still scroll when there more items).

    physics: NeverScrollableScrollPhysics()
    

    Scroll physics that does not allow the user to scroll. Means only Column+SingleChildScrollView Scrolling work.

提交回复
热议问题