Skip to content

ExpansionTile InkSplash doesn't respect Shape's borderRadius  #125779

Description

@Mayb3Nots

Is there an existing issue for this?

Steps to reproduce

Similar issue #86603.

Other failed workaround attempts were to

  • Assign clipBehaviour to ExpansionTile
  • Wrapped InkWell with borderRadius
  • Wrapped ClipRRect with borderRadius

The only workaround that worked is to wrap ExpansionTile with Card or Material suggested in this SO thread

The core underlying problem is the ListTile under the hood, which has seen many instances of the same problem. Usually the workaround is the wrap the ListTile in an InkWell however this is not possible with ExpansionTile.

  1. Run the sample code.
  2. Tap on the ListTile to see that the InkSplash doesn't clip the shape's borderRadius

I would like to help to resolve this issue but I am not clear on the proper way to fix this. Is passing the shape property to ListTile the correct move?

Expected results

InkSplash should not exceed shape's border

Actual results

InkSplash exceeds shape's border

Code sample

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

const Color darkBlue = Color.fromARGB(255, 18, 32, 47);

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: darkBlue,
      ),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      clipBehavior: Clip.antiAlias,
      borderRadius: BorderRadius.circular(20),
      child: ExpansionTile(
        clipBehavior: Clip.antiAlias,
        shape: RoundedRectangleBorder(
          side: const BorderSide(color: Colors.black, width: 3),
          borderRadius: BorderRadius.circular(20),
        ),
        collapsedShape: RoundedRectangleBorder(
          side: const BorderSide(color: Colors.black, width: 3),
          borderRadius: BorderRadius.circular(20),
        ),
        title: const Text("InkSplash not respecting shape's borderRaidus"),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Screen.Recording.2023-05-01.at.12.07.20.PM.mov

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E261 darwin-arm64,
    locale en-MY)
    • Flutter version 3.7.12 on channel stable at /Users/samuel/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (13 days ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version
    33.0.2)
    • Android SDK at /Users/samuel/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

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

[✓] Android Studio (version 2022.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
      17.0.6+0-17.0.6b802.4-9586694)

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

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 12
      (API 31) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS
      13.3.1 22E261 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google
      Chrome 112.0.5615.137
    ! Error: Samuel’s iPhone is busy: Waiting to connect and unlock the device.
      Xcode will continue when Samuel’s iPhone is finished. (code -10)

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

• No issues found!

Activity

  1. darshankawar commented on May 2, 2023

    @darshankawar
    Member

    Thanks for the report @Mayb3Nots
    I think the underlying issue is related to InkSplash and that leads me to this open issue proposing changes to it and InkRipple features respectively that you can take a look and follow-up for further updates.

    Also check this for further reference: #20922 (comment)

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 2, 2023
  3. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    and removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    in triagePresently being triaged by the triage team
    on May 2, 2023
  4. TahaTesser commented on May 2, 2023

    @TahaTesser
    Contributor

    @Mayb3Nots
    Thanks for filing the issue, I can reproduce the behavior

    Is passing the shape property to ListTile the correct move?

    That's right, it looks like the underlying ListTile doesn't know about the ExpansionTile shape to clip it.
    You don't need to wrap any clipping widget since ListTile already has clipping capabilities, just pass the shape

    Here I created a simpler code sample

    code sample
    import 'package:flutter/material.dart';
    
    void main() => runApp(const MyApp());
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          theme: ThemeData(useMaterial3: true),
          home: const Example(),
        );
      }
    }
    
    class Example extends StatelessWidget {
      const Example({super.key});
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: const Text('ExpansionTile'),
          ),
          body: Center(
            child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 20),
              child: ExpansionTile(
                backgroundColor: Colors.red,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20),
                ),
                collapsedShape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20),
                ),
                title: const Text('Title'),
              ),
            ),
          ),
        );
      }
    }
    

    You can see without passing the shape, ListTile doesn't clip.

    Screen.Recording.2023-05-02.at.18.25.17.mov

    When passing the shape

    Screen.Recording.2023-05-02.at.18.24.36.mov
  5. TahaTesser commented on May 2, 2023

    @TahaTesser
    Contributor

    @Mayb3Nots

    I would like to help to resolve this issue but I am not clear on the proper way to fix this

    Feel free to file a PR for this with the test.

  6. changed the title [-]ExpansionTile InkSplash doesnt respect Shape's borderRadius [/-] [+]ExpansionTile InkSplash doesn't respect Shape's borderRadius [/+] on May 4, 2023
  7. Mayb3Nots commented on May 6, 2023

    @Mayb3Nots
    ContributorAuthor

    @Mayb3Nots

    I would like to help to resolve this issue but I am not clear on the proper way to fix this

    Feel free to file a PR for this with the test.

    Hi @TahaTesser while working on this, I slowly realized that this may be a little more complicated than I thought. Because the shape and collapsedShaped properties are used for the "external" widget that surrounds the ListTile, so if we just pass in the shape property to the ListTile, the ListTile will inherit all the properties like color and border which is not what we want.

    This is fine if we dont expand it since the shape is the same as the ListTile
    IMG_3310B5944272-1

    Problem arise when we expands it with children.
    IMG_B74A1359D78A-1

    And also do we have to take into account for the collapsed and expanded state?

    I am thinking maybe just of adding a dedicated listTileShape property? What do you think?

  8. self-assigned this
    on Oct 2, 2023
  9. moved this from To do to In progress in Nevercodeon Oct 3, 2023
  10. moved this from In progress to PR submitted in Nevercodeon Oct 3, 2023
  11. moved this from PR submitted to Done (PR merged) in Nevercodeon Jan 22, 2024
  12. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jan 22, 2024
  13. github-actions commented on Feb 5, 2024

    @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.

  14. locked as resolved and limited conversation to collaborators on Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

frameworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

  • Status
    Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions