Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release
This commit is contained in:
commit
4fa11a4a0a
@ -867,5 +867,7 @@
|
|||||||
"自定义短信模版":"Custom SMS template",
|
"自定义短信模版":"Custom SMS template",
|
||||||
"自定义邮件模版":"Custom email template",
|
"自定义邮件模版":"Custom email template",
|
||||||
"名称":"Name",
|
"名称":"Name",
|
||||||
"星星锁": "Star lock"
|
"星星锁": "Star lock",
|
||||||
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "To receive important updates, please click 'OK' and enable notifications in the settings."
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -899,5 +899,7 @@
|
|||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
"星星锁": "星星锁"
|
"星星锁": "星星锁",
|
||||||
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -867,5 +867,6 @@
|
|||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
"星星锁": "星星锁"
|
"星星锁": "星星锁",
|
||||||
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -325,7 +325,8 @@ class BlueManage {
|
|||||||
mac != null) {
|
mac != null) {
|
||||||
scanSingleTimer?.cancel();
|
scanSingleTimer?.cancel();
|
||||||
//兼容android 的低配手机
|
//兼容android 的低配手机
|
||||||
await doNotSearchBLE(mac, connectStateCallBack);
|
await doNotSearchBLE(mac, connectStateCallBack,
|
||||||
|
isAddEquipment: isAddEquipment);
|
||||||
scanSingleTimer = Timer(3.seconds, () {
|
scanSingleTimer = Timer(3.seconds, () {
|
||||||
scanSingleTimer?.cancel();
|
scanSingleTimer?.cancel();
|
||||||
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) => null);
|
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) => null);
|
||||||
@ -384,6 +385,7 @@ class BlueManage {
|
|||||||
isAddEquipment == false) {
|
isAddEquipment == false) {
|
||||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||||
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
EasyLoading.showToast('该锁已被重置'.tr, duration: 2000.milliseconds);
|
||||||
|
scanDevices.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//尝试连接设备
|
//尝试连接设备
|
||||||
@ -392,7 +394,8 @@ class BlueManage {
|
|||||||
|
|
||||||
//直接给蓝牙设备写入
|
//直接给蓝牙设备写入
|
||||||
Future<void> doNotSearchBLE(
|
Future<void> doNotSearchBLE(
|
||||||
String masAdds, ConnectStateCallBack connectStateCallBack) async {
|
String masAdds, ConnectStateCallBack connectStateCallBack,
|
||||||
|
{bool isAddEquipment = false}) async {
|
||||||
await FlutterBluePlus.stopScan();
|
await FlutterBluePlus.stopScan();
|
||||||
if (bluetoothConnectDevice == null ||
|
if (bluetoothConnectDevice == null ||
|
||||||
bluetoothConnectDevice?.remoteId.str != masAdds) {
|
bluetoothConnectDevice?.remoteId.str != masAdds) {
|
||||||
@ -401,12 +404,14 @@ class BlueManage {
|
|||||||
_initListenConnectionState();
|
_initListenConnectionState();
|
||||||
}
|
}
|
||||||
//尝试连接设备
|
//尝试连接设备
|
||||||
await bluetoothDeviceConnect(bluetoothConnectDevice!, connectStateCallBack);
|
await bluetoothDeviceConnect(bluetoothConnectDevice!, connectStateCallBack,
|
||||||
|
isAddEquipment: isAddEquipment);
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备连接
|
//设备连接
|
||||||
Future<void> bluetoothDeviceConnect(BluetoothDevice bluetoothConnectDevice,
|
Future<void> bluetoothDeviceConnect(BluetoothDevice bluetoothConnectDevice,
|
||||||
ConnectStateCallBack connectStateCallBack) async {
|
ConnectStateCallBack connectStateCallBack,
|
||||||
|
{bool isAddEquipment = false}) async {
|
||||||
// 重连三次
|
// 重连三次
|
||||||
const int maxAttempts = 3;
|
const int maxAttempts = 3;
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
@ -430,23 +435,22 @@ class BlueManage {
|
|||||||
|
|
||||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||||
try {
|
try {
|
||||||
bluetoothConnectDevice!
|
final List<BluetoothService> services =
|
||||||
.discoverServices()
|
await bluetoothConnectDevice.discoverServices();
|
||||||
.then((List<BluetoothService> services) {
|
//循环判断服务
|
||||||
for (final BluetoothService service in services) {
|
for (final BluetoothService service in services) {
|
||||||
if (service.uuid == _serviceIdConnect) {
|
if (service.uuid == _serviceIdConnect) {
|
||||||
for (final BluetoothCharacteristic characteristic
|
for (final BluetoothCharacteristic characteristic
|
||||||
in service.characteristics) {
|
in service.characteristics) {
|
||||||
if (characteristic.characteristicUuid ==
|
if (characteristic.characteristicUuid ==
|
||||||
_characteristicIdSubscription) {
|
_characteristicIdSubscription) {
|
||||||
_subScribeToCharacteristic(characteristic);
|
_subScribeToCharacteristic(characteristic);
|
||||||
bluetoothConnectionState = BluetoothConnectionState.connected;
|
bluetoothConnectionState = BluetoothConnectionState.connected;
|
||||||
connectStateCallBack(bluetoothConnectionState!);
|
connectStateCallBack(bluetoothConnectionState!);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
||||||
connectStateCallBack(bluetoothConnectionState!);
|
connectStateCallBack(bluetoothConnectionState!);
|
||||||
|
|||||||
@ -52,6 +52,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
|
|||||||
@ -54,6 +54,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.card!.tr,
|
barTitle: TranslationLoader.lanKeys!.card!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
|
|||||||
@ -51,6 +51,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.electronicKey!.tr,
|
barTitle: TranslationLoader.lanKeys!.electronicKey!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
|
|||||||
@ -51,6 +51,7 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.face!.tr,
|
barTitle: TranslationLoader.lanKeys!.face!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
|
|||||||
@ -55,6 +55,7 @@ class _FingerprintListPageState extends State<FingerprintListPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.fingerprint!.tr,
|
barTitle: TranslationLoader.lanKeys!.fingerprint!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
|
|||||||
@ -4,21 +4,21 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
import 'fingerprintListData_entity.dart';
|
import 'fingerprintListData_entity.dart';
|
||||||
|
|
||||||
class FingerprintListState{
|
class FingerprintListState{ // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
final lockId = 0.obs;
|
|
||||||
|
|
||||||
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
|
||||||
var isDeletAll = false;
|
|
||||||
var deletKeyID = "0";
|
|
||||||
var deletFingerNo = 0;
|
|
||||||
|
|
||||||
final fingerprintItemListData = <FingerprintItemData>[].obs;
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
|
||||||
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
|
||||||
|
|
||||||
FingerprintListState() {
|
FingerprintListState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
lockId.value = map["lockId"];
|
lockId.value = map['lockId'];
|
||||||
}
|
}
|
||||||
|
final RxInt lockId = 0.obs;
|
||||||
|
|
||||||
|
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
||||||
|
bool isDeletAll = false;
|
||||||
|
String deletKeyID = '0';
|
||||||
|
int deletFingerNo = 0;
|
||||||
|
|
||||||
|
final RxList<FingerprintItemData> fingerprintItemListData = <FingerprintItemData>[].obs;
|
||||||
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
RxBool ifCurrentScreen = true.obs;
|
||||||
}
|
}
|
||||||
@ -52,6 +52,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.password!.tr,
|
barTitle: TranslationLoader.lanKeys!.password!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_settings.dart';
|
import '../../../app_settings/app_settings.dart';
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
@ -17,7 +21,8 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
|
|
||||||
Future<LockListInfoEntity> getStarLockInfo(
|
Future<LockListInfoEntity> getStarLockInfo(
|
||||||
{bool isUnShowLoading = false}) async {
|
{bool isUnShowLoading = false}) async {
|
||||||
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
final LockListInfoEntity entity =
|
||||||
|
await ApiRepository.to.getStarLockListInfo(
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
isUnShowLoading: isUnShowLoading,
|
isUnShowLoading: isUnShowLoading,
|
||||||
@ -59,33 +64,35 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
|
|
||||||
/// 获取联网类型
|
/// 获取联网类型
|
||||||
void getConnectType() async {
|
void getConnectType() async {
|
||||||
var connectResult = await (Connectivity().checkConnectivity());
|
final ConnectivityResult connectResult =
|
||||||
|
await (Connectivity().checkConnectivity());
|
||||||
if (connectResult == ConnectivityResult.mobile) {
|
if (connectResult == ConnectivityResult.mobile) {
|
||||||
// _netType = "4G";
|
// _netType = "4G";
|
||||||
state.networkConnectionStatus.value = 1;
|
state.networkConnectionStatus.value = 1;
|
||||||
AppLog.log("网络连接: 4G 4G 4G 4G 4G");
|
AppLog.log('网络连接: 4G 4G 4G 4G 4G');
|
||||||
} else if (connectResult == ConnectivityResult.wifi) {
|
} else if (connectResult == ConnectivityResult.wifi) {
|
||||||
// _netType = "wifi";
|
// _netType = "wifi";
|
||||||
state.networkConnectionStatus.value = 1;
|
state.networkConnectionStatus.value = 1;
|
||||||
AppLog.log("网络连接: wifi wifi wifi wifi wifi");
|
AppLog.log('网络连接: wifi wifi wifi wifi wifi');
|
||||||
} else {
|
} else {
|
||||||
// _netType = "未连接";
|
// _netType = "未连接";
|
||||||
state.networkConnectionStatus.value = 0;
|
state.networkConnectionStatus.value = 0;
|
||||||
AppLog.log("网络连接: 未连接 未连接 未连接 未连接 未连接");
|
AppLog.log('网络连接: 未连接 未连接 未连接 未连接 未连接');
|
||||||
// showToast("网络访问失败,请检查网络是否正常");
|
// showToast("网络访问失败,请检查网络是否正常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 判断网络是否连接
|
/// 判断网络是否连接
|
||||||
Future<bool> isConnected() async {
|
Future<bool> isConnected() async {
|
||||||
var connectResult = await (Connectivity().checkConnectivity());
|
final ConnectivityResult connectResult =
|
||||||
|
await Connectivity().checkConnectivity();
|
||||||
return connectResult != ConnectivityResult.none;
|
return connectResult != ConnectivityResult.none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 设置网络切换监听
|
/// 设置网络切换监听
|
||||||
connectListener() async {
|
Future<void> connectListener() async {
|
||||||
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
||||||
AppLog.log("设置网络切换监听:$result");
|
AppLog.log('设置网络切换监听:$result');
|
||||||
if (state.networkConnectionStatus.value == 0 &&
|
if (state.networkConnectionStatus.value == 0 &&
|
||||||
result != ConnectivityResult.none) {
|
result != ConnectivityResult.none) {
|
||||||
// 从无网络到有网络
|
// 从无网络到有网络
|
||||||
@ -95,36 +102,52 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 检测推送是否开启
|
||||||
|
Future<void> checkWhetherPushIsEnabled() async {
|
||||||
|
bool notificationEnabled = false;
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
notificationEnabled = await FlutterLocalNotificationsPlugin()
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
|
?.areNotificationsEnabled() ??
|
||||||
|
false;
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
notificationEnabled = await FlutterLocalNotificationsPlugin()
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
IOSFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestPermissions(
|
||||||
|
alert: true,
|
||||||
|
badge: false,
|
||||||
|
sound: true,
|
||||||
|
) ??
|
||||||
|
false;
|
||||||
|
}
|
||||||
|
if (!notificationEnabled) {
|
||||||
|
//推送未开启
|
||||||
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。'.tr, () async {
|
||||||
|
openAppSettings();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// 开启UDP
|
// 开启UDP
|
||||||
UdpHelp().openUDP();
|
UdpHelp().openUDP();
|
||||||
|
|
||||||
BlueManage();
|
BlueManage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
checkWhetherPushIsEnabled();
|
||||||
// getLockInfo();
|
|
||||||
// 设置网络变化监听
|
|
||||||
// connectListener();
|
|
||||||
// 获取网络连接状态
|
|
||||||
// getConnectType();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
// refreshController.dispose();
|
|
||||||
// _teamEvent.cancel();
|
|
||||||
// state.timer.cancel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,9 +54,6 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
// if (mounted) {
|
|
||||||
// setState(() {});
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -8,50 +8,41 @@ class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{
|
|||||||
final AppUnlockNeedMobileNetworkingLockState state = AppUnlockNeedMobileNetworkingLockState();
|
final AppUnlockNeedMobileNetworkingLockState state = AppUnlockNeedMobileNetworkingLockState();
|
||||||
|
|
||||||
//请求锁列表
|
//请求锁列表
|
||||||
Future<List<LockItemData>> mockNetworkDataRequest() async {
|
Future<SelectLockListEntity> mockNetworkDataRequest() async {
|
||||||
SelectLockListEntity entity = await ApiRepository.to.selectLockList();
|
final SelectLockListEntity entity = await ApiRepository.to.selectLockList(searchStr: state.searchController.text);
|
||||||
List<LockItemData> dataList = [];
|
List<LockItemData> dataList = <LockItemData>[];
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
dataList = entity.data!.list!;
|
dataList = entity.data!.list!;
|
||||||
state.lockItemList.value = dataList;
|
state.lockItemList.value = dataList;
|
||||||
for (int i = 0; i < dataList.length; i++) {
|
for (int i = 0; i < dataList.length; i++) {
|
||||||
var itemData = dataList[i];
|
final LockItemData itemData = dataList[i];
|
||||||
if (itemData.appUnlockOnline == 1) {
|
if (itemData.appUnlockOnline == 1) {
|
||||||
state.selectLockIdList.add(itemData.lockId);
|
state.selectLockIdList.add(itemData.lockId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dataList;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
//APP开锁时需手机联网的锁
|
//APP开锁时需手机联网的锁
|
||||||
Future<void> setAppUnlockMustOnlineRequest() async {
|
Future<void> setAppUnlockMustOnlineRequest() async {
|
||||||
SelectLockListEntity entity =
|
final SelectLockListEntity entity =
|
||||||
await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList);
|
await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("操作成功");
|
showToast('操作成功');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// TODO: implement onClose
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,11 +1,14 @@
|
|||||||
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/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_state.dart';
|
||||||
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
|
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/commonItem.dart';
|
import '../../../tools/commonItem.dart';
|
||||||
|
import '../../../tools/keySearchWidget.dart';
|
||||||
import '../../../tools/noData.dart';
|
import '../../../tools/noData.dart';
|
||||||
|
import '../../../tools/storage.dart';
|
||||||
import '../../../tools/submitBtn.dart';
|
import '../../../tools/submitBtn.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
@ -20,19 +23,30 @@ class APPUnlockNeedMobileNetworkingLockPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMobileNetworkingLockPage> {
|
class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMobileNetworkingLockPage> {
|
||||||
final logic = Get.put(AppUnlockNeedMobileNetworkingLockLogic());
|
final AppUnlockNeedMobileNetworkingLockLogic logic = Get.put(AppUnlockNeedMobileNetworkingLockLogic());
|
||||||
final state = Get.find<AppUnlockNeedMobileNetworkingLockLogic>().state;
|
final AppUnlockNeedMobileNetworkingLockState state = Get.find<AppUnlockNeedMobileNetworkingLockLogic>().state;
|
||||||
|
|
||||||
|
Future<void> getHttpData() async {
|
||||||
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
logic.mockNetworkDataRequest().then((SelectLockListEntity value) {
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
getHttpData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader
|
barTitle: TranslationLoader
|
||||||
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
||||||
@ -48,12 +62,19 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
|||||||
// ],
|
// ],
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Obx(() => state.lockItemList.value.isEmpty ? NoData() :Column(
|
body: Obx(() => state.lockItemList.value.isEmpty ? NoData() :Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
|
KeySearchWidget(
|
||||||
|
editingController: state.searchController,
|
||||||
|
onSubmittedAction: () {
|
||||||
|
state.lockItemList.value = [];
|
||||||
|
logic.mockNetworkDataRequest();
|
||||||
|
},
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(30.w),
|
padding: EdgeInsets.all(15.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!
|
TranslationLoader.lanKeys!
|
||||||
@ -65,14 +86,14 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
|||||||
),
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.checkAll!.tr,
|
leftTitel: TranslationLoader.lanKeys!.checkAll!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: GestureDetector(
|
rightWidget: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
state.isCheckAll.value = !state.isCheckAll.value;
|
state.isCheckAll.value = !state.isCheckAll.value;
|
||||||
for(LockItemData lockItemData in state.lockItemList.value){
|
for(final LockItemData lockItemData in state.lockItemList.value){
|
||||||
if(state.isCheckAll.value == true){
|
if(state.isCheckAll.value == true){
|
||||||
lockItemData.appUnlockOnline = 1;
|
lockItemData.appUnlockOnline = 1;
|
||||||
state.selectLockIdList.add(lockItemData.lockId);
|
state.selectLockIdList.add(lockItemData.lockId);
|
||||||
@ -84,7 +105,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
|||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: Obx(() => Row(
|
child: Obx(() => Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
state.isCheckAll.value ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png',
|
state.isCheckAll.value ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png',
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
@ -97,8 +118,8 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: state.lockItemList.value.length,
|
itemCount: state.lockItemList.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
LockItemData itemData = state.lockItemList.value[index];
|
final LockItemData itemData = state.lockItemList.value[index];
|
||||||
// if(state.isCheckAll.value == true){
|
// if(state.isCheckAll.value == true){
|
||||||
// itemData.isCheck = true;
|
// itemData.isCheck = true;
|
||||||
// }else{
|
// }else{
|
||||||
@ -113,7 +134,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
|||||||
if (state.selectLockIdList.isNotEmpty) {
|
if (state.selectLockIdList.isNotEmpty) {
|
||||||
logic.setAppUnlockMustOnlineRequest();
|
logic.setAppUnlockMustOnlineRequest();
|
||||||
} else {
|
} else {
|
||||||
logic.showToast("请选择需设置的锁");
|
logic.showToast('请选择需设置的锁');
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -152,7 +173,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
|||||||
borderRadius: BorderRadius.circular(10.w),
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 15.w,
|
width: 15.w,
|
||||||
),
|
),
|
||||||
@ -166,10 +187,14 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
Text(
|
Expanded(child: Text(
|
||||||
itemData.lockAlias ?? "",
|
itemData.lockAlias ?? '',
|
||||||
style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600),
|
style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600),
|
||||||
)
|
)),
|
||||||
|
// Text(
|
||||||
|
// itemData.lockAlias ?? '',
|
||||||
|
// style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600),
|
||||||
|
// )
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import 'selectLockListEntity.dart';
|
import 'selectLockListEntity.dart';
|
||||||
|
|
||||||
class AppUnlockNeedMobileNetworkingLockState {
|
class AppUnlockNeedMobileNetworkingLockState {
|
||||||
var lockItemList = <LockItemData>[].obs;
|
RxList<LockItemData> lockItemList = <LockItemData>[].obs;
|
||||||
var selectLockIdList = [];
|
List selectLockIdList = [];
|
||||||
var isCheckAll = false.obs;
|
RxBool isCheckAll = false.obs;
|
||||||
|
|
||||||
|
final TextEditingController searchController = TextEditingController();
|
||||||
}
|
}
|
||||||
@ -595,8 +595,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
'lockIds': lockIds,
|
'lockIds': lockIds,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> selectLockList() =>
|
Future<Response> selectLockList(String searchStr) =>
|
||||||
post(selectLockListURL.toUrl, jsonEncode({}));
|
post(selectLockListURL.toUrl, jsonEncode({
|
||||||
|
'searchStr': searchStr,
|
||||||
|
}));
|
||||||
|
|
||||||
//APP开锁时需手机联网的锁
|
//APP开锁时需手机联网的锁
|
||||||
Future<Response> setAppUnlockMustOnline(List lockIdList) => post(
|
Future<Response> setAppUnlockMustOnline(List lockIdList) => post(
|
||||||
|
|||||||
@ -618,8 +618,8 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//选择锁列表
|
//选择锁列表
|
||||||
Future<SelectLockListEntity> selectLockList() async {
|
Future<SelectLockListEntity> selectLockList({String? searchStr}) async {
|
||||||
final res = await apiProvider.selectLockList();
|
final res = await apiProvider.selectLockList(searchStr ?? '');
|
||||||
return SelectLockListEntity.fromJson(res.body);
|
return SelectLockListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import 'package:star_lock/app.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||||
// Build our app and trigger a frame.
|
// Build our app and trigger a frame.
|
||||||
await tester.pumpWidget(const MyApp());
|
await tester.pumpWidget(MyApp(isLogin: false));
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
// Verify that our counter starts at 0.
|
||||||
expect(find.text('0'), findsOneWidget);
|
expect(find.text('0'), findsOneWidget);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user