Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RenderRepaintBoundary.toImage throws operation failed exception on Stable andNoSuchMethodError on Master. #76591

Closed
flutter/engine
#24877
Labels
P2Important issues not at the top of the work lista: imagesLoading, displaying, rendering imagesengineflutter/engine related. See also e: labels.found in release: 1.22Found to occur in 1.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
@liuxuliangcumt

Description

@liuxuliangcumt
  • flutter doctor -v
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.17134.2026], locale zh-CN)    • Flutter version 1.22.6 at E:\flutter_windows_v1.12.13+hotfix.6-beta\flutter    • Framework revision 9b2d32b605 (4 weeks ago), 2021-01-22 14:36:39 -0800    • Engine revision 2f0af37152    • Dart version 2.10.5    • Pub download mirror https://pub.flutter-io.cn    • Flutter download mirror https://storage.flutter-io.cn[!] Android toolchain - develop for Android devices (Android SDK version 30.0.1)    • Android SDK at E:\androidSdk    • Platform android-30, build-tools 30.0.1    • Java binary at: D:\softInstall\AndroidStudio\jre\bin\java    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)    X Android license status unknown.      Run `flutter doctor --android-licenses` to accept the SDK licenses.      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.[!] Android Studio (version 4.0)    • Android Studio at C:\Program Files\Android\Android Studio    X Flutter plugin not installed; this adds Flutter specific functionality.    X Dart plugin not installed; this adds Dart specific functionality.    X Unable to find bundled Java version.    • Try updating or re-installing Android Studio.[!] Android Studio (version 4.1.0)    • Android Studio at D:\softInstall\AndroidStudio    X Flutter plugin not installed; this adds Flutter specific functionality.    X Dart plugin not installed; this adds Dart specific functionality.    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)[√] Connected device (1 available)    • TNY AL00 (mobile) • 2XTGL20403000004 • android-arm64 • Android 10 (API 29)! Doctor found issues in 3 categories.
  • Source code
import 'dart:typed_data';import 'dart:ui';import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'dart:async';void main() => runApp(new MyApp());class MyApp extends StatefulWidget {  @override  _MyAppState createState() => new _MyAppState();}class _MyAppState extends State<MyApp> {  GlobalKey _key = new GlobalKey();  String title = "";  @override  void initState() {    super.initState();  }  @override  Widget build(BuildContext context) {    return new MaterialApp(      home: new Scaffold(        appBar: new AppBar(          title: Text(title),          actions: [            MaterialButton(              onPressed: () {                makeImage();              },              child: Text('makeImage'),            )          ],        ),        body: SingleChildScrollView(          child: RepaintBoundary(            key: _key,            child: ListView.builder(              shrinkWrap: true,              physics: BouncingScrollPhysics(),              itemCount: 16,              itemBuilder: picItemBuilder,            ),          ),        ),      ),    );  }  Widget picItemBuilder(BuildContext context, int index) {    return Container(      color: Colors.white,      padding: EdgeInsets.only(top: 10, bottom: 10),      child: Image.network(        "https://bkimg.cdn.bcebos.com/pic/b999a9014c086e06e49a297e01087bf40ad1cbd1?x-bce-process=image/resize,m_lfit,w_268,limit_1/format,f_jpg",      ),    );  }  Future<void> makeImage() async {    RenderRepaintBoundary boundary = _key.currentContext.findRenderObject();    double pix = window.devicePixelRatio;    var image = await boundary.toImage(pixelRatio: pix);    ByteData byteData = await image.toByteData(format: ImageByteFormat.png);    Uint8List pngBytes = byteData.buffer.asUint8List();    setTitle("makeImageDone");  }  setTitle(String title) {    setState(() {      this.title = title;    });  }}
  • ERROR:flutter
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Exception: operation failed

Reproduction:

  1. Start app
  2. hit "makeImage"

RepaintBoundary child: ListView itemCount big enough the error come out ,if itemCount ==1 ,it works will

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: imagesLoading, displaying, rendering imagesengineflutter/engine related. See also e: labels.found in release: 1.22Found to occur in 1.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp