Skip to content

"Ink" Items in ListView are not cropped properly #33520

@Lootwig

Description

@Lootwig

Observed behavior:

The decoration of "Ink" widgets that are positioned outside of a ListView is being painted.

Expected behaviour:

The decoration is cropped in the same way all the other contents are.

Minimal example:

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Column(
          children: <Widget>[
            SizedBox(height: 500, child: Container(color:Colors.black45)),
            Expanded(
              child: ListView(
                children: <Widget>[
                  InkItem(),
                  InkItem(),
                  InkItem(),
                  InkItem(),
                  InkItem(),
                  InkItem(),
                  InkItem(),
                  InkItem(),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}

class InkItem extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Ink(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(5),
        color: Colors.black12,
      ),
      child: SizedBox(height: 100, child: Center(child: Text("Item"))),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions