MixinNetwork / MixinNetwork/flutter-plugins

[pasteboard] write image failed

Open
#271 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
512
Forks
292
Avg merge
15h 8m
Merged PRs (30d)
7

Description

A clear and concise description of what the bug is.

Reproduce Steps

this is part of my code, it toggle Pasteboard.writeImage

 OutlinedButton(
            onPressed: () async {
              final imagefile = File("/home/steiner/disk/windows-data/Download/私を染めるiの歌_109951167807493772.jpg");
              final bytes = await imagefile.readAsBytes();
              await Pasteboard.writeImage(bytes);
              final imagebytes = await Pasteboard.image;
              print(imagebytes?.length);
            },

            child: const Text("copy image to clipboard"),
          )

whatever the image is, the result is always null
image

Expected behavior

A clear and concise description of what you expected to happen.

the result shouldn't be null

Version (please complete the following information):

  • Flutter Version: 3.10.6
  • OS: Linux 6.1.39-1-lts
  • plugin: pasteboard 0.2.0

you can check the full code

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:pasteboard/pasteboard.dart';
void main() => runApp(App());

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      title: "clipboard",
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(title: const Text("hello clipboard")),
      body: buildBody(context),
    );
  }

  Widget buildBody(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          OutlinedButton(
            onPressed: () {
              Pasteboard.writeText("fuck you");
            },

            child: const Text("copy text to clipboard"),
          ),

          OutlinedButton(
            onPressed: () async {
              final imagefile = File("/home/steiner/disk/windows-data/Download/私を染めるiの歌_109951167807493772.jpg");
              final bytes = await imagefile.readAsBytes();
              await Pasteboard.writeImage(bytes);
              final imagebytes = await Pasteboard.image;
              print(imagebytes?.length);
            },

            child: const Text("copy image to clipboard"),
          )
        ],
      ),
    );
  }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue on Linux using the supplied Flutter example and the Pasteboard.writeImage and Pasteboard.image APIs. Inspect the pasteboard implementation behind those entry points to determine why the image round trip returns null. Done means writing the supplied image and reading it back returns non-null bytes.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.