reader_english_plugin 0.0.1
reader_english_plugin: ^0.0.1 copied to clipboard
reader_english_plugin project.
example/lib/main.dart
import 'dart:convert';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'DependenParserWidget.dart';
// import 'package:reader_english_plugin/reader_english_plugin.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _dependlist = 'Unknown';
// final _readerEnglishPlugin = ReaderEnglishPlugin();
@override
void initState() {
super.initState();
// initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
/**
Future<void> initPlatformState() async {
List? dependlist;
const text =
"Joe Smith was born in California. In 2017, he went to Paris, France in the summer. "
"His flight left at 3:00pm on July 10th, 2017. After eating some escargot for the first time, Joe said, \"That was delicious!\" "
"He sent a postcard to his sister Jane Smith. After hearing about Joe's trip, Jane decided she might go to France one day.";
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
dependlist = (await _readerEnglishPlugin.getDependenceParser(text) ??
'Unknown platform getDependenceParser') as List?;
} on PlatformException {
dependlist = null;
}
// 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(() {
_dependlist = jsonEncode(dependlist);
});
}
*/
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
// appBar: AppBar(
// title: const Text('Plugin example app'),
// ),
body: Container(
height: 200,
child: Scrollbar(
interactive: true,
child: Container(
width: 100,
height: 100,
child: CustomPaint(
size: const Size(100, 100),
painter: DependenParserWidget(),
),
),
))),
);
}
}