6 Commits
0.0.2 ... 0.0.4

Author SHA1 Message Date
zhugy781
7b38d2c835 添加 export 2025-12-25 14:58:34 +08:00
zhugy781
7350940500 分享卡片模型定义 2025-12-25 14:37:50 +08:00
zhugy781
54a522b3f9 添加说明 2025-12-23 17:46:10 +08:00
zhugy781
ae48890a1c 修改版本 2025-12-23 16:28:28 +08:00
zhugy781
ee927acf63 创建类 2025-12-23 16:05:17 +08:00
zhugy781
c1ef4d3b26 添加下载地址 2025-12-23 15:17:42 +08:00
6 changed files with 56 additions and 10 deletions

View File

@@ -1,3 +1,8 @@
## 0.0.1 ## 0.0.1
* Initial release
* TODO: Describe initial release. ## 0.0.2
* 优化通信
## 0.0.3
* 添加iOS/Android下载地址

View File

@@ -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 {
@@ -73,6 +74,7 @@ enum ToFlutterAppEnum {
); );
} }
} }
//通用交互 //通用交互
enum WebInteractionType { enum WebInteractionType {
taskKeyWatchLive('TaskKeyWatchLive'), // 观看直播 taskKeyWatchLive('TaskKeyWatchLive'), // 观看直播
@@ -101,14 +103,14 @@ enum WebInteractionType {
; ;
const WebInteractionType( const WebInteractionType(
this.code, this.code,
); );
final String code; //服务端 key final String code; //服务端 key
factory WebInteractionType.fromCode(String? code) => values.firstWhere( factory WebInteractionType.fromCode(String? code) => values.firstWhere(
(element) => element.code == code, (element) => element.code == code,
orElse: () => WebInteractionType.unknown, orElse: () => WebInteractionType.unknown,
); );
} }
// 原生交互通知 h5 {type:'enum',data:'所需参数 '} // 原生交互通知 h5 {type:'enum',data:'所需参数 '}
@@ -242,15 +244,16 @@ class FlutterBridge {
}); });
void checkGameState(String gameCode) => sendToFlutter( void checkGameState(String gameCode) => sendToFlutter(
ToFlutterAppEnum.checkGameState.code, {'gameCode': gameCode}); ToFlutterAppEnum.checkGameState.code, {'gameCode': gameCode});
void share({ void share({
required String activityId, 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 checkStartBroadcaster() => void checkStartBroadcaster() =>

6
lib/utils/config.dart Normal file
View File

@@ -0,0 +1,6 @@
class WebConfig {
static const String iOSDownloadUrl =
"https://apps.apple.com/sg/app/sugarvibe/id6737873037";
static const String androidDownloadUrl =
"https://play.google.com/store/apps/details?id=com.sugarvibe.chat";
}

View 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,
};
}

View File

@@ -1,3 +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/model/model.dart';

View File

@@ -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.1 version: 0.0.4
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