action_process_text 1.0.0-nullsafety.0 copy "action_process_text: ^1.0.0-nullsafety.0" to clipboard
action_process_text: ^1.0.0-nullsafety.0 copied to clipboard

PlatformAndroid
outdated

A flutter plugin for ACTION_PROCESS_TEXT implementation in android.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:action_process_text/action_process_text.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  _MyAppState() {
    initActionProcessText();
  }

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: ActionProcessText.calledFromNative ? MainPage(inputText) : Home(),
    );
  }
}

class MainPage extends StatefulWidget {
  final String text;
  MainPage(this.text);
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: const Text('ACTION_PROCESS_TEXT Example'),
        ),
        body: Center(
          child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
            Container(child: Text('Selected Text:\n')),
            Container(child: Text('${widget.text}')),
          ]),
        ),
      ),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Text('Not called from native side.'),
    );
  }
}
29
likes
140
pub points
20%
popularity

Publisher

unverified uploader

A flutter plugin for ACTION_PROCESS_TEXT implementation in android.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on action_process_text