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

1、搜全文参数跳转

2、倒计时 3、阅读页目录支持多级
上级 0688944f
......@@ -178,7 +178,7 @@ class _BuildItemState extends State<BuildItem> {
itemBuilder: (BuildContext context, int index){
ChapterModel model = chapterModel.children![index];
return Container(
padding: EdgeInsets.only(left: 60.w,bottom: 4.w),
padding: EdgeInsets.only(left: 20.w,bottom: 4.w),
child: _buildChapter(model)
);
// GestureDetector(
......
......@@ -83,6 +83,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
just_audio.AudioPlayer audioPlayer = just_audio.AudioPlayer();
late SearchAllModel sModel = SearchAllModel(bookId: '0');
///------------------------------------------ 页面 生命周期--------------------------------------------------------
......@@ -546,7 +548,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
bookId: bookId,
chapterId: chapterId,
commentId: '0',
quoteContent: '',
quoteContent: noteTitle,
title: titleInput.text,
content: jsonEncode(contentMap)
);
......
......@@ -104,7 +104,7 @@ class _ReadPageState extends State<ReadPage> {
'chapter_id': readController.chapterId,
'token':UserStore.to.token
};
String str = '$kServerUrl,${readController.bookId},${readController.chapterId},${UserStore.to.token},${readController.noteId}';
String str = '$kServerUrl,${readController.bookId},${readController.chapterId},${UserStore.to.token},${readController.noteId},${readController.sModel.bookId =='0'?'':readController.sModel.combinedContent}';
Console.log('传给前端的参数--------------------------------$str');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
......@@ -159,7 +159,7 @@ class _ReadPageState extends State<ReadPage> {
Console.log('监听讨论回调------------------------------------------------$args');
readController.setShowChat(true);
readController.setChatType(0);
readController.titleInput.text = args.first.toString();
readController.noteTitle = args.first.toString();
});
controller.addJavaScriptHandler(handlerName: 'answerResultCallBack', callback: (args){
......@@ -194,7 +194,7 @@ class _ReadPageState extends State<ReadPage> {
controller.addJavaScriptHandler(handlerName: 'loadChapterCallBack', callback: (args){
String chapterId = args.first[0].toString();
String chapterName = args.first[1].toString();
readController.setChapterInfo(id: chapterId, name: chapterName);
readController.setChapterInfo(id: chapterId, name: chapterName ?? '');
Console.log('监听 上一节 下一节------------------------------------------------$args');
});
......@@ -347,10 +347,13 @@ class _ReadPageState extends State<ReadPage> {
controller.chooseTool(model);
},
// 点 搜索全部 列表 某一项 事件
onTapSearchItem: (){
onTapSearchItem: (SearchAllModel sModel){
controller.chooseTool(model);
// TODO:重新加载阅读界面 参数:chapter_id text
Console.log('-----------目录点击搜索条目---------------------');
controller.sModel = sModel;
controller.selectChapter(ChapterModel(id: sModel.chapterId,name: sModel.chapterName));
controller.webViewController.reload();
},
onTapChapter: (ChapterModel chapterModel){
Console.log('-----------选择的章节-------------${chapterModel.name}--------');
......@@ -370,10 +373,13 @@ class _ReadPageState extends State<ReadPage> {
controller.chooseTool(model);
},
// 点 搜索全部 列表 某一项 事件
onTapSearchItem: (){
onTapSearchItem: (SearchAllModel sModel){
controller.chooseTool(model);
// TODO:重新加载阅读界面 参数:chapter_id text
Console.log('-----------笔记点击搜索条目---------------------');
controller.sModel = sModel;
controller.selectChapter(ChapterModel(id: sModel.chapterId,name: sModel.chapterName));
controller.webViewController.reload();
},
bookDetailModel: controller.bookDetailModel,
chapterId: controller.chapterId,
......@@ -386,10 +392,13 @@ class _ReadPageState extends State<ReadPage> {
controller.chooseTool(model);
},
// 点 搜索全部 列表 某一项 事件
onTapSearchItem: (){
onTapSearchItem: (SearchAllModel sModel){
controller.chooseTool(model);
controller.sModel = sModel;
// TODO:重新加载阅读界面 参数:chapter_id text
Console.log('-----------讨论点击搜索条目---------------------');
controller.selectChapter(ChapterModel(id: sModel.chapterId,name: sModel.chapterName));
controller.webViewController.reload();
},
bookDetailModel: controller.bookDetailModel,
chapterId:controller.chapterId,
......
......@@ -4,7 +4,7 @@ class ReadCategoryPage extends StatefulWidget {
final ReadController controller;
final void Function()? onTap;
// 点击 搜索全文 中的列表事件
final void Function()? onTapSearchItem;
final void Function(SearchAllModel sModel)? onTapSearchItem;
final Function(ChapterModel chapterModel) onTapChapter;
const ReadCategoryPage({
Key? key,
......@@ -88,9 +88,9 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
),
widget.controller.showSearch? Expanded(
child: BuildSearchAll(
onTap: (){
onTap: (SearchAllModel sModel){
if (widget.onTapSearchItem !=null) {
widget.onTapSearchItem!();
widget.onTapSearchItem!(sModel);
}
},
searchALlResults: widget.controller.searchALlResults
......
......@@ -4,7 +4,7 @@ class ReadDiscussPage extends StatefulWidget {
// 点 x 事件
final void Function()? onTap;
// 点击 搜索全文 中的列表事件
final void Function()? onTapSearchItem;
final void Function(SearchAllModel sModel)? onTapSearchItem;
final BookDetailModel bookDetailModel;
// 当前的章节id
final String chapterId;
......@@ -89,9 +89,9 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
),
controller.showSearch? Expanded(
child: BuildSearchAll(
onTap: (){
onTap: (SearchAllModel sModel){
if (widget.onTapSearchItem !=null) {
widget.onTapSearchItem!();
widget.onTapSearchItem!(sModel);
}
},
searchALlResults: controller.searchALlResults,
......
......@@ -22,31 +22,37 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
children: [
Container(
margin: EdgeInsets.symmetric(vertical: 10.w),
child: widget.controller.chatType ==0?Row(
child: widget.controller.chatType ==0?Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('话题',style: TextStyle(fontSize: 14.w,color: Colours.c3,height: 1.5,fontWeight: Fonts.medium),),
Gaps.hGaps5,
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(4),
child: TextField(
focusNode: widget.controller.discussTitleFocusNode,
controller: widget.controller.titleInput,
autofocus: true,
decoration: InputDecoration(
border: InputBorder.none,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
hintText: '请输入话题名称',
hintStyle:TextStyle(fontSize: 12.w,height: 1.5,color: Colours.c9,),
filled: true,
fillColor: Colours.cF8,
Text('"${widget.controller.noteTitle}"',style: TextStyle(fontSize: 12.w,height: 1.4,color: Colours.c9),),
Row(
children: [
Text('话题',style: TextStyle(fontSize: 14.w,color: Colours.c3,height: 1.5,fontWeight: Fonts.medium),),
Gaps.hGaps5,
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(4),
child: TextField(
focusNode: widget.controller.discussTitleFocusNode,
controller: widget.controller.titleInput,
autofocus: true,
decoration: InputDecoration(
border: InputBorder.none,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
hintText: '请输入话题名称',
hintStyle:TextStyle(fontSize: 12.w,height: 1.5,color: Colours.c9,),
filled: true,
fillColor: Colours.cF8,
),
onSubmitted: (_){
FocusScope.of(context).requestFocus(widget.controller.discussContentFocusNode);
},
),
),
onSubmitted: (_){
FocusScope.of(context).requestFocus(widget.controller.discussContentFocusNode);
},
),
),
],
),
],
):Text('"${widget.controller.noteTitle}"',style: TextStyle(fontSize: 12.w,height: 1.4,color: Colours.c9),),
......
......@@ -16,82 +16,171 @@ class BuildItem extends StatefulWidget {
class _BuildItemState extends State<BuildItem> {
@override
Widget build(BuildContext context) {
return _buildChapter(widget.model);
// Column(
// children: [
// /// 章节名称容器
// GestureDetector(
// onTap: (){
// if(widget.model.children!.isEmpty){
// widget.onTapChapter(widget.model);
// }
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 15.w),
// height: 30.w,
// color: Colors.white,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// 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.boldSemi,height: 2),),
// Gaps.hGaps5,
// widget.model.isReading == 1? Container(
// height: 18,
// width: 18,
// margin: EdgeInsets.only(top: 6.w),
// 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: SizedBox(
// width: 20.w,
// height: 20.w,
// 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.onTapChapter(model);
// },
// child: _buildSection(model)
// );
// },
// itemCount: widget.model.children!.length,
// )
// )
// ],
// );
}
Widget _buildChapter(ChapterModel chapterModel){
return Column(
children: [
/// 章节名称容器
GestureDetector(
onTap: (){
if(widget.model.children!.isEmpty){
widget.onTapChapter(widget.model);
}
widget.onTapChapter(chapterModel);
// // 如果章下面没有节 点击才会跳转
// 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,
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.boldSemi,height: 2),),
Gaps.hGaps5,
widget.model.isReading == 1? Container(
height: 18,
width: 18,
margin: EdgeInsets.only(top: 6.w),
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: SizedBox(
width: 20.w,
height: 20.w,
child: Image.asset('assets/images/down.png')
),
)
)
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(chapterModel.name??'',style: TextStyle(fontSize: 14.w,color: chapterModel.seen ==0? Colours.c3:Colours.c9,fontWeight: Fonts.medium,height: 2),),
Gaps.hGaps5,
chapterModel.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: chapterModel.selected?0:-90 * (3.141592653589793 / 180),
child: GestureDetector(
onTap: (){
setState(() {
chapterModel.selected = !chapterModel.selected;
});
},
child: Container(
width: 20.w,
height: 20.w,
// color: Colors.red,
child: Image.asset('assets/images/down.png')
),
)
)
],
)
],
)
),
),
/// 节的名称容器
Visibility(
visible: widget.model.selected,
visible: chapterModel.selected,
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index){
ChapterModel model = widget.model.children![index];
return GestureDetector(
onTap: (){
widget.onTapChapter(model);
},
child: _buildSection(model)
);
},
itemCount: widget.model.children!.length,
itemBuilder: (BuildContext context, int index){
ChapterModel model = chapterModel.children![index];
return Container(
padding: EdgeInsets.only(left: 20.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: chapterModel.children!.length,
)
)
],
);
}
Widget _buildSection(ChapterModel model){
return Container(
color: Colors.white,
......
......@@ -3,7 +3,7 @@ part of web;
class ReadNotePage extends StatefulWidget {
final BookDetailModel bookDetailModel;
// 点击 搜索全文 中的列表事件
final void Function()? onTapSearchItem;
final void Function(SearchAllModel sModel)? onTapSearchItem;
// 当前的章节id
final String chapterId;
final void Function()? onTap;
......@@ -86,9 +86,9 @@ class _ReadNotePageState extends State<ReadNotePage> {
],
),
controller.showSearch? Expanded(child: BuildSearchAll(
onTap: (){
onTap: (SearchAllModel sModel){
if (widget.onTapSearchItem !=null) {
widget.onTapSearchItem!();
widget.onTapSearchItem!(sModel);
}
},
searchALlResults: controller.searchALlResults
......
part of web;
class BuildSearchAll extends StatefulWidget {
final void Function()? onTap;
final void Function(SearchAllModel sModel)? onTap;
final List<SearchAllModel> searchALlResults;
const BuildSearchAll({
......@@ -23,14 +23,14 @@ class _BuildSearchAllState extends State<BuildSearchAll> {
return GestureDetector(
onTap: (){
if(widget.onTap !=null){
widget.onTap!();
widget.onTap!(model);
}
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
// color: Colors.red,
color: Colors.white,
margin: EdgeInsets.only(left: 15.w,top: 8.w),
// height: 110,
child: Column(
......
......@@ -128,7 +128,7 @@ class BuiltAwaiting extends StatelessWidget {
child: Align(
alignment: Alignment.center,
child: Text(
'${30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
'${31 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
style: TextStyle(
color: Colours.cC31F4C,
fontSize: 10.w,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论