smart_speech_sdk 1.3.1
smart_speech_sdk: ^1.3.1 copied to clipboard
智言语音评测Flutter sdk ,暂时只支持安卓和ios 两个平台
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:smart_speech_sdk_example/SpeechPage.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('智言语音评测'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
HomeButton('英文音标', "phoneme","en"),
const SizedBox(width: 24.0),
HomeButton('英文单词', "word","en"),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
HomeButton('英文句子', "sentence","en"),
const SizedBox(width: 24.0),
HomeButton('英文段落', "chapter","en"),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
HomeButton('中文拼音', "phoneme","zh"),
const SizedBox(width: 24.0),
HomeButton('中文字词', "word","zh"),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
HomeButton('中文句子', "sentence","zh"),
const SizedBox(width: 24.0),
HomeButton('中文段落', "chapter","zh"),
],
),
],
),
),
);
}
}
class HomeButton extends StatelessWidget {
final String buttonText;
final String coreType;
final String langType;
HomeButton(this.buttonText,this.coreType, this.langType);
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SpeechPage(buttonText: buttonText, coreType: coreType,langType: langType,),
),
);
},
child: Text(buttonText),
);
}
}