簡體   English   中英

ListView 在 SingleChildScrollView 中不滾動 Flutter

[英]ListView not scrolling in SingleChildScrollView Flutter

遇到問題,添加SingleChildScrollViewListView.builder不滾動。 可能是什么問題以及如何解決? 我們需要使 ListView 可滾動。

身體

 Widget _child(context, Size size) => Padding(
        padding: const EdgeInsets.symmetric(horizontal: 24),
        child: SingleChildScrollView(
          physics: const NeverScrollableScrollPhysics(),
          child: Column(
            children: [
              const SizedBox(height: 121),
              const BackStepWidget(text: 'My Poynts'),
              const SizedBox(height: 25),
              PoyntsList(size: size),
            ],
          ),
        ),
      );

點列表

Widget build(BuildContext context) => MediaQuery.removePadding(
        context: context,
        removeTop: true,
        child: ListView.builder(
          shrinkWrap: true,
          itemCount: list.length + 1,
          itemBuilder: (context, index)...

確保刪除:

physics: const NeverScrollableScrollPhysics(),

你可以在這里閱讀: NeverScrollableScrollPhysics

請刪除 singlechildscrollview 並簡單地用 expanded 包裹你的 PoyntsList。 它會起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM