Skip to content

[Impeller] Gradient rendering error #128012

@GoldenSoju

Description

@GoldenSoju

Is there an existing issue for this?

Steps to reproduce

  1. Add a Gradient (doesn't matter if Radial, Linear, etc) to a DecoratedBox/BoxDecoration.
  2. run flutter without impeller
  3. run flutter with --enable-impeller

I realized this error while testing an app with flutter stable 3.10.2 on iOS. So I checked on Android with and without impeller and saw the difference.

I guess it is related to #127104 and #126867, however, I wasn't able to solve it by wrapping the widget with a RepaintBoundary widget.

Expected results

A correctly rendered gradient:

Screenshot_20230601_120615

Actual results

Only the gradient's base colors appearing, without gradation.

Screenshot_20230601_120722

Code sample

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
          body: Center(
            child: Text('hello'),
          ),
          bottomNavigationBar: CustomAppBar()),
    );
  }
}

class CustomAppBar extends StatelessWidget {
  const CustomAppBar({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const SizedBox(
      height: 60,
      child: BottomAppBar(
        color: Colors.green,
        child: SizedBox.expand(
          child: DecoratedBox(
            decoration: BoxDecoration(
              gradient: RadialGradient(
                colors: [
                  Colors.blue,
                  Colors.red,
                ],
                focalRadius: 3,
                focal: Alignment(0, 0.8),
                center: Alignment.topCenter,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.2, on openSUSE Tumbleweed 6.3.4-1-default, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.78.2)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levele: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions