提交 15924952 authored 作者: maodou's avatar maodou

Merge remote-tracking branch 'origin/test' into test

...@@ -133,7 +133,10 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid ...@@ -133,7 +133,10 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
// 1免费 0 不免费 // 1免费 0 不免费
if(controller.bookDetails.isFree == 1){ if(controller.bookDetails.isFree == 1){
context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails); final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
if (result == true){
controller.getBookDetails();
}
} }
else { else {
// 没有购买 // 没有购买
...@@ -159,11 +162,18 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid ...@@ -159,11 +162,18 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
} }
} }
else{ else{
context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails); final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
if (result == true){
controller.getBookDetails();
}
} }
} }
else{ else{
context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails); final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': controller.bookDetails.bookId.toString(),'chapter_id': controller.bookDetails.chapterId.toString(),'chapter_name':controller.bookDetails.chapterName.toString()},extra: controller.bookDetails);
if (result == true){
controller.getBookDetails();
}
} }
} }
}, },
......
...@@ -43,7 +43,7 @@ class BuildBanner extends StatelessWidget { ...@@ -43,7 +43,7 @@ class BuildBanner extends StatelessWidget {
//CustomImage.network(item.pic??'',) //CustomImage.network(item.pic??'',)
child: GestureDetector( child: GestureDetector(
onTap: (){ onTap: (){
if (onTap !=null) onTap!(item); if (onTap !=null && item.url!.isNotEmpty) onTap!(item);
}, },
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
......
...@@ -25,185 +25,191 @@ class _ReadPageState extends State<ReadPage> { ...@@ -25,185 +25,191 @@ class _ReadPageState extends State<ReadPage> {
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<ReadController>( return WillPopScope(
init: ReadController(bookId: widget.bookId, chapterId: widget.chapterId,chapterName: widget.chapterName,bookDetailModel: widget.bookDetailModel), onWillPop: () async {
builder: (readController) => Scaffold( context.pop(true);
appBar: CustomAppBar( return false;
title: Text(readController.chapterName), },
centerTitle: false, child: GetBuilder<ReadController>(
actions: [ init: ReadController(bookId: widget.bookId, chapterId: widget.chapterId,chapterName: widget.chapterName,bookDetailModel: widget.bookDetailModel),
GestureDetector( builder: (readController) => Scaffold(
onTap: () { appBar: CustomAppBar(
readController.getBookDown(); title: Text(readController.chapterName),
}, centerTitle: false,
child: Text( actions: [
'离线阅读', GestureDetector(
style: TextStyle( onTap: () {
fontSize: 14.w, color: Colours.c3), readController.getBookDown();
))
],
),
resizeToAvoidBottomInset: false,
floatingActionButton: readController.show&& !readController.toolModel.selected?GestureDetector(
onTap: (){
readController.setShowChat(true);
readController.noteTitle = '你好你问你你等您第五年对哦in我ID呢哦win地哦为内地那打卡你打困哪';
readController.setChatType(1);
},
child: Image.asset('assets/images/chat.png'),
):null,
// floatingActionButtonAnimator: const NoAnimationFabAnimator(),
floatingActionButtonLocation:MyFloatingActionButtonLocation(),
body: Container(
color: Colors.white,
child: Stack(
children: [
// Container(
// height: 40,
// width: double.infinity,
// color: Colors.lightBlue,
// ),
InAppWebView(
initialUrlRequest: URLRequest(
url: Uri.parse('http://150.158.138.40:9200/read.html'),
),
contextMenu: ContextMenu(
options: ContextMenuOptions(hideDefaultSystemContextMenuItems: true),
),
onWebViewCreated: (InAppWebViewController controller){
readController.webViewController = controller;
},
onConsoleMessage: (controller, consoleMessage) {
// 接收从 WebView 发送的消息
print("Received message from WebView: ${consoleMessage.message}");
}, },
onLoadStop: (controller, url) { child: Text(
// flutter 主动给 js 传参数 '离线阅读',
Map<String, dynamic> param = { style: TextStyle(
'book_id': readController.bookId, fontSize: 14.w, color: Colours.c3),
'chapter_id': readController.chapterId, ))
'token':UserStore.to.token ],
}; ),
Console.log('param--------------------------------$param'); resizeToAvoidBottomInset: false,
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$param");'); floatingActionButton: readController.show&& !readController.toolModel.selected?GestureDetector(
onTap: (){
readController.setShowChat(true);
readController.noteTitle = '你好你问你你等您第五年对哦in我ID呢哦win地哦为内地那打卡你打困哪';
readController.setChatType(1);
},
child: Image.asset('assets/images/chat.png'),
):null,
// floatingActionButtonAnimator: const NoAnimationFabAnimator(),
floatingActionButtonLocation:MyFloatingActionButtonLocation(),
body: Container(
color: Colors.white,
child: Stack(
children: [
// Container(
// height: 40,
// width: double.infinity,
// color: Colors.lightBlue,
// ),
InAppWebView(
initialUrlRequest: URLRequest(
url: Uri.parse('http://150.158.138.40:9200/read.html'),
),
contextMenu: ContextMenu(
options: ContextMenuOptions(hideDefaultSystemContextMenuItems: true),
),
onWebViewCreated: (InAppWebViewController controller){
readController.webViewController = controller;
},
onConsoleMessage: (controller, consoleMessage) {
// 接收从 WebView 发送的消息
print("Received message from WebView: ${consoleMessage.message}");
},
onLoadStop: (controller, url) {
// flutter 主动给 js 传参数
Map<String, dynamic> param = {
'book_id': readController.bookId,
'chapter_id': readController.chapterId,
'token':UserStore.to.token
};
String str = '${readController.bookId},${readController.chapterId},${UserStore.to.token}';
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
// 添加单击事件 // 添加单击事件
controller.evaluateJavascript(source: ''' controller.evaluateJavascript(source: '''
document.addEventListener('click', function() { document.addEventListener('click', function() {
window.flutter_inappwebview.callHandler('onTap'); window.flutter_inappwebview.callHandler('onTap');
}); });
'''); ''');
// 监听js单击回调 // 监听js单击回调
controller.addJavaScriptHandler(handlerName: 'onTap', callback: (args){ controller.addJavaScriptHandler(handlerName: 'onTap', callback: (args){
readController.setShow(readController.show); readController.setShow(readController.show);
}); });
// 监听笔记回调 // 监听笔记回调
controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){
}); });
// 监听百科回调 // 监听百科回调
controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){
context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args}); context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args});
}); });
// 监听讨论回调 // 监听讨论回调
controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){
readController.setShowChat(true); readController.setShowChat(true);
readController.setChatType(0); readController.setChatType(0);
readController.titleInput.text = '11111'; readController.titleInput.text = '11111';
}); });
}, },
), ),
// AnimatedPositioned( // AnimatedPositioned(
// duration: readController.controller.duration!, // duration: readController.controller.duration!,
// curve: Curves.easeInOut, // curve: Curves.easeInOut,
// top: readController.show ? 0 : -100, // 负值隐藏,0 显示 // top: readController.show ? 0 : -100, // 负值隐藏,0 显示
// left: 0, // left: 0,
// right: 0, // right: 0,
// height: 100, // height: 100,
// child: Container( // child: Container(
// color: Colors.limeAccent, // color: Colors.limeAccent,
// alignment: Alignment.center, // alignment: Alignment.center,
// child: Text('top View'), // child: Text('top View'),
// ), // ),
// ), // ),
Positioned( Positioned(
left: 0,
right: 0,
top: 0,
bottom: 49,
child: _showContent(readController,readController.toolModel)
),
// AnimatedPositioned(
// duration: readController.controller.duration!,
// curve: Curves.easeInOut,
// bottom: readController.show ? 0 : -49 - MediaQuery.of(context).viewInsets.bottom, // 负值隐藏,0 显示
// left: 0,
// right: 0,
// height: 49,
// child: Container(
// color: Colors.limeAccent,
// alignment: Alignment.center,
// child: _createToolBar(readController)
// ),
// ),
/// 底部工具栏布局
Visibility(
visible: readController.show,
child:Positioned(
left: 0,
right: 0,
bottom: 0,
child: SafeArea(
child: Container(
height: 49,
color: Colors.limeAccent,
alignment: Alignment.center,
child: _createToolBar(readController)
),
),
)
),
/// 悬浮按钮点击发起话题布局
Visibility(
visible: readController.showChat,
child: Positioned(
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
bottom:0, bottom: 49,
child: GestureDetector( child: _showContent(readController,readController.toolModel)
onTap: (){ ),
readController.setShowChat(false); // AnimatedPositioned(
readController.clearAllDiscussInput(); // duration: readController.controller.duration!,
// curve: Curves.easeInOut,
}, // bottom: readController.show ? 0 : -49 - MediaQuery.of(context).viewInsets.bottom, // 负值隐藏,0 显示
child: Container( // left: 0,
color: const Color(0xFF000000).withOpacity(0.5), // right: 0,
child: SingleChildScrollView( // height: 49,
reverse: true, // child: Container(
child: Container( // color: Colors.limeAccent,
color: Colors.white, // alignment: Alignment.center,
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), // child: _createToolBar(readController)
// alignment:Alignment.bottomCenter, // ),
child: GestureDetector( // ),
behavior: HitTestBehavior.opaque, /// 底部工具栏布局
onTap: (){}, Visibility(
child: ReadInputDiscuss(controller: readController,) visible: readController.show,
) child:Positioned(
), left: 0,
right: 0,
bottom: 0,
child: SafeArea(
child: Container(
height: 49,
color: Colors.limeAccent,
alignment: Alignment.center,
child: _createToolBar(readController)
), ),
), ),
) )
), ),
), /// 悬浮按钮点击发起话题布局
], Visibility(
visible: readController.showChat,
child: Positioned(
left: 0,
right: 0,
top: 0,
bottom:0,
child: GestureDetector(
onTap: (){
readController.setShowChat(false);
readController.clearAllDiscussInput();
},
child: Container(
color: const Color(0xFF000000).withOpacity(0.5),
child: SingleChildScrollView(
reverse: true,
child: Container(
color: Colors.white,
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
// alignment:Alignment.bottomCenter,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){},
child: ReadInputDiscuss(controller: readController,)
)
),
),
),
)
),
),
],
),
), ),
), ),
), ),
); );
......
...@@ -12,6 +12,7 @@ import 'package:flutter_inapp_purchase/modules.dart'; ...@@ -12,6 +12,7 @@ import 'package:flutter_inapp_purchase/modules.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
import 'package:tobias/tobias.dart'; import 'package:tobias/tobias.dart';
import '../../apis/index.dart'; import '../../apis/index.dart';
......
...@@ -10,53 +10,59 @@ class UserCoinPage extends StatefulWidget { ...@@ -10,53 +10,59 @@ class UserCoinPage extends StatefulWidget {
class _UserCoinPageState extends State<UserCoinPage> { class _UserCoinPageState extends State<UserCoinPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<UserCoinController>( return WillPopScope(
init: UserCoinController(), onWillPop: () async {
builder: (controller) => Scaffold( context.pop(true);
appBar: CustomAppBar( return false;
title: const Text('紫荆币'), },
actions: [ child: GetBuilder<UserCoinController>(
GestureDetector( init: UserCoinController(),
onTap: (){ builder: (controller) => Scaffold(
showModalBottomSheet( appBar: CustomAppBar(
context: context, title: const Text('紫荆币'),
shape: RoundedRectangleBorder( actions: [
borderRadius: BorderRadius.vertical(top: Radius.circular(8.w)), GestureDetector(
onTap: (){
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(8.w)),
),
builder: (BuildContext context) {
return const CoinRechargePage();
},
).then((value) {
controller.getCoin();
});
},
child: Text('充值',style: TextStyle(color: Colours.c3,fontSize: 14.w,height: 1.5,fontWeight: Fonts.medium),)
)
],
),
body: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: Container(
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
), ),
builder: (BuildContext context) { ],
return const CoinRechargePage(); ),
}, child: ListView.builder(
).then((value) { itemBuilder: (BuildContext context, int index){
controller.getCoin(); return BuildCell(model: controller.coins[index],);
}); },
}, itemCount: controller.coins.length,
child: Text('充值',style: TextStyle(color: Colours.c3,fontSize: 14.w,height: 1.5,fontWeight: Fonts.medium),) ),
)
],
),
body: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: Container(
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
],
),
child: ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildCell(model: controller.coins[index],);
},
itemCount: controller.coins.length,
), ),
), ),
), ),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论