From 7350940500844dd7435ec56d1b979ed95ddfac67 Mon Sep 17 00:00:00 2001 From: zhugy781 Date: Thu, 25 Dec 2025 14:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=8D=A1=E7=89=87=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/app_bridge.dart | 5 +++-- lib/utils/model/model.dart | 30 ++++++++++++++++++++++++++++++ pubspec.yaml | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 lib/utils/model/model.dart diff --git a/lib/utils/app_bridge.dart b/lib/utils/app_bridge.dart index 774ee9e..0dcb420 100644 --- a/lib/utils/app_bridge.dart +++ b/lib/utils/app_bridge.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'dart:html' as html; import 'package:js/js.dart'; +import 'package:web_tools/utils/model/model.dart'; // h5交互通知 原生 {type:'enum',data:'所需参数,可无'} enum ToFlutterAppEnum { @@ -247,12 +248,12 @@ class FlutterBridge { void share({ required String activityId, // 活动id required bool needShareReport, // 是否需要上报分享数据 - Map extraParams = const {}, // 额外的参数 分享上方卡片 数据,参考客户端参数 + ShareCardModel? shareCardModel, // 分享上方卡片 数据,参考客户端参数 }) => sendToFlutter(ToFlutterAppEnum.share.code, { "activityId": activityId, "shareReportKey": needShareReport ? "ActivityShared" : "", - ...extraParams + ...shareCardModel?.toJson() ?? {}, }); void checkStartBroadcaster() => diff --git a/lib/utils/model/model.dart b/lib/utils/model/model.dart new file mode 100644 index 0000000..c79a707 --- /dev/null +++ b/lib/utils/model/model.dart @@ -0,0 +1,30 @@ +class ShareCardModel { + /** + * 分享弹框 上方卡片模型 + * */ + + final String activityIcon; //卡片中间的icon + final String activityDesc; // 卡片描述 + final String themeTextColor; //主题色 + final String activityBgIcon; //卡片背景icon + final String userNameSub; //用户名 下方文案 + final String qrImageLink; //二维码链接 + + ShareCardModel({ + required this.activityIcon, + required this.activityDesc, + this.qrImageLink = "", // 客户端已有能力获取,无需网页端传 + this.userNameSub = "", + this.themeTextColor = "#FFE499", + this.activityBgIcon = "app/img/local/christmas_share_bg_th.webp", + }); + + Map toJson() => { + "activityIcon": activityIcon, + "activityDesc": activityDesc, + "themeTextColor": themeTextColor, + "activityBgIcon": activityBgIcon, + "userNameSub": userNameSub, + "activityUrl": qrImageLink, + }; +} diff --git a/pubspec.yaml b/pubspec.yaml index d95ced3..9da4ea8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: web_tools description: "A new Flutter package project." -version: 0.0.3 +version: 0.0.4 publish_to: 'none' # 不发布到pub.dev homepage: https://gitea.sdws.shop/xim/web_tools.git