Skip to content

Document ListView usage with the Column widget #18341

Closed

Description

@elnurvl

I use flutter framework with following revisions:

Flutter 0.4.4 • channel beta • https://github.com/flutter/flutter.git
Framework • revision f9bb4289e9 (4 weeks ago) • 2018-05-11 21:44:54 -0700
Engine • revision 06afdfe54e
Tools • Dart 2.0.0-dev.54.0.flutter-46ab040e58

I cannot use ListView or ListViewBuilder inside Column widget. No list item is shown until I remove Column wrapper. Is it supposed not to work in that way, or is it a bug?

Here it is my test widget.

new Container(
        child: new Column(
      children: <Widget>[
        new ListView.builder(
            itemCount: 3,
            padding: const EdgeInsets.only(top: 10.0),
            itemBuilder: (context, index) {
              return new Text(" asdasd");
            })
      ],
    ))

Activity

  1. xster commented on Jun 11, 2018

    @xster
    Contributor

    The error message should explain why it wouldn't work conceptually. Could you elaborate on your expected outcome?

  2. elnurvl commented on Jun 12, 2018

    @elnurvl
    Author

    @xster There is no any error message. Just an empty view.

  3. added
    framework
    on Aug 26, 2018
  4. added this to the milestone on Aug 26, 2018
  5. zoechi commented on Aug 27, 2018

    @zoechi
    Contributor

    Can you please provide a running example (main.dart) that allows to reproduce?

  6. JosephDunivan commented on Dec 6, 2018

    @JosephDunivan

    Im having this issue too.

  7. zoechi commented on Dec 6, 2018

    @zoechi
    Contributor

    @JosephDunivan would you mind providing a minimal example,
    error output, expected behavior?

  8. JosephDunivan commented on Dec 6, 2018

    @JosephDunivan

    Hmm... where to start. Well ListView really wants to be put in an expanded widget right?
    The implementation would be to put a search bar above it and perhaps some buttons below it.

    What I expected to be able to do

    Column (
     children: <Widget>[
        new TextField(
        decoration: new InputDecoration(
        labelText: "Search something"
        ),
        ListView(),
      ]
    )

    Instead I think you need to use an expanded widget.

    Column (
      children: <Widget>[
        new TextField(
        decoration: new InputDecoration(
        labelText: "Search something"
        ),
        Expanded(
          ListView(),
        ),
      ]
    )
  9. JosephDunivan commented on Dec 6, 2018

    @JosephDunivan

    @elnurvl Can you see if wrapping your ListView in and Expanded with a parent of type flex (ie like a column widget) resolves your issue?

  10. zoechi commented on Dec 6, 2018

    @zoechi
    Contributor

    Can you please make it a self-contained runnable example,
    so that we just can copy it into lib/main.dart of a new project created with flutter create foo and reproduce?

  11. JosephDunivan commented on Dec 6, 2018

    @JosephDunivan

    You could just place that code right after body:

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(new MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
        Widget build(BuildContext context) {
             return Scaffold(
              appBar: AppBar(
              title: Text("Title"),
              body: 
      );
    }
  12. JosephDunivan commented on Dec 6, 2018

    @JosephDunivan

    ListView simply wants to be put in an Expanded widget that has a parent of type flex.
    I don't necessarily think that's intuitive, but that's how it works.

  13. added
    d: api docs
    on Dec 7, 2018
  14. zoechi commented on Dec 19, 2018

    @zoechi
    Contributor
    I/flutter ( 7377): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
    I/flutter ( 7377): The following assertion was thrown during performResize():
    I/flutter ( 7377): Vertical viewport was given unbounded height.
    I/flutter ( 7377): Viewports expand in the scrolling direction to fill their container.In this case, a vertical
    I/flutter ( 7377): viewport was given an unlimited amount of vertical space in which to expand. This situation
    I/flutter ( 7377): typically happens when a scrollable widget is nested inside another scrollable widget.
    I/flutter ( 7377): If this widget is always nested in a scrollable widget there is no need to use a viewport because
    I/flutter ( 7377): there will always be enough vertical space for the children. In this case, consider using a Column
    I/flutter ( 7377): instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size
    I/flutter ( 7377): the height of the viewport to the sum of the heights of its children.
    

    It is not that ListView wants to be in an Expanded, it's that it needs to know the available height and inside a Column Expanded provides that. You can also use another widget that limits the height in some way, it doesn't have to be Expanded.

    I think this is working as intended.
    Feel free to add a comment to have the issue reopened if you disagree.

  15. 29 remaining items

  16. exaby73 commented on Mar 17, 2023

    @exaby73
    Member

    Since https://api.flutter.dev/flutter/widgets/ListView-class.html does not contain any docs that explain this behavior of ListView, I'll update the labels

  17. added
    found in release: 3.7
    found in release: 3.9
    and removed
    found in release: 1.21
    on Mar 17, 2023
  18. added
    team-framework
    triaged-framework
    on Jul 8, 2023
  19. self-assigned this
    on Sep 16, 2026
  20. removed their assignment
    on Oct 12, 2026
  21. added a commit that references this issue on Nov 14, 2026
    30953fc
  22. github-actions commented on Nov 28, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  23. locked as resolved and limited conversation to collaborators on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2d: api docsf: scrollingfound in release: 3.7found in release: 3.9frameworkhas reproducible stepsteam-frameworktriaged-framework

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions