Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
371b60fb
提交
371b60fb
authored
3月 26, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化代码
上级
886bf4f5
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
14 行删除
+10
-14
controller.dart
lib/pages/read_web/controller.dart
+10
-14
没有找到文件。
lib/pages/read_web/controller.dart
浏览文件 @
371b60fb
...
@@ -49,7 +49,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -49,7 +49,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bool
get
show
=>
_show
;
bool
get
show
=>
_show
;
// 录音
// 录音
FlutterSoundRecorder
_mRecorder
=
FlutterSoundRecorder
(
logLevel:
Level
.
error
);
final
FlutterSoundRecorder
_mRecorder
=
FlutterSoundRecorder
(
logLevel:
Level
.
error
);
// 录音开始
// 录音开始
bool
startRecording
=
false
;
bool
startRecording
=
false
;
// 是否存在离线文件
// 是否存在离线文件
...
@@ -137,9 +137,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -137,9 +137,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
contentInput
.
dispose
();
contentInput
.
dispose
();
flutterTts
.
stop
();
flutterTts
.
stop
();
searchInput
.
dispose
();
searchInput
.
dispose
();
if
(
_mRecorder
!=
null
)
{
_mRecorder
.
closeRecorder
();
_mRecorder
.
closeRecorder
();
}
// 关闭防截屏
// 关闭防截屏
// await ScreenProtector.preventScreenshotOff();
// await ScreenProtector.preventScreenshotOff();
super
.
onClose
();
super
.
onClose
();
...
@@ -204,7 +202,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -204,7 +202,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
String
htmlStr
=
EncryptUtil
.
aesDecrypt
(
content
!);
String
htmlStr
=
EncryptUtil
.
aesDecrypt
(
content
!);
Console
.
log
(
'解密-----------------
$htmlStr
'
);
Console
.
log
(
'解密-----------------
$htmlStr
'
);
Console
.
log
(
'-------------使用本地文件-------------------'
);
Console
.
log
(
'-------------使用本地文件-------------------'
);
webViewController
.
loadData
(
data:
htmlStr
??
''
);
webViewController
.
loadData
(
data:
htmlStr
);
}
}
...
@@ -273,10 +271,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -273,10 +271,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
await
flutterTts
.
setSpeechRate
(
0.5
);
await
flutterTts
.
setSpeechRate
(
0.5
);
await
flutterTts
.
setPitch
(
1.0
);
await
flutterTts
.
setPitch
(
1.0
);
if
(
text
!=
null
)
{
if
(
text
.
isNotEmpty
)
{
if
(
text
!.
isNotEmpty
)
{
await
flutterTts
.
speak
(
text
);
await
flutterTts
.
speak
(
text
!);
}
}
}
}
}
...
@@ -338,9 +334,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -338,9 +334,9 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final
path
=
await
_mRecorder
.
stopRecorder
();
final
path
=
await
_mRecorder
.
stopRecorder
();
Console
.
log
(
'stopRecorder-----------path---------------------
$path
'
);
Console
.
log
(
'stopRecorder-----------path---------------------
$path
'
);
if
(
path
!=
null
&&
path
.
isNotEmpty
){
if
(
path
!=
null
&&
path
.
isNotEmpty
){
var
duration
=
await
audioPlayer
.
setFilePath
(
path
!
);
var
duration
=
await
audioPlayer
.
setFilePath
(
path
);
Console
.
log
(
'-----duration---------------------
$duration
------'
);
Console
.
log
(
'-----duration---------------------
$duration
------'
);
AudioModel
audioModel
=
AudioModel
(
path:
path
!
,
duration:
Tools
.
formatDuration
(
duration
!),
currentDuration:
'0:00:00'
);
AudioModel
audioModel
=
AudioModel
(
path:
path
,
duration:
Tools
.
formatDuration
(
duration
!),
currentDuration:
'0:00:00'
);
if
(
audioModel
.
duration
!=
'0:00:00'
){
if
(
audioModel
.
duration
!=
'0:00:00'
){
discussInputAudios
.
add
(
audioModel
);
discussInputAudios
.
add
(
audioModel
);
}
}
...
@@ -663,7 +659,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -663,7 +659,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
CustomToast
.
dismiss
();
CustomToast
.
dismiss
();
Toast
.
show
(
'离线成功'
);
Toast
.
show
(
'离线成功'
);
final
exit
=
await
_isExistFile
(
bookId
);
await
_isExistFile
(
bookId
);
update
();
update
();
}
else
{
}
else
{
...
@@ -774,7 +770,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -774,7 +770,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
if
(
file
is
File
&&
file
.
path
.
toLowerCase
().
endsWith
(
'.html'
))
{
if
(
file
is
File
&&
file
.
path
.
toLowerCase
().
endsWith
(
'.html'
))
{
String
fileName
=
path
.
basenameWithoutExtension
(
file
.
path
);
String
fileName
=
path
.
basenameWithoutExtension
(
file
.
path
);
if
(
int
.
parse
(
fileName
.
split
(
'-'
).
first
)
==
findIndex
){
if
(
int
.
parse
(
fileName
.
split
(
'-'
).
first
)
==
findIndex
){
print
(
'HTML File--------------------------------
${file.path}
'
);
Console
.
log
(
'HTML File--------------------------------
${file.path}
'
);
toReadHtmlPath
=
file
.
path
;
toReadHtmlPath
=
file
.
path
;
chapterId
=
fileName
.
split
(
'-'
).
last
;
chapterId
=
fileName
.
split
(
'-'
).
last
;
chapterName
=
getChapterName
(
chapterId
);
chapterName
=
getChapterName
(
chapterId
);
...
@@ -884,7 +880,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -884,7 +880,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
ChapterModel
?
tModel
=
findChapterById
(
chapters
,
int
.
parse
(
chapterId
));
ChapterModel
?
tModel
=
findChapterById
(
chapters
,
int
.
parse
(
chapterId
));
if
(
tModel
!=
null
){
if
(
tModel
!=
null
){
updateParentsStatus
(
chapters
,
tModel
!
);
updateParentsStatus
(
chapters
,
tModel
);
}
}
}
}
...
@@ -925,7 +921,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -925,7 +921,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
/// 添加阅读时长
/// 添加阅读时长
void
_addReadTime
({
required
type
})
async
{
void
_addReadTime
({
required
type
})
async
{
final
result
=
await
LibraryAPI
.
addReadTime
(
bookId:
bookId
,
readTypes:
type
);
LibraryAPI
.
addReadTime
(
bookId:
bookId
,
readTypes:
type
);
}
}
/// 获取离线文件路径
/// 获取离线文件路径
void
getBookDown
()
async
{
void
getBookDown
()
async
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论