Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d71234da78 | ||
|
|
7b38d2c835 | ||
|
|
7350940500 |
@@ -3,6 +3,7 @@ import 'dart:convert';
|
|||||||
import 'dart:html' as html;
|
import 'dart:html' as html;
|
||||||
|
|
||||||
import 'package:js/js.dart';
|
import 'package:js/js.dart';
|
||||||
|
import 'package:web_tools/utils/model/model.dart';
|
||||||
|
|
||||||
// h5交互通知 原生 {type:'enum',data:'所需参数,可无'}
|
// h5交互通知 原生 {type:'enum',data:'所需参数,可无'}
|
||||||
enum ToFlutterAppEnum {
|
enum ToFlutterAppEnum {
|
||||||
@@ -58,6 +59,12 @@ enum ToFlutterAppEnum {
|
|||||||
|
|
||||||
// 定向充值
|
// 定向充值
|
||||||
rechargeItem('rechargeItem'),
|
rechargeItem('rechargeItem'),
|
||||||
|
//专属见面礼
|
||||||
|
shouldInviteCodeGift('InviteCodeGiftPackageDialogPage'),
|
||||||
|
//解析 URL 并跳转
|
||||||
|
showCommandJump('commandJump'),
|
||||||
|
//跳转至网页
|
||||||
|
showToWebViewPage('toWebViewPage'),
|
||||||
|
|
||||||
///通用交互 别往这下面加,👆🏻加
|
///通用交互 别往这下面加,👆🏻加
|
||||||
commonInteraction('commonInteraction'),
|
commonInteraction('commonInteraction'),
|
||||||
@@ -247,14 +254,29 @@ class FlutterBridge {
|
|||||||
void share({
|
void share({
|
||||||
required String activityId, // 活动id
|
required String activityId, // 活动id
|
||||||
required bool needShareReport, // 是否需要上报分享数据
|
required bool needShareReport, // 是否需要上报分享数据
|
||||||
Map<String, dynamic> extraParams = const {}, // 额外的参数 分享上方卡片 数据,参考客户端参数
|
ShareCardModel? shareCardModel, // 分享上方卡片 数据,参考客户端参数
|
||||||
}) =>
|
}) =>
|
||||||
sendToFlutter(ToFlutterAppEnum.share.code, {
|
sendToFlutter(ToFlutterAppEnum.share.code, {
|
||||||
"activityId": activityId,
|
"activityId": activityId,
|
||||||
"shareReportKey": needShareReport ? "ActivityShared" : "",
|
"shareReportKey": needShareReport ? "ActivityShared" : "",
|
||||||
...extraParams
|
...shareCardModel?.toJson() ?? {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//专属见面礼
|
||||||
|
void taskInviteCodeGift() =>
|
||||||
|
sendToFlutter(ToFlutterAppEnum.shouldInviteCodeGift.code, {});
|
||||||
|
|
||||||
|
//解析 URL 并跳转
|
||||||
|
void taskCommandJump({required String scheme, required String activityId}) =>
|
||||||
|
sendToFlutter(ToFlutterAppEnum.showCommandJump.code,
|
||||||
|
{"scheme": scheme, "activityId": activityId});
|
||||||
|
|
||||||
|
//跳转至网页
|
||||||
|
void taskToWebViewPage(
|
||||||
|
{required String linkUrl, required String activityId}) =>
|
||||||
|
sendToFlutter(ToFlutterAppEnum.showToWebViewPage.code,
|
||||||
|
{"linkUrl": linkUrl, "activityId": activityId});
|
||||||
|
|
||||||
void checkStartBroadcaster() =>
|
void checkStartBroadcaster() =>
|
||||||
sendToFlutter(ToFlutterAppEnum.checkStartBroadcaster.code, {});
|
sendToFlutter(ToFlutterAppEnum.checkStartBroadcaster.code, {});
|
||||||
|
|
||||||
|
|||||||
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,4 +1,5 @@
|
|||||||
library;
|
library;
|
||||||
|
|
||||||
export 'package:web_tools/utils/app_bridge.dart';
|
export 'package:web_tools/utils/app_bridge.dart';
|
||||||
export 'package:web_tools/utils/config.dart';
|
export 'package:web_tools/utils/config.dart';
|
||||||
|
export 'package:web_tools/utils/model/model.dart';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: web_tools
|
name: web_tools
|
||||||
description: "A new Flutter package project."
|
description: "A new Flutter package project."
|
||||||
version: 0.0.3
|
version: 0.0.5
|
||||||
publish_to: 'none' # 不发布到pub.dev
|
publish_to: 'none' # 不发布到pub.dev
|
||||||
homepage: https://gitea.sdws.shop/xim/web_tools.git
|
homepage: https://gitea.sdws.shop/xim/web_tools.git
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user