-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: regressionIt was better in the past than it is nowIt was better in the past than it is nowf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.32Found to occur in 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33Found to occur in 3.33frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework teamwaiting for PR to land (fixed)A fix is in flightA fix is in flight
Description
Steps to reproduce
- Create a
CustomScrollViewwithreverse: trueand aSliverMainAxisGroupinside. - Add a
SliverPadding(padding: EdgeInsets.only(bottom: 56))before theSliverGrid. - Build and run on Flutter 3.32.4-stable.
- Tap any item inside the
SliverGrid.
Expected results
The tapped grid tile should receive the tap event and update its color (or perform any other intended action) exactly under the finger.
Removing the SliverPadding (or placing it outside the SliverMainAxisGroup) fixes the issue.
Using the same widget tree on Flutter 3.29.3 does not reproduce the problem, so this appears to be a regression introduced after that release.
Actual results
The visual tile under the finger is not the one that receives the tap event.
The hit-test region seems to be shifted when a SliverPadding with bottom padding is present inside a SliverMainAxisGroup.
Code sample
Code sample
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final ScrollController _scrollController = ScrollController();
int? _selectedIndex;
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
reverse: true,
controller: _scrollController,
slivers: [
// Problematic padding ─ removing this line makes taps work again.
SliverPadding(padding: const EdgeInsets.only(bottom: 56)),
SliverMainAxisGroup(
slivers: [
SliverGrid(
delegate: SliverChildBuilderDelegate(
(context, index) {
final selected = _selectedIndex == index;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => setState(() => _selectedIndex = index),
child: ColoredBox(
color: selected
? Theme.of(context).colorScheme.primaryContainer
: Colors.transparent,
child: Center(child: Text('Item $index')),
),
);
},
childCount: 100,
),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
mainAxisSpacing: 1,
crossAxisSpacing: 1,
),
),
],
),
],
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.4, on macOS 15.5 24F74 darwin-arm64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.101.1)
[✓] Connected device (4 available)
[✓] Network resourcesMetadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: regressionIt was better in the past than it is nowIt was better in the past than it is nowf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.32Found to occur in 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33Found to occur in 3.33frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework teamwaiting for PR to land (fixed)A fix is in flightA fix is in flight