搜索插件、代码仓与 APP 分类

插件详情v0.3.0

clipboard_watcher

此插件允许 Flutter 应用程序监视剪贴板更改。

AndroidiOSmacOSWindowsLinux
近 30 天下载
4280
喜欢数
43
Pub 分数
140

安装插件

flutter pub add clipboard_watcher

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

clipboard_watcher 包使 Flutter 应用程序能够在多个平台上监控系统剪贴板的实时变化。它提供了一个简单的 API 来监听剪贴板更新,非常适合需要响应复制文本或数据的应用程序。该插件支持 Android、iOS、macOS、Windows 和 Linux,确保跨平台兼容性。开发者可以使用它来构建剪贴板历史记录管理器、自动化工具或动态响应用户复制操作的文本处理应用。

适合场景

  • 剪贴板历史记录跟踪
  • 自动文本处理
  • 跨平台剪贴板监控
  • 数据传输自动化
  • 实时文本捕获

主要特点

  • 实时剪贴板监听
  • 多平台支持
  • 简单的基于事件的 API
  • 跨平台一致性
  • 轻量且高效

适合对象

  • 开发剪贴板感知应用的开发者
  • 需要自动文本提取的工具
  • 需要从剪贴板实时同步数据的应用程序
  • 自动化和生产力工具
  • 跨平台桌面和移动应用

使用建议

  • 某些平台需要适当的权限
  • 在较旧的操作系统版本上可能功能受限
  • 后台操作依赖于平台特定的行为
  • 未经加密,不适用于敏感数据
  • 如果轮询过于频繁,性能影响

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

🚀 Ship Your App Faster: Try Fastforge - The simplest way to build, package and distribute your Flutter apps.

clipboard_watcher

pub version All Contributors

This plugin allows Flutter apps to watch clipboard changes.


English | 简体中文


Platform Support

Platform Support
Linux ✔️ Fully supported
macOS ✔️ Fully supported
Windows ✔️ Fully supported
iOS 14+ Needs user permission to read data copied from others apps
Old versions are fully supported out of the box
Android 10+ Only works when the app is in the foreground
Old versions are fully supported out of the box

Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  clipboard_watcher: ^0.2.0
Usage
class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> with ClipboardListener {
  @override
  void initState() {
    clipboardWatcher.addListener(this);
    // start watch
    clipboardWatcher.start();
    super.initState();
  }

  @override
  void dispose() {
    clipboardWatcher.removeListener(this);
    // stop watch
    clipboardWatcher.stop();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // ...
  }

  @override
  void onClipboardChanged() async {
    ClipboardData? newClipboardData = await Clipboard.getData(Clipboard.kTextPlain);
    print(newClipboardData?.text ?? "");
  }
}

Please see the example app of this plugin for a full example.

Who's using it?

  • Biyi - A convenient translation and dictionary app.

Contributors

LiJianying
LiJianying

💻
Ademar
Ademar

💻
Amritpal Singh
Amritpal Singh

💻
J-P Nurmi
J-P Nurmi

💻
Leo Peng
Leo Peng

💻
Add your contributions

License

MIT

所属分类

源码仓库

使用此插件的项目