a,领锁,点击+号时,如果获取网络时间失败,不进入下一页,提示必须联网 b. 开锁时:有网络时间则同步,无网络则不同步时间 c. 同步时间功能:必须有网才同步时间,确定和通通锁不一致 2、修改登录、注册、修改密码选择跟当前ip不是用一个国家的时候,弹窗提示
125 lines
3.8 KiB
Dart
Executable File
125 lines
3.8 KiB
Dart
Executable File
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
|
import 'package:star_lock/tools/showTFView.dart';
|
|
|
|
import '../translations/trans_lib.dart';
|
|
import 'showDeleteAdministratorIsHaveAllDataWidget.dart';
|
|
|
|
typedef BlockIsHaveAllDataCallback = void Function(bool isAllData);
|
|
|
|
class ShowTipView {
|
|
// 只有一个确定按钮
|
|
void showSureAlertDialog(String contentStr, {String? tipTitle, String? sureStr}) {
|
|
showCupertinoDialog(
|
|
context: Get.context!,
|
|
builder: (BuildContext context) {
|
|
return CupertinoAlertDialog(
|
|
title: Text(tipTitle ?? ''),
|
|
content: Text(contentStr),
|
|
actions: <Widget>[
|
|
CupertinoDialogAction(
|
|
child: Text(sureStr ?? TranslationLoader.lanKeys!.sure!.tr),
|
|
onPressed: Get.back,
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
// 授权管理员调用是否删除数据
|
|
void showDeleteAdministratorIsHaveAllDataDialog(String contentStr,
|
|
BlockIsHaveAllDataCallback blockIsHaveAllDataCallback) {
|
|
bool selet = false;
|
|
showDialog(
|
|
context: Get.context!,
|
|
builder: (BuildContext context) {
|
|
return CupertinoAlertDialog(
|
|
title: Text('提示'.tr),
|
|
content: SizedBox(
|
|
// height: 100.h,
|
|
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
|
contentStr: contentStr,
|
|
blockIsHaveAllDataCallback: (bool a) {
|
|
selet = a;
|
|
},
|
|
),
|
|
),
|
|
actions: <Widget>[
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
onPressed: Get.back,
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
|
onPressed: () {
|
|
Get.back();
|
|
blockIsHaveAllDataCallback(selet);
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
// 有取消和确定按钮
|
|
void showIosTipWithContentDialog(String contentStr, Function sureClick) {
|
|
showCupertinoDialog(
|
|
context: Get.context!,
|
|
builder: (BuildContext context) {
|
|
return CupertinoAlertDialog(
|
|
content: Text(contentStr),
|
|
actions: <Widget>[
|
|
CupertinoDialogAction(
|
|
child: Text('取消', style: TextStyle(color: AppColors.mainColor)),
|
|
onPressed: Get.back,
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text('确定', style: TextStyle(color: AppColors.mainColor)),
|
|
onPressed: () {
|
|
Get.back();
|
|
sureClick();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
void showTFViewAlertDialog(TextEditingController controller, String title,
|
|
String tipTitle, Function sureClick,
|
|
{List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
|
|
// 点击删除 开始扫描
|
|
showDialog(
|
|
context: Get.context!,
|
|
builder: (BuildContext context) {
|
|
return ShowTFView(
|
|
title: title,
|
|
tipTitle: tipTitle,
|
|
inputFormatters: inputFormatters,
|
|
controller: controller,
|
|
isShowSuffixIcon: isShowSuffixIcon ?? false,
|
|
sureClick: () {
|
|
//发送删除锁请求
|
|
if (controller.text.isEmpty) {
|
|
EasyLoading.showToast(tipTitle, duration: 2000.milliseconds);
|
|
return;
|
|
}
|
|
sureClick();
|
|
},
|
|
cancelClick: () {
|
|
// 取消的时候停止扫描
|
|
Get.back();
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|