提交 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
// 1免费 0 不免费
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 {
// 没有购买
......@@ -159,11 +162,18 @@ class _BookDetailPageState extends State<BookDetailPage> with SingleTickerProvid
}
}
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{
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 {
//CustomImage.network(item.pic??'',)
child: GestureDetector(
onTap: (){
if (onTap !=null) onTap!(item);
if (onTap !=null && item.url!.isNotEmpty) onTap!(item);
},
child: ClipRRect(
borderRadius: BorderRadius.circular(8.w),
......
......@@ -25,185 +25,191 @@ class _ReadPageState extends State<ReadPage> {
}
@override
Widget build(BuildContext context) {
return GetBuilder<ReadController>(
init: ReadController(bookId: widget.bookId, chapterId: widget.chapterId,chapterName: widget.chapterName,bookDetailModel: widget.bookDetailModel),
builder: (readController) => Scaffold(
appBar: CustomAppBar(
title: Text(readController.chapterName),
centerTitle: false,
actions: [
GestureDetector(
onTap: () {
readController.getBookDown();
},
child: Text(
'离线阅读',
style: TextStyle(
fontSize: 14.w, color: Colours.c3),
))
],
),
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}");
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<ReadController>(
init: ReadController(bookId: widget.bookId, chapterId: widget.chapterId,chapterName: widget.chapterName,bookDetailModel: widget.bookDetailModel),
builder: (readController) => Scaffold(
appBar: CustomAppBar(
title: Text(readController.chapterName),
centerTitle: false,
actions: [
GestureDetector(
onTap: () {
readController.getBookDown();
},
onLoadStop: (controller, url) {
// flutter 主动给 js 传参数
Map<String, dynamic> param = {
'book_id': readController.bookId,
'chapter_id': readController.chapterId,
'token':UserStore.to.token
};
Console.log('param--------------------------------$param');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$param");');
child: Text(
'离线阅读',
style: TextStyle(
fontSize: 14.w, color: Colours.c3),
))
],
),
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) {
// 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: '''
document.addEventListener('click', function() {
window.flutter_inappwebview.callHandler('onTap');
});
''');
// 添加单击事件
controller.evaluateJavascript(source: '''
document.addEventListener('click', function() {
window.flutter_inappwebview.callHandler('onTap');
});
''');
// 监听js单击回调
controller.addJavaScriptHandler(handlerName: 'onTap', callback: (args){
readController.setShow(readController.show);
// 监听js单击回调
controller.addJavaScriptHandler(handlerName: 'onTap', callback: (args){
readController.setShow(readController.show);
});
});
// 监听笔记回调
controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){
});
// 监听笔记回调
controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){
});
// 监听百科回调
controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){
context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args});
});
// 监听百科回调
controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){
context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args});
});
// 监听讨论回调
controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){
readController.setShowChat(true);
readController.setChatType(0);
readController.titleInput.text = '11111';
});
// 监听讨论回调
controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){
readController.setShowChat(true);
readController.setChatType(0);
readController.titleInput.text = '11111';
});
},
),
// AnimatedPositioned(
// duration: readController.controller.duration!,
// curve: Curves.easeInOut,
// top: readController.show ? 0 : -100, // 负值隐藏,0 显示
// left: 0,
// right: 0,
// height: 100,
// child: Container(
// color: Colors.limeAccent,
// alignment: Alignment.center,
// child: Text('top View'),
// ),
// ),
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(
},
),
// AnimatedPositioned(
// duration: readController.controller.duration!,
// curve: Curves.easeInOut,
// top: readController.show ? 0 : -100, // 负值隐藏,0 显示
// left: 0,
// right: 0,
// height: 100,
// child: Container(
// color: Colors.limeAccent,
// alignment: Alignment.center,
// child: Text('top View'),
// ),
// ),
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,)
)
),
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,
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';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
import 'package:tobias/tobias.dart';
import '../../apis/index.dart';
......
......@@ -10,53 +10,59 @@ class UserCoinPage extends StatefulWidget {
class _UserCoinPageState extends State<UserCoinPage> {
@override
Widget build(BuildContext context) {
return GetBuilder<UserCoinController>(
init: UserCoinController(),
builder: (controller) => Scaffold(
appBar: CustomAppBar(
title: const Text('紫荆币'),
actions: [
GestureDetector(
onTap: (){
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(8.w)),
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserCoinController>(
init: UserCoinController(),
builder: (controller) => Scaffold(
appBar: CustomAppBar(
title: const Text('紫荆币'),
actions: [
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();
},
).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,
),
],
),
child: ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildCell(model: controller.coins[index],);
},
itemCount: controller.coins.length,
],
),
child: ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildCell(model: controller.coins[index],);
},
itemCount: controller.coins.length,
),
),
),
),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论