ShrinkWrap vs Slivers | Decoding Flutter
Why Stack Overflow recommends it
Stack Overflow users link it when answering nested ListView, GridView and unbounded height questions, to explain why shrinkWrap hurts performance and to point people to CustomScrollView with slivers.
Recommended by 9 people across 10 different months, 2021 to 2025.
What it is
A 4.5 minute episode of the official Flutter channel's Decoding Flutter series, presented by Craig Labenz. It explains nested lists in Flutter, how the shrinkWrap parameter works and why it can be costly, and when slivers are a better fit, with a DartPad demo.
What people said
Strong rec Gagan Yadav · 2023-06 · Stack Overflow · on “Single Child Scroll View not scrolling in flutter”
In your code you are nesting multiple scroll views with shrinkWrap: true . However using shrink wrap effects performance as mentioned in this [this video] video (must watch). I would suggest to use a CustomScrollView instead with SliverList .
Recommends Vettiyanakan · 2021-11 · Stack Overflow · on “How do I use multiple ListView.builder inside a ListView and to make nested scrolling using Flutter?”
ListView , shrinkWrap , SliverList Check this for more info [this video] , and this [LINK] . ShrinkWrApp // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'dart:math' as math; void main() { runApp(ShrinkWrApp()); } class ShrinkWrApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'ShrinkWrap vs Slivers', home: Scaffold( appBar: AppBar( title: const Text("ShrinkWrap, Street Rat, I don't, Buy that!"), ),
Recommends Rahman Rezaee · 2022-01 · Stack Overflow · on “How to put two ListView in a column?”
check the link instead listview use sliverlist for better performance Tuturial [this video] and full Example [LINK] return CustomScrollView( slivers: [ SliverList( delegate: SliverChildBuilderDelegate( (BuildContext context, int index) => Container( height: 100, color: Colors.red, child: Text("List 1 item${index}")), childCount: 5, ), ), SliverList( delegate: SliverChildBuilderDelegate( (BuildContext context, int index) => Container( height: 100, color: Colors.blue, child: Text("List 2 item${index}")), childCount: 5, ), ), ], );
Recommends Omatt · 2022-01 · Stack Overflow · on “Flutter ListView of custom Widget including ListView gives errors”
The reason why you're getting "viewport hasBoundedHeight" errors is because you're using a ListView inside a ListView. You may want to consider using CustomScrollView and SliverList. More details regarding this about this is covered here [this video] .
Recommends Tavinder Singh · 2022-02 · Stack Overflow · on “Incorrect use of ParentDataWidget Error Flutter”
shrinkWrap is bad for performance if there are large number of items in the list. You can refer this [this video]
Recommends XavierRenegadeAngel · 2022-03 · Stack Overflow · on “Flutter: Vertical Overflow Problems When Nesting Multiple Gridviews Inside Of Column”
I'm having trouble with managing vertical overflow in my Flutter application. Essentially, I have a main column with a container child that holds another column with 3 containers each containing a gridview : stateful widget Scaffold body: Center Column Container Column Container Gridview Container Gridview Container Gridview What I've Tried: Method 1: to try and solve the vertical overflow, I have tried wrapping the containers in expanded , but the problem with that is it smushes everything together and I want all the content of the gridviews to be displayed at full height, with the ability to scroll down through the main column . Method 2: so next i tried wrapping the main column in a singl
Recommends XavierRenegadeAngel · 2022-03 · Stack Overflow · on “Flutter: Vertical Overflow Problems When Nesting Multiple Gridviews Inside Of Column”
@AlwayssBijoy this looks like the solution i need! here's official Flutter YouTube video explaining the concept [this video]
Recommends Omatt · 2022-04 · Stack Overflow · on “Flutter listview item disappear when scrolling”
Flutter ListView [LINK] could redraw items previously not visible on its viewport. If the ListView items to be rendered contains a lot of Widgets, it's possible that it could cause some delay during render when scrolled fast. Here's an informational video [this video] from Flutter discussing how viewport works.
Recommends Md. Yeasin Sheikh · 2022-09 · Stack Overflow · on “ListView inside MasonryGridView in Flutter”
ListView is getting unbounded height, you can provide fixed height, or shrinkWrap: true, on ListView. itemBuilder: (context, index) { return ListView( shrinkWrap: true, children: [Text("A")], ); }, Or itemBuilder: (context, index) { return SizedBox( height: 100, child: ListView( // shrinkWrap: true, children: [Text("A")], ), ); }, There is a cost on using ShrinkWrap [this video] , if you dont need scrollable for individual item, you can try Column widget. @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(), body: Column( children: [ Expanded( child: MasonryGridView.count( itemCount: 33, padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), crossAxisCount:
Recommends Md. Yeasin Sheikh · 2023-03 · Stack Overflow · on “Listview.builder render all view issue if its child of ScrollView/ Listview/ Listview.builder flutter”
shrinkWrap: true isnt good. You can use CustomScrolView. class MyApp extends StatelessWidget { final List<String> items; const MyApp({super.key, required this.items}); @override Widget build(BuildContext context) { const title = 'Long List'; return MaterialApp( title: title, home: Scaffold( appBar: AppBar( title: const Text(title), ), body: CustomScrollView( slivers: [ SliverToBoxAdapter( child: Text("Test nexted List rendering"), ), SliverList( delegate: SliverChildBuilderDelegate(childCount: items.length, (context, index) { print(index); return ListTile( title: Text(items[index]), ); })) ], ), ), ); } } More about ShrinkWrap vs Slivers | Decoding Flutter [this video] Or on your general case, if