Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorFiltered doesn't work on web #61780

Closed
VrajGohil opened this issue Jul 18, 2020 · 9 comments
Closed

ColorFiltered doesn't work on web #61780

VrajGohil opened this issue Jul 18, 2020 · 9 comments
Assignees
Labels
a: images Loading, displaying, rendering images c: crash Stack traces logged to the console customer: june customer: web10 found in release: 1.21 Found to occur in 1.21 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list platform-web Web applications specifically waiting for PR to land (fixed) A fix is in flight

Comments

@VrajGohil
Copy link

Steps to Reproduce

  1. Apply ColorFiltered to any Image
ColorFiltered(
   colorFilter: ColorFilter.mode(Colors.blue, BlendMode.color),
   child: Image.network(
    'https://ih1.redbubble.net/image.1076687066.0716/st,small,507x507-pad,600x600,f8f8f8.jpg',
    ),
),

Original image:

original_image

Expected results: (works on android)

Screenshot_1595045105

Actual results:

Only shows white screen on web. Throws UnimplementedError

Logs
[  +13 ms] executing: [D:\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +81 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] 8fe7655ed20ffd1395f68e30539a847a01a30351
[   +1 ms] executing: [D:\flutter/] git tag --contains HEAD
[ +291 ms] Exit code 0 from: git tag --contains HEAD
[   +2 ms] 1.19.0-4.3.pre
[  +17 ms] executing: [D:\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +44 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/beta
[        ] executing: [D:\flutter/] git ls-remote --get-url origin
[  +41 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +99 ms] executing: [D:\flutter/] git rev-parse --abbrev-ref HEAD
[  +44 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] beta
[  +61 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +7 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +24 ms] executing: C:\Users\Vraj\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +50 ms] List of devices attached
[   +7 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +71 ms] More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
[  +29 ms] Web Server • web-server • web-javascript • Flutter Tools
[   +2 ms] Chrome     • chrome     • web-javascript • Google Chrome 83.0.4103.116
[  +14 ms] "flutter run" took 244ms.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:333:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:777:11)
<asynchronous suspension>
#3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:694:33)
<asynchronous suspension>
#4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart)
#5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#6      _rootRun (dart:async/zone.dart:1190:13)
#7      _CustomZone.run (dart:async/zone.dart:1093:19)
#8      _runZoned (dart:async/zone.dart:1630:10)
#9      runZoned (dart:async/zone.dart:1550:10)
#10     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#11     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:684:20)
#12     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:339:21)
#14     _rootRunUnary (dart:async/zone.dart:1198:47)
#15     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#16     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#17     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#18     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#19     Future._completeWithValue (dart:async/future_impl.dart:529:5)
#20     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
#21     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
#22     FlutterVersion.checkFlutterVersionFreshness (package:flutter_tools/src/version.dart)
#23     _rootRunUnary (dart:async/zone.dart:1198:47)
#24     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#25     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#26     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#27     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#28     Future._completeWithValue (dart:async/future_impl.dart:529:5)
#29     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#30     _rootRun (dart:async/zone.dart:1190:13)
#31     _CustomZone.run (dart:async/zone.dart:1093:19)
#32     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#33     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#34     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#35     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#36     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#37     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

No issues found! (ran in 26.1s)
[√] Flutter (Channel beta, 1.19.0-4.3.pre, on Microsoft Windows [Version 10.0.18362.900], locale en-GB)
    • Flutter version 1.19.0-4.3.pre at D:\flutter
    • Framework revision 8fe7655ed2 (2 weeks ago), 2020-07-01 14:31:18 -0700
    • Engine revision 9a28c3bcf4
    • Dart version 2.9.0 (build 2.9.0-14.1.beta)


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\Vraj\AppData\Local\Android\sdk
    • Platform android-28, build-tools 28.0.3
    • Java binary at: D:\Software\NewAndroidStudio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

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

[√] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] Android Studio (version 3.6)
    • Android Studio at D:\Software\NewAndroidStudio
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.1
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[√] VS Code (version 1.47.2)
    • VS Code at C:\Users\Vraj\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.12.2

[√] VS Code, 64-bit edition (version 1.28.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.12.2

[√] Connected device (2 available)
    • Web Server • web-server • web-javascript • Flutter Tools
    • Chrome     • chrome     • web-javascript • Google Chrome 83.0.4103.116

! Doctor found issues in 1 category.

@sscsp489
Copy link

You can use box shadow instead !!

@VrajGohil
Copy link
Author

VrajGohil commented Jul 18, 2020

You can use box shadow instead !!

Yes, but then it will be inconsistent across platforms, also what if I want to apply different blend modes?

@iapicca
Copy link
Contributor

iapicca commented Jul 20, 2020

Hi @VrajGohil
testing the code below with the latest master

code
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);
  static const Widget _home = MyHomePage(key: Key('home'));
  @override
  Widget build(BuildContext context) => MaterialApp(
        home: _home,
      );
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key key}) : super(key: key);
  static const String _url = 
    'https://ih1.redbubble.net/image.1076687066.0716/st,small,507x507-pad,600x600,f8f8f8.jpg';
  @override
  Widget build(BuildContext context) => Material(
        child: Center(
          child: ColorFiltered(
            colorFilter: ColorFilter.mode(Colors.blue, BlendMode.color),
            child: Image.network(_url),
          ),
        ),
      );
}
logs
[   +4 ms] MSG : Got dependencies!
[  +20 ms] Running "flutter pub get" in flutter_tools... (completed in 2.1s)
[  +75 ms] Updating assets
[ +154 ms] Syncing files to device Chrome...
[  +51 ms] Generating /Users/nevercode/Desktop/projects/master/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +50 ms] <- reset
[   +8 ms] /Users/nevercode/development/flutter_master/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/Users/nevercode/development/flutter_master/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root
/Users/nevercode/development/flutter_master/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names --experimental-emit-debug-metadata
-Ddart.developer.causal_async_stacks=true --output-dill /var/folders/c3/l5jpznsj5k37yrj47l__xpw40000gn/T/flutter_tools.yPk6hn/flutter_tool.Mjdq39/app.dill --libraries-spec
file:///Users/nevercode/development/flutter_master/bin/cache/flutter_web_sdk/libraries.json --packages .packages -Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts
--track-widget-creation --filesystem-root /var/folders/c3/l5jpznsj5k37yrj47l__xpw40000gn/T/flutter_tools.yPk6hn/flutter_tools.XgTBw0 --filesystem-scheme org-dartlang-app
--initialize-from-dill build/cache.dill.track.dill --platform file:///Users/nevercode/development/flutter_master/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk.dill
[  +17 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+20224 ms] Syncing files to device Chrome... (completed in 20,351ms, longer than expected)
[   +2 ms] Synced 23.9MB.
[        ] <- accept
[   +1 ms] Caching compiled dill
[+1275 ms] [CHROME]:
[   +5 ms] [CHROME]:DevTools listening on ws://127.0.0.1:54837/devtools/browser/b011effd-bfcc-4fa8-ba5b-7a9dcfa013e8
[+5881 ms] Debug service listening on ws://127.0.0.1:54865/zYRfPnEwuzA=

[ +414 ms] Debug service listening on ws://127.0.0.1:54865/zYRfPnEwuzA=
[   +1 ms] Warning: Flutter's support for web development is not stable yet and hasn't
[        ] been thoroughly tested in production environments.
[        ] For more information see https://flutter.dev/web
[   +1 ms] 🔥  To hot restart changes while running, press "r" or "R".
[   +1 ms] For a more detailed help message, press "h". To quit, press "q".
[+1810 ms] ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════

[   +3 ms] The following UnimplementedError was thrown during a scheduler callback:

[        ] UnimplementedError

[   +1 ms] When the exception was thrown, this was the stack:

[   +1 ms] dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 213:49  throw_

[   +1 ms] lib/_engine/engine/surface/scene_builder.dart 185:5                           pushColorFilter

[        ] packages/flutter/src/rendering/layer.dart 1512:26                             addToScene

[        ] packages/flutter/src/rendering/layer.dart 444:5                               [_addToSceneWithRetainedRendering]

[        ] packages/flutter/src/rendering/layer.dart 1035:14                             addChildrenToScene

[        ] packages/flutter/src/rendering/layer.dart 2013:5                              addToScene

[        ] packages/flutter/src/rendering/layer.dart 444:5                               [_addToSceneWithRetainedRendering]

[        ] packages/flutter/src/rendering/layer.dart 1035:14                             addChildrenToScene

[        ] packages/flutter/src/rendering/layer.dart 1173:5                              addToScene

[        ] packages/flutter/src/rendering/layer.dart 444:5                               [_addToSceneWithRetainedRendering]

[        ] packages/flutter/src/rendering/layer.dart 1035:14                             addChildrenToScene

[        ] packages/flutter/src/rendering/layer.dart 1173:5                              addToScene

[        ] packages/flutter/src/rendering/layer.dart 444:5                               [_addToSceneWithRetainedRendering]

[        ] packages/flutter/src/rendering/layer.dart 1035:14                             addChildrenToScene

[        ] packages/flutter/src/rendering/layer.dart 1621:5                              addToScene

[   +2 ms] packages/flutter/src/rendering/layer.dart 772:5                               buildScene

[   +1 ms] packages/flutter/src/rendering/view.dart 243:36                               compositeFrame

[   +1 ms] packages/flutter/src/rendering/binding.dart 408:18                            drawFrame

[        ] packages/flutter/src/widgets/binding.dart 881:13                              drawFrame

[        ] packages/flutter/src/rendering/binding.dart 286:5                             [_handlePersistentFrameCallback]

[        ] packages/flutter/src/scheduler/binding.dart 1117:15                           [_invokeFrameCallback]

[   +3 ms] packages/flutter/src/scheduler/binding.dart 1056:9                            handleDrawFrame

[        ] packages/flutter/src/scheduler/binding.dart 865:7                             <fn>

[        ] dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19       internalCallback

[        ] ════════════════════════════════════════════════════════════════════════════════════════════════════

[        ] Another exception was thrown: UnimplementedError

[  +77 ms] Another exception was thrown: UnimplementedError

[+3963 ms] Another exception was thrown: UnimplementedError
doctor
[✓] Flutter (Channel master, 1.21.0-2.0.pre.66, on Mac OS X 10.15.5 19F101, locale en-GB)
    • Flutter version 1.21.0-2.0.pre.66 at /Users/nevercode/development/flutter_master
    • Framework revision 54c9441723 (2 days ago), 2020-07-17 18:56:12 -0400
    • Engine revision d327828632
    • Dart version 2.9.0 (build 2.9.0-21.0.dev 9dca49e71e)


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/nevercode/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.0

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

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.12.2

[✓] Connected device (4 available)
    • Pixel 3a (mobile) • 965AY0WP5C • android-arm64  • Android 10 (API 29)
    • macOS (desktop)   • macos      • darwin-x64     • Mac OS X 10.15.5 19F101
    • Web Server (web)  • web-server • web-javascript • Flutter Tools
    • Chrome (web)      • chrome     • web-javascript • Google Chrome 83.0.4103.116

• No issues found!

I experience the behaviour you are describing;
the issue occur with --dart-define=FLUTTER_WEB_USE_SKIA=true as well

Thank you

@iapicca iapicca added a: images Loading, displaying, rendering images found in release: 1.20 Found to occur in 1.20 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on c: crash Stack traces logged to the console platform-web Web applications specifically found in release: 1.21 Found to occur in 1.21 and removed found in release: 1.20 Found to occur in 1.20 labels Jul 20, 2020
@mariamhas
Copy link

another repo case from customer:
ColorFiltered(
colorFilter: ColorFilter.mode(
disableGrid ? Colors.grey : Colors.transparent,
BlendMode.saturation,
),

@ferhatb ferhatb added the P1 High-priority issues at the top of the work list label Jul 23, 2020
@ferhatb ferhatb self-assigned this Jul 23, 2020
@ferhatb ferhatb added this to the 1.22 - August 2020 milestone Jul 23, 2020
@azimuthdeveloper
Copy link

At first blush it seems like this should have been fixed in #50897 ? Just hit this today as well, have to remove it for web platforms.

@ferhatb
Copy link
Contributor

ferhatb commented Aug 31, 2020

In master

@ferhatb ferhatb closed this as completed Aug 31, 2020
@azimuthdeveloper
Copy link

azimuthdeveloper commented Aug 31, 2020

Are you saying if I switch to the master channel in Flutter and upgrade, that this should work now? I just did that and the ColorFilter still doesn't work as it should (it's just pitch white - the same as before this was merged in). My usage looks like this (I increase the blend as the scroll progresses)

                        key: Key(state.welcomeImageIndex.toString()),
                        decoration: BoxDecoration(
                          image: DecorationImage(
                            image: AssetImage('assets/introslides/${state.welcomeImageIndex}.jpg'),
                            fit: BoxFit.cover,
                            colorFilter: ColorFilter.mode(
                                    _isPastHalfwayPointScrolling() ? Colors.brown[800].withOpacity(percentagePastHalfway()) : Colors.red,
                                    BlendMode.clear),
                          ),
                        ),
                      ),```

@ferhatb
Copy link
Contributor

ferhatb commented Sep 1, 2020

@lewcianci , the PR fixes the filed issue (see above example: BlendMode.color). There is no support for BlendMode.clear on the web platform AFAIK (all other blend modes are supported). Please file a new issue specifically for BlendMode.clear with use case, thx.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: images Loading, displaying, rendering images c: crash Stack traces logged to the console customer: june customer: web10 found in release: 1.21 Found to occur in 1.21 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list platform-web Web applications specifically waiting for PR to land (fixed) A fix is in flight
Projects
None yet
Development

No branches or pull requests

6 participants