Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using SentryAssetBundle() causes asset images to flash when CupertinoContextMenu() tapped #2528

Open
kouroku-room opened this issue Dec 20, 2024 · 4 comments

Comments

@kouroku-room
Copy link

kouroku-room commented Dec 20, 2024

Platform

Flutter Mobile Android

Obfuscation

Disabled

Debug Info

Disabled

Doctor

flutter doctor -v
[√] Flutter (Channel stable, 3.27.0, on Microsoft Windows [Version 10.0.22631.4602], locale ja-JP)
• Flutter version 3.27.0 on channel stable at C:\dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 8495dee1fd (9 days ago), 2024-12-10 14:23:39 -0800
• Engine revision 83bacfc525
• Dart version 3.6.0
• DevTools version 2.40.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\sugur\AppData\Local\Android\sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.1)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.10.34928.147
• Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android\Android Studio Koala Feature Drop
• 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 version "17.0.11" 2024-04-16

[√] Android Studio (version 2024.2)
• Android Studio at C:\Program Files\Android\Android Studio
• 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 version "21.0.3" 2024-04-16

[√] VS Code (version 1.95.3)
• VS Code at C:\Users\sugur\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.102.0

[√] Connected device (4 available)
• SH M25 (mobile) • adb-SX3LHMB420105423-rrDg4j._adb-tls-connect._tcp • android-arm64 • Android 14 (API 34)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4602]
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.140
• Edge (web) • edge • web-javascript • Microsoft Edge 131.0.2903.99

[√] Network resources
• All expected network resources are available.

• No issues found!

Version

8.11.1

Steps to Reproduce

Probably the same thing is occurring with that issue.
#1457

The above issue is closed because they could not provide reproducible code, but I could create it and will provide it.
https://github.com/kouroku-room/sample_for_issue/tree/9ca1d8f7fc4c7287cb7a96e0d9b4b63e698f6635

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        useMaterial3: true,
      ),
      home: DefaultAssetBundle(
        bundle: SentryAssetBundle(),
        child: MyHomePage(),
      ),
      // No flickering occurs when SentryAssetBundle() is not used as shown below.
      // home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: CupertinoContextMenu(
        actions: [
          CupertinoContextMenuAction(
            child: const Text('Action 1'),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
        ],
        child: Image.asset(
          'assets/bottle_1.png',
          width: 500,
          height: 500,
          // No flickering occurs when setting scale as shown below.
          // scale: 1,
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}
  1. Prepare Assets files with different resolutions.
    https://docs.flutter.dev/ui/assets/assets-and-images#resolution-aware

  2. Put CupertinoContextMenu(child: Image.asset()).
    ->At this time, a long press will not cause flickering.

  3. When wrapped in DefaultAssetBundle() with SentryAssetBundle() in place, the image flickers when long pressed.

Expected Result

No image flicker shall occur.

Actual Result

The image flickers when long pressed CupertinoContextMenu().

Are you willing to submit a PR?

None

@buenaflor
Copy link
Contributor

hey, thanks for the issue

does this happen consistently?

@buenaflor
Copy link
Contributor

I'm able to reproduce this, thanks for the snippet

@buenaflor buenaflor moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Dec 20, 2024
@kouroku-room
Copy link
Author

does this happen consistently?

I tried it on a device called "SH M25 (mobile)" and it occurred 100% of the time.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 21, 2024
@buenaflor
Copy link
Contributor

thanks for the info, we're looking into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Backlog
Development

No branches or pull requests

2 participants