Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
0e69056c
提交
0e69056c
authored
3月 05, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、阅读页加入loading
2、写笔记时,语音可以删除 可以播放
上级
d2547a76
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
44 行增加
和
18 行删除
+44
-18
library.dart
lib/apis/library.dart
+2
-0
controller.dart
lib/pages/read_web/controller.dart
+11
-4
view.dart
lib/pages/read_web/view.dart
+2
-0
input_discuss.dart
lib/pages/read_web/widgets/input_discuss.dart
+28
-13
note.dart
lib/pages/read_web/widgets/note.dart
+1
-1
没有找到文件。
lib/apis/library.dart
浏览文件 @
0e69056c
...
@@ -156,6 +156,7 @@ abstract class LibraryAPI {
...
@@ -156,6 +156,7 @@ abstract class LibraryAPI {
'book_id'
:
bookId
,
'book_id'
:
bookId
,
'chapter_id'
:
chapterId
'chapter_id'
:
chapterId
},
},
showLoading:
true
);
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
)
{
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
)
{
...
@@ -178,6 +179,7 @@ abstract class LibraryAPI {
...
@@ -178,6 +179,7 @@ abstract class LibraryAPI {
'book_id'
:
bookId
,
'book_id'
:
bookId
,
'chapter_id'
:
chapterId
'chapter_id'
:
chapterId
},
},
showLoading:
true
,
);
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
)
{
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
)
{
...
...
lib/pages/read_web/controller.dart
浏览文件 @
0e69056c
...
@@ -322,7 +322,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -322,7 +322,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final
path
=
await
_mRecorder
.
stopRecorder
();
final
path
=
await
_mRecorder
.
stopRecorder
();
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
!));
AudioModel
audioModel
=
AudioModel
(
path:
path
,
duration:
Tools
.
formatDuration
(
duration
!)
,
currentDuration:
'0:00:00'
);
discussInputAudios
.
add
(
audioModel
);
discussInputAudios
.
add
(
audioModel
);
update
();
update
();
}
}
...
@@ -357,6 +357,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -357,6 +357,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 播放音频
// 播放音频
void
playAudio
(
AudioModel
audioModel
){
void
playAudio
(
AudioModel
audioModel
){
Console
.
log
(
'-------------播放开始-------------------'
);
if
(
audioPlayer
.
playerState
.
playing
){
if
(
audioPlayer
.
playerState
.
playing
){
audioPlayer
.
stop
();
audioPlayer
.
stop
();
audioModel
.
currentDuration
=
'0:00:00'
;
audioModel
.
currentDuration
=
'0:00:00'
;
...
@@ -366,7 +368,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -366,7 +368,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
}
// 本地音频
// 本地音频
audioPlayer
.
setFilePath
(
audioModel
.
path
);
audioPlayer
.
setFilePath
(
audioModel
.
path
);
audioPlayer
.
play
();
StreamSubscription
?
positionSubscription
;
StreamSubscription
?
positionSubscription
;
positionSubscription
=
audioPlayer
.
positionStream
.
listen
((
position
)
{
positionSubscription
=
audioPlayer
.
positionStream
.
listen
((
position
)
{
String
temp
=
Tools
.
formatDuration
(
position
);
String
temp
=
Tools
.
formatDuration
(
position
);
...
@@ -414,6 +416,11 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
...
@@ -414,6 +416,11 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
Console
.
log
(
'clearAllDiscussInput--------------------------------'
);
Console
.
log
(
'clearAllDiscussInput--------------------------------'
);
update
();
update
();
}
}
// 删除音频
void
delAudio
(
AudioModel
audioModel
){
discussInputAudios
.
remove
(
audioModel
);
update
();
}
// 上传文件
// 上传文件
...
@@ -897,8 +904,8 @@ class ToolModel {
...
@@ -897,8 +904,8 @@ class ToolModel {
}
}
class
AudioModel
{
class
AudioModel
{
AudioModel
({
required
this
.
path
,
required
this
.
duration
});
AudioModel
({
required
this
.
path
,
required
this
.
duration
,
required
this
.
currentDuration
});
String
path
;
String
path
;
String
duration
;
String
duration
;
late
String
currentDuration
;
String
currentDuration
;
}
}
lib/pages/read_web/view.dart
浏览文件 @
0e69056c
...
@@ -89,6 +89,7 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -89,6 +89,7 @@ class _ReadPageState extends State<ReadPage> {
)
)
),
),
onWebViewCreated:
(
InAppWebViewController
controller
){
onWebViewCreated:
(
InAppWebViewController
controller
){
CustomToast
.
loading
();
readController
.
webViewController
=
controller
;
readController
.
webViewController
=
controller
;
},
},
onConsoleMessage:
(
controller
,
consoleMessage
)
{
onConsoleMessage:
(
controller
,
consoleMessage
)
{
...
@@ -96,6 +97,7 @@ class _ReadPageState extends State<ReadPage> {
...
@@ -96,6 +97,7 @@ class _ReadPageState extends State<ReadPage> {
Console
.
log
(
"Received message from WebView-----------------------------:
${consoleMessage.message}
"
);
Console
.
log
(
"Received message from WebView-----------------------------:
${consoleMessage.message}
"
);
},
},
onLoadStop:
(
controller
,
url
)
{
onLoadStop:
(
controller
,
url
)
{
CustomToast
.
dismiss
();
// flutter 主动给 js 传参数
// flutter 主动给 js 传参数
Map
<
String
,
dynamic
>
param
=
{
Map
<
String
,
dynamic
>
param
=
{
'book_id'
:
readController
.
bookId
,
'book_id'
:
readController
.
bookId
,
...
...
lib/pages/read_web/widgets/input_discuss.dart
浏览文件 @
0e69056c
...
@@ -126,29 +126,44 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
...
@@ -126,29 +126,44 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
shrinkWrap:
true
,
shrinkWrap:
true
,
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
AudioModel
audioModel
=
widget
.
controller
.
discussInputAudios
[
index
];
AudioModel
audioModel
=
widget
.
controller
.
discussInputAudios
[
index
];
return
GestureDetector
(
return
Container
(
onTap:
(){
// height: 20.w,
widget
.
controller
.
playAudio
(
audioModel
);
margin:
EdgeInsets
.
only
(
right:
130
.
w
,),
},
child:
Stack
(
child:
Container
(
children:
[
height:
20
.
w
,
Container
(
margin:
EdgeInsets
.
only
(
right:
130
.
w
),
child:
Container
(
margin:
EdgeInsets
.
only
(
top:
5
.
w
),
padding:
EdgeInsets
.
only
(
right:
20
.
w
,
left:
10
.
w
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
10
.
w
),
borderRadius:
BorderRadius
.
circular
(
10
.
w
),
color:
Colours
.
cF9
,
color:
Colors
.
white
,
),
),
padding:
EdgeInsets
.
only
(
right:
20
.
w
,
left:
10
.
w
),
margin:
EdgeInsets
.
only
(
top:
10
.
w
,
right:
10
.
w
),
height:
20
,
child:
Row
(
child:
Row
(
// mainAxisSize: MainAxisSize.min,
// mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
children:
[
Image
.
asset
(
'assets/images/audio.png'
),
GestureDetector
(
// Text('0:00/1:52',style: TextStyle(fontSize: 10.w,height: 1.4,color: Colours.c9),)
onTap:
(){
widget
.
controller
.
playAudio
(
audioModel
);
},
child:
Image
.
asset
(
'assets/images/audio.png'
)
),
Text
(
'
${audioModel.currentDuration}
/
${audioModel.duration}
'
,
style:
TextStyle
(
fontSize:
10
.
w
,
height:
1.4
,
color:
Colours
.
c9
),)
],
],
),
),
),
),
Positioned
(
right:
6
,
top:
6
,
child:
GestureDetector
(
onTap:
(){
widget
.
controller
.
delAudio
(
audioModel
);
},
child:
Image
.
asset
(
'assets/images/media_del.png'
,
width:
12
.
w
,
height:
12
.
w
,)
)
)
],
),
),
);
);
},
},
...
...
lib/pages/read_web/widgets/note.dart
浏览文件 @
0e69056c
...
@@ -98,7 +98,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
...
@@ -98,7 +98,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
child:
MediaQuery
.
removePadding
(
child:
MediaQuery
.
removePadding
(
context:
context
,
context:
context
,
removeTop:
true
,
removeTop:
true
,
child:
ListView
.
builder
(
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
NoteModel
model
=
controller
.
notes
[
index
];
NoteModel
model
=
controller
.
notes
[
index
];
// 划线
// 划线
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论