Skip to content

[Impeller] Impeller and Skia gradients disagree on behavior for invalid color stops (outside of the range of 0.0 to 1.0) #132792

@LiamHockley

Description

@LiamHockley

Is there an existing issue for this?

Steps to reproduce

  1. Run the sample code in IOS build
    a. With Impeller Enabled (can just use latest default Flutter project)
    b. Without Impeller Enabled (can use Flutter < v3.10, or disable in info.plist with the following code:
<key>FLTEnableImpeller</key>
<false />

Expected results

Linear gradient is rendered consistently as before.

Actual results

Linear gradient is rendered as a flat color.

Code sample

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

void main() {
  runApp(MyApp());
}


class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: SizedBox(
            width: 315,
            child: FittedBox(
              fit: BoxFit.fitWidth,
              child: ClipRRect(
                borderRadius: BorderRadius.circular(24),
                child: Container(
                  width: 315,
                  height: 398,
                  decoration: BoxDecoration(
                    gradient: LinearGradient(
                      stops: [0, 25, 62, 100],
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      colors: [
                        Color(0XFF987CEE),
                        Color(0XFF6843D7),
                        Color(0XFF532ACA),
                        Color(0XFFBDA8FF),
                      ],
                    ),
                  )
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output I am using a specific flutter version via checking out the tag in my Flutter SDK git repo, hence the warning about not being on a channel. But this error persists regardless of that.
[!] Flutter (Channel [user-branch], 3.13.0, on macOS 13.5 22G74 darwin-x64, locale en-US)
    ! Flutter version 3.13.0 on channel [user-branch] at /Users/liam.hockley/fvm/versions/3.7.12
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision efbf63d9c6 (2 days ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git"
      directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/liam.hockley/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/VisualStudioCode.app/Contents
    • Flutter extension version 3.70.0

[✓] Connected device (3 available)
    • iPad (9th generation) (mobile) • 6EBD9BF1-405B-4D3A-AB5A-BB1B6D44F947 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)                • macos                                • darwin-x64     • macOS 13.5
      22G74 darwin-x64
    • Chrome (web)                   • chrome                               • web-javascript • Google Chrome
      116.0.5845.96

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

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

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 teamwaiting 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