Skip to content

Screenshot & Shader Effects result in flipped output on certain android devices (v3.29.0) #163521

@hm21

Description

@hm21

Steps to reproduce

In version 3.29.0, a screenshot or applying a shader on some Android devices results in a vertically flipped output.

Option 1: Screenshot

  1. Use the minimal example below to capture the image with RenderRepaintBoundary.
  2. Test it using the Android emulator “Pixel Pro 8” — the image will appear flipped.
  3. Test it on another device like the “Galaxy S10” — the result will not be flipped.

Option 2: Shader

  1. Set up a simple shader for a specific area and apply it to the BackdropFilter.
  2. Test it using the Android emulator “Pixel Pro 8 API 35” — the image will appear flipped.
  3. Test it on another device like the “Galaxy S10” — the result will not be flipped.

FYI: If you want to test option 2 without setting up the shader and related configurations, you can use my package, pro_image_editor: ^8.3.1. Simply open the paint editor, select pixelate mode, and draw an area—you'll immediately notice that the Y-axis is flipped.

Expected results

The result should not be vertical flipped on any device.

Actual results

The image is vertical flipped on a few devices. In my tests, this issue occurred on "Pixel Pro 8" and "Nexus 10". However, a user reported in my package here that additional devices are also affected.

Affected devices:
Moto G54
Moto G55
Moto G Pure
Oppo F19 Pro
Galaxy Tab 7 Lite

Non affected devices:
HTC 10
Infinix Hot 11s
Samsung A06
Xiaomi Redmi Note 13
Xiaomi Redmi Pad Pro

Code sample

Code sample
class _MyHomePageState extends State<MyHomePage> {
  final _repaintKey = GlobalKey();

  Uint8List? _bytes;

  Future<ui.Image> _getDartUiImage() async {
    RenderObject? findRenderObject =
        _repaintKey.currentContext?.findRenderObject();

    RenderRepaintBoundary boundary = findRenderObject as RenderRepaintBoundary;

    return await boundary.toImage(
      pixelRatio: MediaQuery.devicePixelRatioOf(context),
    );
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            Expanded(
              child: RepaintBoundary(
                key: _repaintKey,
                child: Image.network(
                  'https://picsum.photos/id/230/2000',
                ),
              ),
            ),
            Expanded(
              child: _bytes != null
                  ? Image.memory(_bytes!)
                  : const Center(
                      child: Text(
                        'Press "Capture Image"',
                        style: TextStyle(color: Colors.red),
                      ),
                    ),
            )
          ],
        ),
      ),
      persistentFooterButtons: [
        FilledButton(
          onPressed: () async {
            var image = await _getDartUiImage();
            var bytes = await image.toByteData(format: ui.ImageByteFormat.png);
            _bytes = bytes!.buffer.asUint8List();
            setState(() {});
          },
          child: const Text('Capture Image'),
        ), 
      ],
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Result on devices that vertically flip the output

Capture Image Shader
Test1 Test2

Expected result

Capture Image Shader
Test3 Test4

Logs

No response

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.29.0, on Microsoft Windows [Version 10.0.26100.3194], locale de-CH) [1’103ms]
    • Flutter version 3.29.0 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (7 days ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[√] Windows Version (11 Home 64-bit, 24H2, 2009) [6.3s]

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [8.2s]
    • Android SDK at C:\Users\AlexF\AppData\Local\Android\Sdk
    • Platform android-35, build-tools 34.0.0
    • ANDROID_HOME = C:\Users\AlexF\AppData\Local\Android\Sdk
    • ANDROID_SDK_ROOT = C:\Users\AlexF\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
    • All Android licenses accepted.

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

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.0) [207ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.5.33414.496
    • Windows 10 SDK version 10.0.22000.0

[!] Android Studio (version 2023.2) [44ms]
    • 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
    X Unable to determine bundled Java version.
    • Try updating or re-installing Android Studio.

[√] Android Studio (version 2023.3) [42ms]
    • Android Studio at C:\Program Files\Android\Android Studio1
    • 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 Runtime Environment (build 17.0.10+0--11572160)

[√] VS Code (version 1.97.2) [41ms]
    • VS Code at C:\Users\AlexF\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.104.0

[√] Connected device (4 available) [1’194ms]
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.26100.3194]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 132.0.6834.197
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 132.0.2957.127

[√] Network resources [1’547ms]
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: renderingUI glitches reported at the engine/skia or impeller rendering levele: device-specificOnly manifests on certain devicese: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions