fix:修复无网络下点击开锁会报错
This commit is contained in:
parent
26792c6c7f
commit
dafb40954a
@ -45,7 +45,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Stack(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
pageView(
|
||||
widget: StarLockMainPage(
|
||||
showAppBar: false,
|
||||
@ -102,7 +102,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
navigationBarItem(Icons.key,
|
||||
TranslationLoader.lanKeys!.device!.tr, logic, 0, () {
|
||||
logic.setIndex(0);
|
||||
@ -142,8 +142,8 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
||||
|
||||
//底部按钮
|
||||
Widget navigationBarItem(IconData icon, String text, LockMainXHJLogic logic,
|
||||
int index, var onTop) {
|
||||
bool check = logic.state.index == index;
|
||||
int index, GestureTapCallback? onTop) {
|
||||
final bool check = logic.state.index == index;
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: onTop,
|
||||
@ -151,7 +151,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
||||
color: Colors.transparent,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 8.h),
|
||||
child: Icon(
|
||||
|
||||
@ -11,7 +11,7 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({
|
||||
'countryCode': countryCode,
|
||||
'account': account,
|
||||
"channel": channel,
|
||||
'channel': channel,
|
||||
'codeType': codeType,
|
||||
'xWidth': xWidth,
|
||||
}));
|
||||
@ -28,10 +28,10 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({
|
||||
'receiverType': receiverType,
|
||||
'countryCode': countryCode,
|
||||
"account": account,
|
||||
'account': account,
|
||||
'password': password,
|
||||
'verificationCode': verificationCode,
|
||||
'platId': "2",
|
||||
'platId': '2',
|
||||
}));
|
||||
|
||||
// post(
|
||||
@ -71,10 +71,10 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({
|
||||
'loginType': loginType,
|
||||
'password': password,
|
||||
"platId": "2",
|
||||
'uniqueid': "477E6814-289D-402A-9F49-F89A8BD05D63",
|
||||
'platId': '2',
|
||||
'uniqueid': '477E6814-289D-402A-9F49-F89A8BD05D63',
|
||||
'countryCode': countryCode,
|
||||
"username": username
|
||||
'username': username
|
||||
}));
|
||||
|
||||
Future<Response> resetPassword(
|
||||
@ -89,9 +89,9 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({
|
||||
'countryCode': countryCode,
|
||||
'account': account,
|
||||
"date": date,
|
||||
'date': date,
|
||||
'newPassword': newPassword,
|
||||
"uniqueid": uniqueid,
|
||||
'uniqueid': uniqueid,
|
||||
'verificationCode': verificationCode,
|
||||
}));
|
||||
|
||||
@ -114,7 +114,7 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({
|
||||
'endDate': endDate,
|
||||
'keyId': keyId,
|
||||
"keyStatus": keyStatus,
|
||||
'keyStatus': keyStatus,
|
||||
'lockId': lockId,
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
@ -178,13 +178,15 @@ class ApiProvider extends BaseProvider {
|
||||
bool isUnShowLoading,
|
||||
) =>
|
||||
post(
|
||||
uploadElectricQuantityURL.toUrl,
|
||||
jsonEncode({
|
||||
'electricQuantity': electricQuantity,
|
||||
'electricQuantityStandby': electricQuantityStandby,
|
||||
'lockId': lockId,
|
||||
}),
|
||||
isUnShowLoading: isUnShowLoading);
|
||||
uploadElectricQuantityURL.toUrl,
|
||||
jsonEncode({
|
||||
'electricQuantity': electricQuantity,
|
||||
'electricQuantityStandby': electricQuantityStandby,
|
||||
'lockId': lockId,
|
||||
}),
|
||||
isUnShowLoading: isUnShowLoading,
|
||||
isShowErrMsg: false,
|
||||
);
|
||||
|
||||
Future<Response> modifyKeyName(
|
||||
String keyId,
|
||||
@ -300,9 +302,9 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'lockEventType': lockEventType,
|
||||
"pageNo": pageNo,
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
"startDate": startDate,
|
||||
'startDate': startDate,
|
||||
'endDate': endDate,
|
||||
}));
|
||||
|
||||
@ -317,11 +319,13 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 查询锁记录最后时间
|
||||
Future<Response> getLockRecordLastUploadDataTime(String lockId) => post(
|
||||
getLockRecordLastUploadDataTimeURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}),
|
||||
isUnShowLoading: true);
|
||||
getLockRecordLastUploadDataTimeURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}),
|
||||
isUnShowLoading: true,
|
||||
isShowErrMsg: false,
|
||||
);
|
||||
|
||||
// 获取手机联网token
|
||||
Future<Response> getLockNetToken(String lockId) => post(
|
||||
@ -354,7 +358,7 @@ class ApiProvider extends BaseProvider {
|
||||
post(
|
||||
bindingBlueAdminURL.toUrl,
|
||||
jsonEncode({
|
||||
"lockAlias": lockAlias,
|
||||
'lockAlias': lockAlias,
|
||||
'position': position,
|
||||
'bluetooth': bluetooth,
|
||||
'lockInfo': lockInfo,
|
||||
@ -370,7 +374,7 @@ class ApiProvider extends BaseProvider {
|
||||
getLockInfoURL.toUrl,
|
||||
jsonEncode({
|
||||
'lastUpdateDate': lastUpdateDate,
|
||||
"pageNo": pageNo,
|
||||
'pageNo': pageNo,
|
||||
}));
|
||||
|
||||
// 获取锁信息列表
|
||||
@ -379,7 +383,7 @@ class ApiProvider extends BaseProvider {
|
||||
post(
|
||||
getStarLockInfoURL.toUrl,
|
||||
jsonEncode({
|
||||
"pageNo": pageNo,
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
}),
|
||||
isUnShowLoading: isUnShowLoading);
|
||||
@ -529,8 +533,8 @@ class ApiProvider extends BaseProvider {
|
||||
'isCoerced': isCoerced,
|
||||
'hoursStart': hoursStart,
|
||||
'hoursEnd': hoursEnd,
|
||||
"keyboardPwdType": keyboardPwdType,
|
||||
"pwdRight": pwdRight
|
||||
'keyboardPwdType': keyboardPwdType,
|
||||
'pwdRight': pwdRight
|
||||
}));
|
||||
|
||||
Future<Response> clearOperationRecord(String lockId) =>
|
||||
@ -1283,11 +1287,11 @@ class ApiProvider extends BaseProvider {
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'faceType': faceType,
|
||||
"weekDay": weekDay,
|
||||
'weekDay': weekDay,
|
||||
'faceName': faceName,
|
||||
'addType': addType,
|
||||
"isCoerced": isCoerced,
|
||||
"faceRight": faceRight
|
||||
'isCoerced': isCoerced,
|
||||
'faceRight': faceRight
|
||||
}));
|
||||
|
||||
// 删除人脸
|
||||
@ -1631,7 +1635,7 @@ class ApiProvider extends BaseProvider {
|
||||
jsonEncode({
|
||||
'countryCode': countryCode,
|
||||
'account': account,
|
||||
"channel": channel,
|
||||
'channel': channel,
|
||||
'codeType': codeType,
|
||||
'xWidth': xWidth,
|
||||
}));
|
||||
@ -1679,9 +1683,9 @@ class ApiProvider extends BaseProvider {
|
||||
post(
|
||||
changePasswordURL.toUrl,
|
||||
jsonEncode({
|
||||
"date": date,
|
||||
'date': date,
|
||||
'newPassword': newPassword,
|
||||
"oldPassword": oldPassword,
|
||||
'oldPassword': oldPassword,
|
||||
}));
|
||||
|
||||
//获取安全信息列表
|
||||
@ -1689,7 +1693,7 @@ class ApiProvider extends BaseProvider {
|
||||
post(
|
||||
getQuestionListURL.toUrl,
|
||||
jsonEncode({
|
||||
"operatorUid": operatorUid,
|
||||
'operatorUid': operatorUid,
|
||||
'countryCode': countryCode,
|
||||
}));
|
||||
|
||||
@ -1700,12 +1704,12 @@ class ApiProvider extends BaseProvider {
|
||||
//设置安全信息
|
||||
Future<Response> setSafeAnswer(List questionAndAnswerList) => post(
|
||||
setSafeAnswerURL.toUrl,
|
||||
jsonEncode({"questionAndAnswerList": questionAndAnswerList}));
|
||||
jsonEncode({'questionAndAnswerList': questionAndAnswerList}));
|
||||
|
||||
//修改安全信息
|
||||
Future<Response> updateSafeAnswer(List questionAndAnswerList) => post(
|
||||
updateSafeAnswerURL.toUrl,
|
||||
jsonEncode({"questionAndAnswerList": questionAndAnswerList}));
|
||||
jsonEncode({'questionAndAnswerList': questionAndAnswerList}));
|
||||
|
||||
// 获取上传文件的upToken 再调用updateUserInfo
|
||||
Future<Response> getUpHeadToken(
|
||||
@ -1716,10 +1720,10 @@ class ApiProvider extends BaseProvider {
|
||||
post(
|
||||
getUpTokenURL.toUrl,
|
||||
jsonEncode({
|
||||
"module": "avatar",
|
||||
"userId": userId,
|
||||
"filename": filename,
|
||||
"size": size,
|
||||
'module': 'avatar',
|
||||
'userId': userId,
|
||||
'filename': filename,
|
||||
'size': size,
|
||||
}));
|
||||
|
||||
// 文件上传
|
||||
@ -1731,17 +1735,17 @@ class ApiProvider extends BaseProvider {
|
||||
//获取解绑手机号Token
|
||||
Future<Response> unbindPhoneToken(String verificationCode) => post(
|
||||
unbindPhoneTokenURL.toUrl,
|
||||
jsonEncode({"verificationCode": verificationCode}));
|
||||
jsonEncode({'verificationCode': verificationCode}));
|
||||
|
||||
//获取解绑邮箱Token
|
||||
Future<Response> unbindEmailToken(String verificationCode) => post(
|
||||
unbindEmailTokenURL.toUrl,
|
||||
jsonEncode({"verificationCode": verificationCode}));
|
||||
jsonEncode({'verificationCode': verificationCode}));
|
||||
|
||||
//推送绑定DeviceID
|
||||
Future<Response> pushBindAppId(String deviceId, int deviceType) => post(
|
||||
pushBindAppIdURL.toUrl,
|
||||
jsonEncode({"deviceId": deviceId, "deviceType": deviceType}));
|
||||
jsonEncode({'deviceId': deviceId, 'deviceType': deviceType}));
|
||||
|
||||
// 消息列表
|
||||
Future<Response> messageListLoadData(String pageNo, String pageSize) => post(
|
||||
@ -2106,8 +2110,7 @@ class ApiProvider extends BaseProvider {
|
||||
'recordType': recordType,
|
||||
'records': records
|
||||
}),
|
||||
isUnShowLoading: isUnShowLoading
|
||||
);
|
||||
isUnShowLoading: isUnShowLoading);
|
||||
|
||||
// 获取短信或者邮箱模板
|
||||
Future<Response<dynamic>> getNoticeTemplate(
|
||||
|
||||
@ -34,9 +34,10 @@ class BaseProvider extends GetConnect with Api {
|
||||
Progress? uploadProgress,
|
||||
bool? isUnShowLoading = false, // 是否显示loading
|
||||
bool? isUserBaseUrl = true, // 文件上传不使用baseUrl
|
||||
bool? isShowErrMsg = true, // 文件上传不使用baseUrl
|
||||
}) async {
|
||||
AppLog.log('post: url:$url body:$body');
|
||||
if (isUnShowLoading == false){
|
||||
if (isUnShowLoading == false) {
|
||||
EasyLoading.show();
|
||||
}
|
||||
if (isUserBaseUrl == false) {
|
||||
@ -54,8 +55,9 @@ class BaseProvider extends GetConnect with Api {
|
||||
if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
|
||||
|
||||
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||
if (res.statusCode == null) {
|
||||
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
|
||||
if (res.statusCode == null && isShowErrMsg!) {
|
||||
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr,
|
||||
duration: 2000.milliseconds);
|
||||
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||
}
|
||||
var rs = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user