Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
b83edf38
提交
b83edf38
authored
1月 16, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
章节选中状态
上级
3cef8b26
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
64 行增加
和
23 行删除
+64
-23
library.dart
lib/models/library.dart
+4
-1
index.dart
lib/pages/book_category/index.dart
+1
-0
item.dart
lib/pages/book_category/widgets/item.dart
+48
-18
view.dart
lib/pages/book_detail/view.dart
+11
-4
没有找到文件。
lib/models/library.dart
浏览文件 @
b83edf38
...
@@ -128,7 +128,8 @@ class ChapterModel {
...
@@ -128,7 +128,8 @@ class ChapterModel {
this
.
isReading
,
this
.
isReading
,
this
.
sort
,
this
.
sort
,
this
.
seen
,
this
.
seen
,
this
.
children
this
.
children
,
this
.
selected
=
false
});
});
ChapterModel
.
fromJson
(
dynamic
json
)
{
ChapterModel
.
fromJson
(
dynamic
json
)
{
...
@@ -145,6 +146,7 @@ class ChapterModel {
...
@@ -145,6 +146,7 @@ class ChapterModel {
children
?.
add
(
ChapterModel
.
fromJson
(
v
));
children
?.
add
(
ChapterModel
.
fromJson
(
v
));
});
});
}
}
selected
=
false
;
}
}
num
?
id
;
num
?
id
;
String
?
name
;
String
?
name
;
...
@@ -153,6 +155,7 @@ class ChapterModel {
...
@@ -153,6 +155,7 @@ class ChapterModel {
num
?
isReading
;
num
?
isReading
;
num
?
sort
;
num
?
sort
;
num
?
seen
;
num
?
seen
;
late
bool
selected
;
List
<
ChapterModel
>?
children
;
List
<
ChapterModel
>?
children
;
ChapterModel
copyWith
({
num
?
id
,
ChapterModel
copyWith
({
num
?
id
,
String
?
name
,
String
?
name
,
...
...
lib/pages/book_category/index.dart
浏览文件 @
b83edf38
library
book_category
;
library
book_category
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'../../models/index.dart'
;
import
'../../models/index.dart'
;
...
...
lib/pages/book_category/widgets/item.dart
浏览文件 @
b83edf38
part of
book_category
;
part of
book_category
;
class
BuildItem
extends
State
less
Widget
{
class
BuildItem
extends
State
ful
Widget
{
final
ChapterModel
model
;
final
ChapterModel
model
;
const
BuildItem
({
const
BuildItem
({
Key
?
key
,
Key
?
key
,
required
this
.
model
required
this
.
model
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
@override
State
<
BuildItem
>
createState
()
=>
_BuildItemState
();
}
class
_BuildItemState
extends
State
<
BuildItem
>
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Column
(
return
Column
(
children:
[
children:
[
/// 章节名称容器
/// 章节名称容器
Container
(
GestureDetector
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
onTap:
(){
child:
Row
(
setState
(()
{
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
widget
.
model
.
selected
=
!
widget
.
model
.
selected
;
children:
[
});
Text
(
model
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
color:
Colours
.
c3
,
fontWeight:
Fonts
.
medium
,
height:
1.6
),),
},
Container
(
child:
Container
(
width:
14
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
4
,
height:
30
,
color:
Colors
.
cyan
,
color:
Colors
.
white
,
)
child:
Row
(
],
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
)
children:
[
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Text
(
widget
.
model
.
name
??
''
,
style:
TextStyle
(
fontSize:
14
,
color:
widget
.
model
.
seen
==
0
?
Colours
.
c3
:
Colours
.
c9
,
fontWeight:
Fonts
.
medium
,
height:
1.4
),),
Gaps
.
hGaps5
,
widget
.
model
.
isReading
==
1
?
Container
(
height:
17
,
width:
17
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8.5
),
border:
Border
.
all
(
width:
1
,
color:
AppTheme
.
primary
)
),
child:
const
Text
(
'试'
,
style:
TextStyle
(
fontSize:
12
,
color:
AppTheme
.
primary
),),
):
const
SizedBox
(),
],
),
Transform
.
rotate
(
angle:
widget
.
model
.
selected
?
0
:-
90
*
(
3.141592653589793
/
180
),
child:
Image
.
asset
(
'assets/images/down.png'
)
)
],
)
),
),
),
/// 节的名称容器
/// 节的名称容器
Visibility
(
Visibility
(
visible:
true
,
visible:
widget
.
model
.
selected
,
child:
ListView
.
builder
(
child:
ListView
.
builder
(
shrinkWrap:
true
,
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
physics:
const
NeverScrollableScrollPhysics
(),
itemBuilder:
(
BuildContext
context
,
int
index
){
itemBuilder:
(
BuildContext
context
,
int
index
){
return
_buildSection
(
model
.
children
![
index
]);
return
_buildSection
(
widget
.
model
.
children
![
index
]);
},
},
itemCount:
model
.
children
!.
length
,
itemCount:
widget
.
model
.
children
!.
length
,
)
)
)
)
],
],
...
@@ -45,7 +75,7 @@ class BuildItem extends StatelessWidget {
...
@@ -45,7 +75,7 @@ class BuildItem extends StatelessWidget {
Widget
_buildSection
(
ChapterModel
model
){
Widget
_buildSection
(
ChapterModel
model
){
return
Container
(
return
Container
(
margin:
const
EdgeInsets
.
only
(
left:
60
),
margin:
const
EdgeInsets
.
only
(
left:
60
),
child:
Text
(
model
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
12
,
color:
Colours
.
c3
,
height:
1.6
),),
child:
Text
(
model
.
name
??
''
,
style:
TextStyle
(
fontSize:
12
,
color:
model
.
seen
==
0
?
Colours
.
c3
:
Colours
.
c9
,
height:
1.6
),),
);
);
}
}
}
}
lib/pages/book_detail/view.dart
浏览文件 @
b83edf38
...
@@ -108,7 +108,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
...
@@ -108,7 +108,7 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
// color: Colours.cE0.withOpacity(0.5),
// color: Colours.cE0.withOpacity(0.5),
),
),
// padding: EdgeInsets.symmetric(vertical: 8),
// padding: EdgeInsets.symmetric(vertical: 8),
child:
con
st
Text
(
'学习报告'
,
style:
TextStyle
(
fontSize:
13
,
color:
Colours
.
c9
,
height:
1.5
),),
child:
con
troller
.
bookDetails
.
isHave
==
1
?
Text
(
'学习报告'
,
style:
TextStyle
(
fontSize:
13
,
color:
Colours
.
c9
,
height:
1.5
),):
Text
(
'加入书架'
,
style:
TextStyle
(
fontSize:
13
,
color:
AppTheme
.
primary
,
height:
1.5
),),
),
),
),
),
),
),
...
@@ -116,9 +116,14 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
...
@@ -116,9 +116,14 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
Expanded
(
Expanded
(
child:
GestureDetector
(
child:
GestureDetector
(
onTap:
(){
onTap:
(){
context
.
pushNamed
(
Routes
.
creditPoints
).
then
((
value
){
// context.pushNamed(Routes.creditPoints).then((value){
print
(
'---------------------
$value
'
);
// print('---------------------$value');
});
// });
/// 没有购买并且没有试读直接跳转 购买页
bool
noTryRead
=
true
;
if
(
controller
.
bookDetails
.
isHave
==
0
&&
noTryRead
){
context
.
pushNamed
(
Routes
.
bookPay
);
}
},
},
child:
Container
(
child:
Container
(
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
...
@@ -141,4 +146,6 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
...
@@ -141,4 +146,6 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论