杨华轩 4 年之前
父節點
當前提交
a1d25d05fe
共有 2 個檔案被更改,包括 21 行新增4 行删除
  1. +18
    -1
      lib/pages/webview/base_webview.dart
  2. +3
    -3
      lib/widgets/goods_details/coupon/counpon_widget.dart

+ 18
- 1
lib/pages/webview/base_webview.dart 查看文件

@@ -1,5 +1,11 @@
import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/launch_page/launch_page.dart';
import 'package:zhiying_comm/util/log/let_log.dart';
import 'package:zhiying_comm/util/empty_util.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';

class BaseWebview extends StatefulWidget {
@@ -33,7 +39,18 @@ class _BaseWebviewState extends State<BaseWebview> {
onWebViewCreated: (WebViewController webViewController) {
_webViewController = webViewController;
},
navigationDelegate: (NavigationRequest request) {
navigationDelegate: (NavigationRequest request) async{
// 解决Android的拼多多webview 转发的问题
if(Platform.isAndroid){
String url = request?.url?.toString();
if(!EmptyUtil.isEmpty(url) && !url.startsWith('https://') && !url.startsWith('http://')){
Logger.log('navigation url = $url');
// if(await canLaunch(url)){
// await launch(url);
// }
return NavigationDecision.prevent;
}
}
return NavigationDecision.navigate;
},
onPageStarted: (String url) {


+ 3
- 3
lib/widgets/goods_details/coupon/counpon_widget.dart 查看文件

@@ -58,7 +58,7 @@ class _CounponWidgetContainerState extends State<CounponWidgetContainer> {

/// 点击领取
void _onJump(CounponModel model) async{
TurnChainUtil.openReceiveCoupon(context, _user, model.provider, model.toJson());
TurnChainUtil.openReceiveCoupon(context, _user, model.provider, model?.convertArgs?.toJson());
}

@override
@@ -73,7 +73,7 @@ class _CounponWidgetContainerState extends State<CounponWidgetContainer> {
},
builder: (context, state) {
if (state is CounponLoadedState) {
return _getMainWdiget(state.model);
return _getMainWidget(state.model);
}
return CounponSkeleton();
},
@@ -81,7 +81,7 @@ class _CounponWidgetContainerState extends State<CounponWidgetContainer> {
}

/// 主视图
Widget _getMainWdiget(CounponModel model) {
Widget _getMainWidget(CounponModel model) {
return Visibility(
visible: !EmptyUtil.isEmpty(model?.coupon_price),
child: GestureDetector(


Loading…
取消
儲存