Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
d5e98ffd
提交
d5e98ffd
authored
3月 05, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
三级标题
上级
0e69056c
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
105 行增加
和
15 行删除
+105
-15
item.dart
lib/pages/book_category/widgets/item.dart
+105
-15
没有找到文件。
lib/pages/book_category/widgets/item.dart
浏览文件 @
d5e98ffd
...
...
@@ -20,12 +20,99 @@ class BuildItem extends StatefulWidget {
class
_BuildItemState
extends
State
<
BuildItem
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
_buildChapter
(
widget
.
model
);
// Column(
// children: [
// /// 章节名称容器
// GestureDetector(
// onTap: (){
// widget.onTap(widget.model);
// // // 如果章下面没有节 点击才会跳转
// // if (widget.model.children!.isEmpty){
// // widget.onTap(widget.model);
// // // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id': widget.model.id.toString(),'chapter_name':widget.model.name.toString()},extra: widget.bookDetails);
// // }
// // setState(() {
// // widget.model.selected = !widget.model.selected;
// // });
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 15.w),
// height: 30.w,
// color: Colors.white,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(widget.model.name??'',style: TextStyle(fontSize: 14.w,color: widget.model.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),),
// Gaps.hGaps5,
// widget.model.isReading == 1? Container(
// margin: const EdgeInsets.fromLTRB(0, 6, 0, 0),
// height: 18,
// width: 18,
// alignment: Alignment.center,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8.5.w),
// border: Border.all(width:1,color: AppTheme.primary)
// ),
// child: Text('试',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),),
// ):const SizedBox(),
// ],
// ),
// Transform.rotate(
// angle: widget.model.selected?0:-90 * (3.141592653589793 / 180),
// child: GestureDetector(
// onTap: (){
// setState(() {
// widget.model.selected = !widget.model.selected;
// });
// },
// child: Container(
// width: 20.w,
// height: 20.w,
// // color: Colors.red,
// child: Image.asset('assets/images/down.png')
// ),
// )
// )
//
// ],
// )
// ),
// ),
// /// 节的名称容器
// Visibility(
// visible: widget.model.selected,
// child: ListView.builder(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// itemBuilder: (BuildContext context, int index){
// ChapterModel model = widget.model.children![index];
// return GestureDetector(
// onTap: (){
// widget.onTap(model);
// // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id':model.id.toString(),'chapter_name':model.name.toString()},extra: widget.bookDetails);
// },
// child: _buildSection(model)
// );
// },
// itemCount: widget.model.children!.length,
// )
// )
// ],
// );
}
Widget
_buildChapter
(
ChapterModel
chapterModel
){
return
Column
(
children:
[
/// 章节名称容器
GestureDetector
(
onTap:
(){
widget
.
onTap
(
widget
.
m
odel
);
widget
.
onTap
(
chapterM
odel
);
// // 如果章下面没有节 点击才会跳转
// if (widget.model.children!.isEmpty){
// widget.onTap(widget.model);
...
...
@@ -46,9 +133,9 @@ class _BuildItemState extends State<BuildItem> {
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Text
(
widget
.
model
.
name
??
''
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
widget
.
m
odel
.
seen
==
0
?
Colours
.
c3
:
Colours
.
c9
,
fontWeight:
Fonts
.
medium
,
height:
2
),),
Text
(
chapterModel
.
name
??
''
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
chapterM
odel
.
seen
==
0
?
Colours
.
c3
:
Colours
.
c9
,
fontWeight:
Fonts
.
medium
,
height:
2
),),
Gaps
.
hGaps5
,
widget
.
m
odel
.
isReading
==
1
?
Container
(
chapterM
odel
.
isReading
==
1
?
Container
(
margin:
const
EdgeInsets
.
fromLTRB
(
0
,
6
,
0
,
0
),
height:
18
,
width:
18
,
...
...
@@ -62,11 +149,11 @@ class _BuildItemState extends State<BuildItem> {
],
),
Transform
.
rotate
(
angle:
widget
.
m
odel
.
selected
?
0
:-
90
*
(
3.141592653589793
/
180
),
angle:
chapterM
odel
.
selected
?
0
:-
90
*
(
3.141592653589793
/
180
),
child:
GestureDetector
(
onTap:
(){
setState
(()
{
widget
.
model
.
selected
=
!
widget
.
m
odel
.
selected
;
chapterModel
.
selected
=
!
chapterM
odel
.
selected
;
});
},
child:
Container
(
...
...
@@ -84,27 +171,30 @@ class _BuildItemState extends State<BuildItem> {
),
/// 节的名称容器
Visibility
(
visible:
widget
.
m
odel
.
selected
,
visible:
chapterM
odel
.
selected
,
child:
ListView
.
builder
(
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
itemBuilder:
(
BuildContext
context
,
int
index
){
ChapterModel
model
=
widget
.
model
.
children
![
index
];
return
GestureDetector
(
onTap:
(){
widget
.
onTap
(
model
);
// context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id':model.id.toString(),'chapter_name':model.name.toString()},extra: widget.bookDetails);
},
child:
_buildSection
(
model
)
ChapterModel
model
=
chapterModel
.
children
![
index
];
return
Container
(
padding:
EdgeInsets
.
only
(
left:
60
.
w
,
bottom:
4
.
w
),
child:
_buildChapter
(
model
)
);
// GestureDetector(
// onTap: (){
// widget.onTap(model);
// // context.pushNamed(Routes.web,queryParameters: {'book_id': widget.bookDetails.bookId.toString(),'chapter_id':model.id.toString(),'chapter_name':model.name.toString()},extra: widget.bookDetails);
// },
// child: _buildSection(model)
// );
},
itemCount:
widget
.
m
odel
.
children
!.
length
,
itemCount:
chapterM
odel
.
children
!.
length
,
)
)
],
);
}
Widget
_buildSection
(
ChapterModel
model
){
return
Container
(
color:
Colors
.
white
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论