提交 4877d007 authored 作者: yueweilu's avatar yueweilu

1、第一次录音失败

2、本书信息 适配
上级 2b4a08c2
...@@ -108,14 +108,19 @@ class BookInfoPage extends StatelessWidget { ...@@ -108,14 +108,19 @@ class BookInfoPage extends StatelessWidget {
{'name':'上架时间','value':Tools.dateFromMS(model.onsaleTime!.toInt(),pattern:'yyyy年MM月dd日' )}, {'name':'上架时间','value':Tools.dateFromMS(model.onsaleTime!.toInt(),pattern:'yyyy年MM月dd日' )},
].map((item){ ].map((item){
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
children: [ children: [
Container( Container(
// color: Colors.cyan, // color: Colors.cyan,
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
width: 60.w, width: 80.w,
child: Text(item['name'].toString(),style: const TextStyle(fontSize: 15,height: 2.1,color: Colours.c3),), child: Text(item['name'].toString(),style: const TextStyle(fontSize: 15,height: 2.1,color: Colours.c3),),
), ),
Gaps.hGaps20, Gaps.hGaps20,
],
),
Expanded( Expanded(
child: Container( child: Container(
// color: Colors.red, // color: Colors.red,
......
...@@ -282,8 +282,12 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -282,8 +282,12 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 初始化录音组件 // 初始化录音组件
Future<void> openTheRecorder() async { Future<void> openTheRecorder() async {
// 获取权限
if(await Access.microphone()){ var status = await Access.microphone();
if (status == false) {
Toast.show('录音权限没有开启无法使用该功能');
return;
}
await _mRecorder.openRecorder(); await _mRecorder.openRecorder();
final session = await AudioSession.instance; final session = await AudioSession.instance;
await session.configure(AudioSessionConfiguration( await session.configure(AudioSessionConfiguration(
...@@ -304,14 +308,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -304,14 +308,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
androidWillPauseWhenDucked: true, androidWillPauseWhenDucked: true,
)); ));
} }
// 没有权限
else {
}
}
// 开启录音 // 开启录音
void record() async { void record() async {
openTheRecorder(); await openTheRecorder();
startRecording = true; startRecording = true;
String filePath = await Tools.getDirectory(); String filePath = await Tools.getDirectory();
String fileName = Tools.generateVoiceFileName(); String fileName = Tools.generateVoiceFileName();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论