杨华轩 vor 4 Jahren
Ursprung
Commit
a1d25d05fe
2 geänderte Dateien mit 21 neuen und 4 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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(


Laden…
Abbrechen
Speichern