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

1、搜全文参数跳转

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