From c4a42c7533636b5ca4076aff0eeff35f3372121d Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Wed, 21 Oct 2020 09:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0ios=E7=99=BE=E5=B7=9D?= =?UTF-8?q?=E5=B0=8F=E6=8A=8A=E6=89=8B=E7=82=B9=E5=87=BB=E6=97=A0=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intellect_search_goods_dialog.dart | 33 +++++++++++-------- .../footer/goods_details_footer_widget.dart | 10 ++++-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart index c26d72d..85c969d 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart @@ -1,19 +1,17 @@ import 'dart:convert'; +import 'dart:io'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_alibc/alibc_const_key.dart'; +import 'package:flutter_alibc/alibc_model.dart'; +import 'package:flutter_alibc/flutter_alibc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:provider/provider.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/has_goods_dialog_style_model.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; -import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/model/wallet_detail_model.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; -import 'package:provider/provider.dart'; -import 'package:zhiying_comm/zhiying_comm.dart'; -import 'package:flutter_alibc/flutter_alibc.dart'; -import 'package:flutter_alibc/alibc_model.dart'; -import 'package:flutter_alibc/alibc_const_key.dart'; class IntellectSearchGoodsDialog extends StatefulWidget { final IntellectDialogDataModel model; @@ -244,8 +242,8 @@ class _IntellectSearchGoodsDialogState ), Text( (num.tryParse(widget?.model?.price ?? "0") - - num.tryParse( - widget?.model?.couponPrice ?? "0")).toString() ?? + num.tryParse(widget?.model?.couponPrice ?? "0")) + .toString() ?? "", style: TextStyle( fontSize: 32.sp, @@ -286,8 +284,7 @@ class _IntellectSearchGoodsDialogState " ¥" + ((num.tryParse(widget?.model?.couponPrice ?? "0") ?? 0) + - num.tryParse( - widget?.model?.commission ?? '0')) + num.tryParse(widget?.model?.commission ?? '0')) .toString(), style: TextStyle( color: HexColor.fromHex( @@ -357,10 +354,18 @@ class _IntellectSearchGoodsDialogState print("平台" + widget?.model?.provider ?? ""); print("链接" + widget?.model?.couponUrl ?? ""); if (widget?.model?.provider == 'taobao') { - TradeResult result = await FlutterAlibc.openByUrl( + TradeResult result; + if (Platform.isAndroid) { + result = await FlutterAlibc.openByUrl( + url: widget?.model?.couponUrl ?? "", + openType: AlibcOpenType.AlibcOpenTypeNative, + backUrl: "alisdk://"); + } else if (Platform.isIOS) { + result = await FlutterAlibc.openByUrl( url: widget?.model?.couponUrl ?? "", openType: AlibcOpenType.AlibcOpenTypeNative, - backUrl: "alisdk://"); + ); + } Logger.debug('${result.errorCode} ${result.errorMessage} '); print("链接" + widget?.model?.couponUrl ?? ""); print("错误码" + result.errorCode); diff --git a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart index 45c2a22..508a525 100644 --- a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart +++ b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/cupertino.dart'; @@ -126,9 +127,12 @@ class _GooddsDetailsFooterContainerState TaobaoAuth.auth(context); return; } - - TradeResult result = - await FlutterAlibc.openByUrl(url: url, backUrl: "alisdk://"); + TradeResult result; + if (Platform.isAndroid) { + result = await FlutterAlibc.openByUrl(url: url, backUrl: "alisdk://"); + } else if (Platform.isIOS) { + result = await FlutterAlibc.openByUrl(url: url); + } Logger.debug('${result.errorCode} ${result.errorMessage} '); } else { RouterUtil.openWebview(url, context);