vieaura_ocr_plugin 0.0.7 copy "vieaura_ocr_plugin: ^0.0.7" to clipboard
vieaura_ocr_plugin: ^0.0.7 copied to clipboard

outdated

A new flutter ocr plugin project.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:vieaura_ocr_plugin/vieaura_ocr_plugin.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _ocrResult = 'Welcome to OCR plugin in Flutter';

  @override
  void initState() {
    super.initState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> startOCR() async {
    String? ocrResult;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      ocrResult =
          await VieauraOcrPlugin.scanOCR("Test OCR");
    } on PlatformException {
      ocrResult = 'Failed to get OCR result.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _ocrResult = ocrResult!;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('OCR Plugin example app'),
        ),
        body: Stack(
          children: [
            Align(
              alignment: Alignment.center,
              child: Text(_ocrResult),
            ),
            Align(
              alignment: Alignment.bottomCenter,
              child: TextButton(
                  style: TextButton.styleFrom(
                    primary: Colors.blue,
                  ),
                  onPressed: startOCR,
                  child: const Text('Start OCR'),
                )
            ),
          ]
        ),
      ),
    );
  }
}
0
likes
0
points
9
downloads

Publisher

unverified uploader

Weekly Downloads

A new flutter ocr plugin project.

License

unknown (license)

Dependencies

flutter

More

Packages that depend on vieaura_ocr_plugin

Packages that implement vieaura_ocr_plugin