Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ios][regression] Visual glitch when scrolling a list in a Scaffold that has a Material and Container as bottomNavigationBar #98739

Closed
xvrh opened this issue Feb 18, 2022 · 12 comments · Fixed by flutter/engine#31656
Labels
c: regression It was better in the past than it is now c: rendering UI glitches reported at the engine/skia rendering level engine flutter/engine repository. See also e: labels. f: scrolling Viewports, list views, slivers, etc. found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@xvrh
Copy link
Contributor

xvrh commented Feb 18, 2022

Steps to Reproduce

  1. Execute flutter run on the below code sample on iOS with Flutter 2.10
  2. Scroll the page and notice the visual glitch with the bottom blue square

I see that with iOS 15.1 on iPhone 11 (real and simulator)

Actual results:

Screen.Recording.2022-02-18.at.10.22.31.mp4
Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(_App());
}

class _App extends StatelessWidget {
  const _App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: ListView(
          children: [
            for (var i = 0; i < 100; i++)
              Padding(
                padding: const EdgeInsets.all(20.0),
                child: Text('abc ' * 20),
              )
          ],
        ),
        bottomNavigationBar: Material(
          child: Transform.translate(
            offset: Offset(0, -20),
            child: Container(
              color: Colors.blue,
              child: SizedBox(
                height: 70,
              ),
            ),
          ),
        ),
      ),
    );
  }
}
Logs
[✓] Flutter (Channel stable, 2.10.1, on macOS 11.6 20G165 darwin-x64, locale
    en-BE)
    • Flutter version 2.10.1 at /Users/xavier/projects/flutter_stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db747aa133 (9 days ago), 2022-02-09 13:57:35 -0600
    • Engine revision ab46186b24
    • Dart version 2.16.1
    • DevTools version 2.9.2
@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Feb 18, 2022
@danagbemava-nc
Copy link
Member

Hi @xvrh, it looks like this is caused by the Container widget.

If you remove it, should work just fine. Kindly try the sample below and let me know if it works for you.

code sample
import 'package:flutter/material.dart';

void main() {
  runApp(_App());
}

class _App extends StatelessWidget {
  const _App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: ListView(
          children: [
            for (var i = 0; i < 100; i++)
              Padding(
                padding: const EdgeInsets.all(20.0),
                child: Text('abc ' * 20),
              )
          ],
        ),
        bottomNavigationBar: Transform.translate(
          offset: Offset(0, -20),
          child: Material(
            color: Colors.blue,
            child: SizedBox(
              height: 70,
            ),
          ),
        ),
      ),
    );
  }
}

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 18, 2022
@xvrh
Copy link
Contributor Author

xvrh commented Feb 18, 2022

@danagbemava-nc yes it works if we remove the Material widget. But it is not possible because I would loose the "ink feedback" on my buttons inside (in my real app). The sample is just to demonstrate the bug.
This is a regression as it worked before in Flutter <= 2.8.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 18, 2022
@danagbemava-nc
Copy link
Member

You don't need to remove the Material, it's the Container that you need to remove.

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 18, 2022
@xvrh
Copy link
Contributor Author

xvrh commented Feb 18, 2022

@danagbemava-nc in your code sample you removed the Material just bellow bottomNavigationBar. This one I need to keep in my real app.
Also you replaced one Container with a Material which is not possible in my app as I need a BoxDecoration on it.

I'm not looking for workarounds. I'm just reporting that there is a regression with Flutter 2.10 on iOS with a certain Widget configuration.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 18, 2022
@danagbemava-nc
Copy link
Member

Hi @xvrh, which version of flutter were you on before flutter 2.10?

Also if you need BoxDecoration, have you considered using an Ink widget?

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 18, 2022
@xvrh
Copy link
Contributor Author

xvrh commented Feb 18, 2022

@danagbemava-nc the code was working with all stable Flutter versions since it was written 1 year ago: v1.x up to v2.8. The visual glitch only appeared on 2.10.

From the Flutter 2.10 annoucement What’s New in Flutter 2.10. There is this sentence: "partial repaints for a single dirty region on iOS/Metal." Could it be related?

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 18, 2022
@danagbemava-nc
Copy link
Member

danagbemava-nc commented Feb 18, 2022

From the Flutter 2.10 announcement What’s New in Flutter 2.10. There is this sentence: "flutter/engine#28801." Could it be related?

There's a possibility, but I can't confirm that atm.

Reproducible on stable and master only on iOS but not on previous versions of flutter.

Observations

  • Removing either the Material or Container causes the bug to not reproduce
  • It works just fine if the Container is replaced with an Ink widget
  • The bug doesn't occur if you use a Stack and Position to create a similar layout.
videos
[iOS] stable 2.8.0 android (same behavior on all versions ) stable 2.10.1+ [iOS]
Simulator.Screen.Recording.-.iPhone.13.-.2022-02-18.at.12.26.58.mp4
Screen.Recording.2022-02-18.at.12.23.30.mov
Simulator.Screen.Recording.-.iPhone.13.-.2022-02-18.at.10.27.27.mp4
flutter doctor -v
[✓] Flutter (Channel unknown, 2.8.1, on macOS 12.2 21D49 darwin-arm, locale en-GB)
    • Flutter version 2.8.1 at /Users/nexus/dev/sdks/flutter_rc/flutter
    • Upstream repository unknown
    • Framework revision 77d935af4d (9 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:318:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1428:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1863:10)
      #15     runZonedGuarded (dart:async/zone.dart:1851:12)
      #16     runZoned (dart:async/zone.dart:1782:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:197:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:301:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:47)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1290:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1140:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • 304CA91D-8D77-4AAE-A50F-ECFC57AFD011 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 98.0.4758.102

! Doctor found issues in 1 category.
[✓] Flutter (Channel stable, 2.10.1, on macOS 12.2 21D49 darwin-arm, locale en-GB)
    • Flutter version 2.10.1 at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db747aa133 (9 days ago), 2022-02-09 13:57:35 -0600
    • Engine revision ab46186b24
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1426:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1861:10)
      #15     runZonedGuarded (dart:async/zone.dart:1849:12)
      #16     runZoned (dart:async/zone.dart:1780:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:205:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:309:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:48)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1320:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • 304CA91D-8D77-4AAE-A50F-ECFC57AFD011 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 98.0.4758.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 2.11.0-0.0.pre.612, on macOS 12.2 21D49 darwin-arm, locale en-GB)
    • Flutter version 2.11.0-0.0.pre.612 at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c50b02f2c3 (9 hours ago), 2022-02-17 22:44:23 -0500
    • Engine revision 605454e201
    • Dart version 2.17.0 (build 2.17.0-118.0.dev)
    • DevTools version 2.10.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 213.5744.122

[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • 304CA91D-8D77-4AAE-A50F-ECFC57AFD011 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 98.0.4758.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@danagbemava-nc danagbemava-nc changed the title Visual glitch on iOS with Flutter 2.10 [ios][regression] Visual glitch when scrolling a list in a Scaffold that has a Material and Container as bottomNavigationBar Feb 18, 2022
@danagbemava-nc danagbemava-nc added engine flutter/engine repository. See also e: labels. found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically c: regression It was better in the past than it is now c: rendering UI glitches reported at the engine/skia rendering level f: scrolling Viewports, list views, slivers, etc. and removed in triage Presently being triaged by the triage team labels Feb 18, 2022
@chinmaygarde chinmaygarde added the P2 Important issues not at the top of the work list label Feb 22, 2022
@chinmaygarde
Copy link
Member

Possibly related to dirty region management but we need to reproduce. cc @jason-simmons @iskakaushik.

@iskakaushik
Copy link
Contributor

cc: @knopp

@knopp
Copy link
Member

knopp commented Feb 23, 2022

I'm looking into this.

@knopp
Copy link
Member

knopp commented Feb 23, 2022

The problem seems to be in PhysicalShapeLayer. It sets the path_ as paint bounds, even if clipping is disabled. This is not correct. The paint bounds in this case should be joined with child paint bounds (the child may paint outside material layer path, and in this case it indeed does due to the transform). Otherwise the PhysicalShapeLayer gets culled away during painting, causing the artifacts in video.

Setting the correct paint bounds resolves the issue. I should have PR ready soon.

@danagbemava-nc danagbemava-nc added the r: fixed Issue is closed as already fixed in a newer version label Feb 25, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now c: rendering UI glitches reported at the engine/skia rendering level engine flutter/engine repository. See also e: labels. f: scrolling Viewports, list views, slivers, etc. found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants