fix: 调整列表左滑无法删除的问题
This commit is contained in:
parent
a4892633a3
commit
5ed7e4013e
@ -96,8 +96,8 @@ class LockListLogic extends BaseGetXController {
|
|||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
keyID: '1',
|
keyID: '1',
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: state.lockListInfoItemEntity.bluetooth!.publicKey!.cast<int>(),
|
publicKey: state.lockListInfoItemEntity.value.bluetooth!.publicKey!.cast<int>(),
|
||||||
privateKey: state.lockListInfoItemEntity.bluetooth!.privateKey!.cast<int>(),
|
privateKey: state.lockListInfoItemEntity.value.bluetooth!.privateKey!.cast<int>(),
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
@ -173,7 +173,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
/// 以下为删除逻辑
|
/// 以下为删除逻辑
|
||||||
void deleyLockLogicOfRoles() {
|
void deleyLockLogicOfRoles() {
|
||||||
if (state.lockListInfoItemEntity.isLockOwner == 1) {
|
if (state.lockListInfoItemEntity.value.isLockOwner == 1) {
|
||||||
// 超级管理员必须通过连接蓝牙删除
|
// 超级管理员必须通过连接蓝牙删除
|
||||||
showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () {
|
showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () {
|
||||||
// 删除锁
|
// 删除锁
|
||||||
@ -181,7 +181,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
showTipView.resetGetController();
|
showTipView.resetGetController();
|
||||||
showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
||||||
});
|
});
|
||||||
} else if (state.lockListInfoItemEntity.keyRight == 1) {
|
} else if (state.lockListInfoItemEntity.value.keyRight == 1) {
|
||||||
// 授权管理员弹框提示
|
// 授权管理员弹框提示
|
||||||
showTipView.showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
|
showTipView.showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
|
||||||
// 授权管理员删除
|
// 授权管理员删除
|
||||||
@ -208,7 +208,7 @@ class LockListLogic extends BaseGetXController {
|
|||||||
// 当是锁拥有者的时候,删除锁
|
// 当是锁拥有者的时候,删除锁
|
||||||
Future<void> deletLockInfoData() async {
|
Future<void> deletLockInfoData() async {
|
||||||
final LockListInfoEntity entity = await ApiRepository.to.deletOwnerLockData(
|
final LockListInfoEntity entity = await ApiRepository.to.deletOwnerLockData(
|
||||||
lockId: state.lockListInfoItemEntity.lockId!,
|
lockId: state.lockListInfoItemEntity.value.lockId!,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
BlueManage().connectDeviceMacAddress = '';
|
BlueManage().connectDeviceMacAddress = '';
|
||||||
@ -221,8 +221,8 @@ class LockListLogic extends BaseGetXController {
|
|||||||
// 普通用户或者授权管理员删除钥匙
|
// 普通用户或者授权管理员删除钥匙
|
||||||
Future<void> deletKeyData() async {
|
Future<void> deletKeyData() async {
|
||||||
final LockListInfoEntity entity = await ApiRepository.to.deletOwnerKeyData(
|
final LockListInfoEntity entity = await ApiRepository.to.deletOwnerKeyData(
|
||||||
lockId: state.lockListInfoItemEntity.lockId.toString(),
|
lockId: state.lockListInfoItemEntity.value.lockId.toString(),
|
||||||
keyId: state.lockListInfoItemEntity.keyId.toString(),
|
keyId: state.lockListInfoItemEntity.value.keyId.toString(),
|
||||||
includeUnderlings: state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0);
|
includeUnderlings: state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
BlueManage().connectDeviceMacAddress = '';
|
BlueManage().connectDeviceMacAddress = '';
|
||||||
@ -241,38 +241,35 @@ class LockListLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
showDeletAlertTipDialog();
|
showDeletAlertTipDialog();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(state.lockListInfoItemEntity.value.lockName!, (BluetoothConnectionState connectionState)
|
||||||
|
async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
final List<int> publicKeyData = state.lockListInfoItemEntity.bluetooth!.publicKey!.cast<int>();
|
final List<int> publicKeyData = state.lockListInfoItemEntity.value.bluetooth!.publicKey!.cast<int>();
|
||||||
final List<String> saveStrList = changeIntListToStringList(publicKeyData);
|
final List<String> saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
await Storage.setStringList(saveBluePublicKey, saveStrList);
|
await Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 私钥
|
// 私钥
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<int> privateKeyData = state.lockListInfoItemEntity.bluetooth!.privateKey!.cast<int>();
|
final List<int> privateKeyData = state.lockListInfoItemEntity.value.bluetooth!.privateKey!.cast<int>();
|
||||||
final List<String> savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
final List<String> savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
||||||
await Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
await Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||||
|
|
||||||
// signKey
|
// signKey
|
||||||
final List<int> signKeyData = state.lockListInfoItemEntity.bluetooth!.signKey!.cast<int>();
|
final List<int> signKeyData = state.lockListInfoItemEntity.value.bluetooth!.signKey!.cast<int>();
|
||||||
final List<String> saveSignKeyList = changeIntListToStringList(signKeyData);
|
final List<String> saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||||
await Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
await Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||||
|
|
||||||
final List<String> saveTokenList = changeIntListToStringList(<int>[0, 0, 0, 0]);
|
final List<String> saveTokenList = changeIntListToStringList(<int>[0, 0, 0, 0]);
|
||||||
await Storage.setStringList(saveBlueToken, saveTokenList);
|
await Storage.setStringList(saveBlueToken, saveTokenList);
|
||||||
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
|
|
||||||
IoSenderManage.senderFactoryDataReset(
|
IoSenderManage.senderFactoryDataReset(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
keyID: '1',
|
keyID: '1',
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyData,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: privateKeyData,
|
||||||
token: <int>[0, 0, 0, 0]);
|
token: <int>[0, 0, 0, 0]);
|
||||||
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
|
|||||||
@ -91,7 +91,8 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
state.lockListInfoItemEntity = keyInfo;
|
state.lockListInfoItemEntity.value = keyInfo;
|
||||||
|
state.lockListInfoItemEntity.refresh();
|
||||||
logic.deleyLockLogicOfRoles();
|
logic.deleyLockLogicOfRoles();
|
||||||
},
|
},
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import '../entity/lockListInfo_entity.dart';
|
|||||||
class LockListState{
|
class LockListState{
|
||||||
|
|
||||||
RxBool itemStatusIsEable = false.obs; // 列表里面item是否能点击
|
RxBool itemStatusIsEable = false.obs; // 列表里面item是否能点击
|
||||||
LockListInfoItemEntity lockListInfoItemEntity = LockListInfoItemEntity(); // 当前选中要删除的item
|
// 修改后
|
||||||
|
Rx<LockListInfoItemEntity> lockListInfoItemEntity = LockListInfoItemEntity().obs; // 当前选中要删除的item
|
||||||
TextEditingController passwordTF = TextEditingController();
|
TextEditingController passwordTF = TextEditingController();
|
||||||
RxBool deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据
|
RxBool deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据
|
||||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
|||||||
@ -192,7 +192,8 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
state.lockListInfoItemEntity = keyInfo;
|
state.lockListInfoItemEntity.value = keyInfo;
|
||||||
|
state.lockListInfoItemEntity.refresh();
|
||||||
logic.deleyLockLogicOfRoles();
|
logic.deleyLockLogicOfRoles();
|
||||||
},
|
},
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user