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">
|
||||
<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="filePath" value="$PROJECT_DIR$/lib/main_sky.dart"/>
|
||||
<option name="filePath" value="$PROJECT_DIR$/lib/main_sky_full.dart"/>
|
||||
<method v="2"/>
|
||||
</configuration>
|
||||
</component>
|
||||
@ -66,7 +66,7 @@ keytool -list -v -keystore android/app/sky.jks
|
||||
|
||||
## 编译
|
||||
```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
|
||||
|
||||
@ -36,8 +36,8 @@ android {
|
||||
keyAlias = 'starlock'
|
||||
keyPassword '123456'
|
||||
}
|
||||
// 下面的xie、pre、sky、xhj 都是自定义变量,自身不起任何作用,而是看哪里引用了它们
|
||||
xie {
|
||||
// 下面的local、pre、sky、xhj 都是自定义变量,自身不起任何作用,而是看哪里引用了它们
|
||||
local {
|
||||
storeFile file("starlock.keystore")
|
||||
storePassword '123456'
|
||||
keyAlias = 'starlock'
|
||||
@ -68,12 +68,12 @@ android {
|
||||
flavorDimensions "flavor-type"
|
||||
|
||||
productFlavors {
|
||||
xie {
|
||||
local {
|
||||
dimension "flavor-type"
|
||||
applicationId "com.starlock.lock.xie"
|
||||
applicationId "com.starlock.lock.local"
|
||||
signingConfig signingConfigs.pre
|
||||
resValue "string", "app_name", "星锁-xie"
|
||||
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.xie"
|
||||
resValue "string", "app_name", "星锁-local"
|
||||
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.local"
|
||||
}
|
||||
dev {
|
||||
dimension "flavor-type"
|
||||
@ -182,7 +182,7 @@ android {
|
||||
// 真实的解决办法
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
productFlavors.xie.signingConfig signingConfigs.pre
|
||||
productFlavors.local.signingConfig signingConfigs.pre
|
||||
productFlavors.dev.signingConfig signingConfigs.pre
|
||||
productFlavors.pre.signingConfig signingConfigs.pre
|
||||
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"
|
||||
|
||||
flavors:
|
||||
xie:
|
||||
local:
|
||||
app:
|
||||
name: "星锁-xie"
|
||||
name: "星锁-local"
|
||||
icon: "assets/icon/dev.png"
|
||||
android:
|
||||
applicationId: "com.starlock.lock.xie"
|
||||
applicationId: "com.starlock.lock.local"
|
||||
customConfig:
|
||||
signingConfig: signingConfigs.pre
|
||||
ios:
|
||||
bundleId: "com.starlock.lock.xie"
|
||||
bundleId: "com.starlock.lock.local"
|
||||
dev:
|
||||
app:
|
||||
name: "星锁-dev"
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.associated-domains</key>
|
||||
<array/>
|
||||
<key>com.apple.external-accessory.wireless-configuration</key>
|
||||
<true/>
|
||||
</dict>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
enum Flavor {
|
||||
xie,
|
||||
local,
|
||||
dev,
|
||||
pre,
|
||||
sky,
|
||||
@ -11,13 +11,16 @@ enum Flavor {
|
||||
class StarLockAMapKey {
|
||||
//iOS平台的key
|
||||
final String iosKey;
|
||||
|
||||
//Android平台的key
|
||||
final String androidKey;
|
||||
|
||||
const StarLockAMapKey({required this.iosKey, required this.androidKey});
|
||||
}
|
||||
|
||||
class F {
|
||||
static Flavor? appFlavor;
|
||||
|
||||
// 是否为精简模式(在一些应用商店场景下,需要精简掉一些功能)
|
||||
static bool isLite = false;
|
||||
|
||||
@ -25,8 +28,8 @@ class F {
|
||||
|
||||
static String get title {
|
||||
switch (appFlavor) {
|
||||
case Flavor.xie:
|
||||
return '星锁-xie';
|
||||
case Flavor.local:
|
||||
return '星锁-local';
|
||||
case Flavor.dev:
|
||||
return '星锁-dev';
|
||||
case Flavor.pre:
|
||||
@ -42,8 +45,8 @@ class F {
|
||||
|
||||
static String get navTitle {
|
||||
switch (appFlavor) {
|
||||
case Flavor.xie:
|
||||
return '${"starLock".tr}-xie';
|
||||
case Flavor.local:
|
||||
return '${"starLock".tr}-local';
|
||||
case Flavor.dev:
|
||||
return '${"starLock".tr}-dev';
|
||||
case Flavor.pre:
|
||||
@ -59,10 +62,8 @@ class F {
|
||||
|
||||
static String get apiPrefix {
|
||||
switch (appFlavor) {
|
||||
// case Flavor.ge:
|
||||
// return 'https://ge.lock.star-lock.cn';
|
||||
case Flavor.xie:
|
||||
return 'http://192.168.1.15:8022';
|
||||
case Flavor.local:
|
||||
return 'https://ge.lock.star-lock.cn';
|
||||
case Flavor.dev:
|
||||
return 'https://dev.lock.star-lock.cn';
|
||||
case Flavor.pre:
|
||||
@ -77,22 +78,20 @@ class F {
|
||||
throw Exception('flavor[$name] apiPrefix not found');
|
||||
}
|
||||
}
|
||||
|
||||
// StarLockAMapKey
|
||||
static StarLockAMapKey get aMapKey {
|
||||
switch (appFlavor) {
|
||||
case Flavor.xie:
|
||||
case Flavor.local:
|
||||
case Flavor.dev:
|
||||
return const StarLockAMapKey(
|
||||
androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe',
|
||||
iosKey: 'bd4496e6598ef49796e3a80715035b4d');
|
||||
androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe', iosKey: 'bd4496e6598ef49796e3a80715035b4d');
|
||||
case Flavor.pre:
|
||||
return const StarLockAMapKey(
|
||||
androidKey: '11d49b3f4fc09c04a02bbb7500925ba2',
|
||||
iosKey: '883a3355d2d77c2fdc2667030dc97ffe');
|
||||
androidKey: '11d49b3f4fc09c04a02bbb7500925ba2', iosKey: '883a3355d2d77c2fdc2667030dc97ffe');
|
||||
case Flavor.sky:
|
||||
return const StarLockAMapKey(
|
||||
androidKey: 'fb0d2a3e4208b36452cf636aa025a24f',
|
||||
iosKey: '86ca725a12a629c280e116a317aaba19');
|
||||
androidKey: 'fb0d2a3e4208b36452cf636aa025a24f', iosKey: '86ca725a12a629c280e116a317aaba19');
|
||||
// case Flavor.xhj:
|
||||
// return const StarLockAMapKey(
|
||||
// androidKey: 'todo',
|
||||
@ -101,5 +100,4 @@ class F {
|
||||
throw Exception('flavor[$name] aMapKey not found');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -12,8 +12,7 @@ class SendEmailNotificationPage extends StatefulWidget {
|
||||
const SendEmailNotificationPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SendEmailNotificationPage> createState() =>
|
||||
_SendEmailNotificationPageState();
|
||||
State<SendEmailNotificationPage> createState() => _SendEmailNotificationPageState();
|
||||
}
|
||||
|
||||
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
@ -21,87 +20,80 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_emailController.text =
|
||||
"亲爱的用户 \n\n你收到电子钥匙,请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
|
||||
_emailController.text = "亲爱的用户 \n\n你收到电子钥匙,请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "邮件通知",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: "786612630@qq.com",
|
||||
isHaveLine: true,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: "类型",
|
||||
rightTitle: "个人邮件",
|
||||
isHaveDirection: true,
|
||||
),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: "模板",
|
||||
rightTitle: "默认模板",
|
||||
appBar: TitleAppBar(barTitle: "邮件通知", haveBack: true, backgroundColor: AppColors.mainColor),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: "786612630@qq.com",
|
||||
isHaveLine: true,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: "类型",
|
||||
rightTitle: "个人邮件",
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true),
|
||||
Container(
|
||||
height: 360.h,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
||||
child: TextField(
|
||||
maxLines: 8,
|
||||
maxLength: 1000,
|
||||
textAlign: TextAlign.start,
|
||||
controller: _emailController,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 22.sp,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
|
||||
///设置边框的粗细
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
Container(height: 10.h),
|
||||
CommonItem(leftTitel: "模板", rightTitle: "默认模板", isHaveDirection: true, isHaveLine: true),
|
||||
Container(
|
||||
height: 360.h,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
||||
child: TextField(
|
||||
maxLines: 8,
|
||||
maxLength: 1000,
|
||||
textAlign: TextAlign.start,
|
||||
controller: _emailController,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 22.sp,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
|
||||
///用来配置输入框获取焦点时的颜色
|
||||
focusedBorder: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
///设置边框的粗细
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
|
||||
///设置边框的粗细
|
||||
width: 1,
|
||||
///用来配置输入框获取焦点时的颜色
|
||||
focusedBorder: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
|
||||
///设置边框的粗细
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(height: 40.h),
|
||||
SubmitBtn(
|
||||
btnName: '发送',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
],
|
||||
Container(height: 40.h),
|
||||
SubmitBtn(
|
||||
btnName: '发送',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -71,7 +71,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
|
||||
void _initRefreshLockDetailInfoDataEventAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_lockRefreshLockDetailInfoDataEvent = eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
||||
_lockRefreshLockDetailInfoDataEvent =
|
||||
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
@ -110,12 +111,14 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
BlueManage().connectDeviceName =
|
||||
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);
|
||||
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);
|
||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||
|
||||
@ -138,9 +141,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
children: [
|
||||
Visibility(
|
||||
visible:
|
||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == 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) // 正常使用、待接收
|
||||
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||
state.keyInfos.value.keyType ==
|
||||
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
|
||||
: false,
|
||||
@ -234,9 +247,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// logic.getStarLockStatus();
|
||||
ShowTipView().showSureAlertDialog("${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state
|
||||
.keyInfos.value.electricQuantityDate!
|
||||
.toString())}");
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
@ -263,11 +275,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
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),
|
||||
Text("--%", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
|
||||
Text("--%",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
SizedBox(width: 2.w),
|
||||
Icon(Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||
Icon(
|
||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||
size: 25.w, // 设置图标大小为 30
|
||||
),
|
||||
@ -561,11 +578,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
}));
|
||||
|
||||
// 设置
|
||||
showWidgetArr.add(bottomItem(
|
||||
'images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr,
|
||||
true,
|
||||
true, () {
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, true, () {
|
||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
"isOnlyOneData": state.isOnlyOneData
|
||||
@ -729,17 +743,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
TranslationLoader.lanKeys!.messageReminding!.tr,
|
||||
state.openDoorBtnisUneable.value,
|
||||
state.bottomBtnisEable.value, () {
|
||||
Get.toNamed(Routers.msgNotificationPage);
|
||||
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
||||
"lockId": state.keyInfos.value.lockId,
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
endWiddget.add(
|
||||
// 设置
|
||||
bottomItem(
|
||||
'images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr,
|
||||
true,
|
||||
true, () {
|
||||
bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, true, () {
|
||||
// logic.clickItemBtnAction(10);
|
||||
Get.toNamed(Routers.lockSetPage, arguments: {
|
||||
"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 height = 42.h;
|
||||
return GestureDetector(
|
||||
|
||||
@ -39,26 +39,30 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Obx(() => Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: Text(state.selectVideoSlot.value,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor)),
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.videoSlotPage,
|
||||
arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'catEyeConfigData': state.lockSetInfoData.value
|
||||
.lockSettingInfo!.catEyeConfig!.isNotEmpty
|
||||
? state.lockSetInfoData.value.lockSettingInfo!
|
||||
.catEyeConfig![0]
|
||||
: null
|
||||
}).then((value) => {logic.getLockSettingInfoData()});
|
||||
},
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.w),
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: Text(state.selectVideoSlot.value,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.videoSlotPage,
|
||||
arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'catEyeConfigData': state.lockSetInfoData.value
|
||||
.lockSettingInfo!.catEyeConfig!.isNotEmpty
|
||||
? state.lockSetInfoData.value.lockSettingInfo!
|
||||
.catEyeConfig![0]
|
||||
: null
|
||||
}).then((value) => {logic.getLockSettingInfoData()});
|
||||
},
|
||||
),
|
||||
),
|
||||
_buildSubTitleItem('有人出现时录像', '有人在门口出现10秒后开始录像。\n有人按门铃时立即录像',
|
||||
state.recordTime.value, () {
|
||||
@ -74,23 +78,26 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: '实时画面',
|
||||
rightTitle: state.realTimeMode.value,
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
isHaveRightWidget: false,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.liveVideoPage,
|
||||
arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'catEyeConfigData': state.lockSetInfoData.value
|
||||
.lockSettingInfo!.catEyeConfig!.isNotEmpty
|
||||
? state.lockSetInfoData.value.lockSettingInfo!
|
||||
.catEyeConfig![0]
|
||||
: null
|
||||
}).then((value) => {logic.getLockSettingInfoData()});
|
||||
},
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.w),
|
||||
child: CommonItem(
|
||||
leftTitel: '实时画面',
|
||||
rightTitle: state.realTimeMode.value,
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
isHaveRightWidget: false,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.liveVideoPage,
|
||||
arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'catEyeConfigData': state.lockSetInfoData.value
|
||||
.lockSettingInfo!.catEyeConfig!.isNotEmpty
|
||||
? state.lockSetInfoData.value.lockSettingInfo!
|
||||
.catEyeConfig![0]
|
||||
: null
|
||||
}).then((value) => {logic.getLockSettingInfoData()});
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)));
|
||||
@ -102,7 +109,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
|
||||
onTap: action,
|
||||
child: Container(
|
||||
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(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
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/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
class VideoSlotLogic extends BaseGetXController {
|
||||
final VideoSlotState state = VideoSlotState();
|
||||
@ -23,6 +24,13 @@ class VideoSlotLogic extends BaseGetXController {
|
||||
} else {
|
||||
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;
|
||||
@ -30,6 +38,20 @@ class VideoSlotLogic extends BaseGetXController {
|
||||
|
||||
//设置猫眼工作模式
|
||||
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(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
catEyeConfig: [
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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/time_picker/model/date_mode.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),
|
||||
),
|
||||
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();
|
||||
},
|
||||
),
|
||||
@ -238,10 +230,9 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
||||
onTap: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
|
||||
if (isEndTime == false) {
|
||||
state.startDate.value =
|
||||
'${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
state.startDate.value = DateTool().getYMDHNDateString(p, 3);
|
||||
} 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:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
class VideoSlotState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
@ -7,12 +8,8 @@ class VideoSlotState {
|
||||
|
||||
var isCustom = false.obs; //是否自定义
|
||||
DateTime dateTime = DateTime.now();
|
||||
final startDateTime = DateTime.now().obs; //开始时间:当日
|
||||
final endDateTime = DateTime.now().obs; //结束时间:次日
|
||||
|
||||
var startDate =
|
||||
'${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
||||
var endDate = '${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
||||
var startDate = DateTool().getNowDateWithType(6).obs; //默认为当前时间
|
||||
var endDate = DateTool().getNowDateWithType(6).obs; //默认为当前时间
|
||||
|
||||
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/lockSet/lockSetInfo_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
class FaceUnlockLogic extends BaseGetXController {
|
||||
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 state = Get.find<FaceUnlockLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
logic.getLockSettingInfoData();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -29,45 +35,57 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
||||
barTitle: TranslationLoader.lanKeys!.faceUnlocksSet!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
|
||||
rightTitle: "",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _switch(1))),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.automaticBrighteningScreen!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _switch(2))),
|
||||
_buildSubTitleItem(
|
||||
TranslationLoader.lanKeys!.sensingDistance!.tr, TranslationLoader.lanKeys!.sensingDistanceTip!.tr, state.senseDistance.value,
|
||||
() {
|
||||
_openBottomItemSheet(state.senseDistanceList.value, 0);
|
||||
}),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
_buildSubTitleItem(
|
||||
TranslationLoader.lanKeys!.preventWrongOpening!.tr, TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr, state.antiMisoperation.value, () {
|
||||
_openBottomItemSheet(state.antiMisoperationList.value, 1);
|
||||
}),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 30.h,
|
||||
)),
|
||||
_buildTipsView(),
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
)
|
||||
],
|
||||
));
|
||||
body: Obx(() => Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.w),
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
|
||||
rightTitle: "",
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _switch(1))),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.w),
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader
|
||||
.lanKeys!.automaticBrighteningScreen!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _switch(2))),
|
||||
),
|
||||
_buildSubTitleItem(
|
||||
TranslationLoader.lanKeys!.sensingDistance!.tr,
|
||||
TranslationLoader.lanKeys!.sensingDistanceTip!.tr,
|
||||
state.senseDistance.value, () {
|
||||
_openBottomItemSheet(state.senseDistanceList.value, 0);
|
||||
}),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
_buildSubTitleItem(
|
||||
TranslationLoader.lanKeys!.preventWrongOpening!.tr,
|
||||
TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr,
|
||||
state.antiMisoperation.value == 0
|
||||
? '关闭'
|
||||
: '${state.antiMisoperation.value}秒', () {
|
||||
_openBottomItemSheet(state.antiMisoperationStrList.value, 1);
|
||||
}),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 30.h,
|
||||
)),
|
||||
_buildTipsView(),
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
||||
Widget _buildSubTitleItem(
|
||||
@ -76,6 +94,7 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
||||
onTap: action,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 20.sp, right: 20.sp, top: 20.h),
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
@ -152,19 +171,20 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: getIndex == 1 ? state.faceOn.value : state.autoBright.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
if (getIndex == 1) {
|
||||
state.faceOn.value = value;
|
||||
} else {
|
||||
state.autoBright.value = value;
|
||||
}
|
||||
});
|
||||
if (getIndex == 1) {
|
||||
//设置面容开锁开关
|
||||
state.faceOn.value = value;
|
||||
logic.updateFaceSwitch();
|
||||
} else {
|
||||
//设置自动亮屏开关
|
||||
state.autoBright.value = value;
|
||||
logic.updateFaceConfig();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future _openBottomItemSheet(
|
||||
List<String> bottomItemList, int clickIndex) async {
|
||||
Future _openBottomItemSheet(List bottomItemList, int clickIndex) async {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
@ -178,13 +198,13 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
|
||||
//感应距离
|
||||
state.senseDistance.value =
|
||||
state.senseDistanceList.value[value];
|
||||
logic.updateFaceSenseDistance();
|
||||
} else if (clickIndex == 1) {
|
||||
//防误开
|
||||
state.antiMisoperation.value =
|
||||
state.antiMisoperationList.value[value];
|
||||
logic.updateFacePreventMisrun();
|
||||
}
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@ -1,20 +1,32 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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';
|
||||
|
||||
class FaceUnlockState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
|
||||
var isCheck = false.obs;
|
||||
var faceOn = false.obs; //面容开锁
|
||||
var autoBright = false.obs; //自动亮屏
|
||||
var senseDistance = TranslationLoader.lanKeys!.remote!.tr.obs; //感应距离
|
||||
var antiMisoperation = TranslationLoader.lanKeys!.close!.tr.obs; //防误开
|
||||
var senseDistanceList = [TranslationLoader.lanKeys!.remote!.tr, TranslationLoader.lanKeys!.closeRange!.tr].obs;
|
||||
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;
|
||||
var antiMisoperation = 0.obs; //防误开
|
||||
var senseDistanceList = [
|
||||
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(
|
||||
color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);
|
||||
@ -23,9 +35,18 @@ class FaceUnlockState {
|
||||
TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp);
|
||||
|
||||
late InlineSpan tipsPreviewSpan = TextSpan(children: [
|
||||
TextSpan(text: '${TranslationLoader.lanKeys!.addAndUseFaceWhenUnlocking!.tr}:\n', style: titleStyle),
|
||||
TextSpan(
|
||||
text:TranslationLoader.lanKeys!.addAndUseFaceWhenUnlockingTip!.tr,
|
||||
text: '${TranslationLoader.lanKeys!.addAndUseFaceWhenUnlocking!.tr}:\n',
|
||||
style: titleStyle),
|
||||
TextSpan(
|
||||
text: TranslationLoader.lanKeys!.addAndUseFaceWhenUnlockingTip!.tr,
|
||||
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,
|
||||
isHaveDirection: true,
|
||||
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,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.msgNotificationPage);
|
||||
Get.toNamed(Routers.msgNotificationPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
})),
|
||||
//猫眼设置
|
||||
Visibility(
|
||||
|
||||
@ -67,11 +67,13 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
||||
// ),
|
||||
CommonItem(
|
||||
leftTitel: '开门通知',
|
||||
rightTitle: "已启用",
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.openDoorNotifyPage);
|
||||
Get.toNamed(Routers.openDoorNotifyPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
});
|
||||
},
|
||||
),
|
||||
CommonItem(
|
||||
|
||||
@ -1,9 +1,18 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class MsgNotificationState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var isCheck = false.obs;
|
||||
var isLeaveHomeOpenDoor = false.obs; //离家开门
|
||||
var isDoorNotShut = false.obs; //门未关好
|
||||
var isSomeoneRing = 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/versionUndate/versionUndate_entity.dart';
|
||||
import 'openDoorNotify_state.dart';
|
||||
|
||||
class OpenDoorNotifyLogic extends BaseGetXController {
|
||||
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
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
logic.getLockNoticeSetting();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -1,7 +1,16 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class OpenDoorNotifyState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var pageNum = 1.obs; //请求页码
|
||||
final pageSize = 20.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() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getTVDataRefreshUIEvent =
|
||||
eventBus.on<GetTVDataRefreshUI>().listen((event) {
|
||||
eventBus.on<GetTVDataRefreshUI>().listen((event) async {
|
||||
if (event.tvList.isNotEmpty) {
|
||||
print('收到图片了啦啦啦啦啦啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊');
|
||||
// 预加载图片数据
|
||||
Uint8List imageData = Uint8List.fromList(event.tvList);
|
||||
// 更新状态
|
||||
|
||||
@ -3,6 +3,6 @@ import 'flavors.dart';
|
||||
import 'main.dart' as runner;
|
||||
|
||||
Future<void> main() async {
|
||||
F.appFlavor = Flavor.xie;
|
||||
F.appFlavor = Flavor.local;
|
||||
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_state.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 '../../tools/baseGetXController.dart';
|
||||
@ -26,18 +33,74 @@ class LockMallLogic extends BaseGetXController {
|
||||
state.webProgress.value = 1.0;
|
||||
},
|
||||
onWebResourceError: (WebResourceError error) {},
|
||||
onNavigationRequest: (NavigationRequest request) {
|
||||
// if (request.url.startsWith('https://www.youtube.com/')) {
|
||||
// return NavigationDecision.prevent;
|
||||
// }
|
||||
onNavigationRequest: (NavigationRequest request) async {
|
||||
//路由跳转逻辑
|
||||
if (WebViewLogic.judgePaySchemes(request.url)) {
|
||||
await WebViewLogic.runScheme(request.url);
|
||||
return NavigationDecision.prevent;
|
||||
}
|
||||
return NavigationDecision.navigate;
|
||||
},
|
||||
),
|
||||
);
|
||||
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
|
||||
Future<void> onReady() async {
|
||||
print("ready home");
|
||||
@ -48,7 +111,6 @@ class LockMallLogic extends BaseGetXController {
|
||||
void onInit() {
|
||||
print("init home");
|
||||
super.onInit();
|
||||
|
||||
getMallURLRequest();
|
||||
}
|
||||
|
||||
|
||||
@ -6,8 +6,6 @@ import 'package:star_lock/mine/mall/lockMall_logic.dart';
|
||||
import 'package:star_lock/tools/titleAppBar.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../../translations/trans_lib.dart';
|
||||
|
||||
class LockMallPage extends StatefulWidget {
|
||||
const LockMallPage({Key? key}) : super(key: key);
|
||||
|
||||
@ -29,30 +27,33 @@ class _LockMallPageState extends State<LockMallPage> {
|
||||
// FIXME 如果未登录状态,应先跳转登录页
|
||||
// FIXME url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录
|
||||
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
appBar: TitleAppBar(
|
||||
barTitle: getWebTitle(),
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Obx(() => Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(bottom: 10.w),
|
||||
child: LinearProgressIndicator(
|
||||
value: state.webProgress.value,
|
||||
backgroundColor: Colors.grey,
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
||||
return PopScope(
|
||||
onPopInvoked: logic.canGoBack,
|
||||
canPop: false,
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
appBar: TitleAppBar(
|
||||
barTitle: getWebTitle(),
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Obx(() => Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(bottom: 10.w),
|
||||
child: LinearProgressIndicator(
|
||||
value: state.webProgress.value,
|
||||
backgroundColor: Colors.grey,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: WebViewWidget(controller: state.mallWebView),
|
||||
),
|
||||
],
|
||||
)));
|
||||
Expanded(
|
||||
child: WebViewWidget(controller: state.mallWebView),
|
||||
),
|
||||
],
|
||||
))),
|
||||
);
|
||||
}
|
||||
|
||||
String getWebTitle() {
|
||||
|
||||
@ -1,11 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/webview/webview_logic.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class LockMallState {
|
||||
var lockMallUrl = "".obs;
|
||||
var webProgress = 0.0.obs;
|
||||
late WebViewController mallWebView = WebViewController()
|
||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
..setBackgroundColor(Colors.white);
|
||||
late WebViewController mallWebView = initWebViewController();
|
||||
|
||||
//初始化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:permission_handler/permission_handler.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/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||
@ -108,16 +109,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
||||
rightTitle: state.mineInfoData.value.nickname != null
|
||||
? state.mineInfoData.value.nickname!
|
||||
: "",
|
||||
rightTitle: state.mineInfoData.value.nickname != null ? state.mineInfoData.value.nickname! : "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditNamePage, arguments: {
|
||||
'nickName': state.mineInfoData.value.nickname
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoEditNamePage,
|
||||
arguments: {'nickName': state.mineInfoData.value.nickname})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
|
||||
@ -129,16 +127,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
||||
action: () {
|
||||
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
||||
if (state.mineInfoData.value.mobile!.isNotEmpty) {
|
||||
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage, arguments: {
|
||||
'mobile': state.mineInfoData.value.mobile!,
|
||||
'isFrom': '1'
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||
'mobile': state.mineInfoData.value.mobile!,
|
||||
'isFrom': '1'
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
|
||||
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -151,18 +146,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
||||
action: () {
|
||||
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
||||
if (state.mineInfoData.value.email!.isNotEmpty) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
'isFrom': '2',
|
||||
'email': state.mineInfoData.value.email!
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||
'isFrom': '2',
|
||||
'email': state.mineInfoData.value.email!
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
|
||||
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
@ -171,30 +161,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoResetPasswordPage);
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoResetPasswordPage);
|
||||
}),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
||||
rightTitle:
|
||||
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
|
||||
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
if (state.mineInfoData.value.haveSafeAnswer == 0) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoSetSafetyProblemPage)
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage)
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoViewSafetyProblemPage);
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoViewSafetyProblemPage);
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
rightTitle: state.mineInfoData.value.countryName != null
|
||||
? state.mineInfoData.value.countryName!
|
||||
: "",
|
||||
rightTitle: state.mineInfoData.value.countryName != null ? state.mineInfoData.value.countryName! : "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: false)),
|
||||
],
|
||||
@ -228,7 +212,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
||||
}
|
||||
|
||||
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) {
|
||||
setState(() {
|
||||
state.hasPhotoPermission.value = true; // 如果权限被授予,更新状态变量
|
||||
@ -287,13 +273,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
||||
int getSelectIndex = value;
|
||||
if (getSelectIndex == 0) {
|
||||
//拍照选项
|
||||
state.hasCameraPermission.value == true
|
||||
? selectCamera()
|
||||
: _requestCameraPermission();
|
||||
state.hasCameraPermission.value == true ? selectCamera() : _requestCameraPermission();
|
||||
} else if (getSelectIndex == 1) {
|
||||
state.hasPhotoPermission.value == true
|
||||
? selectImage()
|
||||
: _requestPhotoPermission();
|
||||
state.hasPhotoPermission.value == true ? selectImage() : _requestPhotoPermission();
|
||||
}
|
||||
},
|
||||
);
|
||||
@ -302,8 +284,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
|
||||
|
||||
///拍摄照片
|
||||
selectCamera() async {
|
||||
XFile? photo = await state.imagePicker.pickImage(
|
||||
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
|
||||
XFile? photo =
|
||||
await state.imagePicker.pickImage(source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
|
||||
if (photo != null) {
|
||||
state.image = photo;
|
||||
// logic.getUpTokenRequest();
|
||||
|
||||
@ -191,4 +191,7 @@ abstract class Api {
|
||||
'/lockSetting/updateCatEyeConfig'; //猫眼相关设置
|
||||
|
||||
final String updateFaceConfigURL = '/lockSetting/updateFaceConfig'; //面容相关设置
|
||||
|
||||
final String getLockNoticeSettingURL =
|
||||
'/lockSetting/getLockNoticeSetting'; //获取锁消息设置
|
||||
}
|
||||
|
||||
@ -1732,8 +1732,9 @@ class ApiProvider extends BaseProvider {
|
||||
'faceSwitch': faceSwitch,
|
||||
}));
|
||||
|
||||
// 设置面容开锁
|
||||
Future<Response> updateFaceConfig(int lockId, int faceInductionDistance) =>
|
||||
// 设置面容感应距离
|
||||
Future<Response> updateFaceSenseDistance(
|
||||
int lockId, int faceInductionDistance) =>
|
||||
post(
|
||||
updateFaceConfigURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1760,6 +1761,13 @@ class ApiProvider extends BaseProvider {
|
||||
'lockId': lockId,
|
||||
'faceAutoLightScreen': faceAutoLightScreen,
|
||||
}));
|
||||
|
||||
// 获取锁消息设置
|
||||
Future<Response> getLockNoticeSetting(int lockId) => post(
|
||||
getLockNoticeSettingURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}));
|
||||
}
|
||||
|
||||
extension ExtensionString on String {
|
||||
|
||||
@ -1769,10 +1769,10 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 设置面容感应距离
|
||||
Future<VersionUndateEntity> updateFaceConfig(
|
||||
Future<VersionUndateEntity> updateFaceSenseDistance(
|
||||
{required int lockId, required int faceInductionDistance}) async {
|
||||
final res =
|
||||
await apiProvider.updateFaceConfig(lockId, faceInductionDistance);
|
||||
final res = await apiProvider.updateFaceSenseDistance(
|
||||
lockId, faceInductionDistance);
|
||||
return VersionUndateEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1791,4 +1791,11 @@ class ApiRepository {
|
||||
lockId, faceAutoLightScreen);
|
||||
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/storage.dart';
|
||||
|
||||
FutureOr<Request> requestInterceptor(Request request) async {
|
||||
request.headers['User-Agent'] =
|
||||
//公共获取UA
|
||||
String getUserAgent() {
|
||||
//赋值变量方便调试
|
||||
String ua =
|
||||
'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['Content-Type'] = 'application/json';
|
||||
// request.headers['token'] = StoreService.to.userToken!;
|
||||
|
||||
@ -102,12 +102,15 @@ class CallTalk {
|
||||
iframe!.bb!.addAll(getList);
|
||||
}
|
||||
// print(
|
||||
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
|
||||
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
|
||||
|
||||
// 如果收到的包数等于总包数,说明这一帧数据已经接收完毕
|
||||
if (iframe!.bagNum == iframe!.bagReceive) {
|
||||
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
||||
// 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!));
|
||||
} else {
|
||||
// print('接收到的包数不等于总包数');
|
||||
|
||||
@ -120,7 +120,7 @@ class CommandUDPReciverManager {
|
||||
// UDPTalkClass().isEndCall = true;
|
||||
// UDPTalkClass().stopLocalAudio();
|
||||
// CallTalk().stopPcmSound();
|
||||
// eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||
// Get.back();
|
||||
UDPTalkClass().callNoAnswer(3);
|
||||
// print('挂断反馈刷新UI1');
|
||||
|
||||
@ -170,6 +170,10 @@ class UDPTalkClass {
|
||||
void stopLocalAudio() async {
|
||||
audioPlayer.setReleaseMode(ReleaseMode.loop);
|
||||
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
|
||||
webview_flutter: ^4.2.3
|
||||
webview_flutter: ^4.4.2
|
||||
|
||||
jpush_flutter: ^2.5.1
|
||||
|
||||
#视频播放器
|
||||
@ -155,6 +156,7 @@ dependencies:
|
||||
audio_service: ^0.18.12
|
||||
app_settings: ^5.1.1
|
||||
flutter_local_notifications: ^17.0.0
|
||||
fluwx: ^4.5.5
|
||||
|
||||
system_settings: ^2.0.0
|
||||
dev_dependencies:
|
||||
|
||||