Skip to content

hitTesting offset when using SliverMainAxisGroup in CustomScrollable(reverse: true) #170999

@spkersten

Description

@spkersten

Steps to reproduce

When SliverMainAxisGroup is used in a CustomScrollable with reverse: true then the main axis extent of the last child of the SliverMainAxisGroup (incorrectly) offsets hit testing of the other children.

Perhaps related to #170991, #167801 (Logging this separately as I'm not sure and this deserves it's own widget tests)

Please add any fix as a point release to Flutter 3.32.

Expected results

hit testing works correctly.

Actual results

Tapping on the bottom 40dp of the red box does nothing, while tapping above outside of the red box prints "TAP".

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) => Directionality(
    textDirection: TextDirection.ltr,
    child: Padding(
      padding: const EdgeInsets.all(20.0),
      child: CustomScrollView(
        reverse: true,
        slivers: [
          SliverMainAxisGroup(
            slivers: [
              SliverToBoxAdapter(
                child: GestureDetector(
                  onTap: () {
                    print("TAP");
                  },
                  child: Container(color: Color(0xffff0000), height: 60),
                ),
              ),
              SliverToBoxAdapter(child: SizedBox(height: 40)),
            ],
          ),
        ],
      ),
    ),
  );
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.32.4, on macOS 15.5 24F74 darwin-arm64, locale en-NL)

Also broken on 3.33.0-1.0.pre.559

Was still working on 3.29.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: gesturesflutter/packages/flutter/gestures repository.f: scrollingViewports, list views, slivers, etc.found in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions