搜尋套件、儲存庫與 APP 分類

action_process_text 封面
套件詳情v0.0.6

action_process_text

一個用於在 Android 上實作 ACTION_PROCESS_TEXT 的 Flutter 外掛。

近 30 天下載
115
喜歡數
31
Pub 分數
40

安裝套件

flutter pub add action_process_text

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 插件,可在 Android 上啟用 ACTION_PROCESS_TEXT 功能,讓應用程式能與系統的文本處理動作整合。它促進選擇文字時觸發自訂應用行為的互動,例如分享、翻譯或直接從 Android 文字選取菜單分析內容。此插件將原生 Android 功能與 Flutter 應用連結起來,透過情境式文字操作提升使用者互動體驗。此插件專為 Android 設計,除標準 Flutter 設定外無需額外設定。

適用情境

  • 在 Android 中整合自定義文字動作
  • 啟用上下文感知的文本處理
  • 擴展 Android 的文字選擇選單
  • 支援文字分析工作流程
  • 透過文字選擇新增分享或翻譯選項

主要特色

  • Android 特定的 ACTION_PROCESS_TEXT 支援
  • 與 Flutter 的無縫整合
  • 上下文文本操作觸發
  • 所需設定最少
  • 原生 Android 行為模擬

適合對象

  • 面向 Android 的 Flutter 應用
  • 文字處理擴展
  • 需要深度 Android 集成的應用程式
  • 面向 Android 文本操作的開發者
  • 可客製化的文字互動功能

使用建議

  • 僅限 Android 平台
  • 需要 Android SDK 知識
  • 不支援 iOS
  • 依賴於 Android 系統行為
  • 可能需要在不同版本的 Android 上進行測試

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

ACTION_PROCESS_TEXT Flutter

A flutter plugin for ACTION_PROCESS_TEXT implementation in android.

What is it used for?

It can be used when you want your users to use a shortcut for opening your app when selecting text anywhere in the android environment.

Constraints

1. It works only for android.
2. It can only be used inside a Stateful widget.
3. Use setState() after updating the value from the action.

Include in your project

dependencies:
  action_process_text: <latest version>

Run pub get and get packages.

Add this to AndroidManifest.xml in the android\app\src\main\ folder.

  <activity android:name="com.example.action_process_text.ActionProcessTextPlugin"
            android:label="Action_Text" android:theme="@style/LaunchTheme">
            <intent-filter>
                <action android:name="android.intent.action.PROCESS_TEXT" />
                <data android:mimeType="text/plain"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
   </activity>

Change the android:label from Action_Text to the action text that you want to display.

Then import the package to use it.

import 'package:action_process_text/action_process_text.dart';

Usage

Use the constructor of the widget to initialize the action_process_text. ActionProcessText.getInputText is used to get the selected text from the android action.

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  _MainPageState() {
    initActionProcessText();
  }

  Future<void> initActionProcessText() async {
    inputText = await ActionProcessText.getInputText;
    setState(() {});
  }

  String inputText = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold();
  }
  }

If you want to check whether the call was made from the native side, you can use the ActionProcessText.calledFromNative . This enables one to navigate to a different screen than usual if needed, by initiating the channel at the start and check if the value is true. If true, the input text will be available. When it's false, the app is opened not by the action_process_text intend, but by the user as in usual cases.

Bugs/Requests

If you encounter any problems feel free to open an issue. Pull request are also welcome.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。