Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
c89ec33a
提交
c89ec33a
authored
1月 19, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
笔记详情界面完成 除图片放大功能和 图片语音展示
上级
d94d3a81
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
387 行增加
和
11 行删除
+387
-11
mine.dart
lib/apis/mine.dart
+27
-0
mine.dart
lib/models/mine.dart
+56
-0
index.dart
lib/pages/user_notes/index.dart
+0
-0
view.dart
lib/pages/user_notes/view.dart
+3
-0
controller.dart
lib/pages/user_notes_des/controller.dart
+67
-1
index.dart
lib/pages/user_notes_des/index.dart
+7
-0
view.dart
lib/pages/user_notes_des/view.dart
+1
-1
high.dart
lib/pages/user_notes_des/widgets/high.dart
+47
-0
line.dart
lib/pages/user_notes_des/widgets/line.dart
+49
-0
list.dart
lib/pages/user_notes_des/widgets/list.dart
+27
-9
note.dart
lib/pages/user_notes_des/widgets/note.dart
+101
-0
styles.dart
lib/utils/styles.dart
+2
-0
没有找到文件。
lib/apis/mine.dart
浏览文件 @
c89ec33a
...
...
@@ -204,5 +204,31 @@ abstract class MineAPI {
return
false
;
}
/// 12、笔记详情列表
///
static
Future
<
List
<
NoteModel
>>
noteList
({
int
page
=
1
,
int
limit
=
10
,
required
String
bookId
,
required
String
types
})
async
{
final
result
=
await
HttpService
.
to
.
post
(
'/v1/members/Information/myBookNotes'
,
params:
{
'page'
:
page
,
'page_size'
:
limit
,
'book_id'
:
bookId
,
'types'
:
types
},
);
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'list'
]
is
!
List
)
return
[];
return
List
.
generate
(
result
.
data
[
'list'
].
length
,
(
index
){
return
NoteModel
.
fromJson
(
result
.
data
[
'list'
][
index
]);
});
}
}
\ No newline at end of file
lib/models/mine.dart
浏览文件 @
c89ec33a
...
...
@@ -308,3 +308,58 @@ class UserInfoModel {
}
}
class
NoteModel
{
NoteModel
({
this
.
types
,
this
.
chapterId
,
this
.
content
,
this
.
positioning
,
this
.
noteContent
,
this
.
color
,
this
.
chapterName
,});
NoteModel
.
fromJson
(
dynamic
json
)
{
types
=
json
[
'types'
];
chapterId
=
json
[
'chapter_id'
];
content
=
json
[
'content'
];
positioning
=
json
[
'positioning'
];
noteContent
=
json
[
'note_content'
];
color
=
json
[
'color'
];
chapterName
=
json
[
'chapter_name'
];
}
num
?
types
;
num
?
chapterId
;
String
?
content
;
String
?
positioning
;
String
?
noteContent
;
String
?
color
;
String
?
chapterName
;
NoteModel
copyWith
({
num
?
types
,
num
?
chapterId
,
String
?
content
,
String
?
positioning
,
String
?
noteContent
,
String
?
color
,
String
?
chapterName
,
})
=>
NoteModel
(
types:
types
??
this
.
types
,
chapterId:
chapterId
??
this
.
chapterId
,
content:
content
??
this
.
content
,
positioning:
positioning
??
this
.
positioning
,
noteContent:
noteContent
??
this
.
noteContent
,
color:
color
??
this
.
color
,
chapterName:
chapterName
??
this
.
chapterName
,
);
Map
<
String
,
dynamic
>
toJson
()
{
final
map
=
<
String
,
dynamic
>{};
map
[
'types'
]
=
types
;
map
[
'chapter_id'
]
=
chapterId
;
map
[
'content'
]
=
content
;
map
[
'positioning'
]
=
positioning
;
map
[
'note_content'
]
=
noteContent
;
map
[
'color'
]
=
color
;
map
[
'chapter_name'
]
=
chapterName
;
return
map
;
}
}
\ No newline at end of file
lib/pages/user_notes/index.dart
浏览文件 @
c89ec33a
lib/pages/user_notes/view.dart
浏览文件 @
c89ec33a
...
...
@@ -36,6 +36,8 @@ class _UserNotePageState extends State<UserNotePage> {
),
],
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8
),
child:
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
...
...
@@ -50,6 +52,7 @@ class _UserNotePageState extends State<UserNotePage> {
itemCount:
controller
.
notes
.
length
,
),
),
),
)
),
),
...
...
lib/pages/user_notes_des/controller.dart
浏览文件 @
c89ec33a
...
...
@@ -2,8 +2,74 @@ part of user_notes_des;
class
UserNotesDesController
extends
GetxController
{
final
String
tag
;
UserNotesDesController
(
this
.
tag
);
final
CourseModel
model
;
UserNotesDesController
(
this
.
tag
,
this
.
model
);
List
<
NoteModel
>
notes
=
[];
final
EasyRefreshController
refreshController
=
EasyRefreshController
(
controlFinishLoad:
true
,
controlFinishRefresh:
true
,
);
final
int
_limit
=
10
;
int
_page
=
1
;
bool
_noMore
=
false
;
@override
void
onReady
()
{
onRefresh
();
super
.
onReady
();
}
@override
void
onClose
()
{
refreshController
.
dispose
();
super
.
onClose
();
}
/// 获取笔记列表
Future
<
void
>
_getNotes
([
bool
isRefresh
=
false
])
async
{
if
(
isRefresh
)
_page
=
1
;
// 网路请求
final
result
=
await
MineAPI
.
noteList
(
page:
_page
,
limit:
_limit
,
bookId:
model
.
bookId
.
toString
(),
types:
tag
);
// 如果是刷新 清理数据
if
(
isRefresh
)
notes
.
clear
();
notes
.
addAll
(
result
);
_page
++;
_noMore
=
result
.
length
<
_limit
;
update
();
}
void
onRefresh
()
async
{
try
{
await
_getNotes
(
true
);
refreshController
.
finishRefresh
(
IndicatorResult
.
success
);
refreshController
.
resetFooter
();
}
catch
(
error
)
{
refreshController
.
finishRefresh
(
IndicatorResult
.
fail
);
}
}
void
onLoading
()
async
{
if
(
_noMore
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
noMore
);
return
;
}
try
{
await
_getNotes
();
refreshController
.
finishLoad
();
}
catch
(
error
)
{
refreshController
.
finishLoad
(
IndicatorResult
.
fail
);
}
}
...
...
lib/pages/user_notes_des/index.dart
浏览文件 @
c89ec33a
library
user_notes_des
;
import
'package:easy_refresh/easy_refresh.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
import
'../../theme.dart'
;
import
'../../utils/index.dart'
;
...
...
@@ -13,3 +16,6 @@ part 'view.dart';
part
'controller.dart'
;
part
'widgets/item.dart'
;
part
'widgets/list.dart'
;
part
'widgets/line.dart'
;
part
'widgets/note.dart'
;
part
'widgets/high.dart'
;
\ No newline at end of file
lib/pages/user_notes_des/view.dart
浏览文件 @
c89ec33a
...
...
@@ -60,7 +60,7 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> {
Expanded
(
child:
TabBarView
(
children:
List
.
generate
(
tabs
.
length
,
(
index
){
return
BuildListPage
(
tag:
'
$index
'
);
return
BuildListPage
(
tag:
'
$index
'
,
model:
widget
.
model
);
})
),
)
...
...
lib/pages/user_notes_des/widgets/high.dart
0 → 100644
浏览文件 @
c89ec33a
part of
user_notes_des
;
class
BuildHigh
extends
StatelessWidget
{
final
NoteModel
model
;
const
BuildHigh
({
Key
?
key
,
required
this
.
model
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
const
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
const
EdgeInsets
.
all
(
10
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
),
color:
Colors
.
white
,
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
1.5
,
0
),
blurRadius:
7
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
model
.
content
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
height:
1.5
,
color:
Colors
.
red
,
),),
Gaps
.
vGaps8
,
Container
(
width:
double
.
infinity
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
5
,
horizontal:
10
),
color:
Colours
.
cF8
,
child:
Text
(
model
.
chapterName
??
''
,
style:
const
TextStyle
(
fontSize:
12
,
height:
1.5
,
color:
Colours
.
c9
),),
)
],
),
);
}
}
lib/pages/user_notes_des/widgets/line.dart
0 → 100644
浏览文件 @
c89ec33a
part of
user_notes_des
;
class
BuildLine
extends
StatelessWidget
{
final
NoteModel
model
;
const
BuildLine
({
Key
?
key
,
required
this
.
model
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
const
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
const
EdgeInsets
.
all
(
10
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
),
color:
Colors
.
white
,
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
1.5
,
0
),
blurRadius:
7
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
model
.
content
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
height:
1.5
,
color:
Colours
.
c3
,
decoration:
TextDecoration
.
underline
,
decorationColor:
Colors
.
red
,
decorationThickness:
2
),),
Gaps
.
vGaps8
,
Container
(
width:
double
.
infinity
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
5
,
horizontal:
10
),
color:
Colours
.
cF8
,
child:
Text
(
model
.
chapterName
??
''
,
style:
const
TextStyle
(
fontSize:
12
,
height:
1.5
,
color:
Colours
.
c9
),),
)
],
),
);
}
}
lib/pages/user_notes_des/widgets/list.dart
浏览文件 @
c89ec33a
...
...
@@ -2,9 +2,11 @@ part of user_notes_des;
class
BuildListPage
extends
StatefulWidget
{
final
String
tag
;
final
CourseModel
model
;
const
BuildListPage
({
Key
?
key
,
required
this
.
tag
required
this
.
tag
,
required
this
.
model
})
:
super
(
key:
key
);
...
...
@@ -12,21 +14,37 @@ class BuildListPage extends StatefulWidget {
State
<
BuildListPage
>
createState
()
=>
_BuildListPageState
();
}
class
_BuildListPageState
extends
State
<
BuildListPage
>
{
class
_BuildListPageState
extends
State
<
BuildListPage
>
with
AutomaticKeepAliveClientMixin
{
@override
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
UserNotesDesController
>(
tag:
widget
.
tag
,
init:
UserNotesDesController
(
widget
.
tag
),
builder:
(
controller
)
=>
ListView
.
builder
(
init:
UserNotesDesController
(
widget
.
tag
,
widget
.
model
),
builder:
(
controller
)
=>
CustomPullScrollView
(
controller:
controller
.
refreshController
,
onLoading:
controller
.
onLoading
,
child:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
){
return
Container
(
height:
20
,
color:
Colors
.
red
,
);
NoteModel
model
=
controller
.
notes
[
index
];
// 划线
if
(
model
.
types
==
1
){
return
BuildLine
(
model:
model
,);
}
// 高亮
else
if
(
model
.
types
==
2
){
return
BuildHigh
(
model:
model
,);
}
// 笔记
else
if
(
model
.
types
==
3
){
return
BuildNote
(
model:
model
,);
}
},
itemCount:
3
,
itemCount:
controller
.
notes
.
length
,
),
),
);
}
@override
bool
get
wantKeepAlive
=>
true
;
}
lib/pages/user_notes_des/widgets/note.dart
0 → 100644
浏览文件 @
c89ec33a
part of
user_notes_des
;
class
BuildNote
extends
StatelessWidget
{
final
NoteModel
model
;
const
BuildNote
({
Key
?
key
,
required
this
.
model
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
margin:
const
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
10
),
padding:
const
EdgeInsets
.
all
(
10
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
),
color:
Colors
.
white
,
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
1.5
,
0
),
blurRadius:
7
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'看来谁都不记得自己为何出现在此'
,
style:
TextStyle
(
fontSize:
14
,
height:
1.5
,
color:
Colors
.
red
,
),),
Gaps
.
vGaps13
,
_buildImageGridView
(),
Gaps
.
vGaps13
,
_buildAudioGridView
(),
Gaps
.
vGaps13
,
Container
(
width:
double
.
infinity
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
5
,
horizontal:
10
),
color:
Colours
.
cF8
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
model
.
chapterName
??
''
,
style:
const
TextStyle
(
fontSize:
12
,
height:
1.5
,
color:
Colours
.
c9
),),
Text
(
'内容:
${model.content??''}
'
,
style:
const
TextStyle
(
fontSize:
12
,
height:
1.5
,
color:
Colours
.
c9
),),
],
)
)
],
),
);
}
// 图片
Widget
_buildImageGridView
(){
return
GridView
.
builder
(
// padding: const EdgeInsets.only(left: 13,top: 10),
physics:
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
6
,
crossAxisSpacing:
2
,
mainAxisSpacing:
2
,
childAspectRatio:
1
),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
color:
Colors
.
red
,
child:
Center
(
child:
Text
(
'图片'
)),
);
},
itemCount:
3
,
);
}
Widget
_buildAudioGridView
(){
return
GridView
.
builder
(
// padding: const EdgeInsets.only(left: 13,top: 10),
physics:
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
6
,
crossAxisSpacing:
2
,
mainAxisSpacing:
2
,
childAspectRatio:
1
),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
color:
Colors
.
red
,
child:
Center
(
child:
Text
(
'音频'
)),
);
},
itemCount:
3
,
);
}
}
lib/utils/styles.dart
浏览文件 @
c89ec33a
...
...
@@ -32,6 +32,7 @@ class Colours {
static
const
cFF
=
Color
(
0xFFFFFFFF
);
static
const
cF2
=
Color
(
0xFFF2F2F2
);
static
const
cF4
=
Color
(
0xFFF4F4F4
);
static
const
cF8
=
Color
(
0xFFF8F8F8
);
static
const
cF9
=
Color
(
0xFFF9F9F9
);
static
const
cC7
=
Color
(
0xFFC7C7C7
);
static
const
cAB1941
=
Color
(
0xB3AB1941
);
...
...
@@ -44,6 +45,7 @@ class Gaps {
static
const
Widget
hGaps20
=
SizedBox
(
width:
20
,);
static
const
Widget
vGaps5
=
SizedBox
(
height:
5
,);
static
const
Widget
vGaps8
=
SizedBox
(
height:
8
,);
static
const
Widget
vGaps10
=
SizedBox
(
height:
10
,);
static
const
Widget
vGaps13
=
SizedBox
(
height:
13
,);
static
const
Widget
vGaps15
=
SizedBox
(
height:
15
,);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论