Skip to content

Unexpected top padding in ListView put inside scaffold with no appBar #14842

Description

@radzish

If you put ListView somewhere inside Scaffold having no appBar, ListView has top padding. There is no padding if appBar is present. There is no padding if you specify EdgeInsets.zero padding for ListView explicitly. See following code snipped for example

...
    return new MaterialApp(
      home: new Scaffold(
//        appBar: new AppBar(
//          title: new Text("test"),
//        ),
        body: new Column(
          children: <Widget>[
            new Container(
              child: new Center(
                  child: new Text("some top widget")
              ),
              decoration: new BoxDecoration(
                color: Colors.red,
              ),
              height: 100.0,
            ),
            new Expanded(
              child: new ListView(
                children: items,
//                padding: EdgeInsets.zero, // explicit padding as a workaround
              ),
            ),
          ],
        ),
      ),
    );
...

See screenshot:

bug

Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (on Linux, locale en_US.UTF-8, channel master)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.0)
[!] IntelliJ IDEA Ultimate Edition (version 2017.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.20.1)
[✓] Connected devices

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.d: api docsIssues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions