Skip to content

App Crashes when using certain BlendMode values with ColorFilter in BackdropFilter #115143

@ousvat

Description

@ousvat

Steps to Reproduce

I am trying to build the widget below but because of the BackdropFilter it is crashing my app. When I commented out the BackdropFilter, everything goes well.

Code sample
 Widget _buildPhotoPicker() {
    return ActionButton(
      color: _colorScheme.primary.withOpacity(.7),
      borderRadius: BorderRadius.circular(24),
      onTap: () async {
        setState(() {
          if (_errorMessage.isNotEmpty) _errorMessage = '';
        });
        ImagePicker picker = ImagePicker();
        XFile? image = await picker.pickImage(source: ImageSource.gallery);
        if (image != null) {
          String appDocPath = (await getApplicationDocumentsDirectory()).path;
          String imagePath = '$appDocPath/${image.name}';
          await image.saveTo(imagePath);
          setState(() {
            _imagePath = imagePath;
          });
        }
      },
      child: Container(
        height: MediaQuery.of(context).size.width - 48,
        width: MediaQuery.of(context).size.width - 48,
        decoration: _imagePath.isNotEmpty
            ? BoxDecoration(
                image: DecorationImage(
                  image: FileImage(
                    File(_imagePath),
                  ),
                  fit: BoxFit.cover,
                ),
              )
            : null,
         // here is why the app is crashing
        child: BackdropFilter(
          filter: ColorFilter.mode(
            _imagePath.isNotEmpty
                ? Colors.black.withOpacity(.40)
                : Colors.transparent,
            BlendMode.darken,
          ),
          child: Center(
            child: Opacity(
              opacity: _imagePath.isEmpty ? 1 : .8,
              child: Container(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(16),
                  color: _colorScheme.secondary.withOpacity(.7),
                ),
                child: Padding(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
                  child: Icon(
                    _imagePath.isNotEmpty
                        ? FontAwesome.picture
                        : FontAwesome5.plus,
                    size: 30,
                    color: _colorScheme.onBackground.withOpacity(.8),
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
Logs
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:Tiramisu/TPP2.220218.008/8250781:userdebug/dev-keys'
Revision: '0'
ABI: 'x86_64'
Timestamp: 2022-11-11 10:13:47.526359800+0200
Process uptime: 436s
Cmdline: com.wattapps.iplanto
pid: 7766, tid: 7829, name: 1.ui  >>> com.wattapps.iplanto <<<
uid: 10164
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000
Cause: null pointer dereference
    rax 00007a682efb6ca8  rbx 00007a68d4ec3c90  rcx a37d000000030103  rdx 0000000000030000
    r8  0000000000000000  r9  0000000000000000  r10 0000000000000030  r11 0000000000000293
    r12 00007a682cfe73f0  r13 00007a682cfe7550  r14 00007a682cfe7430  r15 00007a682cfe7438
    rdi 00007a68d4ec3cb0  rsi 0000000000000000
    rbp 00007a682cfe7530  rsp 00007a682cfe73d0  rip 00007a682eb57ee2
backtrace:
      #00 pc 0000000001a61ee2  /data/app/~~L8YLTL_zTQyxbbXYeO184w==/com.wattapps.iplanto-LJIxmrakMKaxSrt2rzLsSg==/lib/x86_64/libflutter.so (BuildId: b19d2b3189fb7c988d90df73622911a55f5aa88f)
      #01 pc 0000000001a61e96  /data/app/~~L8YLTL_zTQyxbbXYeO184w==/com.wattapps.iplanto-LJIxmrakMKaxSrt2rzLsSg==/lib/x86_64/libflutter.so (BuildId: b19d2b3189fb7c988d90df73622911a55f5aa88f)
      #02 pc 0000000001a618b2  /data/app/~~L8YLTL_zTQyxbbXYeO184w==/com.wattapps.iplanto-LJIxmrakMKaxSrt2rzLsSg==/lib/x86_64/libflutter.so (BuildId: b19d2b3189fb7c988d90df73622911a55f5aa88f)
      #03 pc 0000000001a5ad90  /data/app/~~L8YLTL_zTQyxbbXYeO184w==/com.wattapps.iplanto-LJIxmrakMKaxSrt2rzLsSg==/lib/x86_64/libflutter.so (BuildId: b19d2b3189fb7c988d90df73622911a55f5aa88f)
      #04 pc 0000000001b79dc6  /data/app/~~L8YLTL_zTQyxbbXYeO184w==/com.wattapps.iplanto-LJIxmrakMKaxSrt2rzLsSg==/lib/x86_64/libflutter.so (BuildId: b19d2b3189fb7c988d90df73622911a55f5aa88f)
      #05 pc 0000000000002783  [anon:dart-codespace]
Lost connection to device.
flutter doctor -v
[√] Flutter (Channel stable, 3.3.7, on Microsoft Windows [Version 10.0.22000.1219], locale en-US)
    • Flutter version 3.3.7 on channel stable at C:\Users\ovidiu.usvat\flutterSDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e99c9c7cd9 (9 days ago), 2022-11-01 16:59:00 -0700
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\ovidiu.usvat\AppData\Local\Android\sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

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

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.1.32407.343
    • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (version 2021.1)
    • 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 2021.3)
    • 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 11.0.13+0-b1751.21-8125866)

[√] VS Code (version 1.71.2)
    • VS Code at C:\Users\ovidiu.usvat\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.48.0

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 32) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22000.1219]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 106.0.5249.119
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 107.0.1418.35
    ! Device HBEDU18B09006925 is offline.

[√] HTTP Host Availability
    • All required HTTP hosts are available

Device: Emulator Pixel XL
OS: Android 12 - API 32

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions