-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesc: regressionIt was better in the past than it is nowIt was better in the past than it is nowc: renderingUI glitches reported at the engine/skia or impeller rendering levelUI glitches reported at the engine/skia or impeller rendering levelcustomer: sameheree: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for WebCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specifically
Description
##Issue
Widget to image not working properly on Flutter Web CanvasKit version with Flutter 3. Basically, the Image widget became invisible from the screenshot/generated image. While other widgets are captured properly.
Steps to Reproduce
Run flutter run -d Chrome --web-renderer canvaskit using the following code.
Try to capture an image with save FAB.
Expected results: Expected result Image should be captured as it looks on the UI. It should available on the bottom of the red container.
Actual results: Image gets captured properly but the image widget is missing in the captured image.
Code sample
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:ui' as ui;
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Image Capture Bug',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final key = GlobalKey();
Uint8List? imageBytes;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flutter Image Capture Bug'),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.save),
onPressed: () async {
imageBytes = await captureImage();
setState((){
});
},
),
body: ListView(
children: [
Center(
child: RepaintBoundary(
key: key,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: 300,
width: 200,
color: Colors.red,
),
Image.network(
"https://picsum.photos/200/300",
height: 300,
width: 200,
),
],
),
),
),
if(imageBytes != null)
Center(
child: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text("Capture Image"),
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.memory(imageBytes!),
),
],
),
),
)
],
),
);
}
Future<Uint8List?> captureImage() async {
double pixelRatio = 5;
try {
RenderRepaintBoundary? boundary =
key.currentContext?.findRenderObject() as RenderRepaintBoundary?;
ui.Image? image = await boundary?.toImage(pixelRatio: pixelRatio);
ByteData? byteData =
await image?.toByteData(format: ui.ImageByteFormat.png);
Uint8List? pngBytes = byteData?.buffer.asUint8List();
return pngBytes;
} catch (e) {
debugPrint("$e");
return null;
}
}
}
Logs
Analyzing test_image_capture_web...
No issues found! (ran in 1.4s)
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-arm, locale en-US)
• Flutter version 3.0.0 at /Users/shofiul/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (3 days ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/shofiul/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (Zulu 8.60.0.21-CA-macos-aarch64) (build 1.8.0_322-b06)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• 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 11.0.11+0-b60-7772763)
[✓] Android Studio (version 2021.2)
• Android Studio at /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-2/212.5712.43.2112.8403254/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 11.0.12+0-b1504.28-7817840)
[!] Android Studio
• Android Studio at /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-2/212.5712.43.2112.8233820/Android Studio Preview.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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] IntelliJ IDEA Community Edition (version 2022.1)
• IntelliJ at /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5080.210/IntelliJ IDEA CE.app
• 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
[✓] IntelliJ IDEA Community Edition (version 2021.3.3)
• IntelliJ at /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/213.7172.25/IntelliJ IDEA CE.app
• Flutter plugin version 64.0.4
• Dart plugin version 213.5744.122
[✓] VS Code (version 1.67.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.40.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.3.1 21E258 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
borjandev, Cteq3132, Lyokone, lulupointu, bernaferrari and 3 more
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesc: regressionIt was better in the past than it is nowIt was better in the past than it is nowc: renderingUI glitches reported at the engine/skia or impeller rendering levelUI glitches reported at the engine/skia or impeller rendering levelcustomer: sameheree: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for WebCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specifically