简体   繁体   中英

ListView not scrolling in SingleChildScrollView Flutter

Faced a problem, when adding SingleChildScrollView ListView.builder does not scroll. What could be the problem and how to fix it? We need to make the ListView scrollable.

body

 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),
            ],
          ),
        ),
      );

PoyntsList

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

Make sure to remove:

physics: const NeverScrollableScrollPhysics(),

you can read about it here: NeverScrollableScrollPhysics

Please remove singlechildscrollview and simply wrap your PoyntsList with expanded. it will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM