admin管理员组文章数量:1292116
Issue Summary
Hey all ) I am building a Flutter app that displays a list of offers in a GridView.builder. Above the grid, I have a filtering section that smoothly expands and collapses when scrolling. This filtering section contains several filter buttons that should be clickable and hoverable.
However, I am experiencing a problem:
- When the filtering section is expanded, all filtering options appear visually, but they are not clickable or hoverable.
- It seems like an invisible overlay is covering them.
- Only the first row of buttons (upper tip of the second row) can be clicked/hovered, while the rest are completely unresponsive.
- The GridView itself works fine, and the cards are positioned correctly.
App Structure
- The filtering section is placed above the offers grid.
- The filtering section's height dynamically changes based on _isFilteringHidden.
- The offers grid is wrapped in an Expanded widget inside a Column to fill available space.
- An AnimatedContainer(height: filteringHeight) is used to prevent overlap issues when collapsing the filtering section.
Code Snippet:
AnimatedContainer(
duration: const Duration(milliseconds: 600),
height: filteringHeight, // Adjust height dynamically
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(16),
child: GridView.builder(
controller: _scrollController, // Track scrolling
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 3 / 4,
),
itemCount: offerData.length,
itemBuilder: (context, index) {
return buildOfferCard(
offerData[index]['image']!,
offerData[index]['title']!,
offerData[index]['description']!,
offerData[index]['discount']!
);
},
),
),
),
What I Tried
Check Overlay Issues
I added a debugPrint statement inside my filter button onTap method, and it does not trigger unless the button is in the first row.
Increased Opacity for Debugging
I wrapped the filtering section in a red semi-transparent container and found that the expanded filtering area is being visually rendered, but something is covering the lower part.
Used IgnorePointer & AbsorbPointer for Testing
Wrapping the AnimatedContainer in an IgnorePointer confirmed that the area was intercepting taps.
Potential Cause
I suspect the issue is caused by the AnimatedContainer(height: filteringHeight), which is likely creating a transparent but interactive overlay over the filtering options. This invisible layer blocks interactions with the buttons.
Question
How can I modify my layout to prevent the filteringHeight animation from blocking interactions while still ensuring a smooth expand/collapse motion AND keeping the non-expanded section under the filtering options?
Any help would be greatly appreciated!
本文标签: androidFlutter GridView Overlay Issue Filtering Section Prevents Clicks on OptionsStack Overflow
版权声明:本文标题:android - Flutter GridView Overlay Issue: Filtering Section Prevents Clicks on Options - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741547604a2384686.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论