提交 d5e98ffd authored 作者: yueweilu's avatar yueweilu

三级标题

上级 0e69056c
...@@ -20,12 +20,99 @@ class BuildItem extends StatefulWidget { ...@@ -20,12 +20,99 @@ class BuildItem extends StatefulWidget {
class _BuildItemState extends State<BuildItem> { class _BuildItemState extends State<BuildItem> {
@override @override
Widget build(BuildContext context) { 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( return Column(
children: [ children: [
/// 章节名称容器 /// 章节名称容器
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
widget.onTap(widget.model); widget.onTap(chapterModel);
// // 如果章下面没有节 点击才会跳转 // // 如果章下面没有节 点击才会跳转
// if (widget.model.children!.isEmpty){ // if (widget.model.children!.isEmpty){
// widget.onTap(widget.model); // widget.onTap(widget.model);
...@@ -36,75 +123,78 @@ class _BuildItemState extends State<BuildItem> { ...@@ -36,75 +123,78 @@ class _BuildItemState extends State<BuildItem> {
// }); // });
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 15.w), padding: EdgeInsets.symmetric(horizontal: 15.w),
height: 30.w, height: 30.w,
color: Colors.white, color: Colors.white,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(widget.model.name??'',style: TextStyle(fontSize: 14.w,color: widget.model.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),), Text(chapterModel.name??'',style: TextStyle(fontSize: 14.w,color: chapterModel.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),),
Gaps.hGaps5, Gaps.hGaps5,
widget.model.isReading == 1? Container( chapterModel.isReading == 1? Container(
margin: const EdgeInsets.fromLTRB(0, 6, 0, 0), margin: const EdgeInsets.fromLTRB(0, 6, 0, 0),
height: 18, height: 18,
width: 18, width: 18,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.5.w), borderRadius: BorderRadius.circular(8.5.w),
border: Border.all(width:1,color: AppTheme.primary) border: Border.all(width:1,color: AppTheme.primary)
), ),
child: Text('试',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),), child: Text('试',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),),
):const SizedBox(), ):const SizedBox(),
], ],
), ),
Transform.rotate( Transform.rotate(
angle: widget.model.selected?0:-90 * (3.141592653589793 / 180), angle: chapterModel.selected?0:-90 * (3.141592653589793 / 180),
child: GestureDetector( child: GestureDetector(
onTap: (){ onTap: (){
setState(() { setState(() {
widget.model.selected = !widget.model.selected; chapterModel.selected = !chapterModel.selected;
}); });
}, },
child: Container( child: Container(
width: 20.w, width: 20.w,
height: 20.w, height: 20.w,
// color: Colors.red, // color: Colors.red,
child: Image.asset('assets/images/down.png') child: Image.asset('assets/images/down.png')
), ),
) )
) )
], ],
) )
), ),
), ),
/// 节的名称容器 /// 节的名称容器
Visibility( Visibility(
visible: widget.model.selected, visible: chapterModel.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){
ChapterModel model = widget.model.children![index]; ChapterModel model = chapterModel.children![index];
return GestureDetector( return Container(
onTap: (){ padding: EdgeInsets.only(left: 60.w,bottom: 4.w),
widget.onTap(model); child: _buildChapter(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); );
}, // GestureDetector(
child: _buildSection(model) // 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);
itemCount: widget.model.children!.length, // },
// child: _buildSection(model)
// );
},
itemCount: chapterModel.children!.length,
) )
) )
], ],
); );
} }
Widget _buildSection(ChapterModel model){ Widget _buildSection(ChapterModel model){
return Container( return Container(
color: Colors.white, color: Colors.white,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论