Skip to content

Ink appears to bleed through IndexedStack #59963

Closed

Description

@tvolkert

Steps to reproduce

Run the following app:

import 'package:flutter/material.dart';

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

class BugReport extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection: TextDirection.ltr,
      child: Material(
        child: IndexedStack(
          index: 0,
          children: [
            Ink(width: 100, height: 100, decoration: BoxDecoration(color: Colors.black)),
            Ink(width: 50, height: 50, decoration: BoxDecoration(color: Colors.red)),
          ],
        ),
      ),
    );
  }
}

Expected behavior

Since the index of the IndexedStack is 0, you expect to only see a 100x100 black squareL

expected

Actual behavior

You see a 50x50 red square inside a 100x100 black square:

actual

This can be seen at http://dartpad.dev/b636ac9a0ba8f9f901c0ae872c785d54

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    P1High-priority issues at the top of the work list
    on Jun 22, 2020
  2. tvolkert commented on Jun 22, 2020

    @tvolkert
    ContributorAuthor

    @HansMuller says "It does seem like a bug. The InkDecoration that Ink creates is going to decorate it Material ancestor unconditionally, even if it's part of the tree doesn't get painted."

  3. xu-baolin commented on Jul 9, 2020

    @xu-baolin
    Member

    I would like to work on this issue and will submit a PR in a couple of days. @HansMuller

  4. HansMuller commented on Jul 9, 2020

    @HansMuller
    Contributor

    @xu-baolin - sounds good, will look for your PR

  5. xu-baolin commented on Jul 10, 2020

    @xu-baolin
    Member

    @xu-baolin - sounds good, will look for your PR

    @HansMuller I have submitted the PR, #61216 please review it, thank you very much. ^_^

  6. 19 remaining items

  7. added
    P2Important issues not at the top of the work list
    on Aug 18, 2022
  8. HansMuller commented on Aug 18, 2022

    @HansMuller
    Contributor

    Lowering this to P4 because there's a workaround.

  9. danagbemava-nc commented on Jan 3, 2023

    @danagbemava-nc
    Member

    Reproducible on the latest versions of flutter.

    screenshot
    updated sample
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const BugReport());
    }
    
    class BugReport extends StatelessWidget {
      const BugReport({super.key});
    
      @override
      Widget build(BuildContext context) {
        return Directionality(
          textDirection: TextDirection.ltr,
          child: Material(
            child: SafeArea(
              child: IndexedStack(
                index: 0,
                children: [
                  Ink(width: 100, height: 100, decoration: const BoxDecoration(color: Colors.black)),
                  Ink(width: 50, height: 50, decoration: const BoxDecoration(color: Colors.red)),
                ],
              ),
            ),
          ),
        );
      }
    }
    flutter doctor -v
    [✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-arm, locale en-GB)
        • Flutter version 3.3.10 on channel stable at /Users/nexus/dev/sdks/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 135454af32 (3 weeks ago), 2022-12-15 07:36:55 -0800
        • Engine revision 3316dd8728
        • Dart version 2.18.6
        • DevTools version 2.15.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-33, build-tools 33.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14B47b
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2021.3)
        • 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.13+0-b1751.21-8125866)
    
    [✓] VS Code (version 1.74.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.56.0
    
    [✓] Connected device (3 available)
        • M2007J20CG (mobile) • adb-5dd3be00-22GXB2._adb-tls-connect._tcp. • android-arm64  • Android 12 (API 31)
        • macOS (desktop)     • macos                                      • darwin-arm64   • macOS 13.1 22C65 darwin-arm
        • Chrome (web)        • chrome                                     • web-javascript • Google Chrome 108.0.5359.124
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    [!] Flutter (Channel master, 3.7.0-13.0.pre.138, on macOS 13.1 22C65 darwin-arm64, locale en-GB)
        • Flutter version 3.7.0-13.0.pre.138 on channel master at /Users/nexus/dev/sdks/flutters
        ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision b938dc13df (24 hours ago), 2023-01-02 05:47:23 -0500
        • Engine revision 472e34cbbc
        • Dart version 3.0.0 (build 3.0.0-76.0.dev)
        • DevTools version 2.20.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-33, build-tools 33.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14B47b
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2021.3)
        • 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.13+0-b1751.21-8125866)
    
    [✓] VS Code (version 1.74.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.56.0
    
    [✓] Connected device (3 available)
        • M2007J20CG (mobile) • adb-5dd3be00-22GXB2._adb-tls-connect._tcp. • android-arm64  • Android 12 (API 31)
        • macOS (desktop)     • macos                                      • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
        • Chrome (web)        • chrome                                     • web-javascript • Google Chrome 108.0.5359.124
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
  10. darkstarx commented on Mar 5, 2023

    @darkstarx
  11. tvolkert commented on Mar 14, 2023

    @tvolkert
    ContributorAuthor

    FYI I have a prototype of how I might go about solving this -- #122585

    @xu-baolin interested in your thoughts since it's a different design than your original solution (which I just tried again and breaks dozens of tests inside Google projects).

  12. tvolkert commented on Mar 15, 2023

    @tvolkert
    ContributorAuthor

    Ok, this is fixed in #122585 (still in review)

  13. tvolkert commented on Mar 25, 2023

    @tvolkert
    ContributorAuthor

    Fixed

  14. github-actions commented on Apr 10, 2023

    @github-actions

    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.

  15. locked as resolved and limited conversation to collaborators on Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionworkaround availableThere is a workaround available to overcome the issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions