Skip to content

CustomScrollView with SliverGrid hides scaled widgets with Transform.scale when any filterQuality is used and widget is almost at the end of the viewport #170535

Closed

Description

@krll-kov

Platforms where i reproduced this issue: MacOs and Windows.
Flutter version: 3.32.3

Expected behaviour (No filter quality):

Image

Wrong behaviour (card disappeared) when filter quality was present:

Image

Removal of filterQuality here demonstrates how it should work

  return Transform.scale(
              scale: scale,
              alignment: Alignment.center,
              filterQuality: FilterQuality.medium,
              child: child,
            );

Steps to reproduce:

  • paste the code into main.dart
  • run app on windows or macos
  • change window size or scroll the gridview so that any card is visible for approximately 5-8%
  • Hover the card
  • Test behaviour with and without filter quality to see the difference

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(
      title: 'SliverGrid Hover Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData.light().copyWith(
        scaffoldBackgroundColor: Colors.grey[100],
        primaryColor: Colors.indigo,
        appBarTheme: const AppBarTheme(
          backgroundColor: Colors.indigo,
          foregroundColor: Colors.white,
        ),
      ),
      home: const HoverGridScreen(),
    );
  }
}

class HoverGridScreen extends StatelessWidget {
  const HoverGridScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomScrollView(
        slivers: [
          const SliverAppBar(
            title: Text('Simple Grid with Hover Effect'),
            pinned: true,
            expandedHeight: 120.0,
            flexibleSpace: FlexibleSpaceBar(
              background: ColoredBox(color: Colors.indigo),
            ),
          ),
          SliverPadding(
            padding: const EdgeInsets.all(16.0),
            sliver: SliverGrid.builder(
              itemCount: 50,
              gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 3,
                mainAxisSpacing: 16.0,
                crossAxisSpacing: 16.0,
                childAspectRatio: 1.6,
              ),
              itemBuilder: (context, index) {
                return HoverScaleContainer(index: index + 1);
              },
            ),
          ),
        ],
      ),
    );
  }
}

class HoverScaleContainer extends StatefulWidget {
  final int index;

  const HoverScaleContainer({super.key, required this.index});

  @override
  State<HoverScaleContainer> createState() => _HoverScaleContainerState();
}

class _HoverScaleContainerState extends State<HoverScaleContainer> {
  bool _isHovered = false;

  @override
  Widget build(BuildContext context) {
    return MouseRegion(
      cursor: SystemMouseCursors.click,
      onEnter: (_) => setState(() => _isHovered = true),
      onExit: (_) => setState(() => _isHovered = false),
      child: TweenAnimationBuilder<double>(
        tween: Tween(begin: 1.0, end: _isHovered ? 1.1 : 1.0),
        duration: const Duration(milliseconds: 200),
        curve: Curves.easeOut,
        builder: (context, scale, child) {
          return Transform.scale(
            scale: scale,
            alignment: Alignment.center,
            filterQuality: FilterQuality.high,
            child: child,
          );
        },
        child: Container(
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(10),
            border: Border.all(
              color: _isHovered ? Colors.indigo : Colors.grey.shade300,
              width: _isHovered ? 2.0 : 1.0,
            ),
          ),
          child: Center(
            child: Text(
              'Item ${widget.index}',
              style: TextStyle(
                fontWeight: FontWeight.bold,
                fontSize: 18,
                color: _isHovered ? Colors.indigo : Colors.black54,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Activity

  1. tirth-patel-nc commented on Jun 13, 2025

    @tirth-patel-nc
    Member

    Triage Report

    I was able to reproduce the issue using the provided code sample on the stable (3.29.3), stable (3.32.4) and master (3.33.0-1.0.pre.494) channels. If I remove the filterQuality prop then it works fine. I've tested on macOS.

    Screen.Recording.2025-06-13.at.3.58.51.PM.mov
    On Web it is working fine.
    Screen.Recording.2025-06-13.at.4.05.34.PM.mov
  2. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-macosBuilding on or for macOS specifically
    platform-windowsBuilding on or for Windows specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    and removed
    in triagePresently being triaged by the triage team
    on Jun 13, 2025
  3. added
    P2Important issues not at the top of the work list
    on Aug 11, 2025
  4. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
  5. krll-kov commented on Aug 25, 2026

    @krll-kov
    ContributorAuthor

    This bug seems to be fixed on impeller now for both windows and macos. Linux - not tested. On skia it's still present

  6. added
    team-designOwned by Design Languages team
    triaged-designTriaged by Design Languages team
    and removed on Aug 26, 2026
  7. added a commit that references this issue on Oct 16, 2026
    132e1c6
  8. added a commit that references this issue on Oct 29, 2026
    ae796d7
  9. github-actions commented on Oct 30, 2026

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

  10. locked as resolved and limited conversation to collaborators on Oct 30, 2026
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 lista: desktopRunning on desktopfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.platform-macosBuilding on or for macOS specificallyplatform-windowsBuilding on or for Windows specificallyteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions