分享卡片模型定义
This commit is contained in:
@@ -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<String, dynamic> extraParams = const {}, // 额外的参数 分享上方卡片 数据,参考客户端参数
|
||||
ShareCardModel? shareCardModel, // 分享上方卡片 数据,参考客户端参数
|
||||
}) =>
|
||||
sendToFlutter(ToFlutterAppEnum.share.code, {
|
||||
"activityId": activityId,
|
||||
"shareReportKey": needShareReport ? "ActivityShared" : "",
|
||||
...extraParams
|
||||
...shareCardModel?.toJson() ?? {},
|
||||
});
|
||||
|
||||
void checkStartBroadcaster() =>
|
||||
|
||||
30
lib/utils/model/model.dart
Normal file
30
lib/utils/model/model.dart
Normal file
@@ -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<String, dynamic> toJson() => {
|
||||
"activityIcon": activityIcon,
|
||||
"activityDesc": activityDesc,
|
||||
"themeTextColor": themeTextColor,
|
||||
"activityBgIcon": activityBgIcon,
|
||||
"userNameSub": userNameSub,
|
||||
"activityUrl": qrImageLink,
|
||||
};
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user