Opacity clips SingleChildScrollView content

Setting opacity to any value other than 1.0 or 0.0 clips the Column inside SingleChildScrollView by the scroll offset.

This is a regression. It works fine with Flutter stable, 2.10.4 but is broken on master, 2.13.0-0.0.pre.333

Steps to Reproduce

Run the example code

Code sample

import 'package:flutter/material.dart';

void main() {
  runApp(const Bug101110());
}

/// https://github.com/flutter/flutter/issues/101110
class Bug101110 extends StatefulWidget {
  const Bug101110({Key? key}) : super(key: key);

  @override
  State<Bug101110> createState() => _Bug101110State();
}

class _Bug101110State extends State<Bug101110> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: SingleChildScrollView(
        physics: const BouncingScrollPhysics(),
        child: Opacity(
          // opacity: 1.0, // works
          opacity: 0.5, // clips Column when scrolling
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Container(
                color: Colors.green,
                height: 300,
              ),
              Container(
                color: Colors.red,
                height: 300,
              ),
              Container(
                color: Colors.blue,
                height: 300,
              ),
              Container(
                color: Colors.yellow,
                height: 300,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Broken with opacity: 0.5

Screen-Recording-2022-03-31-13-06-15
video

Working with opacity: 1.0

Screen-Recording-2022-03-31-13-00-00
video

Expected results: Column should be 50%% transparent and fully visible

Actual results: Column is 50%% transparent but clips the children at the bottom when scrolling (yellow box only partially visible)

flutter doctor

[✓] Flutter (Channel master, 2.13.0-0.0.pre.333, on macOS 12.1 21C52 darwin-arm, locale en-DE)
    • Flutter version 2.13.0-0.0.pre.333 at /opt/homebrew/Caskroom/flutter/2.5.3/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9bd04bd03a (2 hours ago), 2022-03-31 05:35:09 -0400
    • Engine revision e4f9ee1d7c
    • Dart version 2.17.0 (build 2.17.0-251.0.dev)
    • DevTools version 2.11.4

1 thought on “Opacity clips SingleChildScrollView content

  1. Hi @passsy, given that the pr that caused the regression has been reverted and I can no longer reproduce this issue on the latest version of master (see video below). I’m going to close this as fixed. Thank you

    video

    Screen.Recording.2022-04-04.at.06.27.25.mov


Comments are closed.