flutter_plugin_tts 1.0.2

flutter_plugin_tts #

A new Flutter plugin.

Github

Getting Started #

English Document (中文文档在下面)

A flutter library that supports tts

Steps for usage:

Import library

Import 'package:flutter_plugin_tts/flutter_plugin_tts.dart';

Example of use:

@override
  Widget build(BuildContext context) {
    Return MaterialApp(
      Home: Scaffold(
        appBar: AppBar(
          Title: const Text('Plugin example app'),
        ),
        Body: ListView(
          Children: <Widget>[
            RaisedButton(child: const Text('set to Chinese'), onPressed: () {
              FlutterPluginTts.setLanguage('zh-CN').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('set to English'), onPressed: () {
              FlutterPluginTts.setLanguage('en-AU').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('set to Japanese'), onPressed: () {
              FlutterPluginTts.setLanguage('ja-JP').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('play Chinese'), onPressed: () {
              FlutterPluginTts.speak ('Hello, World');
            }),
            RaisedButton(child: const Text('playing English'), onPressed: () {
              FlutterPluginTts.speak('hello,world');
            }),
            RaisedButton(child: const Text('playing Japanese'), onPressed: () {
              FlutterPluginTts.speak('こんにちは, world');
            }),
            RaisedButton(child: const Text), onPressed: () {
              FlutterPluginTts.speak('Hello, World. I am testing a long sentence. You can stop my play by clicking the play pause button below. If I don't stop it means there is still a problem with this stop function. Please Continue to repair. La la la la!');
            }),
            RaisedButton(child: const Text), onPressed: () {
              FlutterPluginTts.stop();
            }),
            RaisedButton(child: const Text('play pause, start new sentence immediately'), onPressed: () {
              FlutterPluginTts.stop();
              FlutterPluginTts.speak('hello,world');
            }),
            RaisedButton(child: const Text('Chinese usability'), onPressed: () {
              FlutterPluginTts.isLanguageAvailable('zh-CN').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('English usability'), onPressed: () {
              FlutterPluginTts.isLanguageAvailable('en-US').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('Japanese usability'), onPressed: () {
              FlutterPluginTts.isLanguageAvailable('ja-JP').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('setSpeechRate = 1'), onPressed: () {
              FlutterPluginTts.setSpeechRate(0.5);
            }),
            RaisedButton(child: const Text('setSpeechRate = 0.5'), onPressed: () {
              FlutterPluginTts.setSpeechRate(0.25);
            }),
            RaisedButton(child: const Text('setSpeechRate = 2'), onPressed: () {
              FlutterPluginTts.setSpeechRate(1);
            }),
          ],
        ),
      ),
    );
  }

Welcome everyone to support my website [website] (https://tryenough.com),

中文文档

一个支持tts的flutter库

使用步骤:

导入库

import 'package:flutter_plugin_tts/flutter_plugin_tts.dart';

使用例子:

@override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: ListView(
          children: <Widget>[
            RaisedButton(child: const Text('设置成汉语'), onPressed: () {
              FlutterPluginTts.setLanguage('zh-CN').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('设置成英语'), onPressed: () {
              FlutterPluginTts.setLanguage('en-AU').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('设置成日语'), onPressed: () {
              FlutterPluginTts.setLanguage('ja-JP').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('播放汉语'), onPressed: () {
              FlutterPluginTts.speak('你好,世界');
            }),
            RaisedButton(child: const Text('播放英语'), onPressed: () {
              FlutterPluginTts.speak('hello,world');
            }),
            RaisedButton(child: const Text('播放日语'), onPressed: () {
              FlutterPluginTts.speak('こんにちは、世界');
            }),
            RaisedButton(child: const Text('播放长句子'), onPressed: () {
              FlutterPluginTts.speak('你好,世界。我正在测试播放很长的句子,你可以点击下方的播放暂停按钮来终止我的播放,如果我没有停止那就意味着这个停止功能还有问题。请你继续修复。啦啦啦啦!');
            }),
            RaisedButton(child: const Text('播放暂停'), onPressed: () {
              FlutterPluginTts.stop();
            }),
            RaisedButton(child: const Text('播放暂停,立刻开始新句子'), onPressed: () {
              FlutterPluginTts.stop();
              FlutterPluginTts.speak('hello,world');
            }),
            RaisedButton(child: const Text('中文可用性'), onPressed: () {
              FlutterPluginTts.isLanguageAvailable('zh-CN').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('英文可用性'), onPressed: () {
              FlutterPluginTts.isLanguageAvailable('en-US').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('日文可用性'), onPressed: () {
              FlutterPluginTts.isLanguageAvailable('ja-JP').then((v){
                debugPrint('r = $v');
              });
            }),
            RaisedButton(child: const Text('设置语速为1正常'), onPressed: () {
               FlutterPluginTts.setSpeechRate(0.5);
            }),
            RaisedButton(child: const Text('设置语速为0.5'), onPressed: () {
               FlutterPluginTts.setSpeechRate(0.25);
            }),
            RaisedButton(child: const Text('设置语速为2'), onPressed: () {
               FlutterPluginTts.setSpeechRate(1);
            }),
          ],
        ),
      ),
    );
  }

欢迎大家支持我的网站 网站,

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

1.0.2 #

  • android platform error for set speech rate

1.0.1 #

  • add set speech rate

1.0.0 #

  • text to speech plugin

example/README.md

flutter_plugin_tts_example #

Demonstrates how to use the flutter_plugin_tts plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_plugin_tts: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_plugin_tts/flutter_plugin_tts.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
73
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Sep 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

11 out of 11 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutter_plugin_tts.dart.

Run flutter format to format lib/flutter_plugin_tts.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test