126 lines
3.5 KiB
Dart
Executable File
126 lines
3.5 KiB
Dart
Executable File
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.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) {
|
|
showCupertinoDialog(
|
|
context: Get.context!,
|
|
builder: (context) {
|
|
return CupertinoAlertDialog(
|
|
content: Text(contentStr),
|
|
actions: [
|
|
CupertinoDialogAction(
|
|
child: Text(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: (a) {
|
|
selet = a;
|
|
},
|
|
),
|
|
),
|
|
actions: [
|
|
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: (context) {
|
|
return CupertinoAlertDialog(
|
|
content: Text(contentStr),
|
|
actions: [
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
onPressed: () {
|
|
Get.back();
|
|
},
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
|
onPressed: () {
|
|
Get.back();
|
|
sureClick();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
void showTFViewAlertDialog(TextEditingController controller, String title,
|
|
String tipTitle, Function sureClick) {
|
|
// 点击删除 开始扫描
|
|
showDialog(
|
|
context: Get.context!,
|
|
builder: (BuildContext context) {
|
|
return ShowTFView(
|
|
title: title,
|
|
tipTitle: tipTitle ?? "",
|
|
controller: controller,
|
|
sureClick: () {
|
|
//发送删除锁请求
|
|
if (controller.text.isEmpty) {
|
|
EasyLoading.showToast(tipTitle, duration: 2000.milliseconds);
|
|
return;
|
|
}
|
|
sureClick();
|
|
},
|
|
cancelClick: () {
|
|
// 取消的时候停止扫描
|
|
Get.back();
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|