|
@@ -5,21 +5,21 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
|
|
// 录音列表
|
|
|
-class Records extends StatefulWidget {
|
|
|
- final List<String> records;
|
|
|
+class RecordList extends StatefulWidget {
|
|
|
+ final List<String> records; //audio列表
|
|
|
|
|
|
- const Records({
|
|
|
+ const RecordList({
|
|
|
Key? key,
|
|
|
required this.records,
|
|
|
}) : super(key: key);
|
|
|
|
|
|
@override
|
|
|
- _RecordsState createState() => _RecordsState();
|
|
|
+ _RecordListState createState() => _RecordListState();
|
|
|
}
|
|
|
|
|
|
-class _RecordsState extends State<Records> {
|
|
|
- late int _totalTime;
|
|
|
- late int _currentTime;
|
|
|
+class _RecordListState extends State<RecordList> {
|
|
|
+ late int _totalTime; // 总时常
|
|
|
+ late int _currentTime; // 当前播放位置
|
|
|
double _percent = 0.0;
|
|
|
int _selected = -1;
|
|
|
bool isPlay = false;
|
|
@@ -29,6 +29,7 @@ class _RecordsState extends State<Records> {
|
|
|
Widget build(BuildContext context) {
|
|
|
return ListView.builder(
|
|
|
itemCount: widget.records.length,
|
|
|
+ //滚动条
|
|
|
shrinkWrap: true,
|
|
|
reverse: true,
|
|
|
itemBuilder: (BuildContext context, int i) {
|
|
@@ -150,6 +151,7 @@ class _RecordsState extends State<Records> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ // 获取文件创建的时间(根据文件名)
|
|
|
String _getTime({required String filePath}) {
|
|
|
String fromPath = filePath.substring(
|
|
|
filePath.lastIndexOf('/') + 1, filePath.lastIndexOf('.'));
|
|
@@ -169,9 +171,10 @@ class _RecordsState extends State<Records> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/// 按钮
|
|
|
class _Presso extends StatelessWidget {
|
|
|
- final IconData ico;
|
|
|
- final VoidCallback onPressed;
|
|
|
+ final IconData ico; // 图标
|
|
|
+ final VoidCallback onPressed; //执行事件
|
|
|
|
|
|
const _Presso({Key? key, required this.ico, required this.onPressed})
|
|
|
: super(key: key);
|