系统通知跳转 android 各种协议 地址
This commit is contained in:
parent
7bf8a26e6e
commit
40a0eea463
@ -10,6 +10,7 @@ import 'package:get/get.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
|
||||
import '../../home/logic.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class Sys_notify_listPage extends StatelessWidget {
|
||||
@ -102,9 +103,39 @@ class Sys_notify_listPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
widgets.add(GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.WebViewActivity,
|
||||
arguments: jsonDecode(data.note!));
|
||||
onTap: () async{
|
||||
switch(data.scene){
|
||||
case 'url':
|
||||
Map<String, dynamic> bean = json.decode(data.note!);
|
||||
String url = bean['url'];
|
||||
|
||||
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "",
|
||||
"url": url
|
||||
});
|
||||
// Get.toNamed(AppRoutes.WebViewActivity,
|
||||
// arguments: {"url":jsonDecode(url)} );
|
||||
break;
|
||||
case "my_main":
|
||||
final homeLogic = Get.put(HomeLogic());
|
||||
homeLogic.pageController.jumpToPage(2);
|
||||
homeLogic.updateIndex(2);
|
||||
|
||||
Get.back();
|
||||
|
||||
break;
|
||||
case "user_home":
|
||||
Get.toNamed(AppRoutes.UserInfoActivity);
|
||||
break;
|
||||
case "none":
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 8.sp, left: 16.sp),
|
||||
|
||||
@ -5,6 +5,6 @@ import 'state.dart';
|
||||
class WebviewLogic extends GetxController {
|
||||
final WebviewState state = WebviewState();
|
||||
|
||||
final title = Get.arguments['title'] ?? '';
|
||||
var title = Get.arguments['title'] ?? '';
|
||||
|
||||
}
|
||||
|
||||
@ -15,11 +15,14 @@ class _WebViewContainerState extends State<WebviewPage> {
|
||||
// Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"百度","url":"https://www.baidu.com"});
|
||||
|
||||
_WebViewContainerState();
|
||||
var controller;
|
||||
|
||||
final logic = Get.find<WebviewLogic>();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final url = Get.arguments['url'];
|
||||
var controller = WebViewController()
|
||||
|
||||
controller = WebViewController()
|
||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
..setBackgroundColor(Colors.white)
|
||||
..setNavigationDelegate(
|
||||
@ -28,7 +31,19 @@ class _WebViewContainerState extends State<WebviewPage> {
|
||||
// Update loading bar.
|
||||
},
|
||||
onPageStarted: (String url) {},
|
||||
onPageFinished: (String url) {},
|
||||
onPageFinished: (String url) async {
|
||||
if(logic.title==''){
|
||||
String title = await controller.getTitle(); // 获取网页标题
|
||||
if (title.length > 8) {
|
||||
title = title.substring(0, 8) + '...';
|
||||
}
|
||||
logic.title = title;
|
||||
logic.update();
|
||||
print('Page title: $title'); // 打印网页标题
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
onWebResourceError: (WebResourceError error) {},
|
||||
onNavigationRequest: (NavigationRequest request) {
|
||||
if (request.url.startsWith('')) {
|
||||
|
||||
@ -276,21 +276,7 @@ Future<String> getLibraryDirectoryPath() async {
|
||||
return directory.path;
|
||||
}
|
||||
|
||||
//跳转到用户协议
|
||||
void navigateToUserAgreement() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "用户协议",
|
||||
"url":"https://docs.qq.com/doc/DZVV1SkttZGlPUW1H"
|
||||
});
|
||||
}
|
||||
|
||||
//跳转到隐私政策
|
||||
void navigateToPrivacyPolicy() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "隐私协议",
|
||||
"url": "https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1"
|
||||
});
|
||||
}
|
||||
|
||||
//跳转到文明公约
|
||||
void navigateToCodeOfConduct() {
|
||||
@ -300,13 +286,26 @@ void navigateToCodeOfConduct() {
|
||||
});
|
||||
}
|
||||
|
||||
//跳转到用户协议
|
||||
void navigateToUserAgreement() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "用户协议",
|
||||
"url": Platform.isIOS?"https://docs.qq.com/doc/DZVV1SkttZGlPUW1H":"https://iquanpai.com/app-h5/4_163.html"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//跳转到隐私政策
|
||||
void navigateToPrivacyPolicy() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "隐私协议",
|
||||
"url": Platform.isIOS?"https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1":"https://iquanpai.com/app-h5/4_164.html"
|
||||
});
|
||||
}
|
||||
//发布内容规范
|
||||
void navigateToContentGuidelines() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "发布内容规范",
|
||||
"url": "https://docs.qq.com/doc/DZVhLamZDQnJ0eHds"
|
||||
"url": Platform.isIOS?"https://docs.qq.com/doc/DZVhLamZDQnJ0eHds":"https://iquanpai.com/app-h5/4_165.html"
|
||||
});
|
||||
}
|
||||
|
||||
@ -314,9 +313,8 @@ void navigateToContentGuidelines() {
|
||||
void navigateToPartnerAgreement() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "合伙人协议",
|
||||
"url": "https://docs.qq.com/doc/DZUpwWFdNcGlsYld4"
|
||||
"url": Platform.isIOS?"https://docs.qq.com/doc/DZUpwWFdNcGlsYld4":"https://iquanpai.com/app-h5/4_166.html"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user