76 lines
1.7 KiB
Dart
76 lines
1.7 KiB
Dart
// Copyright (c) 2024 Xiaomi Corporation
|
|
import 'package:flutter/material.dart';
|
|
|
|
import './info.dart';
|
|
import './tts.dart';
|
|
import 'isolate_tts.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Next-gen Kaldi flutter demo',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
useMaterial3: true,
|
|
),
|
|
home: const MyHomePage(title: 'Next-gen Kaldi with Flutter'),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
final String title;
|
|
|
|
@override
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
}
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
int _currentIndex = 0;
|
|
final List<Widget> _tabs = [
|
|
TtsScreen(),
|
|
InfoScreen(),
|
|
IsolateTtsView(),
|
|
];
|
|
@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;
|
|
});
|
|
},
|
|
items: [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.home),
|
|
label: 'Home',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.info),
|
|
label: 'Info',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.multiline_chart),
|
|
label: 'isolate',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|