Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
2
star_lock/.docker/.env.example
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter"
|
||||||
|
PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"
|
||||||
1
star_lock/.docker/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
28
star_lock/.docker/README.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# docker持续部署
|
||||||
|
构建镜像来自:https://github.com/MobileDevOps/flutter-sdk-image/
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
1. 复制.env文件,并编辑其中的代理设置
|
||||||
|
```bash
|
||||||
|
cp .docker/.env.example .docker/.env
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 构建命令
|
||||||
|
```bash
|
||||||
|
cd <path-to-this-repo>
|
||||||
|
|
||||||
|
# 构建sky版本APK
|
||||||
|
docker run --env-file .docker/.env --rm -it -v .:/home/mobiledevops/app mobiledevops/flutter-sdk-image:3.16.4 \
|
||||||
|
flutter build apk --release --flavor sky -t lib/main_sky_full.dart
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 构建完成后,APK文件在build/app/outputs/flutter-apk目录下
|
||||||
|
|
||||||
|
|
||||||
|
## 排除故障
|
||||||
|
测试谷歌连接
|
||||||
|
```bash
|
||||||
|
# flutter以及maven 下载地址是否正常
|
||||||
|
curl -i https://storage.googleapis.com/flutter_infra_release/
|
||||||
|
```
|
||||||
2
star_lock/.run/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# IDE启动文件
|
||||||
|
使用方法:将.run 文件夹下的文件复制到 .idea/runConfigurations文件夹,重新打开项目即可
|
||||||
7
star_lock/.run/main_local_dart.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="main_local.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
||||||
|
<option name="buildFlavor" value="local"/>
|
||||||
|
<option name="filePath" value="$PROJECT_DIR$/lib/main_local.dart"/>
|
||||||
|
<method v="2"/>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="main_sky.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
<configuration default="false" name="main_sky_full.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
||||||
<option name="buildFlavor" value="sky"/>
|
<option name="buildFlavor" value="sky"/>
|
||||||
<option name="filePath" value="$PROJECT_DIR$/lib/main_sky.dart"/>
|
<option name="filePath" value="$PROJECT_DIR$/lib/main_sky_full.dart"/>
|
||||||
<method v="2"/>
|
<method v="2"/>
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
@ -66,7 +66,7 @@ keytool -list -v -keystore android/app/sky.jks
|
|||||||
|
|
||||||
## 编译
|
## 编译
|
||||||
```bash
|
```bash
|
||||||
flutter build apk --split-per-abi --release --flavor sky -t lib/main_sky.dart
|
flutter build apk --release --flavor sky -t lib/main_sky_full.dart
|
||||||
```
|
```
|
||||||
编译后的包:
|
编译后的包:
|
||||||
通用:build/app/outputs/apk/sky/release/app-sky-universal-release.apk
|
通用:build/app/outputs/apk/sky/release/app-sky-universal-release.apk
|
||||||
|
|||||||
@ -36,8 +36,8 @@ android {
|
|||||||
keyAlias = 'starlock'
|
keyAlias = 'starlock'
|
||||||
keyPassword '123456'
|
keyPassword '123456'
|
||||||
}
|
}
|
||||||
// 下面的xie、pre、sky、xhj 都是自定义变量,自身不起任何作用,而是看哪里引用了它们
|
// 下面的local、pre、sky、xhj 都是自定义变量,自身不起任何作用,而是看哪里引用了它们
|
||||||
xie {
|
local {
|
||||||
storeFile file("starlock.keystore")
|
storeFile file("starlock.keystore")
|
||||||
storePassword '123456'
|
storePassword '123456'
|
||||||
keyAlias = 'starlock'
|
keyAlias = 'starlock'
|
||||||
@ -68,12 +68,12 @@ android {
|
|||||||
flavorDimensions "flavor-type"
|
flavorDimensions "flavor-type"
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
xie {
|
local {
|
||||||
dimension "flavor-type"
|
dimension "flavor-type"
|
||||||
applicationId "com.starlock.lock.xie"
|
applicationId "com.starlock.lock.local"
|
||||||
signingConfig signingConfigs.pre
|
signingConfig signingConfigs.pre
|
||||||
resValue "string", "app_name", "星锁-xie"
|
resValue "string", "app_name", "星锁-local"
|
||||||
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.xie"
|
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.local"
|
||||||
}
|
}
|
||||||
dev {
|
dev {
|
||||||
dimension "flavor-type"
|
dimension "flavor-type"
|
||||||
@ -182,7 +182,7 @@ android {
|
|||||||
// 真实的解决办法
|
// 真实的解决办法
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
shrinkResources false
|
shrinkResources false
|
||||||
productFlavors.xie.signingConfig signingConfigs.pre
|
productFlavors.local.signingConfig signingConfigs.pre
|
||||||
productFlavors.dev.signingConfig signingConfigs.pre
|
productFlavors.dev.signingConfig signingConfigs.pre
|
||||||
productFlavors.pre.signingConfig signingConfigs.pre
|
productFlavors.pre.signingConfig signingConfigs.pre
|
||||||
productFlavors.sky.signingConfig signingConfigs.sky
|
productFlavors.sky.signingConfig signingConfigs.sky
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@ -53,16 +53,16 @@ app:
|
|||||||
flavorDimensions: "flavor-type"
|
flavorDimensions: "flavor-type"
|
||||||
|
|
||||||
flavors:
|
flavors:
|
||||||
xie:
|
local:
|
||||||
app:
|
app:
|
||||||
name: "星锁-xie"
|
name: "星锁-local"
|
||||||
icon: "assets/icon/dev.png"
|
icon: "assets/icon/dev.png"
|
||||||
android:
|
android:
|
||||||
applicationId: "com.starlock.lock.xie"
|
applicationId: "com.starlock.lock.local"
|
||||||
customConfig:
|
customConfig:
|
||||||
signingConfig: signingConfigs.pre
|
signingConfig: signingConfigs.pre
|
||||||
ios:
|
ios:
|
||||||
bundleId: "com.starlock.lock.xie"
|
bundleId: "com.starlock.lock.local"
|
||||||
dev:
|
dev:
|
||||||
app:
|
app:
|
||||||
name: "星锁-dev"
|
name: "星锁-dev"
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>aps-environment</key>
|
<key>aps-environment</key>
|
||||||
<string>development</string>
|
<string>development</string>
|
||||||
|
<key>com.apple.developer.associated-domains</key>
|
||||||
|
<array/>
|
||||||
<key>com.apple.external-accessory.wireless-configuration</key>
|
<key>com.apple.external-accessory.wireless-configuration</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
enum Flavor {
|
enum Flavor {
|
||||||
xie,
|
local,
|
||||||
dev,
|
dev,
|
||||||
pre,
|
pre,
|
||||||
sky,
|
sky,
|
||||||
@ -11,13 +11,16 @@ enum Flavor {
|
|||||||
class StarLockAMapKey {
|
class StarLockAMapKey {
|
||||||
//iOS平台的key
|
//iOS平台的key
|
||||||
final String iosKey;
|
final String iosKey;
|
||||||
|
|
||||||
//Android平台的key
|
//Android平台的key
|
||||||
final String androidKey;
|
final String androidKey;
|
||||||
|
|
||||||
const StarLockAMapKey({required this.iosKey, required this.androidKey});
|
const StarLockAMapKey({required this.iosKey, required this.androidKey});
|
||||||
}
|
}
|
||||||
|
|
||||||
class F {
|
class F {
|
||||||
static Flavor? appFlavor;
|
static Flavor? appFlavor;
|
||||||
|
|
||||||
// 是否为精简模式(在一些应用商店场景下,需要精简掉一些功能)
|
// 是否为精简模式(在一些应用商店场景下,需要精简掉一些功能)
|
||||||
static bool isLite = false;
|
static bool isLite = false;
|
||||||
|
|
||||||
@ -25,8 +28,8 @@ class F {
|
|||||||
|
|
||||||
static String get title {
|
static String get title {
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.xie:
|
case Flavor.local:
|
||||||
return '星锁-xie';
|
return '星锁-local';
|
||||||
case Flavor.dev:
|
case Flavor.dev:
|
||||||
return '星锁-dev';
|
return '星锁-dev';
|
||||||
case Flavor.pre:
|
case Flavor.pre:
|
||||||
@ -42,8 +45,8 @@ class F {
|
|||||||
|
|
||||||
static String get navTitle {
|
static String get navTitle {
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.xie:
|
case Flavor.local:
|
||||||
return '${"starLock".tr}-xie';
|
return '${"starLock".tr}-local';
|
||||||
case Flavor.dev:
|
case Flavor.dev:
|
||||||
return '${"starLock".tr}-dev';
|
return '${"starLock".tr}-dev';
|
||||||
case Flavor.pre:
|
case Flavor.pre:
|
||||||
@ -59,10 +62,8 @@ class F {
|
|||||||
|
|
||||||
static String get apiPrefix {
|
static String get apiPrefix {
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
// case Flavor.ge:
|
case Flavor.local:
|
||||||
// return 'https://ge.lock.star-lock.cn';
|
return 'https://ge.lock.star-lock.cn';
|
||||||
case Flavor.xie:
|
|
||||||
return 'http://192.168.1.15:8022';
|
|
||||||
case Flavor.dev:
|
case Flavor.dev:
|
||||||
return 'https://dev.lock.star-lock.cn';
|
return 'https://dev.lock.star-lock.cn';
|
||||||
case Flavor.pre:
|
case Flavor.pre:
|
||||||
@ -77,22 +78,20 @@ class F {
|
|||||||
throw Exception('flavor[$name] apiPrefix not found');
|
throw Exception('flavor[$name] apiPrefix not found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StarLockAMapKey
|
// StarLockAMapKey
|
||||||
static StarLockAMapKey get aMapKey {
|
static StarLockAMapKey get aMapKey {
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.xie:
|
case Flavor.local:
|
||||||
case Flavor.dev:
|
case Flavor.dev:
|
||||||
return const StarLockAMapKey(
|
return const StarLockAMapKey(
|
||||||
androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe',
|
androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe', iosKey: 'bd4496e6598ef49796e3a80715035b4d');
|
||||||
iosKey: 'bd4496e6598ef49796e3a80715035b4d');
|
|
||||||
case Flavor.pre:
|
case Flavor.pre:
|
||||||
return const StarLockAMapKey(
|
return const StarLockAMapKey(
|
||||||
androidKey: '11d49b3f4fc09c04a02bbb7500925ba2',
|
androidKey: '11d49b3f4fc09c04a02bbb7500925ba2', iosKey: '883a3355d2d77c2fdc2667030dc97ffe');
|
||||||
iosKey: '883a3355d2d77c2fdc2667030dc97ffe');
|
|
||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
return const StarLockAMapKey(
|
return const StarLockAMapKey(
|
||||||
androidKey: 'fb0d2a3e4208b36452cf636aa025a24f',
|
androidKey: 'fb0d2a3e4208b36452cf636aa025a24f', iosKey: '86ca725a12a629c280e116a317aaba19');
|
||||||
iosKey: '86ca725a12a629c280e116a317aaba19');
|
|
||||||
// case Flavor.xhj:
|
// case Flavor.xhj:
|
||||||
// return const StarLockAMapKey(
|
// return const StarLockAMapKey(
|
||||||
// androidKey: 'todo',
|
// androidKey: 'todo',
|
||||||
@ -101,5 +100,4 @@ class F {
|
|||||||
throw Exception('flavor[$name] aMapKey not found');
|
throw Exception('flavor[$name] aMapKey not found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,8 +12,7 @@ class SendEmailNotificationPage extends StatefulWidget {
|
|||||||
const SendEmailNotificationPage({Key? key}) : super(key: key);
|
const SendEmailNotificationPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SendEmailNotificationPage> createState() =>
|
State<SendEmailNotificationPage> createState() => _SendEmailNotificationPageState();
|
||||||
_SendEmailNotificationPageState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||||
@ -21,15 +20,12 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
_emailController.text =
|
_emailController.text = "亲爱的用户 \n\n你收到电子钥匙,请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
|
||||||
"亲爱的用户 \n\n你收到电子钥匙,请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(barTitle: "邮件通知", haveBack: true, backgroundColor: AppColors.mainColor),
|
||||||
barTitle: "邮件通知",
|
body: SingleChildScrollView(
|
||||||
haveBack: true,
|
child: Column(
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||||
@ -42,16 +38,11 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
),
|
),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(leftTitel: "模板", rightTitle: "默认模板", isHaveDirection: true, isHaveLine: true),
|
||||||
leftTitel: "模板",
|
|
||||||
rightTitle: "默认模板",
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveLine: true),
|
|
||||||
Container(
|
Container(
|
||||||
height: 360.h,
|
height: 360.h,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
||||||
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
|
||||||
child: TextField(
|
child: TextField(
|
||||||
maxLines: 8,
|
maxLines: 8,
|
||||||
maxLength: 1000,
|
maxLength: 1000,
|
||||||
@ -103,6 +94,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|||||||
onClick: () {}),
|
onClick: () {}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
|
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
|
||||||
void _initRefreshLockDetailInfoDataEventAction() {
|
void _initRefreshLockDetailInfoDataEventAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_lockRefreshLockDetailInfoDataEvent = eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
_lockRefreshLockDetailInfoDataEvent =
|
||||||
|
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -110,12 +111,14 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
BlueManage().connectDeviceName =
|
BlueManage().connectDeviceName =
|
||||||
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
|
|
||||||
List<int> publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
List<int> publicKeyData =
|
||||||
|
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
||||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
var saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 私钥
|
// 私钥
|
||||||
List<int> privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
List<int> privateKeyData =
|
||||||
|
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
||||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||||
|
|
||||||
@ -138,9 +141,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Visibility(
|
Visibility(
|
||||||
visible:
|
visible:
|
||||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 0到30天
|
state.keyInfos.value.keyType ==
|
||||||
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
|
(DateTool().compareTimeGetDaysFromNow(
|
||||||
|
state.keyInfos.value.endDate!) <=
|
||||||
|
15 &&
|
||||||
|
DateTool().compareTimeGetDaysFromNow(
|
||||||
|
state.keyInfos.value.endDate!) >=
|
||||||
|
0) && // 0到30天
|
||||||
|
(state.keyInfos.value.keyStatus ==
|
||||||
|
XSConstantMacro.keyStatusNormalUse ||
|
||||||
|
state.keyInfos.value.keyStatus ==
|
||||||
|
XSConstantMacro.keyStatusWaitReceive) // 正常使用、待接收
|
||||||
)
|
)
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
@ -234,9 +247,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// logic.getStarLockStatus();
|
// logic.getStarLockStatus();
|
||||||
ShowTipView().showSureAlertDialog("${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state
|
ShowTipView().showSureAlertDialog(
|
||||||
.keyInfos.value.electricQuantityDate!
|
"${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
|
||||||
.toString())}");
|
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
@ -263,11 +275,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w),
|
Image.asset(showElectricIcon(state.electricQuantity.value),
|
||||||
|
width: 30.w, height: 24.w),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text("--%", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
|
Text("--%",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
color: AppColors.darkGrayTextColor)),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Icon(Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
Icon(
|
||||||
|
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||||
size: 25.w, // 设置图标大小为 30
|
size: 25.w, // 设置图标大小为 30
|
||||||
),
|
),
|
||||||
@ -561,11 +578,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置
|
// 设置
|
||||||
showWidgetArr.add(bottomItem(
|
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
||||||
'images/main/icon_main_set.png',
|
TranslationLoader.lanKeys!.set!.tr, true, true, () {
|
||||||
TranslationLoader.lanKeys!.set!.tr,
|
|
||||||
true,
|
|
||||||
true, () {
|
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
"isOnlyOneData": state.isOnlyOneData
|
"isOnlyOneData": state.isOnlyOneData
|
||||||
@ -729,17 +743,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
TranslationLoader.lanKeys!.messageReminding!.tr,
|
TranslationLoader.lanKeys!.messageReminding!.tr,
|
||||||
state.openDoorBtnisUneable.value,
|
state.openDoorBtnisUneable.value,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.msgNotificationPage);
|
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
||||||
|
"lockId": state.keyInfos.value.lockId,
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
endWiddget.add(
|
endWiddget.add(
|
||||||
// 设置
|
// 设置
|
||||||
bottomItem(
|
bottomItem('images/main/icon_main_set.png',
|
||||||
'images/main/icon_main_set.png',
|
TranslationLoader.lanKeys!.set!.tr, true, true, () {
|
||||||
TranslationLoader.lanKeys!.set!.tr,
|
|
||||||
true,
|
|
||||||
true, () {
|
|
||||||
// logic.clickItemBtnAction(10);
|
// logic.clickItemBtnAction(10);
|
||||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||||
"lockId": state.keyInfos.value.lockId,
|
"lockId": state.keyInfos.value.lockId,
|
||||||
@ -752,7 +765,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, bool bottomBtnisEable, Function() onClick) {
|
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable,
|
||||||
|
bool bottomBtnisEable, Function() onClick) {
|
||||||
var width = 42.w;
|
var width = 42.w;
|
||||||
var height = 42.h;
|
var height = 42.h;
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
|
|||||||
@ -39,15 +39,18 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
|||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Obx(() => Column(
|
body: Obx(() => Column(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
child: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr,
|
leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: Text(state.selectVideoSlot.value,
|
rightWidget: Text(state.selectVideoSlot.value,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor)),
|
fontSize: 22.sp,
|
||||||
|
color: AppColors.darkGrayTextColor)),
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(context, Routers.videoSlotPage,
|
Navigator.pushNamed(context, Routers.videoSlotPage,
|
||||||
arguments: {
|
arguments: {
|
||||||
@ -60,6 +63,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
|||||||
}).then((value) => {logic.getLockSettingInfoData()});
|
}).then((value) => {logic.getLockSettingInfoData()});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
_buildSubTitleItem('有人出现时录像', '有人在门口出现10秒后开始录像。\n有人按门铃时立即录像',
|
_buildSubTitleItem('有人出现时录像', '有人在门口出现10秒后开始录像。\n有人按门铃时立即录像',
|
||||||
state.recordTime.value, () {
|
state.recordTime.value, () {
|
||||||
_openBottomItemSheet(state.showsUpVideoList.value, 0);
|
_openBottomItemSheet(state.showsUpVideoList.value, 0);
|
||||||
@ -74,7 +78,9 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
CommonItem(
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
child: CommonItem(
|
||||||
leftTitel: '实时画面',
|
leftTitel: '实时画面',
|
||||||
rightTitle: state.realTimeMode.value,
|
rightTitle: state.realTimeMode.value,
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
@ -91,6 +97,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
|||||||
: null
|
: null
|
||||||
}).then((value) => {logic.getLockSettingInfoData()});
|
}).then((value) => {logic.getLockSettingInfoData()});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)));
|
)));
|
||||||
@ -102,7 +109,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
|||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
margin: EdgeInsets.only(left: 20.sp, right: 20.sp, top: 20.h),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_
|
|||||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
class VideoSlotLogic extends BaseGetXController {
|
class VideoSlotLogic extends BaseGetXController {
|
||||||
final VideoSlotState state = VideoSlotState();
|
final VideoSlotState state = VideoSlotState();
|
||||||
@ -23,6 +24,13 @@ class VideoSlotLogic extends BaseGetXController {
|
|||||||
} else {
|
} else {
|
||||||
state.isCustom.value = false;
|
state.isCustom.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.startDate.value = DateTool().dateToHNString(state
|
||||||
|
.catEyeConfigData.value.catEyeModeConfig!.recordStartTime!
|
||||||
|
.toString());
|
||||||
|
state.endDate.value = DateTool().dateToHNString(state
|
||||||
|
.catEyeConfigData.value.catEyeModeConfig!.recordEndTime!
|
||||||
|
.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
@ -30,6 +38,20 @@ class VideoSlotLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//设置猫眼工作模式
|
//设置猫眼工作模式
|
||||||
void updateCatEyeModeConfig() async {
|
void updateCatEyeModeConfig() async {
|
||||||
|
state.isCustom.value == false
|
||||||
|
? state.recordMode.value = 0
|
||||||
|
: state.recordMode.value = 1;
|
||||||
|
|
||||||
|
if (state.recordMode.value == 1) {
|
||||||
|
state.recordStartTime.value =
|
||||||
|
DateTool().dateToTimestamp(state.startDate.value, 0);
|
||||||
|
// 将当前时间加一天
|
||||||
|
DateTime tomorrow =
|
||||||
|
DateTime(DateTool().dateToTimestamp(state.startDate.value, 0))
|
||||||
|
.add(const Duration(days: 1));
|
||||||
|
// 获取明天时间的时间戳
|
||||||
|
state.recordEndTime.value = tomorrow.millisecondsSinceEpoch;
|
||||||
|
}
|
||||||
var entity = await ApiRepository.to.updateCatEyeModeConfig(
|
var entity = await ApiRepository.to.updateCatEyeModeConfig(
|
||||||
lockId: state.lockSetInfoData.value.lockId!,
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
catEyeConfig: [
|
catEyeConfig: [
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
@ -44,15 +45,6 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
|||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
state.isCustom.value == false
|
|
||||||
? state.recordMode.value = 0
|
|
||||||
: state.recordMode.value = 1;
|
|
||||||
if (state.recordMode.value == 1) {
|
|
||||||
state.recordStartTime.value =
|
|
||||||
state.startDateTime.value.millisecondsSinceEpoch;
|
|
||||||
state.recordEndTime.value =
|
|
||||||
state.endDateTime.value.millisecondsSinceEpoch;
|
|
||||||
}
|
|
||||||
logic.updateCatEyeModeConfig();
|
logic.updateCatEyeModeConfig();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -238,10 +230,9 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
|
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
|
||||||
if (isEndTime == false) {
|
if (isEndTime == false) {
|
||||||
state.startDate.value =
|
state.startDate.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
'${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
|
||||||
} else {
|
} else {
|
||||||
state.endDate.value = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
state.endDate.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
class VideoSlotState {
|
class VideoSlotState {
|
||||||
var lockSetInfoData = LockSetInfoData().obs;
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
@ -7,12 +8,8 @@ class VideoSlotState {
|
|||||||
|
|
||||||
var isCustom = false.obs; //是否自定义
|
var isCustom = false.obs; //是否自定义
|
||||||
DateTime dateTime = DateTime.now();
|
DateTime dateTime = DateTime.now();
|
||||||
final startDateTime = DateTime.now().obs; //开始时间:当日
|
var startDate = DateTool().getNowDateWithType(6).obs; //默认为当前时间
|
||||||
final endDateTime = DateTime.now().obs; //结束时间:次日
|
var endDate = DateTool().getNowDateWithType(6).obs; //默认为当前时间
|
||||||
|
|
||||||
var startDate =
|
|
||||||
'${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
|
||||||
var endDate = '${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
|
||||||
|
|
||||||
var recordMode = 0.obs; //录像时段 0全天 1自定义时间
|
var recordMode = 0.obs; //录像时段 0全天 1自定义时间
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,73 @@
|
|||||||
import 'package:star_lock/main/lockDetail/lockSet/faceUnlock/faceUnlock_state.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/faceUnlock/faceUnlock_state.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
class FaceUnlockLogic extends BaseGetXController {
|
class FaceUnlockLogic extends BaseGetXController {
|
||||||
final FaceUnlockState state = FaceUnlockState();
|
final FaceUnlockState state = FaceUnlockState();
|
||||||
|
|
||||||
|
// 获取锁设置信息
|
||||||
|
Future<LockSetInfoEntity> getLockSettingInfoData() async {
|
||||||
|
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.lockSetInfoData.value = entity.data!;
|
||||||
|
state.faceOn.value =
|
||||||
|
entity.data!.lockSettingInfo!.faceSwitch == 0 ? false : true;
|
||||||
|
state.autoBright.value =
|
||||||
|
entity.data!.lockSettingInfo!.faceAutoLightScreen == 0 ? false : true;
|
||||||
|
state.senseDistance.value =
|
||||||
|
entity.data!.lockSettingInfo!.faceInductionDistance! == 0
|
||||||
|
? '远距离'
|
||||||
|
: '近距离';
|
||||||
|
state.antiMisoperation.value =
|
||||||
|
entity.data!.lockSettingInfo!.faceAntiMistakeOpen!;
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置面容开锁开关
|
||||||
|
void updateFaceSwitch() async {
|
||||||
|
var entity = await ApiRepository.to.updateFaceSwitch(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId ?? 0,
|
||||||
|
faceSwitch: state.faceOn.value == false ? 0 : 1,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置自动亮屏开关
|
||||||
|
void updateFaceConfig() async {
|
||||||
|
var entity = await ApiRepository.to.updateFaceAutoLightScreen(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId ?? 0,
|
||||||
|
faceAutoLightScreen: state.autoBright.value == false ? 0 : 1,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置面容感应距离
|
||||||
|
void updateFaceSenseDistance() async {
|
||||||
|
var entity = await ApiRepository.to.updateFaceSenseDistance(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId ?? 0,
|
||||||
|
faceInductionDistance: state.senseDistance.value == '远距离' ? 0 : 1,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置面容防误开
|
||||||
|
void updateFacePreventMisrun() async {
|
||||||
|
var entity = await ApiRepository.to.updateFacePreventMisrun(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId ?? 0,
|
||||||
|
faceAntiMistakeOpen: state.antiMisoperation.value,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,12 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
|||||||
final logic = Get.put(FaceUnlockLogic());
|
final logic = Get.put(FaceUnlockLogic());
|
||||||
final state = Get.find<FaceUnlockLogic>().state;
|
final state = Get.find<FaceUnlockLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
logic.getLockSettingInfoData();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -29,34 +35,46 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
|||||||
barTitle: TranslationLoader.lanKeys!.faceUnlocksSet!.tr,
|
barTitle: TranslationLoader.lanKeys!.faceUnlocksSet!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Obx(() => Column(
|
||||||
children: [
|
children: [
|
||||||
CommonItem(
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
child: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
|
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
rightWidget: SizedBox(
|
||||||
SizedBox(width: 60.w, height: 50.h, child: _switch(1))),
|
width: 60.w, height: 50.h, child: _switch(1))),
|
||||||
CommonItem(
|
),
|
||||||
leftTitel: TranslationLoader.lanKeys!.automaticBrighteningScreen!.tr,
|
Container(
|
||||||
|
margin: EdgeInsets.only(left: 20.w),
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: TranslationLoader
|
||||||
|
.lanKeys!.automaticBrighteningScreen!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
rightWidget: SizedBox(
|
||||||
SizedBox(width: 60.w, height: 50.h, child: _switch(2))),
|
width: 60.w, height: 50.h, child: _switch(2))),
|
||||||
|
),
|
||||||
_buildSubTitleItem(
|
_buildSubTitleItem(
|
||||||
TranslationLoader.lanKeys!.sensingDistance!.tr, TranslationLoader.lanKeys!.sensingDistanceTip!.tr, state.senseDistance.value,
|
TranslationLoader.lanKeys!.sensingDistance!.tr,
|
||||||
() {
|
TranslationLoader.lanKeys!.sensingDistanceTip!.tr,
|
||||||
|
state.senseDistance.value, () {
|
||||||
_openBottomItemSheet(state.senseDistanceList.value, 0);
|
_openBottomItemSheet(state.senseDistanceList.value, 0);
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
_buildSubTitleItem(
|
_buildSubTitleItem(
|
||||||
TranslationLoader.lanKeys!.preventWrongOpening!.tr, TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr, state.antiMisoperation.value, () {
|
TranslationLoader.lanKeys!.preventWrongOpening!.tr,
|
||||||
_openBottomItemSheet(state.antiMisoperationList.value, 1);
|
TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr,
|
||||||
|
state.antiMisoperation.value == 0
|
||||||
|
? '关闭'
|
||||||
|
: '${state.antiMisoperation.value}秒', () {
|
||||||
|
_openBottomItemSheet(state.antiMisoperationStrList.value, 1);
|
||||||
}),
|
}),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -67,7 +85,7 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
|||||||
height: 60.h,
|
height: 60.h,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSubTitleItem(
|
Widget _buildSubTitleItem(
|
||||||
@ -76,6 +94,7 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
|||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(left: 20.sp, right: 20.sp, top: 20.h),
|
margin: EdgeInsets.only(left: 20.sp, right: 20.sp, top: 20.h),
|
||||||
|
color: Colors.white,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -152,19 +171,20 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
|||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: getIndex == 1 ? state.faceOn.value : state.autoBright.value,
|
value: getIndex == 1 ? state.faceOn.value : state.autoBright.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
|
||||||
if (getIndex == 1) {
|
if (getIndex == 1) {
|
||||||
|
//设置面容开锁开关
|
||||||
state.faceOn.value = value;
|
state.faceOn.value = value;
|
||||||
|
logic.updateFaceSwitch();
|
||||||
} else {
|
} else {
|
||||||
|
//设置自动亮屏开关
|
||||||
state.autoBright.value = value;
|
state.autoBright.value = value;
|
||||||
|
logic.updateFaceConfig();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _openBottomItemSheet(
|
Future _openBottomItemSheet(List bottomItemList, int clickIndex) async {
|
||||||
List<String> bottomItemList, int clickIndex) async {
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@ -178,13 +198,13 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
|||||||
//感应距离
|
//感应距离
|
||||||
state.senseDistance.value =
|
state.senseDistance.value =
|
||||||
state.senseDistanceList.value[value];
|
state.senseDistanceList.value[value];
|
||||||
|
logic.updateFaceSenseDistance();
|
||||||
} else if (clickIndex == 1) {
|
} else if (clickIndex == 1) {
|
||||||
//防误开
|
//防误开
|
||||||
state.antiMisoperation.value =
|
state.antiMisoperation.value =
|
||||||
state.antiMisoperationList.value[value];
|
state.antiMisoperationList.value[value];
|
||||||
|
logic.updateFacePreventMisrun();
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,20 +1,32 @@
|
|||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
class FaceUnlockState {
|
class FaceUnlockState {
|
||||||
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
|
||||||
var isCheck = false.obs;
|
var isCheck = false.obs;
|
||||||
var faceOn = false.obs; //面容开锁
|
var faceOn = false.obs; //面容开锁
|
||||||
var autoBright = false.obs; //自动亮屏
|
var autoBright = false.obs; //自动亮屏
|
||||||
var senseDistance = TranslationLoader.lanKeys!.remote!.tr.obs; //感应距离
|
var senseDistance = TranslationLoader.lanKeys!.remote!.tr.obs; //感应距离
|
||||||
var antiMisoperation = TranslationLoader.lanKeys!.close!.tr.obs; //防误开
|
var antiMisoperation = 0.obs; //防误开
|
||||||
var senseDistanceList = [TranslationLoader.lanKeys!.remote!.tr, TranslationLoader.lanKeys!.closeRange!.tr].obs;
|
var senseDistanceList = [
|
||||||
var antiMisoperationList = [TranslationLoader.lanKeys!.close!.tr, '5${TranslationLoader.lanKeys!.second!.tr}', '10${TranslationLoader.lanKeys!.second!.tr}', '15${TranslationLoader.lanKeys!.second!.tr}', '30${TranslationLoader.lanKeys!.second!.tr}', '60${TranslationLoader.lanKeys!.second!.tr}'].obs;
|
TranslationLoader.lanKeys!.remote!.tr,
|
||||||
|
TranslationLoader.lanKeys!.closeRange!.tr
|
||||||
|
].obs;
|
||||||
|
var antiMisoperationList = [0, 5, 10, 15, 30, 60].obs;
|
||||||
|
var antiMisoperationStrList = [
|
||||||
|
TranslationLoader.lanKeys!.close!.tr,
|
||||||
|
'5${TranslationLoader.lanKeys!.second!.tr}',
|
||||||
|
'10${TranslationLoader.lanKeys!.second!.tr}',
|
||||||
|
'15${TranslationLoader.lanKeys!.second!.tr}',
|
||||||
|
'30${TranslationLoader.lanKeys!.second!.tr}',
|
||||||
|
'60${TranslationLoader.lanKeys!.second!.tr}'
|
||||||
|
].obs;
|
||||||
//高亮样式
|
//高亮样式
|
||||||
final TextStyle titleStyle = TextStyle(
|
final TextStyle titleStyle = TextStyle(
|
||||||
color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);
|
color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);
|
||||||
@ -23,9 +35,18 @@ class FaceUnlockState {
|
|||||||
TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp);
|
TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp);
|
||||||
|
|
||||||
late InlineSpan tipsPreviewSpan = TextSpan(children: [
|
late InlineSpan tipsPreviewSpan = TextSpan(children: [
|
||||||
TextSpan(text: '${TranslationLoader.lanKeys!.addAndUseFaceWhenUnlocking!.tr}:\n', style: titleStyle),
|
TextSpan(
|
||||||
|
text: '${TranslationLoader.lanKeys!.addAndUseFaceWhenUnlocking!.tr}:\n',
|
||||||
|
style: titleStyle),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: TranslationLoader.lanKeys!.addAndUseFaceWhenUnlockingTip!.tr,
|
text: TranslationLoader.lanKeys!.addAndUseFaceWhenUnlockingTip!.tr,
|
||||||
style: subTipsStyle),
|
style: subTipsStyle),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
FaceUnlockState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if (map['lockSetInfoData'] != null) {
|
||||||
|
lockSetInfoData.value = map['lockSetInfoData'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -357,7 +357,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.faceUnlockPage);
|
Get.toNamed(Routers.faceUnlockPage, arguments: {
|
||||||
|
'lockSetInfoData': state.lockSetInfoData.value
|
||||||
|
});
|
||||||
})),
|
})),
|
||||||
// ),
|
// ),
|
||||||
// 消息提醒
|
// 消息提醒
|
||||||
@ -369,7 +371,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.msgNotificationPage);
|
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
||||||
|
'lockSetInfoData': state.lockSetInfoData.value
|
||||||
|
});
|
||||||
})),
|
})),
|
||||||
//猫眼设置
|
//猫眼设置
|
||||||
Visibility(
|
Visibility(
|
||||||
|
|||||||
@ -67,11 +67,13 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
|||||||
// ),
|
// ),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: '开门通知',
|
leftTitel: '开门通知',
|
||||||
rightTitle: "已启用",
|
rightTitle: "",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.openDoorNotifyPage);
|
Get.toNamed(Routers.openDoorNotifyPage, arguments: {
|
||||||
|
'lockSetInfoData': state.lockSetInfoData.value,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
|
|||||||
@ -1,9 +1,18 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
|
||||||
class MsgNotificationState {
|
class MsgNotificationState {
|
||||||
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
var isCheck = false.obs;
|
var isCheck = false.obs;
|
||||||
var isLeaveHomeOpenDoor = false.obs; //离家开门
|
var isLeaveHomeOpenDoor = false.obs; //离家开门
|
||||||
var isDoorNotShut = false.obs; //门未关好
|
var isDoorNotShut = false.obs; //门未关好
|
||||||
var isSomeoneRing = false.obs; //有人按门铃
|
var isSomeoneRing = false.obs; //有人按门铃
|
||||||
var isSomeoneAppeared = false.obs; //有人出现在门口
|
var isSomeoneAppeared = false.obs; //有人出现在门口
|
||||||
|
|
||||||
|
MsgNotificationState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if (map['lockSetInfoData'] != null) {
|
||||||
|
lockSetInfoData.value = map['lockSetInfoData'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,16 @@
|
|||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
|
||||||
import 'openDoorNotify_state.dart';
|
import 'openDoorNotify_state.dart';
|
||||||
|
|
||||||
class OpenDoorNotifyLogic extends BaseGetXController {
|
class OpenDoorNotifyLogic extends BaseGetXController {
|
||||||
final OpenDoorNotifyState state = OpenDoorNotifyState();
|
final OpenDoorNotifyState state = OpenDoorNotifyState();
|
||||||
|
|
||||||
|
// 获取锁消息设置
|
||||||
|
void getLockNoticeSetting() async {
|
||||||
|
VersionUndateEntity entity = await ApiRepository.to.getLockNoticeSetting(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,8 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
logic.getLockNoticeSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1,7 +1,16 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
|
||||||
class OpenDoorNotifyState {
|
class OpenDoorNotifyState {
|
||||||
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
var pageNum = 1.obs; //请求页码
|
var pageNum = 1.obs; //请求页码
|
||||||
final pageSize = 20.obs; //请求每页数据条数
|
final pageSize = 20.obs; //请求每页数据条数
|
||||||
final itemDataList = [].obs;
|
final itemDataList = [].obs;
|
||||||
|
|
||||||
|
OpenDoorNotifyState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if (map['lockSetInfoData'] != null) {
|
||||||
|
lockSetInfoData.value = map['lockSetInfoData'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,8 +27,9 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
void _getTVDataRefreshUIAction() {
|
void _getTVDataRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getTVDataRefreshUIEvent =
|
_getTVDataRefreshUIEvent =
|
||||||
eventBus.on<GetTVDataRefreshUI>().listen((event) {
|
eventBus.on<GetTVDataRefreshUI>().listen((event) async {
|
||||||
if (event.tvList.isNotEmpty) {
|
if (event.tvList.isNotEmpty) {
|
||||||
|
print('收到图片了啦啦啦啦啦啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊');
|
||||||
// 预加载图片数据
|
// 预加载图片数据
|
||||||
Uint8List imageData = Uint8List.fromList(event.tvList);
|
Uint8List imageData = Uint8List.fromList(event.tvList);
|
||||||
// 更新状态
|
// 更新状态
|
||||||
|
|||||||
@ -3,6 +3,6 @@ import 'flavors.dart';
|
|||||||
import 'main.dart' as runner;
|
import 'main.dart' as runner;
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
F.appFlavor = Flavor.xie;
|
F.appFlavor = Flavor.local;
|
||||||
await runner.main();
|
await runner.main();
|
||||||
}
|
}
|
||||||
@ -1,6 +1,13 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fluwx/fluwx.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/mine/mall/lockMall_entity.dart';
|
import 'package:star_lock/mine/mall/lockMall_entity.dart';
|
||||||
import 'package:star_lock/mine/mall/lockMall_state.dart';
|
import 'package:star_lock/mine/mall/lockMall_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/pay/wx_pay_tool.dart';
|
||||||
|
import 'package:star_lock/webview/webview_logic.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
import '../../tools/baseGetXController.dart';
|
import '../../tools/baseGetXController.dart';
|
||||||
@ -26,18 +33,74 @@ class LockMallLogic extends BaseGetXController {
|
|||||||
state.webProgress.value = 1.0;
|
state.webProgress.value = 1.0;
|
||||||
},
|
},
|
||||||
onWebResourceError: (WebResourceError error) {},
|
onWebResourceError: (WebResourceError error) {},
|
||||||
onNavigationRequest: (NavigationRequest request) {
|
onNavigationRequest: (NavigationRequest request) async {
|
||||||
// if (request.url.startsWith('https://www.youtube.com/')) {
|
//路由跳转逻辑
|
||||||
// return NavigationDecision.prevent;
|
if (WebViewLogic.judgePaySchemes(request.url)) {
|
||||||
// }
|
await WebViewLogic.runScheme(request.url);
|
||||||
|
return NavigationDecision.prevent;
|
||||||
|
}
|
||||||
return NavigationDecision.navigate;
|
return NavigationDecision.navigate;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
state.mallWebView.loadRequest(Uri.parse(state.lockMallUrl.value));
|
state.mallWebView.loadRequest(Uri.parse(state.lockMallUrl.value));
|
||||||
|
// FlutterBridge.postMessage({action:'',data:'{}',callFun:'回调给js的方法'})
|
||||||
|
state.mallWebView.addJavaScriptChannel(
|
||||||
|
"FlutterBridge",
|
||||||
|
onMessageReceived: (JavaScriptMessage message) async {
|
||||||
|
flutterBridge(message);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
// onMessageReceived
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//监听webview的调用
|
||||||
|
Future<void> flutterBridge(JavaScriptMessage message) async {
|
||||||
|
final dynamic obj = jsonDecode(message.message);
|
||||||
|
print(obj);
|
||||||
|
if (obj is! Map && obj['action'] is String) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String action = obj['action'];
|
||||||
|
dynamic data = obj['data'];
|
||||||
|
String? callFun = obj['callFun'];
|
||||||
|
switch (action) {
|
||||||
|
case 'WechatPayParams':
|
||||||
|
//微信支付
|
||||||
|
wxPay(data, callFun);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//微信支付
|
||||||
|
Future<void> wxPay(dynamic data, String? callFun) async {
|
||||||
|
WxPayTool.pay(WxPayTool.mapToPayment(data), (response) {
|
||||||
|
if (response is WeChatPaymentResponse) {
|
||||||
|
Map data = {
|
||||||
|
'type': response.type,
|
||||||
|
'extData': response.extData,
|
||||||
|
'errCode': response.errCode,
|
||||||
|
'errStr': response.errStr,
|
||||||
|
};
|
||||||
|
state.mallWebView.runJavaScript(
|
||||||
|
'window.$callFun(`${json.encode(data)}`)',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断webview 是否可以有路由可以回退,无则退出当前页面
|
||||||
|
Future<bool> canGoBack(bool didPop) async {
|
||||||
|
bool canGoBack = await state.mallWebView.canGoBack();
|
||||||
|
if (canGoBack) {
|
||||||
|
await state.mallWebView.goBack();
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
print("ready home");
|
print("ready home");
|
||||||
@ -48,7 +111,6 @@ class LockMallLogic extends BaseGetXController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
print("init home");
|
print("init home");
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
getMallURLRequest();
|
getMallURLRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,6 @@ import 'package:star_lock/mine/mall/lockMall_logic.dart';
|
|||||||
import 'package:star_lock/tools/titleAppBar.dart';
|
import 'package:star_lock/tools/titleAppBar.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
import '../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
class LockMallPage extends StatefulWidget {
|
class LockMallPage extends StatefulWidget {
|
||||||
const LockMallPage({Key? key}) : super(key: key);
|
const LockMallPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@ -29,7 +27,10 @@ class _LockMallPageState extends State<LockMallPage> {
|
|||||||
// FIXME 如果未登录状态,应先跳转登录页
|
// FIXME 如果未登录状态,应先跳转登录页
|
||||||
// FIXME url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录
|
// FIXME url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录
|
||||||
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
|
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
|
||||||
return Scaffold(
|
return PopScope(
|
||||||
|
onPopInvoked: logic.canGoBack,
|
||||||
|
canPop: false,
|
||||||
|
child: Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: const Color(0xFFFFFFFF),
|
backgroundColor: const Color(0xFFFFFFFF),
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -44,15 +45,15 @@ class _LockMallPageState extends State<LockMallPage> {
|
|||||||
child: LinearProgressIndicator(
|
child: LinearProgressIndicator(
|
||||||
value: state.webProgress.value,
|
value: state.webProgress.value,
|
||||||
backgroundColor: Colors.grey,
|
backgroundColor: Colors.grey,
|
||||||
valueColor:
|
valueColor: AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
||||||
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: WebViewWidget(controller: state.mallWebView),
|
child: WebViewWidget(controller: state.mallWebView),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)));
|
))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getWebTitle() {
|
String getWebTitle() {
|
||||||
|
|||||||
@ -1,11 +1,20 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/webview/webview_logic.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
class LockMallState {
|
class LockMallState {
|
||||||
var lockMallUrl = "".obs;
|
var lockMallUrl = "".obs;
|
||||||
var webProgress = 0.0.obs;
|
var webProgress = 0.0.obs;
|
||||||
late WebViewController mallWebView = WebViewController()
|
late WebViewController mallWebView = initWebViewController();
|
||||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
|
||||||
..setBackgroundColor(Colors.white);
|
//初始化webView控制器
|
||||||
|
WebViewController initWebViewController() {
|
||||||
|
WebViewController allWebView = WebViewController();
|
||||||
|
allWebView.setJavaScriptMode(JavaScriptMode.unrestricted);
|
||||||
|
allWebView.setBackgroundColor(Colors.white);
|
||||||
|
allWebView.setUserAgent(WebViewLogic.userAgent);
|
||||||
|
return allWebView;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
||||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||||
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||||
@ -108,16 +109,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
|||||||
),
|
),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
||||||
rightTitle: state.mineInfoData.value.nickname != null
|
rightTitle: state.mineInfoData.value.nickname != null ? state.mineInfoData.value.nickname! : "",
|
||||||
? state.mineInfoData.value.nickname!
|
|
||||||
: "",
|
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.minePersonInfoEditNamePage,
|
||||||
context, Routers.minePersonInfoEditNamePage, arguments: {
|
arguments: {'nickName': state.mineInfoData.value.nickname})
|
||||||
'nickName': state.mineInfoData.value.nickname
|
.then((value) => logic.getUserInfoRequest());
|
||||||
}).then((value) => logic.getUserInfoRequest());
|
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
|
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
|
||||||
@ -129,16 +127,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
|||||||
action: () {
|
action: () {
|
||||||
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
||||||
if (state.mineInfoData.value.mobile!.isNotEmpty) {
|
if (state.mineInfoData.value.mobile!.isNotEmpty) {
|
||||||
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage, arguments: {
|
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
|
||||||
'mobile': state.mineInfoData.value.mobile!,
|
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
|
||||||
'isFrom': '1'
|
.then((value) => logic.getUserInfoRequest());
|
||||||
}).then((value) => logic.getUserInfoRequest());
|
|
||||||
} else {
|
} else {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
|
||||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
|
||||||
'mobile': state.mineInfoData.value.mobile!,
|
.then((value) => logic.getUserInfoRequest());
|
||||||
'isFrom': '1'
|
|
||||||
}).then((value) => logic.getUserInfoRequest());
|
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -151,18 +146,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
|||||||
action: () {
|
action: () {
|
||||||
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
||||||
if (state.mineInfoData.value.email!.isNotEmpty) {
|
if (state.mineInfoData.value.email!.isNotEmpty) {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
|
||||||
context, Routers.mineUnbindPhoneOrEmailPage,
|
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
|
||||||
arguments: {
|
.then((value) => logic.getUserInfoRequest());
|
||||||
'isFrom': '2',
|
|
||||||
'email': state.mineInfoData.value.email!
|
|
||||||
}).then((value) => logic.getUserInfoRequest());
|
|
||||||
} else {
|
} else {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
|
||||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
|
||||||
'isFrom': '2',
|
.then((value) => logic.getUserInfoRequest());
|
||||||
'email': state.mineInfoData.value.email!
|
|
||||||
}).then((value) => logic.getUserInfoRequest());
|
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -171,30 +161,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.minePersonInfoResetPasswordPage);
|
||||||
context, Routers.minePersonInfoResetPasswordPage);
|
|
||||||
}),
|
}),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
||||||
rightTitle:
|
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
|
||||||
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
|
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
if (state.mineInfoData.value.haveSafeAnswer == 0) {
|
if (state.mineInfoData.value.haveSafeAnswer == 0) {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage)
|
||||||
context, Routers.minePersonInfoSetSafetyProblemPage)
|
|
||||||
.then((value) => logic.getUserInfoRequest());
|
.then((value) => logic.getUserInfoRequest());
|
||||||
} else {
|
} else {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routers.minePersonInfoViewSafetyProblemPage);
|
||||||
context, Routers.minePersonInfoViewSafetyProblemPage);
|
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
rightTitle: state.mineInfoData.value.countryName != null
|
rightTitle: state.mineInfoData.value.countryName != null ? state.mineInfoData.value.countryName! : "",
|
||||||
? state.mineInfoData.value.countryName!
|
|
||||||
: "",
|
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: false)),
|
isHaveDirection: false)),
|
||||||
],
|
],
|
||||||
@ -228,7 +212,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _requestPhotoPermission() async {
|
Future<void> _requestPhotoPermission() async {
|
||||||
var status = await Permission.photos.request();
|
//针对andriud33以下的设备兼容
|
||||||
|
bool isAndroid33 = AppPlatform.isAndroid && AppPlatform.getSdkIntValue() >= 33;
|
||||||
|
var status = isAndroid33 ? await Permission.photos.request() : await Permission.storage.request();
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.hasPhotoPermission.value = true; // 如果权限被授予,更新状态变量
|
state.hasPhotoPermission.value = true; // 如果权限被授予,更新状态变量
|
||||||
@ -287,13 +273,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
|||||||
int getSelectIndex = value;
|
int getSelectIndex = value;
|
||||||
if (getSelectIndex == 0) {
|
if (getSelectIndex == 0) {
|
||||||
//拍照选项
|
//拍照选项
|
||||||
state.hasCameraPermission.value == true
|
state.hasCameraPermission.value == true ? selectCamera() : _requestCameraPermission();
|
||||||
? selectCamera()
|
|
||||||
: _requestCameraPermission();
|
|
||||||
} else if (getSelectIndex == 1) {
|
} else if (getSelectIndex == 1) {
|
||||||
state.hasPhotoPermission.value == true
|
state.hasPhotoPermission.value == true ? selectImage() : _requestPhotoPermission();
|
||||||
? selectImage()
|
|
||||||
: _requestPhotoPermission();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -302,8 +284,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
|||||||
|
|
||||||
///拍摄照片
|
///拍摄照片
|
||||||
selectCamera() async {
|
selectCamera() async {
|
||||||
XFile? photo = await state.imagePicker.pickImage(
|
XFile? photo =
|
||||||
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
|
await state.imagePicker.pickImage(source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
|
||||||
if (photo != null) {
|
if (photo != null) {
|
||||||
state.image = photo;
|
state.image = photo;
|
||||||
// logic.getUpTokenRequest();
|
// logic.getUpTokenRequest();
|
||||||
|
|||||||
@ -191,4 +191,7 @@ abstract class Api {
|
|||||||
'/lockSetting/updateCatEyeConfig'; //猫眼相关设置
|
'/lockSetting/updateCatEyeConfig'; //猫眼相关设置
|
||||||
|
|
||||||
final String updateFaceConfigURL = '/lockSetting/updateFaceConfig'; //面容相关设置
|
final String updateFaceConfigURL = '/lockSetting/updateFaceConfig'; //面容相关设置
|
||||||
|
|
||||||
|
final String getLockNoticeSettingURL =
|
||||||
|
'/lockSetting/getLockNoticeSetting'; //获取锁消息设置
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1732,8 +1732,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
'faceSwitch': faceSwitch,
|
'faceSwitch': faceSwitch,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置面容开锁
|
// 设置面容感应距离
|
||||||
Future<Response> updateFaceConfig(int lockId, int faceInductionDistance) =>
|
Future<Response> updateFaceSenseDistance(
|
||||||
|
int lockId, int faceInductionDistance) =>
|
||||||
post(
|
post(
|
||||||
updateFaceConfigURL.toUrl,
|
updateFaceConfigURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -1760,6 +1761,13 @@ class ApiProvider extends BaseProvider {
|
|||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
'faceAutoLightScreen': faceAutoLightScreen,
|
'faceAutoLightScreen': faceAutoLightScreen,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 获取锁消息设置
|
||||||
|
Future<Response> getLockNoticeSetting(int lockId) => post(
|
||||||
|
getLockNoticeSettingURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -1769,10 +1769,10 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置面容感应距离
|
// 设置面容感应距离
|
||||||
Future<VersionUndateEntity> updateFaceConfig(
|
Future<VersionUndateEntity> updateFaceSenseDistance(
|
||||||
{required int lockId, required int faceInductionDistance}) async {
|
{required int lockId, required int faceInductionDistance}) async {
|
||||||
final res =
|
final res = await apiProvider.updateFaceSenseDistance(
|
||||||
await apiProvider.updateFaceConfig(lockId, faceInductionDistance);
|
lockId, faceInductionDistance);
|
||||||
return VersionUndateEntity.fromJson(res.body);
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1791,4 +1791,11 @@ class ApiRepository {
|
|||||||
lockId, faceAutoLightScreen);
|
lockId, faceAutoLightScreen);
|
||||||
return VersionUndateEntity.fromJson(res.body);
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取锁消息设置
|
||||||
|
Future<VersionUndateEntity> getLockNoticeSetting(
|
||||||
|
{required int lockId}) async {
|
||||||
|
final res = await apiProvider.getLockNoticeSetting(lockId);
|
||||||
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,16 @@ import 'package:star_lock/login/login/entity/LoginData.dart';
|
|||||||
import '../tools/platform_info_services.dart';
|
import '../tools/platform_info_services.dart';
|
||||||
import '../tools/storage.dart';
|
import '../tools/storage.dart';
|
||||||
|
|
||||||
FutureOr<Request> requestInterceptor(Request request) async {
|
//公共获取UA
|
||||||
request.headers['User-Agent'] =
|
String getUserAgent() {
|
||||||
|
//赋值变量方便调试
|
||||||
|
String ua =
|
||||||
'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
|
'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
|
||||||
|
return ua;
|
||||||
|
}
|
||||||
|
|
||||||
|
FutureOr<Request> requestInterceptor(Request request) async {
|
||||||
|
request.headers['User-Agent'] = getUserAgent();
|
||||||
request.headers['Accept-Language'] = 'zh-CN';
|
request.headers['Accept-Language'] = 'zh-CN';
|
||||||
// request.headers['Content-Type'] = 'application/json';
|
// request.headers['Content-Type'] = 'application/json';
|
||||||
// request.headers['token'] = StoreService.to.userToken!;
|
// request.headers['token'] = StoreService.to.userToken!;
|
||||||
|
|||||||
@ -108,6 +108,9 @@ class CallTalk {
|
|||||||
if (iframe!.bagNum == iframe!.bagReceive) {
|
if (iframe!.bagNum == iframe!.bagReceive) {
|
||||||
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
||||||
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
|
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
String formattedTime = "${now.hour}:${now.minute}:${now.second}";
|
||||||
|
print('$formattedTime得到了一张图片共${iframe!.bagReceive}个数据包');
|
||||||
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
|
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
|
||||||
} else {
|
} else {
|
||||||
// print('接收到的包数不等于总包数');
|
// print('接收到的包数不等于总包数');
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class CommandUDPReciverManager {
|
|||||||
// UDPTalkClass().isEndCall = true;
|
// UDPTalkClass().isEndCall = true;
|
||||||
// UDPTalkClass().stopLocalAudio();
|
// UDPTalkClass().stopLocalAudio();
|
||||||
// CallTalk().stopPcmSound();
|
// CallTalk().stopPcmSound();
|
||||||
// eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||||
// Get.back();
|
// Get.back();
|
||||||
UDPTalkClass().callNoAnswer(3);
|
UDPTalkClass().callNoAnswer(3);
|
||||||
// print('挂断反馈刷新UI1');
|
// print('挂断反馈刷新UI1');
|
||||||
|
|||||||
@ -170,6 +170,10 @@ class UDPTalkClass {
|
|||||||
void stopLocalAudio() async {
|
void stopLocalAudio() async {
|
||||||
audioPlayer.setReleaseMode(ReleaseMode.loop);
|
audioPlayer.setReleaseMode(ReleaseMode.loop);
|
||||||
await audioPlayer.stop();
|
await audioPlayer.stop();
|
||||||
|
if (playLocalAudioTimer != null) {
|
||||||
|
playLocalAudioTimer.cancel();
|
||||||
|
playLocalAudioSecond = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//呼叫有响铃无应答处理
|
//呼叫有响铃无应答处理
|
||||||
|
|||||||
44
star_lock/lib/tools/pay/wx_pay_tool.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import 'package:fluwx/fluwx.dart';
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 微信支付
|
||||||
|
///
|
||||||
|
///
|
||||||
|
class WxPayTool {
|
||||||
|
static bool isInit = false;
|
||||||
|
static Fluwx fluwx = Fluwx();
|
||||||
|
|
||||||
|
static init(String appId, String universalLink) {
|
||||||
|
fluwx.registerApi(appId: appId, universalLink: universalLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> pay(Payment payment, WeChatResponseSubscriber listener) async {
|
||||||
|
if (!isInit) {
|
||||||
|
isInit = true;
|
||||||
|
await init(payment.appId, '123');
|
||||||
|
//回调
|
||||||
|
responseListener(WeChatResponse response) {
|
||||||
|
if (response is WeChatPaymentResponse) {
|
||||||
|
//支付回调
|
||||||
|
listener.call(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//开启监听
|
||||||
|
fluwx.addSubscriber(responseListener);
|
||||||
|
}
|
||||||
|
fluwx.pay(which: payment);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Payment mapToPayment(dynamic data) {
|
||||||
|
Payment payment = Payment(
|
||||||
|
appId: data['appId'],
|
||||||
|
partnerId: data['partnerId'],
|
||||||
|
prepayId: data['prepayId'],
|
||||||
|
packageValue: data['packageValue'],
|
||||||
|
nonceStr: data['nonceStr'],
|
||||||
|
timestamp: int.tryParse(data['timeStamp']) ?? 0,
|
||||||
|
sign: data['sign'],
|
||||||
|
);
|
||||||
|
return payment;
|
||||||
|
}
|
||||||
|
}
|
||||||
32
star_lock/lib/webview/webview_logic.dart
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import 'package:get/get_core/src/get_main.dart';
|
||||||
|
import 'package:star_lock/network/request_interceptor.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
///
|
||||||
|
/// webview的工具类
|
||||||
|
/// 功能:
|
||||||
|
/// * 管理Schemes的跳转
|
||||||
|
/// * webview的UA表示
|
||||||
|
///
|
||||||
|
class WebViewLogic {
|
||||||
|
//pay的Scheme 列表
|
||||||
|
static const List<String> paySchemes = ['weixin:', 'alipay:'];
|
||||||
|
|
||||||
|
//获取公共UA信息
|
||||||
|
static String get userAgent => getUserAgent();
|
||||||
|
|
||||||
|
//判断是否是支付的Scheme
|
||||||
|
static bool judgePaySchemes(String url) {
|
||||||
|
for (int i = 0, j = paySchemes.length; i < j; i++) {
|
||||||
|
if (url.contains(paySchemes[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//运行支付的Scheme业务逻辑
|
||||||
|
static Future<void> runScheme(String url) async {
|
||||||
|
await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -124,7 +124,8 @@ dependencies:
|
|||||||
|
|
||||||
#网络图片缓存
|
#网络图片缓存
|
||||||
cached_network_image: ^3.2.0
|
cached_network_image: ^3.2.0
|
||||||
webview_flutter: ^4.2.3
|
webview_flutter: ^4.4.2
|
||||||
|
|
||||||
jpush_flutter: ^2.5.1
|
jpush_flutter: ^2.5.1
|
||||||
|
|
||||||
#视频播放器
|
#视频播放器
|
||||||
@ -155,6 +156,7 @@ dependencies:
|
|||||||
audio_service: ^0.18.12
|
audio_service: ^0.18.12
|
||||||
app_settings: ^5.1.1
|
app_settings: ^5.1.1
|
||||||
flutter_local_notifications: ^17.0.0
|
flutter_local_notifications: ^17.0.0
|
||||||
|
fluwx: ^4.5.5
|
||||||
|
|
||||||
system_settings: ^2.0.0
|
system_settings: ^2.0.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||