Skip to content

[Impeller] Android SurfaceControl errors on Xiaomi 14 / Xiaomi 15 Pro. #160025

Description

@LennoxGong

Steps to reproduce

Slide the page up and down and this problem occurs frequently.
Device:Xiaomi 14 (HyperOS2.0)(Android V) Snapdragon 8 Gen3
Xiaomi 15 Pro (reproduce)

Expected results

The page can be rendered normally.

Actual results

There were many unexpected anomalies.
What puzzles me is that I started the application with the option --enable-vulkan-validation, but I didn't see any vulkan-related errors.

Code sample

Code sample
import 'dart:ui';
import 'package:flutter/material.dart';

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

  @override
  _ComplexUIPageState createState() => _ComplexUIPageState();
}

class _ComplexUIPageState extends State<ComplexUIPage> {
  final ScrollController _scrollController = ScrollController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          // 背景模糊与半透明覆盖层
          Positioned.fill(
            child: Image.asset(
              'assets/images/3.jpeg', // 替换为实际背景图片路径
              fit: BoxFit.cover,
            ),
          ),
          Positioned.fill(
            child: BackdropFilter(
              filter: ImageFilter.blur(sigmaX: 8.0, sigmaY: 8.0),
              child: Container(
                color: Colors.black.withAlpha(50),
              ),
            ),
          ),
          // 可上下滑动的内容区域
          ListView(
            controller: _scrollController,
            cacheExtent: 200, // 设置了cacheExtent属性优化滚动性能
            children: [
              // 顶部带有透明度变化和重叠效果的标题区域
              Container(
                margin: const EdgeInsets.all(20),
                height: 250,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(80),
                ),
                child: const Stack(
                  children: [
                    // 底层文本,半透明
                    Positioned.fill(
                      child: Opacity(
                          opacity: 0.5,
                          // 使用const关键字优化,避免不必要重绘
                          child: Center(
                            child: Text(
                              '测试字体',
                              style: TextStyle(
                                fontSize: 40,
                                fontWeight: FontWeight.bold,
                                color: Colors.blue,
                              ),
                            ),
                          )),
                    ),
                    Positioned.fill(
                      child: Opacity(
                        opacity: 0.5,
                        // 使用const关键字优化,避免不必要重绘
                        child: Center(
                            child: Text(
                          '测试字体',
                          style: TextStyle(
                            fontSize: 50,
                            fontWeight: FontWeight.bold,
                            color: Colors.red,
                          ),
                        )),
                      ),
                    ),
                    // 上层文本,完全不透明,与底层文本重叠
                  ],
                ),
              ),
              // 带有模糊和透明度变化的图片区域
              // Container(
              //   height: 300,
              //   margin: const EdgeInsets.all(20),
              //   decoration: BoxDecoration(
              //     borderRadius: BorderRadius.circular(10),
              //     color: Colors.white.withAlpha(50),
              //   ),
              //   child: Stack(
              //     children: [
              //       // 原始图片
              //       // 使用缓存图片加载方式(假设为网络图片,本地图片可参考相应缓存库用法调整)
              //       Positioned.fill(
              //         child: Image.asset(
              //           'assets/images/1.jpeg', // 替换为实际图片路径
              //         ),
              //       ),
              //       // 模糊层,覆盖在图片上,有透明度变化
              //       Positioned.fill(
              //         child: Opacity(
              //           opacity: 0.1,
              //           child: BackdropFilter(
              //             filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
              //             child: Container(
              //               color: Colors.black.withAlpha(30),
              //             ),
              //           ),
              //         ),
              //       ),
              //     ],
              //   ),
              // ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),              Container(
                margin: const EdgeInsets.all(20),
                height: 200,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.white.withAlpha(50),
                ),
                child: const Center(
                  child: Opacity(
                    opacity: 0.8,
                    // 使用const关键字优化,避免不必要重绘
                    child: Text(
                      'Scroll to explore more',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                        color: Colors.blue,
                      ),
                    ),
                  ),
                ),
              ),



            ],
          ),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
rendererror.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.27.0-1.0.pre.763, on Ubuntu 24.04.1 LTS 6.8.0-49-generic, locale zh_CN.UTF-8)
    • Flutter version 3.27.0-1.0.pre.763 on channel master at /home/mi/workspace/devkit/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 0104a81f55 (7 小时前), 2024-12-10 00:31:10 -0500
    • Engine revision 0338d1c7d7
    • Dart version 3.7.0 (build 3.7.0-226.0.dev)
    • DevTools version 2.41.0

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /home/mi/Android/Sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /home/mi/Android/Sdk
    • Java binary at: /home/mi/.local/share/JetBrains/Toolbox/apps/android-studio/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.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✗] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 18.1.3 (1ubuntu1)
    • cmake version 3.28.3
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
    • pkg-config version 1.8.1
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install libgtk-3-dev)

[✓] Android Studio (version 2024.2)
    • Android Studio at /home/mi/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin version 81.1.3
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.2)
    • IntelliJ at /home/mi/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate
    • 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

[✓] VS Code (version 1.95.3)
    • VS Code at /usr/share/code
    • Flutter extension version 3.98.0

[✓] Connected device (3 available)
    • 23127PN0CC (mobile) • b46a0e79 • android-arm64  • Android 15 (API 35)
    • Linux (desktop)     • linux    • linux-x64      • Ubuntu 24.04.1 LTS 6.8.0-49-generic
    • Chrome (web)        • chrome   • web-javascript • Google Chrome 131.0.6778.108

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work liste: impellerImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions