74 lines
1.8 KiB
Dart
74 lines
1.8 KiB
Dart
// Copyright (c) 2024 Xiaomi Corporation
|
|
import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx;
|
|
import 'package:flutter/material.dart';
|
|
|
|
import './vad.dart';
|
|
import './streaming_asr.dart';
|
|
import './info.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({Key? key}) : super(key: key);
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Next-gen Kaldi',
|
|
theme: ThemeData(
|
|
primarySwatch: Colors.blue,
|
|
),
|
|
home: const MyHomePage(title: 'Next-gen Kaldi Demo'),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
const MyHomePage({Key? key, required this.title}) : super(key: key);
|
|
final String title;
|
|
@override
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
}
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
int _currentIndex = 0;
|
|
final List<Widget> _tabs = [
|
|
StreamingAsrScreen(),
|
|
VadScreen(),
|
|
InfoScreen(),
|
|
];
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(widget.title),
|
|
),
|
|
body: _tabs[_currentIndex],
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _currentIndex,
|
|
onTap: (int index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
// https://www.xiconeditor.com/
|
|
items: [
|
|
BottomNavigationBarItem(
|
|
icon: new Image.asset("assets/streaming-asr.ico"),
|
|
label: '',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: new Image.asset("assets/vad.ico"),
|
|
label: '',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.info),
|
|
label: 'Info',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|