Skip to content

ImageFilter.dilate produces asymmetric results on Android #184072

Description

@arcashka

Steps to reproduce

  1. Apply ImageFilter.dilate(radiusX: 1.5, radiusY: 1.5) to a widget (e.g., an Icon or a solid-color Container).
  2. Observe the dilated edges - the expansion is uneven, with the right and/or bottom edges appearing clipped or thinner

Expected results

The dilation should expand equally on all sides.

Actual results

Right/bottom edges show noticeably less expansion than left/top.

Code sample

Code sample the stack of 2 icons is to make the issue more obvious visually.
import 'dart:ui' as ui;
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(
      home: Scaffold(
        backgroundColor: Colors.white,
        body: Center(
          child: Container(
            padding: const EdgeInsets.all(32),
            child: Stack(
              alignment: Alignment.center,
              children: [
                ImageFiltered(
                  imageFilter: ui.ImageFilter.dilate(
                    radiusX: 1.5,
                    radiusY: 1.5,
                  ),
                  child: const ColorFiltered(
                    colorFilter: ColorFilter.mode(
                      Colors.red,
                      BlendMode.srcATop,
                    ),
                    child: Icon(Icons.add, size: 48, color: Colors.black),
                  ),
                ),
                const Icon(Icons.add, size: 48, color: Colors.black),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots Image Image

Logs

Logs
flutter run
Resolving dependencies...
Downloading packages...
  meta 1.18.0 (1.18.2 available)
  vector_math 2.2.0 (2.3.0 available)
Got dependencies!
2 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Launching lib/main.dart on Pixel 7a in debug mode...
Project does not support Flutter build mode: profile, skipping adding Flutter dependencies
Project does not support Flutter build mode: release, skipping adding Flutter dependencies
Running Gradle task 'assembleDebug'...                             26.2s
✓ Built build/app/outputs/flutter-apk/app-debug.apk
Installing build/app/outputs/flutter-apk/app-debug.apk...           5.0s
I/FlutterActivityAndFragmentDelegate(20755): If you are attempting to set --enable-dart-profiling via Intent extras to launch a Flutter component outside of using the Flutter CLI, note that support for setting engine flags on Android via Intent will soon be dropped; see https://github.com/flutter/flutter/issues/180686 for more information on this breaking change. To migrate, set --enable-dart-profiling or any other flags specified via Intent extras on the command line instead or see https://github.com/flutter/flutter/blob/main/docs/engine/Flutter-Android-Engine-Flags.md for alternative methods.
D/FlutterJNI(20755): Beginning load of flutter...
D/FlutterJNI(20755): flutter (null) was loaded normally!
I/flutter (20755): [IMPORTANT:flutter/shell/platform/android/android_context_vk_impeller.cc(62)] Using the Impeller rendering backend (Vulkan).
D/FlutterRenderer(20755): Width is zero. 0,0
Syncing files to device Pixel 7a...                                242ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on Pixel 7a is available at: http://127.0.0.1:51776/ZMb24NBUNOU=/
The Flutter DevTools debugger and profiler on Pixel 7a is available at:
http://127.0.0.1:51776/ZMb24NBUNOU=/devtools/?uri=ws://127.0.0.1:51776/ZMb24NBUNOU=/ws
I/Choreographer(20755): Skipped 542 frames!  The application may be doing too much work on its main thread.
D/WindowOnBackDispatcher(20755): setTopOnBackInvokedCallback (unwrapped): android.app.Activity$$ExternalSyntheticLambda0@e5ec82e
I/WindowExtensionsImpl(20755): Initializing Window Extensions, vendor API level=9, activity embedding enabled=true
I/morphology_test(20755): Compiler allocated 5049KB to compile void android.view.ViewRootImpl.performTraversals()
D/VRI[MainActivity](20755): WindowInsets changed: 1080x2400 statusBars:[0,118,0,0] mandatorySystemGestures:[0,150,0,84]
D/FlutterRenderer(20755): Width is zero. 0,0
D/FlutterJNI(20755): Sending viewport metrics to the engine.
I/Choreographer(20755): Skipped 147 frames!  The application may be doing too much work on its main thread.
D/FlutterJNI(20755): Sending viewport metrics to the engine.
D/WindowLayoutComponentImpl(20755): Register WindowLayoutInfoListener on Context=com.example.morphology_test.MainActivity@e853632, of which baseContext=android.app.ContextImpl@69e743
D/FlutterJNI(20755): Sending viewport metrics to the engine.
D/VRI[MainActivity](20755): WindowInsets changed: navigationBars:[0,0,0,63]
D/FlutterJNI(20755): Sending viewport metrics to the engine.
D/FlutterJNI(20755): Sending viewport metrics to the engine.
D/InsetsController(20755): hide(ime())
I/ImeTracker(20755): com.example.morphology_test:613156c1: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
D/ProfileInstaller(20755): Installing profile for com.example.morphology_test
D/VRI[MainActivity](20755): visibilityChanged oldVisibility=true newVisibility=false
W/morphology_test(20755): userfaultfd: MOVE ioctl seems unsupported: Connection timed out
D/ViewRootImpl(20755): Skipping stats log for color mode
D/InsetsController(20755): hide(ime())
I/ImeTracker(20755): com.example.morphology_test:bb1f16c: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
D/InsetsController(20755): hide(ime())
I/ImeTracker(20755): com.example.morphology_test:26310a7f: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
D/VRI[MainActivity](20755): visibilityChanged oldVisibility=true newVisibility=false

Application finished.

Flutter Doctor output

Doctor output
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.41.5, on macOS 26.3.1 25D2128 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 26.3)
[✓] Chrome - develop for the web
⢿^[    [✓] Connected device (3 available)
    ! Error: Browsing on the local area network for iPhone 13 mini. Ensure the device is unlocked and attached with a cable or associated with the same
      local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyteam-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