Sitelet https://web.archive.org/web/20230422093513/https://github.com/flutter/flutter/issues/86584
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

ListView background overflows from parent Container #86584

Open
CicadaCinema opened this issue Jul 16, 2021 · 13 comments
Open

ListView background overflows from parent Container #86584

CicadaCinema opened this issue Jul 16, 2021 · 13 comments
Labels
a: layout SystemChrome and Framework's Layout Issues f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. found in release: 2.2 Found to occur in 2.2 found in release: 2.4 Found to occur in 2.4 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on. P4 Priority 4 issue (default for bugs, things we're likely to work on) severe: regression It was better in the past than it is now.

Comments

@CicadaCinema
Copy link
Contributor

I'm facing an issue where I have constrained the height of a ListView (builder) widget with a Container, however the background colours of the contents of the ListView - ListTile widgets - are drawn outside the parent Container, as shown below.

Here is the code needed to reproduce the issue:

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Container(
          height: 200,
          child: ListView.builder(
            itemCount: 12,
            itemBuilder: (BuildContext context, int index) {
              return Container(
                height: 50,
                child: ListTile(
                  tileColor: index % 2 == 0 ? Colors.grey : null,
                  hoverColor: Colors.red,
                  onTap: () {},
                  title: Text(
                    "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                  ),
                ),
              );
            },
          ),
        ),
      ),
    );
  }
}

I have been able to reproduce the issue on both the stable and dev channels, but I have only attached logs from the stable channel. My system runs the Microsoft Windows [Version 10.0.19043.1083] operating system.

You can also view the issue in dartpad:
https://dartpad.dev/add807346cce557cd859364a2b843571

I think the following stackoverflow post also references this issue:
https://stackoverflow.com/questions/51211959/

However the 'solution' proposed is merely a workaround to the underlying issue, because in my case it breaks the expected hovering behaviour, as can be seen here, where I have implemented the workaround of setting the background colour of the Container instead of the ListTile:

https://dartpad.dev/22b2a05837b512e34e729c004b8afdde

Here, the red hovering indicator is not applied to the tiles coloured grey, which is not intended. It may be possible to work around this second issue once again by setting the red hovering indicator in the Container widget, but this is not a solution to the underlying issue with the ListTile widget.

Steps to Reproduce

  1. Run flutter create garbage.
  2. Replace the contents of /lib/main.dart with the code block above.
  3. Run flutter run and choose either the Windows or Web - Chrome option.

Expected results:

I would expect for the background of the ListTile widgets to be constrained to the size of the parent Container, just like the contents of the ListTile widgets (the lorem ipsum text).

Actual results:

chrome_1618

Logs

logs from the stable channel

flutter analyse

C:\Users\Atom\Downloads\garbage>flutter analyze
Analyzing garbage...

  error - The constructor being called isn't a const constructor - test\widget_test.dart:16:29 - const_with_non_const

1 issue found. (ran in 2.5s)

flutter doctor

C:\Software\flutter>flutter doctor -v
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19043.1083], locale en-GB)
    • Flutter version 2.2.3 at C:\Software\flutter
    • Framework revision f4abaa0735 (2 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Atom\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\OpenJDK\openjdk-11.0.11_9\bin\java
    • Java version OpenJDK Runtime Environment 18.9 (build 11.0.11+9)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.9.31129.286
    • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] VS Code, 64-bit edition (version 1.55.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.21.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1083]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 91.0.4472.164
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 91.0.864.67

! Doctor found issues in 1 category.

flutter run --verbose on Windows first, then on Chrome (web)


C:\Users\Atom\Downloads\garbage>flutter run --verbose
[  +69 ms] executing: [C:\Software\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +414 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] f4abaa0735eba4dfd8f33f73363911d63931fe03
[   +1 ms] executing: [C:\Software\flutter/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[  +62 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] 2.2.3
[   +5 ms] executing: [C:\Software\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +44 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\Software\flutter/] git ls-remote --get-url origin
[  +39 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +116 ms] executing: [C:\Software\flutter/] git rev-parse --abbrev-ref HEAD
[  +44 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +75 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +48 ms] executing: C:\Users\Atom\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +37 ms] List of devices attached
[   +5 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +5 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +64 ms] Multiple devices found:
[  +19 ms] Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1083]
[   +1 ms] Chrome (web)      • chrome  • web-javascript • Google Chrome 91.0.4472.164
[   +1 ms] Edge (web)        • edge    • web-javascript • Microsoft Edge 91.0.864.67
[   +1 ms] [1]: Windows (windows)
[        ] [2]: Chrome (chrome)
[        ] [3]: Edge (edge)
[   +2 ms] Please choose one (To quit, press "q/Q")
[        ] :
[+6477 ms] 1
[  +11 ms] Skipping pub get: version match.
[ +104 ms] Generating
C:\Users\Atom\Downloads\garbage\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +75 ms] Initializing file store
[   +9 ms] Skipping target: gen_localizations
[   +7 ms] complete
[   +4 ms] Launching lib\main.dart on Windows in debug mode...
[   +5 ms] C:\Software\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
C:\Software\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\Software\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter
--debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill
C:\Users\Atom\AppData\Local\Temp\flutter_tools.bbda6855\flutter_tool.2793bd05\app.dill --packages
C:\Users\Atom\Downloads\garbage\.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false
--enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
build\3c113a45063dc6628e68a4111abcacad.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy
[  +21 ms] executing: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -format json -products *
-utf8 -latest -version 16 -requires Microsoft.VisualStudio.Workload.NativeDesktop
Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.CMake.Project
[  +28 ms] Exit code 0 from: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -format json -products
* -utf8 -latest -version 16 -requires Microsoft.VisualStudio.Workload.NativeDesktop
Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.CMake.Project
[   +1 ms] [
             {
               "instanceId": "80743339",
               "installDate": "2021-04-02T01:50:28Z",
               "installationName": "VisualStudio/16.9.3+31129.286",
               "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community",
               "installationVersion": "16.9.31129.286",
               "productId": "Microsoft.VisualStudio.Product.Community",
               "productPath": "C:\\Program Files (x86)\\Microsoft Visual
               Studio\\2019\\Community\\Common7\\IDE\\devenv.exe",
               "state": 4294967295,
               "isComplete": true,
               "isLaunchable": true,
               "isPrerelease": false,
               "isRebootRequired": false,
               "displayName": "Visual Studio Community 2019",
               "description": "Powerful IDE, free for students, open-source contributors, and individuals",
               "channelId": "VisualStudio.16.Release",
               "channelUri": "https://aka.ms/vs/16/release/channel",
               "enginePath": "C:\\Program Files (x86)\\Microsoft Visual
               Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
               "releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-v16.9#16.9.3",
               "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909",
               "updateDate": "2021-04-02T01:50:28.7324977Z",
               "catalog": {
                 "buildBranch": "d16.9",
                 "buildVersion": "16.9.31129.286",
                 "id": "VisualStudio/16.9.3+31129.286",
                 "localBuild": "build-lab",
                 "manifestName": "VisualStudio",
                 "manifestType": "installer",
                 "productDisplayVersion": "16.9.3",
                 "productLine": "Dev16",
                 "productLineVersion": "2019",
                 "productMilestone": "RTW",
                 "productMilestoneIsPreRelease": "False",
                 "productName": "Visual Studio",
                 "productPatchVersion": "3",
                 "productPreReleaseMilestoneSuffix": "1.0",
                 "productSemanticVersion": "16.9.3+31129.286",
                 "requiredEngineVersion": "2.9.3365.38425"
               },
               "properties": {
                 "campaignId": "",
                 "channelManifestId": "VisualStudio.16.Release/16.9.3+31129.286",
                 "nickname": "2",
                 "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
               }
             }
           ]
[   +3 ms] Building Windows application...
[   +9 ms] <- compile package:garbage/main.dart
[   +2 ms] executing: C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -S
C:\Users\Atom\Downloads\garbage\windows -B build\windows -G Visual Studio 16 2019
[  +38 ms] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
[  +29 ms] -- Configuring done
[ +400 ms] -- Generating done
[  +36 ms] -- Build files have been written to: C:/Users/Atom/Downloads/garbage/build/windows
[   +5 ms] executing: C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe --build build\windows --config
Debug --target INSTALL --verbose
[ +145 ms] Microsoft (R) Build Engine version 16.9.0+5e4b48a27 for .NET Framework
[   +1 ms] Copyright (C) Microsoft Corporation. All rights reserved.
[  +55 ms] Build started 16/07/2021 22:29:26.
[ +254 ms] Project "C:\Users\Atom\Downloads\garbage\build\windows\INSTALL.vcxproj" on node 1 (default targets).
[   +1 ms] Project "C:\Users\Atom\Downloads\garbage\build\windows\INSTALL.vcxproj" (1) is building
"C:\Users\Atom\Downloads\garbage\build\windows\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
[   +1 ms] InitializeBuildStatus:
[   +1 ms]   Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[  +26 ms] CustomBuild:
[        ]   All outputs are up-to-date.
[  +80 ms]   Checking Build System
[  +73 ms] FinalizeBuildStatus:
[   +1 ms]   Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
[        ] Done Building Project "C:\Users\Atom\Downloads\garbage\build\windows\ZERO_CHECK.vcxproj" (default targets).
[ +101 ms] Project "C:\Users\Atom\Downloads\garbage\build\windows\INSTALL.vcxproj" (1) is building
"C:\Users\Atom\Downloads\garbage\build\windows\ALL_BUILD.vcxproj" (3) on node 1 (default targets).
[   +2 ms] Project "C:\Users\Atom\Downloads\garbage\build\windows\ALL_BUILD.vcxproj" (3) is building
"C:\Users\Atom\Downloads\garbage\build\windows\flutter\flutter_wrapper_app.vcxproj" (4) on node 1 (default targets).
[   +1 ms] Project "C:\Users\Atom\Downloads\garbage\build\windows\flutter\flutter_wrapper_app.vcxproj" (4) is building
"C:\Users\Atom\Downloads\garbage\build\windows\flutter\flutter_assemble.vcxproj" (5) on node 1 (default targets).
[   +1 ms] InitializeBuildStatus:
[        ]   Creating "x64\Debug\flutter_assemble\flutter_assemble.tlog\unsuccessfulbuild" because "AlwaysCreate" was
specified.
[   +2 ms] CustomBuild:
[        ]   "The build of
'C:\Users\Atom\Downloads\garbage\build\windows\CMakeFiles\7126dcc11d0bfef79bc9ce8b6e06c2de\flutter_assemble.rule'
depends on 'C:\USERS\ATOM\DOWNLOADS\GARBAGE\WINDOWS\FLUTTER\EPHEMERAL\FLUTTER_WINDOWS.DLL' which is produced by the
build of
'C:\Users\Atom\Downloads\garbage\build\windows\CMakeFiles\68875d1bddea5cc962e1a48af757105f\flutter_windows.dll.rule'.
The items cannot be built in parallel."
[  +41 ms]   Generating C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/flutter_windows.dll,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/flutter_export.h,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/flutter_windows.h,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/flutter_messenger.h,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/flutter_plugin_registrar.h,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/flutter_texture_registrar.h,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/cpp_client_wrapper/core_implementations.cc,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/cpp_client_wrapper/standard_codec.cc,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/cpp_client_wrapper/plugin_registrar.cc,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/cpp_client_wrapper/flutter_engine.cc,
C:/Users/Atom/Downloads/garbage/windows/flutter/ephemeral/cpp_client_wrapper/flutter_view_controller.cc, _phony_
[+1405 ms]   [  +68 ms] executing: [C:\Software\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +424 ms]   [ +446 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms]   [        ] f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ]   [        ] executing: [C:\Software\flutter/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[  +72 ms]   [  +73 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[   +1 ms]   [        ] 2.2.3
[   +4 ms]   [   +5 ms] executing: [C:\Software\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +51 ms]   [  +50 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +1 ms]   [        ] origin/stable
[        ]   [        ] executing: [C:\Software\flutter/] git ls-remote --get-url origin
[  +48 ms]   [  +50 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms]   [        ] https://github.com/flutter/flutter.git
[  +54 ms]   [  +56 ms] executing: [C:\Software\flutter/] git rev-parse --abbrev-ref HEAD
[  +53 ms]   [  +53 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +1 ms]   [        ] stable
[  +57 ms]   [  +58 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +1 ms]   [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ]   [   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +92 ms]   [  +96 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[   +1 ms]   [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ]   [   +2 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ]   [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +13 ms]   [  +23 ms] Initializing file store
[  +13 ms]   [  +13 ms] Done initializing file store
[  +32 ms]   [  +32 ms] Skipping target: gen_localizations
[+2690 ms]   [+2690 ms] Skipping target: unpack_windows
[ +466 ms]   [ +467 ms] kernel_snapshot: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have
updated contents: C:\Users\Atom\Downloads\garbage\lib\main.dart}
[  +10 ms]   [  +10 ms] C:\Software\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
C:\Software\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\Software\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --target=flutter
--no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true -Ddart.vm.profile=false -Ddart.vm.product=false
--enable-asserts --track-widget-creation --packages C:\Users\Atom\Downloads\garbage\.dart_tool\package_config.json
--output-dill C:\Users\Atom\Downloads\garbage\.dart_tool\flutter_build\bdd4e5f3475584af56b320e16dcdf05d\app.dill
--depfile C:\Users\Atom\Downloads\garbage\.dart_tool\flutter_build\bdd4e5f3475584af56b320e16dcdf05d\kernel_snapshot.d
package:garbage/main.dart
[+7572 ms]   [+7572 ms] kernel_snapshot: Complete
[ +475 ms]   [ +475 ms] debug_bundle_windows_assets: Starting due to {InvalidatedReasonKind.inputChanged: The following
inputs have updated contents:
C:\Users\Atom\Downloads\garbage\.dart_tool\flutter_build\bdd4e5f3475584af56b320e16dcdf05d\app.dill}
[ +117 ms]   [ +117 ms] debug_bundle_windows_assets: Complete
[ +248 ms]   [ +248 ms] Persisting file store
[   +8 ms]   [   +8 ms] Done persisting file store
[   +5 ms]   [   +4 ms] build succeeded.
[   +8 ms]   [   +8 ms] "flutter assemble" took 11,794ms.
[   +3 ms]   [   +3 ms] Running shutdown hooks
[   +2 ms]   [        ] Shutdown hooks complete
[        ]   [        ] exiting with code 0
[  +80 ms] FinalizeBuildStatus:
[   +1 ms]   Deleting file "x64\Debug\flutter_assemble\flutter_assemble.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\flutter_assemble\flutter_assemble.tlog\flutter_assemble.lastbuildstate".
[        ] Done Building Project "C:\Users\Atom\Downloads\garbage\build\windows\flutter\flutter_assemble.vcxproj"
(default targets).
[   +4 ms] InitializeBuildStatus:
[        ]   Creating "flutter_wrapper_app.dir\Debug\flutter_.3606C26B.tlog\unsuccessfulbuild" because "AlwaysCreate"
was specified.
[   +1 ms] CustomBuild:
[        ]   All outputs are up-to-date.
[  +38 ms] ClCompile:
[   +1 ms]   All outputs are up-to-date.
[  +18 ms] Lib:
[   +1 ms]   All outputs are up-to-date.
[        ]   flutter_wrapper_app.vcxproj ->
C:\Users\Atom\Downloads\garbage\build\windows\flutter\Debug\flutter_wrapper_app.lib
[   +8 ms] FinalizeBuildStatus:
[   +1 ms]   Deleting file "flutter_wrapper_app.dir\Debug\flutter_.3606C26B.tlog\unsuccessfulbuild".
[        ]   Touching "flutter_wrapper_app.dir\Debug\flutter_.3606C26B.tlog\flutter_wrapper_app.lastbuildstate".
[        ] Done Building Project "C:\Users\Atom\Downloads\garbage\build\windows\flutter\flutter_wrapper_app.vcxproj"
(default targets).
[  +32 ms] Project "C:\Users\Atom\Downloads\garbage\build\windows\ALL_BUILD.vcxproj" (3) is building
"C:\Users\Atom\Downloads\garbage\build\windows\flutter\flutter_wrapper_plugin.vcxproj" (6) on node 1 (default targets).
[   +1 ms] InitializeBuildStatus:
[   +1 ms]   Creating "flutter_wrapper_plugin.dir\Debug\flutter_.82AEA20C.tlog\unsuccessfulbuild" because "AlwaysCreate"
was specified.
[   +1 ms] CustomBuild:
[        ]   All outputs are up-to-date.
[   +6 ms] ClCompile:
[        ]   All outputs are up-to-date.
[   +4 ms] Lib:
[   +2 ms]   All outputs are up-to-date.
[        ]   flutter_wrapper_plugin.vcxproj ->
C:\Users\Atom\Downloads\garbage\build\windows\flutter\Debug\flutter_wrapper_plugin.lib
[   +4 ms] FinalizeBuildStatus:
[        ]   Deleting file "flutter_wrapper_plugin.dir\Debug\flutter_.82AEA20C.tlog\unsuccessfulbuild".
[   +1 ms]   Touching "flutter_wrapper_plugin.dir\Debug\flutter_.82AEA20C.tlog\flutter_wrapper_plugin.lastbuildstate".
[        ] Done Building Project "C:\Users\Atom\Downloads\garbage\build\windows\flutter\flutter_wrapper_plugin.vcxproj"
(default targets).
[  +34 ms] Project "C:\Users\Atom\Downloads\garbage\build\windows\ALL_BUILD.vcxproj" (3) is building
"C:\Users\Atom\Downloads\garbage\build\windows\runner\garbage.vcxproj" (7) on node 1 (default targets).
[   +1 ms] InitializeBuildStatus:
[        ]   Creating "garbage.dir\Debug\garbage.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[        ] CustomBuild:
[        ]   All outputs are up-to-date.
[  +19 ms] ClCompile:
[   +1 ms]   C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\CL.exe /c /IC:\Users\Atom\Downloads\garbage\windows
/IC:\Users\Atom\Downloads\garbage\windows\flutter\ephemeral
/IC:\Users\Atom\Downloads\garbage\windows\flutter\ephemeral\cpp_client_wrapper\include /Zi /nologo /W4 /WX
/diagnostics:column /Od /Ob0 /D WIN32 /D _WINDOWS /D _HAS_EXCEPTIONS=0 /D _DEBUG /D NOMINMAX /D UNICODE /D _UNICODE /D
"CMAKE_INTDIR=\"Debug\"" /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope
/Zc:inline /GR /std:c++17 /Fo"garbage.dir\Debug\\" /Fd"garbage.dir\Debug\vc142.pdb" /Gd /TP /wd4100 /errorReport:queue
C:\Users\Atom\Downloads\garbage\windows\flutter\generated_plugin_registrant.cc
C:\Users\Atom\Downloads\garbage\windows\runner\flutter_window.cpp
[  +85 ms]   generated_plugin_registrant.cc
[ +371 ms]   flutter_window.cpp
[ +813 ms]   Generating Code...
[  +83 ms] ResourceCompile:
[   +1 ms]   All outputs are up-to-date.
[  +27 ms] Link:
[   +1 ms]   C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE
/OUT:"C:\Users\Atom\Downloads\garbage\build\windows\runner\Debug\garbage.exe" /INCREMENTAL /NOLOGO
..\flutter\Debug\flutter_wrapper_app.lib
C:\Users\Atom\Downloads\garbage\windows\flutter\ephemeral\flutter_windows.dll.lib kernel32.lib user32.lib gdi32.lib
winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed
/manifestinput:C:\Users\Atom\Downloads\garbage\windows\runner\runner.exe.manifest /DEBUG
/PDB:"C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/garbage.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE
/NXCOMPAT /IMPLIB:"C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/garbage.lib" /MACHINE:X64  /machine:x64
garbage.dir\Debug\Runner.res
[   +1 ms]   garbage.dir\Debug\flutter_window.obj
[        ]   garbage.dir\Debug\main.obj
[   +1 ms]   garbage.dir\Debug\utils.obj
[        ]   garbage.dir\Debug\win32_window.obj
[        ]   garbage.dir\Debug\generated_plugin_registrant.obj
[ +232 ms]   garbage.vcxproj -> C:\Users\Atom\Downloads\garbage\build\windows\runner\Debug\garbage.exe
[   +6 ms] FinalizeBuildStatus:
[        ]   Deleting file "garbage.dir\Debug\garbage.tlog\unsuccessfulbuild".
[        ]   Touching "garbage.dir\Debug\garbage.tlog\garbage.lastbuildstate".
[        ] Done Building Project "C:\Users\Atom\Downloads\garbage\build\windows\runner\garbage.vcxproj" (default
targets).
[   +6 ms] InitializeBuildStatus:
[        ]   Creating "x64\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[   +4 ms] CustomBuild:
[        ]   All outputs are up-to-date.
[  +42 ms]   Building Custom Rule C:/Users/Atom/Downloads/garbage/windows/CMakeLists.txt
[  +44 ms] FinalizeBuildStatus:
[   +2 ms]   Deleting file "x64\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\ALL_BUILD\ALL_BUILD.tlog\ALL_BUILD.lastbuildstate".
[        ] Done Building Project "C:\Users\Atom\Downloads\garbage\build\windows\ALL_BUILD.vcxproj" (default targets).
[   +3 ms] InitializeBuildStatus:
[        ]   Creating "x64\Debug\INSTALL\INSTALL.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[  +58 ms] PostBuildEvent:
[   +1 ms]   setlocal
[   +1 ms]   "C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P
cmake_install.cmake
[        ]   if %errorlevel% neq 0 goto :cmEnd
[        ]   :cmEnd
[        ]   endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
[        ]   :cmErrorLevel
[        ]   exit /b %1
[        ]   :cmDone
[        ]   if %errorlevel% neq 0 goto :VCEnd
[        ]   :VCEnd
[  +47 ms]   -- Install configuration: "Debug"
[  +23 ms]   -- Up-to-date: C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/icudtl.dat
[        ]   -- Up-to-date: C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/flutter_windows.dll
[   +7 ms]   -- Installing: C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets
[        ]   -- Installing:
C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/AssetManifest.json
[   +1 ms]   -- Installing:
C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/FontManifest.json
[   +1 ms]   -- Installing: C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/fonts
[   +2 ms]   -- Installing:
C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/fonts/MaterialIcons-Regular.otf
[   +5 ms]   -- Installing:
C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/kernel_blob.bin
[ +117 ms]   -- Installing: C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/NOTICES
[   +3 ms]   -- Installing: C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/packages
[        ]   -- Installing:
C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/packages/cupertino_icons
[        ]   -- Installing:
C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/packages/cupertino_icons/assets
[        ]   -- Installing:
C:/Users/Atom/Downloads/garbage/build/windows/runner/Debug/data/flutter_assets/packages/cupertino_icons/assets/Cupertino
Icons.ttf
[  +13 ms] FinalizeBuildStatus:
[        ]   Deleting file "x64\Debug\INSTALL\INSTALL.tlog\unsuccessfulbuild".
[        ]   Touching "x64\Debug\INSTALL\INSTALL.tlog\INSTALL.lastbuildstate".
[        ] Done Building Project "C:\Users\Atom\Downloads\garbage\build\windows\INSTALL.vcxproj" (default targets).
[   +1 ms] Build succeeded.
[        ]     0 Warning(s)
[        ]     0 Error(s)
[        ] Time Elapsed 00:00:16.88
[  +17 ms] Building Windows application... (completed in 17.6s)
[+3022 ms] Observatory URL on device: http://127.0.0.1:51417/_kSzEtUdFUU=/
[   +4 ms] Caching compiled dill
[  +28 ms] Connecting to service protocol: http://127.0.0.1:51417/_kSzEtUdFUU=/
[ +141 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at
http://127.0.0.1:51417/_kSzEtUdFUU=/.
[  +60 ms] DDS is listening at http://127.0.0.1:51420/zHT-pFFsSuM=/.
[  +51 ms] Successfully connected to service protocol: http://127.0.0.1:51417/_kSzEtUdFUU=/
[  +16 ms] DevFS: Creating new filesystem on the device (null)
[  +16 ms] DevFS: Created new filesystem on the device
(file:///C:/Users/Atom/AppData/Local/Temp/garbageeeb63281/garbage/)
[   +2 ms] Updating assets
[  +72 ms] Syncing files to device Windows...
[   +2 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +2 ms] <- recompile package:garbage/main.dart a7d96fcf-47fd-4651-b8e2-7a688e7ea94b
[        ] <- a7d96fcf-47fd-4651-b8e2-7a688e7ea94b
[ +118 ms] Updating files.
[   +1 ms] DevFS: Sync finished
[   +1 ms] Syncing files to device Windows... (completed in 127ms)
[   +1 ms] Synced 0.0MB.
[   +1 ms] <- accept
[   +5 ms] Connected to _flutterView/0x1e95a86cc60.
[   +2 ms] Flutter run key commands.
[   +2 ms] r Hot reload.
[   +1 ms] R Hot restart.
[        ] h Repeat this help message.
[   +1 ms] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ]  Running with sound null safety
[   +1 ms] An Observatory debugger and profiler on Windows is available at: http://127.0.0.1:51420/zHT-pFFsSuM=/
[ +627 ms] The Flutter DevTools debugger and profiler on Windows is available at:
                    http://127.0.0.1:9104?uri=http%3A%2F%2F127.0.0.1%3A51420%2FzHT-pFFsSuM%3D%2F
[+9600 ms] DevFS: Deleting filesystem on the device (file:///C:/Users/Atom/AppData/Local/Temp/garbageeeb63281/garbage/)
[   +5 ms] DevFS: Deleted filesystem on the device (file:///C:/Users/Atom/AppData/Local/Temp/garbageeeb63281/garbage/)
[ +115 ms] Service protocol connection closed.
[   +1 ms] Application finished.
[   +4 ms] "flutter run" took 38,522ms.
[   +3 ms] Running shutdown hooks
[   +1 ms] Shutdown hooks complete
[   +3 ms] exiting with code 0

C:\Users\Atom\Downloads\garbage>flutter run --verbose
[  +68 ms] executing: [C:\Software\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +416 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] executing: [C:\Software\flutter/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[  +60 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] 2.2.3
[   +5 ms] executing: [C:\Software\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +42 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\Software\flutter/] git ls-remote --get-url origin
[  +38 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +118 ms] executing: [C:\Software\flutter/] git rev-parse --abbrev-ref HEAD
[  +42 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +77 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +49 ms] executing: C:\Users\Atom\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +38 ms] List of devices attached
[   +5 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +5 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +65 ms] Multiple devices found:
[  +19 ms] Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1083]
[   +1 ms] Chrome (web)      • chrome  • web-javascript • Google Chrome 91.0.4472.164
[        ] Edge (web)        • edge    • web-javascript • Microsoft Edge 91.0.864.67
[   +1 ms] [1]: Windows (windows)
[        ] [2]: Chrome (chrome)
[        ] [3]: Edge (edge)
[   +2 ms] Please choose one (To quit, press "q/Q")
[        ] :
[+7298 ms] 2
[  +11 ms] Skipping pub get: version match.
[ +101 ms] Generating
C:\Users\Atom\Downloads\garbage\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +77 ms] Launching lib\main.dart on Chrome in debug mode...
[  +97 ms] Updating assets
[  +68 ms] Waiting for connection from debug service on Chrome...
[  +72 ms] <- reset
[   +9 ms] C:\Software\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
C:\Software\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\Software\flutter\bin\cache\flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill
C:\Users\Atom\AppData\Local\Temp\flutter_tools.81f76edd\flutter_tool.90da54fe\app.dill --libraries-spec
file:///C:/Software/flutter/bin/cache/flutter_web_sdk/libraries.json --packages
C:\Users\Atom\Downloads\garbage\.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false
--enable-asserts --track-widget-creation --filesystem-root
C:\Users\Atom\AppData\Local\Temp\flutter_tools.81f76edd\flutter_tools.7d171f71 --filesystem-scheme org-dartlang-app
--initialize-from-dill build\b1b715402d823b7fd5c2b68d2edcb2ce.cache.dill.track.dill --platform
file:///C:/Software/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill --sound-null-safety
[   +8 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+14808 ms] Waiting for connection from debug service on Chrome... (completed in 14.9s)
[   +1 ms] Synced 28.2MB.
[   +1 ms] <- accept
[        ] Caching compiled dill
[ +854 ms] [CHROME]:
[   +5 ms] [CHROME]:DevTools listening on ws://127.0.0.1:63547/devtools/browser/f266c332-f8d9-4687-b90b-fc85bb5140b8
[ +393 ms] DwdsInjector: Received request for entrypoint at http://localhost:51473/main_module.bootstrap.js
[   +8 ms] MetadataProvider: Loading debug metadata...
[  +14 ms] MetadataProvider: Loaded debug metadata (sound null safety)
[   +5 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:51473/main_module.bootstrap.js
[+1461 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety:
true
[  +57 ms] DevHandler: Debug service listening on ws://127.0.0.1:62687/9IIkN3f-lMg=/ws

[  +21 ms] This app is linked to the debug service: ws://127.0.0.1:62687/9IIkN3f-lMg=/ws
[   +7 ms] Debug service listening on ws://127.0.0.1:62687/9IIkN3f-lMg=/ws
[        ]  Running with sound null safety
[   +3 ms]   To hot restart changes while running, press "r" or "R".
[        ] For a more detailed help message, press "h". To quit, press "q".
[+13720 ms] DevHandler: Stopped debug service on ws://127.0.0.1:62685

[+3658 ms] Application finished.
[   +5 ms] "flutter run" took 43,006ms.
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[   +9 ms] exiting with code 0

C:\Users\Atom\Downloads\garbage>
@gitaaron
Copy link

gitaaron commented Jul 17, 2021 •

I encountered the same issue. Here is a gist illustrating the problem -

https://dartpad.dev/?id=4eebd5c2bf278a8ba2e2c0c7e9a269bf&null_safety=true

Wrapping the 'ListTile' in a 'Container' with a background color of black does not make the issue go away. It just becomes more apparent! I also tried to wrap the 'ListView' in a 'ClipRect' and it did not solve the issue.

This feels like it should be a fairly common problem meaning I must be missing something.

Is there a simple fix for this?

Edit:
I figured out what I am missing! I had a look at the 'ListTile' docs and realized they wrapped the component in a 'Card'. Here is a working gist -
https://dartpad.dev/?id=1c94d75522b329061f3f164e85b47d60&null_safety=true

Just a suggestion for the flutter team - if the 'ListTile' expects a certain type of parent it would be nice if the framework threw an exception.

@CicadaCinema
Copy link
Contributor Author

Thank you for the suggestion! I still feel as though this is unexpected behaviour and should be resolved somehow since under no circumstance would I expect the background/foreground of a Widget to be clipped differently.

@gitaaron
Copy link

gitaaron commented Jul 18, 2021 •

I agree @ColonisationCaptain. FYI - it seems to not only be a problem with 'ListTile' but also other widgets such as 'InkWell' if the direct child of the list is not a 'Card'.

@maheshmnj maheshmnj added the in triage Presently being triaged by the triage team. label Jul 19, 2021
@maheshmnj
Copy link
Member

maheshmnj commented Jul 19, 2021 •

Hi @ColonisationCaptain,
Thank you so much for filing the issue, I am able to reproduce the issue on the latest stable and the master channel. The ListView is not respecting the bounds of the container it lies in. This is a severe regression I could not find the exact version where it broke though but I found this to be working fine on 1.22.6 output attached below.

Edited: This works fine on v2.0.0 and is broken on 2.0.1, so most probably it was broken on v2.0.1

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: ListViewIssue(),
    );
  }
}


class ListViewIssue extends StatefulWidget {
  ListViewIssue({Key key}) : super(key: key);

  @override
  _ListViewIssueState createState() => _ListViewIssueState();
}

class _ListViewIssueState extends State<ListViewIssue> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Container(
            color: Colors.grey,
            height: 300,
            child: ListView.builder(
              itemCount: 12,
              itemBuilder: (BuildContext context, int index) {
                return Container(
                  height: 50,
                  child: ListTile(
                    tileColor: Colors.green,
                    hoverColor: Colors.red,
                    onTap: () {},
                    title: Text("List Item $index"),
                  ),
                );
              },
            ),
          ),
          Text('This is out of List'),
        ],
      ),
    );
  }
}

Output
Broken on latest Stable 2.2 or master 2.4 This is working fine on the older version 2.0.0
Screen.Recording.2021-07-19.at.6.18.47.PM.mov
Screen.Recording.2021-07-19.at.6.16.57.PM.mov
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-arm, locale en-GB)
    • Flutter version 2.2.3 at /Users/mahesh/Documents/flutter
    • Framework revision f4abaa0735 (2 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.2)
    • 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.8+10-b944.6916264)

[✓] IntelliJ IDEA Community Edition (version 2021.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 57.0.5
    • Dart plugin version 211.7233

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 11.4 20F71 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 91.0.4472.114

• No issues found!
[✓] Flutter (Channel master, 2.4.0-1.0.pre.149, on macOS 11.4 20F71 darwin-arm, locale en-GB)
    • Flutter version 2.4.0-1.0.pre.149 at /Users/mahesh/Documents/flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d71c0eb1d8 (10 days ago), 2021-07-09 06:01:04 -0400
    • Engine revision 024cc455fe
    • Dart version 2.14.0 (build 2.14.0-293.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.2)
    • 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.8+10-b944.6916264)

[✓] IntelliJ IDEA Community Edition (version 2021.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 57.0.5
    • Dart plugin version 211.7233

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 11.4 20F71 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 91.0.4472.114

• No issues found!

Thank you for your contribution.

@maheshmnj maheshmnj added f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. found in release: 2.2 Found to occur in 2.2 found in release: 2.4 Found to occur in 2.4 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on. severe: regression It was better in the past than it is now. and removed in triage Presently being triaged by the triage team. labels Jul 19, 2021
@maheshmnj
Copy link
Member

cc: @goderbauer

@Piinks Piinks self-assigned this Sep 9, 2021
@Piinks Piinks added the a: layout SystemChrome and Framework's Layout Issues label Sep 9, 2021
@Piinks
Copy link
Contributor

Piinks commented Sep 9, 2021

I was able to isolate this is a little bit more.

import 'package:flutter/material.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SizedBox(
          height: 200,
          child: ListView.builder(
            itemCount: 12,
            itemBuilder: (BuildContext context, int index) {
              // Wrapping ListTile in a Card resolves this issue, but should not
              // be necessary
              return ListTile(
                tileColor: index % 2 == 0 ? Colors.grey : null,
                onTap: () {},
                title: Text('List Item $index'),
              );
            },
          ),
        ),
      ),
    );
  }
}

I also was able to bisect to the change that caused it: #76892
@gspencergoog can you take a look at this?

@Piinks Piinks removed their assignment Sep 9, 2021
@gspencergoog gspencergoog added the P4 Priority 4 issue (default for bugs, things we're likely to work on) label Sep 9, 2021
@gspencergoog
Copy link
Contributor

gspencergoog commented Sep 9, 2021 •

cc @NWalker1208 Looks like your change (#74373) is causing some clipping issues. Do you have time to take a look at it?

It took me a bit to realize what the bug here is from the description, but if you scroll the view in the dartpad examples, you can see that although the list content isn't displayed outside the container, the ink is still drawing outside of the bounds of the parent container when it should be clipped.

I think the reason that putting a ListTile around the contents fixes it is that it introduces a Material widget that is bounded, and indeed, the following version of the example just adds a Material, which works around the issue.

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: SizedBox(
          height: 200,
          child: Material(  // Just adding this fixes the issue
            child: ListView.builder(
              itemCount: 12,
              itemBuilder: (BuildContext context, int index) {
                return SizedBox(
                  height: 50,
                  child: ListTile(
                    tileColor: index.isEven ? Colors.grey : null,
                    hoverColor: Colors.red,
                    onTap: () {},
                    title: const Text(
                      "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                    ),
                  ),
                );
              },
            ),
          ),
        ),
      ),
    );
  }
}

@NWalker1208
Copy link
Contributor

@gspencergoog

Gotcha. It's been a while since I looked at the changes I made, but this makes sense based on what I remember. The ListTile was having issues with ink effects because its background was drawn on top of the Material widget that rendered the ink effects. We fixed that by making the background an ink decoration so it is rendered below the ink effects. But that seems to be causing issues when the Material widget that renders the background and effects is larger than the area that the tile should be clipped to. This issue was likely present before, but was less noticeable since only the ripple effects were being drawn instead of the background.

I see two possible solutions. One, you could wrap the ListView's widget tree in a Material widget, which would then clip any ink decorations to the appropriate area. That's basically the workaround it sounds like they're using, but this would make it built in to the ListView. This would be a simple solution, but doesn't solve the larger problem of InkDecorations being clipped only based on the Material widget rather than whatever widget created them. You could also have the ListTile wrap itself in a Material widget, so that any clipping applied to it also applies to the ink effects it creates.

If I understand right, though, Material widgets are more resource intensive, so it's generally encouraged to use as few of them as possible. Long term, there may need to be some way to have InkDecorations include information about how they should be clipped. I'm not sure how that could be implemented, and unfortunately I'm pretty busy now with school. Hopefully you all can find a workable solution, I'll try to chime in when I can.

@Piinks
Copy link
Contributor

Piinks commented Sep 10, 2021

Thank you for the update @NWalker1208! This makes me think #88793 is related.

@gspencergoog
Copy link
Contributor

I'm actually starting to think that this is "as intended", because ink is meant to be drawn on whatever material it is on top of, and we have plenty of places where you have to supply a Material widget in order to limit the spread of the ink to the desired area. I think the difference here is that the ink in question is the background color, not just an animated ink splash. So, if you want the background ink to only be drawn in the area of your widget, you have to supply a Material widget that limits it.

I'm not saying it's totally intuitive the first time you encounter it, or that we shouldn't change the way it works, but it does give you more flexibility to have ink (especially ink splashes) draw outside the immediate widget that is being clicked (which is desirable for some design scenarios).

@gspencergoog
Copy link
Contributor

It's also a "regression" in the sense that the behavior has now changed from the original implementation.

@gitaaron
Copy link

gitaaron commented Sep 11, 2021 •

First off I found a better solution that takes into account @NWalker1208's performance concerns in wrapping each child. The 'ListView' can simply be wrapped in a Material component.

https://dartpad.dev/?id=e911a9f82de19eac8c7e70ccd3af599d&null_safety=true

@gspencergoog - from my perspective (a dumb user), it would be more helpful if any scroll container were more consistently clipping it's content.

For example, I would expect both the background and text to be clipped in this case -

https://dartpad.dev/?id=2c242d875656a8e5f03cca6dde39e851&null_safety=true

What if the viewport wrapped its children in a material component?

@caseycrogers
Copy link
Contributor

caseycrogers commented Jan 5, 2022 •

I'm actually starting to think that this is "as intended", because ink is meant to be drawn on whatever material it is on top of, and we have plenty of places where you have to supply a Material widget in order to limit the spread of the ink to the desired area. I think the difference here is that the ink in question is the background color, not just an animated ink splash...

Jumping into this as a confused flutter user without much context so sorry if this isn't helpful, but this feels like really strange and undesirable behavior for a background color. It makes total sense to me for something like an ink splash. What about just making list tile's background color behave like Container instead of behaving like ink?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: layout SystemChrome and Framework's Layout Issues f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. found in release: 2.2 Found to occur in 2.2 found in release: 2.4 Found to occur in 2.4 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on. P4 Priority 4 issue (default for bugs, things we're likely to work on) severe: regression It was better in the past than it is now.
Projects
None yet
Development

No branches or pull requests

8 participants