1、修改循环 23:00~24:00 不能开锁问题。2、修改TAPD问题

This commit is contained in:
魏少阳 2024-06-03 13:50:07 +08:00
parent ad91e4d17a
commit 7aa487038c
44 changed files with 644 additions and 608 deletions

View File

@ -680,7 +680,7 @@
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "After the password is generated, please use it once for activation before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. After the password is activated, it can be used unlimited times within the validity period.",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. The clear code is used to clear all the passwords generated before 0 o'clock today.",
"密码生成后请在当日2359前使用否则过0点后失效。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock.",
"清空密码底部提示": "The password is valid until 24 o 'clock on the day of emptying\n Empty Content 1: All passwords generated before 0:00 of the day (Passwords generated after 0:00 of the day are not affected by clearing passwords and can continue to be used) \nEmpty content 2: Clear passwords Clear all custom passwords (used and unused) immediately after use \nTo completely clear all passwords, use the Reset All Passwords feature",
"清空密码底部提示": "The password is valid until 23:59 on the day of emptying\n Empty Content 1: All passwords generated before 0:00 of the day (Passwords generated after 0:00 of the day are not affected by clearing passwords and can continue to be used) \nEmpty content 2: Clear passwords Clear all custom passwords (used and unused) immediately after use \nTo completely clear all passwords, use the Reset All Passwords feature",
"相机": "camera",
"相册": "photos",
"读写": "storage",

View File

@ -683,7 +683,7 @@
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
"密码生成后请在当日2359前使用否则过0点后失效。": "密码生成后请在当日2359前使用否则过0点后失效。",
"清空密码底部提示": "清空密码当日24点前有效\n清空内容1当日0点前生成的所有密码当日0点后生成的密码不受清空密码影响可继续使用\n清空内容2清空密码使用后立即清除所有自定义密码含使用过和未使用过的\n如需彻底清除所有密码请使用重置所有密码功能",
"清空密码底部提示": "清空密码当日23:59前有效\n清空内容1当日0点前生成的所有密码当日0点后生成的密码不受清空密码影响可继续使用\n清空内容2清空密码使用后立即清除所有自定义密码含使用过和未使用过的\n如需彻底清除所有密码请使用重置所有密码功能",
"密码不一致哦": "密码不一致哦",
"相机": "相机",
"相册": "相册",

View File

@ -1,8 +1,11 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart';
import '../../network/api_repository.dart';
import '../../tools/baseGetXController.dart';
@ -13,7 +16,7 @@ class StarLockRegisterLogic extends BaseGetXController {
late Timer _timer;
void _startTimer() {
_timer = Timer.periodic(1.seconds, (timer) {
_timer = Timer.periodic(1.seconds, (Timer timer) {
if (state.currentSecond > 1) {
state.currentSecond--;
} else {
@ -29,33 +32,33 @@ class StarLockRegisterLogic extends BaseGetXController {
// _timer = null;
}
void register() async {
AppLog.log("state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}");
Future<void> register() async {
// AppLog.log("state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}");
if(state.pwd.value != state.surePwd.value){
showToast("密码不一致哦".tr);
showToast('密码不一致哦'.tr);
return;
}
var entity = await ApiRepository.to.register(
final LoginEntity entity = await ApiRepository.to.register(
receiverType: state.isIphoneType.value == true ? 1 : 2,
countryCode: int.parse(state.countryCode.value),
account: state.phoneOrEmailStr.value,
password: state.pwd.value,
verificationCode: state.verificationCode.value);
if (entity.errorCode!.codeIsSuccessful) {
showToast("注册成功".tr);
Get.back(result:{
"phoneOrEmailStr":state.phoneOrEmailStr.value,
"pwd":state.pwd.value
showToast('注册成功'.tr);
Get.back(result:<String, String>{
'phoneOrEmailStr':state.phoneOrEmailStr.value,
'pwd':state.pwd.value
});
}
}
void sendValidationCode() async {
var entity = await ApiRepository.to.sendValidationCodeUnLogin(
Future<void> sendValidationCode() async {
final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin(
// state.countryCode.value,
countryCode: state.countryCode.value.toString(),
account: state.phoneOrEmailStr.value,
channel: state.isIphoneType.value ? "1" : "2",
channel: state.isIphoneType.value ? '1' : '2',
codeType: '1',
xWidth: state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) {

View File

@ -1,14 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/login/register/starLock_register_state.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
import '../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../tools/tf_loginInput.dart';
import '../../tools/submitBtn.dart';
import '../../tools/tf_loginInput.dart';
import '../../tools/titleAppBar.dart';
import '../../translations/trans_lib.dart';
import 'starLock_register_logic.dart';
@ -21,8 +23,8 @@ class StarLockRegisterPage extends StatefulWidget {
}
class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
final logic = Get.put(StarLockRegisterLogic());
final state = Get.find<StarLockRegisterLogic>().state;
final StarLockRegisterLogic logic = Get.put(StarLockRegisterLogic());
final StarLockRegisterState state = Get.find<StarLockRegisterLogic>().state;
@override
Widget build(BuildContext context) {
@ -35,7 +37,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
backgroundColor: AppColors.mainColor),
body: ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: [
children: <Widget>[
topSelectCountryAndRegionWidget(),
middleTFWidget(),
Obx(() {
@ -67,11 +69,11 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Widget topSelectCountryAndRegionWidget() {
return Column(
children: [
children: <Widget>[
SizedBox(height: 50.h),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Container(
width: 340.w,
height: 60.h,
@ -81,7 +83,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
border:
Border.all(width: 1.0, color: AppColors.greyLineColor)),
child: Row(
children: [
children: <Widget>[
GestureDetector(
onTap: () {
state.isIphoneType.value = true;
@ -141,19 +143,19 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
SizedBox(height: 60.h),
GestureDetector(
onTap: () async {
var result = await Get.toNamed(Routers.selectCountryRegionPage);
final result = await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
AppLog.log(
"路由返回值: $result, countryCode:${logic.state.countryCode}");
'路由返回值: $result, countryCode:${logic.state.countryCode}');
},
child: Obx(() => SizedBox(
height: 70.h,
child: Row(
children: [
children: <Widget>[
SizedBox(width: 5.w),
Expanded(
child: Text(
@ -163,7 +165,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
SizedBox(width: 20.w),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
children: <Widget>[
Text(
state.isIphoneType.value
? '${state.countryName.value} +${state.countryCode.value}'
@ -194,7 +196,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Widget middleTFWidget() {
return Column(
children: [
children: <Widget>[
Obx(() => LoginInput(
controller: state.phoneOrEmailController,
onchangeAction: (v) {
@ -207,7 +209,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: Image.asset(
state.isIphoneType.value
? 'images/icon_login_account.png'
: "images/icon_login_email.png",
: 'images/icon_login_email.png',
width: 30.w,
height: 30.w,
),
@ -215,7 +217,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${state.isIphoneType.value ? "手机号".tr : TranslationLoader.lanKeys!.email!.tr}",
keyboardType: TextInputType.number,
inputFormatters: [
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(30),
])),
@ -236,8 +238,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
),
),
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
inputFormatters: [
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
SizedBox(height: 15.w),
@ -263,13 +265,13 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
),
),
hintText:
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
inputFormatters: [
'${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
SizedBox(height: 10.w),
Row(
children: [
children: <Widget>[
Expanded(
child: LoginInput(
controller: state.codeController,
@ -284,8 +286,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
),
),
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
inputFormatters: [
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
),
@ -297,14 +299,14 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
state.phoneOrEmailStrIsOK.value && state.canResend.value
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
var result = await Navigator.pushNamed(
final Object? result = await Navigator.pushNamed(
context, Routers.safetyVerificationPage,
arguments: {
"countryCode": state.countryCode,
"account": state.phoneOrEmailStr.value
arguments: <String, Object>{
'countryCode': state.countryCode,
'account': state.phoneOrEmailStr.value
});
state.xWidth.value =
(result as Map<String, dynamic>)['xWidth'];
(result! as Map<String, dynamic>)['xWidth'];
logic.sendValidationCode();
}
: null,
@ -337,7 +339,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Widget _buildBottomAgreement() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
children: <Widget>[
Obx(() => GestureDetector(
onTap: () {
state.agree.value = !state.agree.value;
@ -358,7 +360,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
text: TextSpan(
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
style: TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
children: [
children: <InlineSpan>[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
@ -367,9 +369,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: {
"url": XSConstantMacro.userAgreementURL,
"title": '用户协议'.tr
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
'url': XSConstantMacro.userAgreementURL,
'title': '用户协议'.tr
});
},
)),
@ -381,9 +383,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: {
"url": XSConstantMacro.privacyPolicyURL,
"title": '隐私政策'.tr
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
'url': XSConstantMacro.privacyPolicyURL,
'title': '隐私政策'.tr
});
},
)),

View File

@ -5,37 +5,37 @@ import 'package:get/get.dart';
import '../../translations/trans_lib.dart';
class StarLockRegisterState {
StarLockRegisterState() {
resetResend();
}
final TextEditingController phoneOrEmailController = TextEditingController();
final TextEditingController pwdController = TextEditingController();
final TextEditingController sureController = TextEditingController();
final TextEditingController codeController = TextEditingController();
var countryCode = "86".obs;
var countryName = '中国'.tr.obs;
RxString countryCode = '86'.obs;
RxString countryName = '中国'.tr.obs;
var phoneOrEmailStr = ''.obs;
var phoneOrEmailStrIsOK = false.obs;
var pwd = ''.obs;
var surePwd = ''.obs;
var verificationCode = ''.obs;
var xWidth = ''.obs; //
var isIphoneType = true.obs;
var canSub = false.obs;
var agree = false.obs;
RxString phoneOrEmailStr = ''.obs;
RxBool phoneOrEmailStrIsOK = false.obs;
RxString pwd = ''.obs;
RxString surePwd = ''.obs;
RxString verificationCode = ''.obs;
RxString xWidth = ''.obs; //
RxBool isIphoneType = true.obs;
RxBool canSub = false.obs;
RxBool agree = false.obs;
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty;
bool get codeIsOK => verificationCode.value.isNotEmpty;
var canResend = false.obs;
var btnText = ''.obs;
var totalSeconds = 120;
var currentSecond = 120;
StarLockRegisterState() {
resetResend();
}
RxBool canResend = false.obs;
RxString btnText = ''.obs;
int totalSeconds = 120;
int currentSecond = 120;
void resetResend() {
canResend.value = totalSeconds == currentSecond;

View File

@ -3,10 +3,6 @@ import 'dart:convert';
import 'package:azlistview/azlistview.dart';
class CountryRegionEntity {
int? errorCode;
String? description;
String? errorMsg;
List<CountryRegionModel>? dataList;
CountryRegionEntity(
{this.errorCode, this.description, this.errorMsg, this.dataList});
@ -22,6 +18,10 @@ class CountryRegionEntity {
});
}
}
int? errorCode;
String? description;
String? errorMsg;
List<CountryRegionModel>? dataList;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -36,13 +36,6 @@ class CountryRegionEntity {
}
class CountryRegionModel extends ISuspensionBean {
int? countryId;
String? name;
String? code;
String? flag;
String? abbreviation;
String? group;
String? tagIndex;
CountryRegionModel(
{this.countryId,
@ -61,6 +54,13 @@ class CountryRegionModel extends ISuspensionBean {
abbreviation = json['abbreviation'];
group = json['group'];
}
int? countryId;
String? name;
String? code;
String? flag;
String? abbreviation;
String? group;
String? tagIndex;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -1,7 +1,6 @@
export 'utils.dart';
export 'dart:convert';
export 'package:common_utils/common_utils.dart';
export 'package:lpinyin/lpinyin.dart';
export 'utils.dart';

View File

@ -48,7 +48,7 @@ class Utils {
height: 80.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
SizedBox(
width: 20.w,
),

View File

@ -21,8 +21,8 @@ class SelectCountryRegionPage extends StatefulWidget {
}
class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
List<CountryRegionModel> countriesList = [];
List<CountryRegionModel> topCountriesList = [];
List<CountryRegionModel> countriesList = <CountryRegionModel>[];
List<CountryRegionModel> topCountriesList = <CountryRegionModel>[];
TextEditingController searchController = TextEditingController();
@override
@ -30,19 +30,17 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
super.initState();
SuspensionUtil.setShowSuspensionStatus(countriesList.cast<ISuspensionBean>());
Future.delayed(const Duration(milliseconds: 20), () {
getCountriesListRequest();
});
Future.delayed(const Duration(milliseconds: 20), getCountriesListRequest);
}
///json文件
Future<void> getCountriesListRequest() async {
CountryRegionEntity entity = await ApiRepository.to.getCountryRegion('1');
final CountryRegionEntity entity = await ApiRepository.to.getCountryRegion('1');
countriesList.clear();
if (entity.errorCode!.codeIsSuccessful) {
countriesList.addAll(entity.dataList!);
for(CountryRegionModel model in countriesList){
if(model.name! == "中国"){
for(final CountryRegionModel model in countriesList){
if(model.name! == '中国'){
topCountriesList.add(model);
break;
}
@ -56,10 +54,12 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
}
void _handleList(List<CountryRegionModel> list) {
if (list.isEmpty) return;
if (list.isEmpty) {
return;
}
for (int i = 0, length = list.length; i < length; i++) {
CountryRegionModel countryModel = list[i];
String tag = countryModel.group!;
final CountryRegionModel countryModel = list[i];
final String tag = countryModel.group!;
if (RegExp('[A-Z]').hasMatch(tag)) {
list[i].tagIndex = tag;
} else {
@ -85,12 +85,12 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.select!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}",
'${TranslationLoader.lanKeys!.select!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}',
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Column(
children: [
children: <Widget>[
KeySearchWidget(
editingController: searchController,
backgroundColor: AppColors.mainBackgroundColor,
@ -98,9 +98,9 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
if(searchController.text.isEmpty){
getCountriesListRequest();
}else{
var searchList = <CountryRegionModel>[];
final List<CountryRegionModel> searchList = <CountryRegionModel>[];
for (int i = 0, length = countriesList.length; i < length; i++) {
CountryRegionModel countryModel = countriesList[i];
final CountryRegionModel countryModel = countriesList[i];
if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){
searchList.add(countryModel);
}
@ -116,25 +116,25 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
visible: searchController.text.isEmpty,
child: Utils.getSusItem(context, '')
),
countriesList.isNotEmpty ? Visibility(
if (countriesList.isNotEmpty) Visibility(
visible: searchController.text.isEmpty,
child: Utils.getListItem(context, topCountriesList[0], () {
CountryRegionModel model = topCountriesList[0];
Map<String, dynamic> resultMap = {};
final CountryRegionModel model = topCountriesList[0];
final Map<String, dynamic> resultMap = {};
resultMap['code'] = model.code ?? '';
resultMap['countryId'] = model.countryId.toString() ?? '';
resultMap['countryName'] = model.name ?? '' ;
Navigator.pop(context, resultMap);
})
): Container(),
) else Container(),
Expanded(
child: AzListView(
data: countriesList,
itemCount: countriesList.length,
itemBuilder: (BuildContext context, int index) {
CountryRegionModel model = countriesList[index];
final CountryRegionModel model = countriesList[index];
return Utils.getListItem(context, model, () {
Map<String, dynamic> resultMap = {};
final Map<String, dynamic> resultMap = {};
resultMap['code'] = model.code;
resultMap['countryId'] = model.countryId.toString();
resultMap['countryName'] = model.name;
@ -144,11 +144,11 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
},
padding: EdgeInsets.zero,
susItemBuilder: (BuildContext context, int index) {
CountryRegionModel model = countriesList[index];
String tag = model.getSuspensionTag();
final CountryRegionModel model = countriesList[index];
final String tag = model.getSuspensionTag();
return Utils.getSusItem(context, tag);
},
indexBarData: const ['', ...kIndexBarData],
indexBarData: const <String>['', ...kIndexBarData],
),
),
],

View File

@ -396,7 +396,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
LengthLimitingTextInputFormatter(50),
],
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -1,3 +1,4 @@
import 'dart:async';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart';
@ -13,7 +14,7 @@ class AuthorizedAdminListLogic extends BaseGetXController {
//
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
final ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
endDate: '0',
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
keyStatus: '',
@ -39,10 +40,10 @@ class AuthorizedAdminListLogic extends BaseGetXController {
//
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
final ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
keyId: keyId, includeUnderlings: includeUnderlings);
if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功");
showToast('删除成功');
pageNo = 1;
mockNetworkDataRequest();
}
@ -61,20 +62,12 @@ class AuthorizedAdminListLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_getAuthorizedAdminPageRefreshUIAction();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_getAuthorizedAdminPageRefreshUIEvent?.cancel();
}

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
@ -12,6 +13,7 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
@ -139,7 +141,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
],
),
child: _electronicKeyItem(
'images/controls_user.png',
indexEntity.headUrl!,
indexEntity.keyName!,
useDateStr,
keyStatus,
@ -195,10 +197,18 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
child: Row(
children: <Widget>[
SizedBox(width: 30.w),
Image.asset(
avatarURL,
SizedBox(
width: 60.w,
height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: avatarURL,
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
),
SizedBox(width: 20.w),
Expanded(

View File

@ -7,8 +7,8 @@ class AuthorizedAdminListState {
// final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs;
final itemDataList = <ElectronicKeyListItem>[].obs;
final searchStr = ''.obs;
final RxList<ElectronicKeyListItem> itemDataList = <ElectronicKeyListItem>[].obs;
final RxString searchStr = ''.obs;
// AuthorizedAdminListState() {
// Map map = Get.arguments;

View File

@ -1,12 +1,9 @@
import 'dart:ffi';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'volumeAuthorizationLock_state.dart';
@ -15,6 +12,16 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
//
Future<void> addAuthorizedAdminRequest() async {
if (state.keyNameController.text.isEmpty) {
showToast('请输入接收者姓名');
return;
}
if (state.lockIdList.isEmpty) {
showToast('请选择锁'.tr);
return;
}
String getFailureDateTime = '0';
String getEffectiveDateTime = '0';
if (state.selectWidgetType.value == '1') {
@ -23,11 +30,6 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
getEffectiveDateTime =
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
}
if (state.lockIdList.isEmpty) {
showToast('请选择锁'.tr);
return;
}
final KeyDetailEntity entity = await ApiRepository.to.addAuthorizedAdmin(
createUser: state.isCreateUser.value ? '1' : '0',
endDate: getFailureDateTime,

View File

@ -4,10 +4,8 @@ import 'package:get/get.dart';
class VolumeAuthorizationLockState {
final FlutterContactPicker contactPicker = FlutterContactPicker();
final TextEditingController emailOrPhoneController =
TextEditingController(); ///
final TextEditingController keyNameController =
TextEditingController(); //
final TextEditingController emailOrPhoneController = TextEditingController(); ///
final TextEditingController keyNameController = TextEditingController(); //
late Contact contact;
RxList<int> lockIdList = <int>[].obs;
RxBool isSendSuccess = false.obs;

View File

@ -323,7 +323,7 @@ class _AddCardPageState extends State<AddCardPage>
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
LengthLimitingTextInputFormatter(50),
],
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -62,7 +63,10 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
Get.back();
state.typeName.value = state.changeNameController.text;
logic.editICCardData();
});
}, inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})),
Obx(() => Visibility(
visible: state.keyType.value == 4 ||

View File

@ -15,7 +15,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
//
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
final ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
endDate: '0',
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
keyStatus: '',
@ -27,11 +27,11 @@ class ElectronicKeyListLogic extends BaseGetXController {
searchStr: state.searchController.text);
if (entity.errorCode!.codeIsSuccessful) {
if (pageNo == 1) {
state.itemDataList.value = entity.data!.itemList!;
state.itemDataList.value = entity.data!.itemList;
pageNo++;
} else {
if (entity.data!.itemList!.isNotEmpty) {
state.itemDataList.value.addAll(entity.data!.itemList!);
if (entity.data!.itemList.isNotEmpty) {
state.itemDataList.value.addAll(entity.data!.itemList);
pageNo++;
}
}
@ -41,10 +41,10 @@ class ElectronicKeyListLogic extends BaseGetXController {
//
Future<void> resetElectronicKeyListRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to
final ElectronicKeyListEntity entity = await ApiRepository.to
.resetElectronicKey(CommonDataManage().currentKeyInfo.lockId.toString(), '0');
if (entity.errorCode!.codeIsSuccessful) {
showToast("重置成功".tr, something: (){
showToast('重置成功'.tr, something: (){
pageNo = 1;
mockNetworkDataRequest();
});
@ -53,20 +53,20 @@ class ElectronicKeyListLogic extends BaseGetXController {
//
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
ElectronicKeyListEntity entity =
final ElectronicKeyListEntity entity =
await ApiRepository.to.deleteElectronicKey(
keyId:keyId,
includeUnderlings:includeUnderlings
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功".tr,something: (){
showToast('删除成功'.tr,something: (){
pageNo = 1;
mockNetworkDataRequest();
});
}
}
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
void deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
if(electronicKeyListItem.keyRight == 1){
//
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
@ -74,7 +74,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
});
}else{
//
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){
ShowTipView().showIosTipWithContentDialog('删除钥匙会在用户APP连网后生效'.tr,(){
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
});
}
@ -92,21 +92,13 @@ class ElectronicKeyListLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_getElectronicKeyListRefreshUIAction();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_getElectronicKeyListRefreshUIEvent?.cancel();

View File

@ -13,6 +13,7 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart';
@ -39,7 +40,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
Future<void> mockRequest() async {
//
bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) {
setState(() {});
@ -130,7 +131,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
shrinkWrap: true,
itemCount: state.itemDataList.value.length,
itemBuilder: (BuildContext c, int index) {
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
final ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
String useDateStr = ''; //使
String keyStatus = ''; //
@ -166,12 +167,12 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
],
),
child: _electronicKeyItem(
'images/controls_user.png',
indexEntity.headUrl!,
indexEntity.keyName!,
useDateStr,
keyStatus,
isAdminKey,
indexEntity.remoteEnable == 1 ? true : false, () {
indexEntity.remoteEnable == 1, () {
Navigator.pushNamed(
context, Routers.electronicKeyDetailPage,
arguments: <String, ElectronicKeyListItem>{
@ -198,13 +199,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
//使
String getUseDateStr(ElectronicKeyListItem indexEntity) {
String useDateStr = '';
DateTime sendDateStr =
final DateTime sendDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
DateTime startDateStr =
final DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
final DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
@ -233,11 +234,24 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
child: Row(
children: <Widget>[
SizedBox(width: 30.w),
Image.asset(
avatarURL,
SizedBox(
width: 60.w,
height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: avatarURL,
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
),
// Image.asset(
// avatarURL,
// width: 60.w,
// height: 60.w,
// ),
SizedBox(width: 20.w),
Expanded(
child: Column(
@ -259,25 +273,20 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
color: AppColors.blackColor)),
),
SizedBox(width: 5.w),
isRemteUnlocking
? Image.asset(
if (isRemteUnlocking) Image.asset(
'images/icon_electronicKey_remteUnlocking.png',
width: 24.w,
height: 20.w,
)
: Container(),
) else Container(),
SizedBox(width: 5.w),
isAdminKey
? Image.asset(
if (isAdminKey) Image.asset(
'images/icon_electronicKey_admin.png',
width: 24.w,
height: 20.w,
)
: Container(),
) else Container(),
],
),
),
// Expanded(child: SizedBox(width: 20.w,)),
SizedBox(width: 10.w),
Text(

View File

@ -8,9 +8,9 @@ class ElectronicKeyListState {
TextEditingController searchController = TextEditingController(); ///
// final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs;
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = <ElectronicKeyListItem>[].obs;
RxInt pageNum = 1.obs; //
final RxInt pageSize = 20.obs; //
final RxList<ElectronicKeyListItem> itemDataList = <ElectronicKeyListItem>[].obs;
// ElectronicKeyListState() {
// Map map = Get.arguments;

View File

@ -1,8 +1,4 @@
class ElectronicKeyListEntity {
int? errorCode;
String? description;
String? errorMsg;
ElectronicKeyListData? data;
ElectronicKeyListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
@ -15,6 +11,10 @@ class ElectronicKeyListEntity {
? ElectronicKeyListData.fromJson(json['data'])
: null;
}
int? errorCode;
String? description;
String? errorMsg;
ElectronicKeyListData? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -29,11 +29,6 @@ class ElectronicKeyListEntity {
}
class ElectronicKeyListData {
late List<ElectronicKeyListItem> itemList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
ElectronicKeyListData(
{required this.itemList,
@ -54,6 +49,11 @@ class ElectronicKeyListData {
pages = json['pages'];
total = json['total'];
}
late List<ElectronicKeyListItem> itemList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -67,29 +67,6 @@ class ElectronicKeyListData {
}
class ElectronicKeyListItem {
int? keyId;
int? lockId;
String? username;
String? lockName;
String? lockAlias;
int? userType;
String? keyName;
int? keyStatus;
int? startDate;
int? endDate;
int? keyRight;
int? keyType;
String? senderUsername;
String? remarks;
int? isCameraEnable;
int? faceAuthentication;
int? sendDate;
int? remoteEnable;
int? appUnlockMustOnline;
List? weekDays;
int? isOnlyManageSelf;
UserIdCard? userIdCard;
int? uid;
ElectronicKeyListItem({
this.keyId,
@ -115,13 +92,14 @@ class ElectronicKeyListItem {
this.isOnlyManageSelf,
this.userIdCard,
this.uid,
this.headUrl
});
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
keyId = json['keyId'];
lockId = json['lockId'];
json['username'] != null ? username = json['username'] : "";
json['lockName'] != null ? lockName = json['lockName'] : "";
json['username'] != null ? username = json['username'] : '';
json['lockName'] != null ? lockName = json['lockName'] : '';
lockAlias = json['lockAlias'];
userType = json['userType'];
keyName = json['keyName'];
@ -131,7 +109,7 @@ class ElectronicKeyListItem {
keyRight = json['keyRight'];
keyType = json['keyType'];
senderUsername = json['senderUsername'];
json['remarks'] != null ? remarks = json['remarks'] : "";
json['remarks'] != null ? remarks = json['remarks'] : '';
json['isCameraEnable'] != null
? isCameraEnable = json['isCameraEnable']
: 0;
@ -147,7 +125,32 @@ class ElectronicKeyListItem {
? userIdCard = UserIdCard.fromJson(json['userIdCard'])
: null;
uid = json['uid'];
headUrl = json['headUrl'];
}
int? keyId;
int? lockId;
String? username;
String? lockName;
String? lockAlias;
int? userType;
String? keyName;
int? keyStatus;
int? startDate;
int? endDate;
int? keyRight;
int? keyType;
String? senderUsername;
String? remarks;
int? isCameraEnable;
int? faceAuthentication;
int? sendDate;
int? remoteEnable;
int? appUnlockMustOnline;
List? weekDays;
int? isOnlyManageSelf;
UserIdCard? userIdCard;
int? uid;
String? headUrl;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
@ -176,13 +179,12 @@ class ElectronicKeyListItem {
data['userIdCard'] = userIdCard!.toJson();
}
data['uid'] = uid;
data['headUrl'] = headUrl;
return data;
}
}
class UserIdCard {
String? realName;
String? idCardNumber;
UserIdCard({this.realName, this.idCardNumber});
@ -190,6 +192,8 @@ class UserIdCard {
realName = json['realName'];
idCardNumber = json['idCardNumber'];
}
String? realName;
String? idCardNumber;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -306,7 +306,7 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
LengthLimitingTextInputFormatter(50),
],
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -1,10 +1,10 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_type.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart';
@ -23,7 +23,7 @@ class FaceDetailLogic extends BaseGetXController {
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) {
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
// ()
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
_replyAddFaceBegin(reply);
@ -33,7 +33,7 @@ class FaceDetailLogic extends BaseGetXController {
//
Future<void> _replyAddFaceBegin(Reply reply) async {
int status = reply.data[2];
final int status = reply.data[2];
switch (status) {
case 0x00:
@ -49,14 +49,14 @@ class FaceDetailLogic extends BaseGetXController {
break;
case 0x06:
//
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token);
final List<int> token = reply.data.sublist(5, 9);
final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderAddFaceCommand(
@ -101,14 +101,14 @@ class FaceDetailLogic extends BaseGetXController {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
IoSenderManage.senderAddFaceCommand(
keyID:state.keyId.value.toString(),
@ -143,36 +143,36 @@ class FaceDetailLogic extends BaseGetXController {
}
//
void deletFaceData() async {
var entity = await ApiRepository.to.deleteFaceData(
Future<void> deletFaceData() async {
final LoginEntity entity = await ApiRepository.to.deleteFaceData(
faceId: state.faceItemData.value.faceId!,
lockId: state.faceItemData.value.lockId!,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功", something: () {
Get.back(result: "addScuess");
showToast('删除成功', something: () {
Get.back(result: 'addScuess');
});
}
}
//
void updateFaceNameData() async {
var entity = await ApiRepository.to.updateFaceName(
Future<void> updateFaceNameData() async {
final LoginEntity entity = await ApiRepository.to.updateFaceName(
lockId: state.faceItemData.value.lockId!,
faceId: state.faceItemData.value.faceId!,
faceName: state.changeNameController.text,
);
if (entity.errorCode!.codeIsSuccessful) {
state.typeName.value = state.changeNameController.text;
showToast("修改成功", something: () {
Get.back(result: "addScuess");
showToast('修改成功', something: () {
Get.back(result: 'addScuess');
});
}
}
//
void editFaceData() async {
var entity = await ApiRepository.to.updateFaceValidity(
Future<void> editFaceData() async {
final LoginEntity entity = await ApiRepository.to.updateFaceValidity(
lockId: state.faceItemData.value.lockId!,
faceId: state.faceItemData.value.faceId!,
startDate: int.parse(state.startDate.value),
@ -182,13 +182,13 @@ class FaceDetailLogic extends BaseGetXController {
faceType: state.keyType.value,
weekDay: state.weekDay.value,
faceName: state.changeNameController.text,
addType: "1",
addType: '1',
isCoerced: state.isStressFace.value ? 2 : 1,
faceRight: state.isAdministrator.value ? 1 : 0,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: () {
Get.back(result: "addScuess");
showToast('修改成功', something: () {
Get.back(result: 'addScuess');
});
}
}
@ -196,33 +196,25 @@ class FaceDetailLogic extends BaseGetXController {
String getKeyTypeShowDateTime() {
String useDateStr = '';
if (state.keyType.value == 1) {
useDateStr = "永久";
useDateStr = '永久';
} else if (state.keyType.value == 2) {
useDateStr =
"${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
'${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}';
} else if (state.keyType.value == 4) {
useDateStr =
"${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
'${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}';
}
return useDateStr;
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_initReplySubscription();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_replySubscription.cancel();

View File

@ -1,9 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_logic.dart';
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -23,22 +25,22 @@ class FaceDetailPage extends StatefulWidget {
}
class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
final logic = Get.put(FaceDetailLogic());
final state = Get.find<FaceDetailLogic>().state;
final FaceDetailLogic logic = Get.put(FaceDetailLogic());
final FaceDetailState state = Get.find<FaceDetailLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "人脸详情",
barTitle: '人脸详情',
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: ListView(
children: [
children: <Widget>[
Obx(() => CommonItem(
leftTitel: "人脸号",
leftTitel: '人脸号',
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
@ -51,23 +53,24 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
// showCupertinoAlertDialog(context);
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
"", () {
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
'', () {
if (state.changeNameController.text.isEmpty) {
logic.showToast("请输入姓名".tr);
logic.showToast('请输入姓名'.tr);
return;
}
Get.back();
state.typeName.value = state.changeNameController.text;
logic.updateFaceNameData();
});
}, inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})),
Obx(() => Visibility(
visible: (state.keyType.value == 4 ||
visible: state.keyType.value == 4 ||
state.keyType.value == 2 ||
state.keyType.value == 1)
? true
: false,
state.keyType.value == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h,
@ -80,14 +83,14 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
//
var data = await Get.toNamed(
Routers.otherTypeKeyChangeDatePage,
arguments: {
"pushType": 3,
"fingerprintItemData": state.faceItemData.value,
arguments: <String, Object>{
'pushType': 3,
'fingerprintItemData': state.faceItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data["beginTimeTimestamp"];
state.endDate.value = data["endTimeTimestamp"];
state.startDate.value = data['beginTimeTimestamp'];
state.endDate.value = data['endTimeTimestamp'];
state.keyType.value = 2;
});
}
@ -95,23 +98,23 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
//
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: {
"pushType": 3,
"fingerprintItemData": state.faceItemData.value,
arguments: <String, Object>{
'pushType': 3,
'fingerprintItemData': state.faceItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data["starDate"];
state.endDate.value = data["endDate"];
state.startTime.value = data["starTime"];
state.endTime.value = data["endTime"];
state.weekDay.value = data["validityValue"];
state.startDate.value = data['starDate'];
state.endDate.value = data['endDate'];
state.startTime.value = data['starTime'];
state.endTime.value = data['endTime'];
state.weekDay.value = data['validityValue'];
});
}
}
}))),
Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false,
visible: state.keyType.value == 4,
child: Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
rightTitle: state.weekDay.value.join(','),
@ -120,41 +123,41 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
action: () async {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: {
"pushType": 3,
"fingerprintItemData": state.faceItemData.value,
arguments: <String, Object>{
'pushType': 3,
'fingerprintItemData': state.faceItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data["starDate"];
state.endDate.value = data["endDate"];
state.startTime.value = data["starTime"];
state.endTime.value = data["endTime"];
state.weekDay.value = data["validityValue"];
state.startDate.value = data['starDate'];
state.endDate.value = data['endDate'];
state.startTime.value = data['starTime'];
state.endTime.value = data['endTime'];
state.weekDay.value = data['validityValue'];
});
}
})))),
Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false,
visible: state.keyType.value == 4,
child: Obx(() => CommonItem(
leftTitel: "有效时间",
leftTitel: '有效时间',
rightTitle:
"${DateTool().dateToHNString(state.startTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
'${DateTool().dateToHNString(state.startTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
isHaveDirection: true,
action: () async {
var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage,
arguments: {
"pushType": 3,
"fingerprintItemData": state.faceItemData.value,
arguments: <String, Object>{
'pushType': 3,
'fingerprintItemData': state.faceItemData.value,
});
if (data != null) {
setState(() {
state.startDate.value = data["starDate"];
state.endDate.value = data["endDate"];
state.startTime.value = data["starTime"];
state.endTime.value = data["endTime"];
state.weekDay.value = data["validityValue"];
state.startDate.value = data['starDate'];
state.endDate.value = data['endDate'];
state.startTime.value = data['starTime'];
state.endTime.value = data['endTime'];
state.weekDay.value = data['validityValue'];
});
}
})))),
@ -177,8 +180,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
// isHaveLine: true,
// rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFace()))),
Obx(() => CommonItem(
leftTitel: "是否为管理员".tr,
rightTitle: "",
leftTitel: '是否为管理员'.tr,
rightTitle: '',
isTipsImg: false,
isHaveRightWidget: true,
rightWidget:
@ -186,10 +189,10 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
Container(height: 10.h),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
rightTitle: "",
rightTitle: '',
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 4,
'id': state.faceItemData.value.faceId.toString(),
'recordName': state.faceItemData.value.faceName
@ -206,7 +209,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr,
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr,
() async {
state.isDeletFace.value = true;
logic.senderAddFace();
@ -223,7 +226,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isStressFace.value,
onChanged: (value) {
onChanged: (bool value) {
setState(() {
state.isStressFace.value = value;
state.isDeletFace.value = false;
@ -240,7 +243,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isAdministrator.value,
onChanged: (value) {
onChanged: (bool value) {
// state.isAdministrator.value = value;
// state.isDeletFace.value = false;
// logic.senderAddFace();
@ -250,7 +253,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
@ -259,7 +261,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();

View File

@ -383,7 +383,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
LengthLimitingTextInputFormatter(50),
],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: state.nameController,

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -41,7 +42,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
children: <Widget>[
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}",
'${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}',
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
@ -53,7 +54,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
action: () {
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
'', () {
if (state.changeNameController.text.isEmpty) {
logic.showToast('请输入姓名'.tr);
@ -62,14 +63,15 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
Get.back();
state.typeName.value = state.changeNameController.text;
logic.editFingerprintsData();
});
}, inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})),
Obx(() => Visibility(
visible: (state.keyType.value == 4 ||
visible: state.keyType.value == 4 ||
state.keyType.value == 2 ||
state.keyType.value == 1)
? true
: false,
state.keyType.value == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h,
@ -115,7 +117,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
}
}))),
Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false,
visible: state.keyType.value == 4,
child: Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveDay!.tr,
rightTitle: state.weekDay.value.join(','),
@ -140,7 +142,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
}
})))),
Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false,
visible: state.keyType.value == 4,
child: Obx(() => CommonItem(
leftTitel: '有效时间'.tr,
rightTitle:
@ -259,7 +261,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
@ -268,7 +269,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
@ -286,7 +286,9 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
void didPop() {
super.didPop();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0;
}
@ -303,7 +305,9 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
void didPushNext() {
super.didPushNext();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0;
}

View File

@ -5,6 +5,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintList_state.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -30,11 +31,11 @@ class FingerprintListPage extends StatefulWidget {
}
class _FingerprintListPageState extends State<FingerprintListPage> with RouteAware {
final logic = Get.put(FingerprintListLogic());
final state = Get.find<FingerprintListLogic>().state;
final FingerprintListLogic logic = Get.put(FingerprintListLogic());
final FingerprintListState state = Get.find<FingerprintListLogic>().state;
Future<void> getHttpData() async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic.getFingerprintsListData().then((FingerprintListDataEntity value){
if (mounted) {
@ -59,23 +60,23 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
barTitle: TranslationLoader.lanKeys!.fingerprint!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
actionsList: <Widget>[
TextButton(
child: Text(
TranslationLoader.lanKeys!.reset!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog("重置后,该锁的指纹都将被删除哦,确认要重置吗?".tr, () async {
ShowTipView().showIosTipWithContentDialog('重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true;
state.deletKeyID = "1";
state.deletKeyID = '1';
state.deletFingerNo = 0;
logic.senderAddFingerprint();
});
} else {
logic.showToast("演示模式".tr);
logic.showToast('演示模式'.tr);
}
},
),
@ -90,7 +91,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
getHttpData();
},
child: Column(
children: [
children: <Widget>[
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
@ -105,10 +106,10 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
AddBottomWhiteBtn(
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}',
onClick: () async {
var data =
await Get.toNamed(Routers.addFingerprintTypePage, arguments: {
"lockId": state.lockId.value,
"fromType": 1 // 1 2
final data =
await Get.toNamed(Routers.addFingerprintTypePage, arguments: <String, int>{
'lockId': state.lockId.value,
'fromType': 1 // 1 2
});
if (data != null) {
logic.pageNo = 1;
@ -128,18 +129,18 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
? SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.fingerprintItemListData.value.length,
itemBuilder: (c, index) {
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
itemBuilder: (BuildContext c, int index) {
final FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
//
return Slidable(
key:ValueKey(fingerprintItemData.fingerprintId),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
children: <Widget>[
SlidableAction(
onPressed: (BuildContext context){
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
state.isDeletAll = false;
state.deletKeyID = fingerprintItemData.fingerprintId.toString();
state.deletFingerNo = int.parse(fingerprintItemData.fingerprintNumber!);
@ -158,10 +159,10 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
fingerprintItemData.fingerprintName!,
logic.getKeyType(fingerprintItemData),
logic.getKeyDateType(fingerprintItemData), () async {
var data = await Get.toNamed(
final data = await Get.toNamed(
Routers.fingerprintDetailPage,
arguments: {
"fingerprintItemData": fingerprintItemData,
arguments: <String, FingerprintItemData>{
'fingerprintItemData': fingerprintItemData,
});
if (data != null) {
logic.pageNo = 1;
@ -192,21 +193,21 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
// // borderRadius: BorderRadius.circular(10.w),
// ),
child: Row(
children: [
children: <Widget>[
SizedBox(width: 30.w),
Image.asset(lockTypeIcon, width: 60.w, height: 60.w),
SizedBox(width: 20.w),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
children: <Widget>[
SizedBox(
width: ifInvalidation.isNotEmpty ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w,
child: Row(
children: [
children: <Widget>[
Flexible(
child: Text(
lockTypeTitle,
@ -228,7 +229,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
SizedBox(height: 5.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
children: <Widget>[
Flexible(
child: Text(showTime,
maxLines: 1,
@ -252,7 +253,6 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
@ -261,7 +261,6 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
@ -279,7 +278,9 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
void didPop() {
super.didPop();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false;
}
@ -295,7 +296,9 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
void didPushNext() {
super.didPushNext();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false;
}

View File

@ -121,7 +121,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
}))),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
rightTitle: state.lockBasicInfo.value.groupName!.tr ?? '',
rightTitle: state.lockBasicInfo.value.groupName ?? '',
isHaveLine: true,
isHaveDirection: true,
action: () async {
@ -150,7 +150,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
}),
)),
Obx(() => Visibility(
visible: state.lockBasicInfo.value.lockName!.contains('T9A'),
visible: (state.lockBasicInfo.value.lockName ?? '').contains('T9A'),
child: CommonItem(
leftTitel: '当前网络'.tr,
rightTitle: state.lockBasicInfo.value.network ?? '-',

View File

@ -21,18 +21,18 @@ class UploadElectricQuantityLogic extends BaseGetXController {
//
Future<void> uploadElectricQuantityRequest(String electricQuantity, String electricQuantityStandby) async {
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(
final KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(
electricQuantity:electricQuantity,
electricQuantityStandby: electricQuantityStandby,
lockId: state.lockSetInfoData.value.lockId.toString(),
isUnShowLoading: false
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("锁电量更新成功".tr, something: () {
showToast('锁电量更新成功'.tr, something: () {
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(
LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity));
LockSetChangeSetRefreshLockDetailWithType(4, electricQuantity));
eventBus.fire(RefreshLockListInfoDataEvent());
});
}
@ -54,8 +54,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
dismissEasyLoading();
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
@ -89,7 +89,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
//
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
int status = reply.data[2];
final int status = reply.data[2];
switch (status) {
case 0x00:
//
@ -98,11 +98,11 @@ class UploadElectricQuantityLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
//
var battRemCap = reply.data[132];
final battRemCap = reply.data[132];
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap;
//
var battRemCapStandby = reply.data[133];
final battRemCapStandby = reply.data[133];
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityStandby = battRemCapStandby;
state.uploadElectricQuantityDate.value = DateTime.now().millisecondsSinceEpoch;
@ -111,8 +111,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
break;
case 0x06:
//
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
@ -130,7 +130,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
//
void getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData();
final entity = await ApiRepository.to.getServerDatetimeData();
if(entity.errorCode!.codeIsSuccessful){
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
getLocalNetTime();
@ -143,8 +143,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
}
int getLocalNetTime(){
DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getUTCNetTime()*1000, isUtc: true);
DateTime localTime = utcTime.toLocal();
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getUTCNetTime()*1000, isUtc: true);
final DateTime localTime = utcTime.toLocal();
// AppLog.log('getUTCNetTime: ${getUTCNetTime()}');
// AppLog.log('UTC time: $utcTime');

View File

@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_state.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -25,8 +27,8 @@ class LockSetPage extends StatefulWidget {
}
class _LockSetPageState extends State<LockSetPage> with RouteAware {
final logic = Get.put(LockSetLogic());
final state = Get.find<LockSetLogic>().state;
final LockSetLogic logic = Get.put(LockSetLogic());
final LockSetState state = Get.find<LockSetLogic>().state;
Future<void> getHttpData() async {
logic.getLockSettingInfoData().then((LockSetInfoEntity value) {
@ -36,7 +38,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
@override
void initState() {
// TODO: implement initState
super.initState();
logic.initLoadDataAction(() {
@ -59,7 +60,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
getHttpData();
},
child: Column(
children: [
children: <Widget>[
Expanded(
child: Obx(() => ListView(
children: getListWidget(),
@ -83,25 +84,25 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
List<Widget> getNormalWidget() {
var showWidgetArr = [
final List<Widget> showWidgetArr = <Widget>[
//
CommonItem(
leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.basicInformationPage,
arguments: {'lockSetInfoData': state.lockSetInfoData.value});
arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
}),
SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1 ? true : false,
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s"
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
@ -110,14 +111,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage, arguments: {
Get.toNamed(Routers.automaticBlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value
});
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1 ? true : false,
visible: state.lockFeature.value.passageMode == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
@ -126,7 +127,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage, arguments: {
Get.toNamed(Routers.normallyOpenModePage, arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value
});
@ -135,11 +136,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockTime!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockTimePage, arguments: {
Get.toNamed(Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
@ -164,16 +165,16 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
List<Widget> getAllWidget() {
var showWidgetArr = [
final List<Widget> showWidgetArr = <Widget>[
//
CommonItem(
leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.basicInformationPage,
arguments: {'lockSetInfoData': state.lockSetInfoData.value});
arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
}),
SizedBox(height: 10.h),
//by DaisyWu
@ -226,11 +227,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1 ? true : false,
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0
? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s"
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
@ -239,13 +240,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage, arguments: {
Get.toNamed(Routers.automaticBlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() {
var titleStr = "";
String titleStr = '';
if ((state.lockSettingInfo.value.lockSound ?? 0) == 1) {
switch (state.lockSettingInfo.value.lockSoundVolume ?? 0) {
case 1:
@ -268,21 +269,21 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
titleStr = TranslationLoader.lanKeys!.closed!.tr;
}
return Visibility(
visible: state.lockFeature.value.lockSound == 1 ? true : false,
visible: state.lockFeature.value.lockSound == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockSound!.tr,
rightTitle: titleStr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockSoundSetPage, arguments: {
Get.toNamed(Routers.lockSoundSetPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}));
}),
//
Obx(() => Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1 ? true : false,
visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1
@ -291,14 +292,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage, arguments: {
Get.toNamed(Routers.burglarAlarmPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1 ? true : false,
visible: state.lockFeature.value.passageMode == 1,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
@ -308,13 +309,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage, arguments: {
Get.toNamed(Routers.normallyOpenModePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.remoteUnlock == 1 ? true : false,
visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1
@ -323,16 +324,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage, arguments: {
Get.toNamed(Routers.remoteUnlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() => Visibility(
visible: (state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.resetSwitch == 1)
? true
: false,
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.resetSwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
@ -341,7 +339,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage, arguments: {
Get.toNamed(Routers.resetButtonPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
@ -350,14 +348,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// Obx(() =>
//
Visibility(
visible: state.lockFeature.value.d3Face == 1 ? true : false,
visible: state.lockFeature.value.d3Face == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.faceUnlockPage, arguments: {
Get.toNamed(Routers.faceUnlockPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
@ -367,23 +365,23 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.messageReminding!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.msgNotificationPage,
arguments: {'lockId': state.lockSetInfoData.value.lockId});
arguments: <String, int?>{'lockId': state.lockSetInfoData.value.lockId});
})),
//
Obx(() => Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1 ? true : false,
visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage, arguments: {
Get.toNamed(Routers.catEyeSetPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
@ -415,23 +413,23 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// Obx(() =>
//
Visibility(
visible: state.lockFeature.value.openDirection == 1 ? true : false,
visible: state.lockFeature.value.openDirection == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.openingDirectionSet!.tr,
rightTitle: "",
rightTitle: '',
isHaveDirection: true,
isHaveLine: true,
action: () {
Get.toNamed(Routers.openDoorDirectionPage, arguments: {
Get.toNamed(Routers.openDoorDirectionPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
//
Visibility(
visible: state.lockFeature.value.motorTorsion == 1 ? true : false,
visible: state.lockFeature.value.motorTorsion == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.motorPowerSetting!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -481,7 +479,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
: false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())),
@ -489,13 +487,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
Obx(
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1
? true
: false,
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.unlockReminder == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())),
@ -503,14 +498,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// APP开锁时是否需联网
Obx(
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.appUnlockOnline == 1
? true
: false,
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.appUnlockOnline == 1,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()),
@ -520,15 +512,15 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// wifi配网
Obx(
() => Visibility(
visible: state.lockFeature.value.wifi == 1 ? true : false,
visible: state.lockFeature.value.wifi == 1,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wifiListPage, arguments: {
Get.toNamed(Routers.wifiListPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
// Get.toNamed(Routers.configuringWifiPage, arguments: {
@ -542,11 +534,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockTime!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockTimePage, arguments: {
Get.toNamed(Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
@ -572,7 +564,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -598,7 +590,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockEscalation!.tr,
rightTitle: "",
rightTitle: '',
isHaveLine: false,
isHaveDirection: true,
action: () {
@ -626,7 +618,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}
Widget rightText(String rightTitle) {
return Text(rightTitle ?? "",
return Text(rightTitle ?? '',
textAlign: TextAlign.end,
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor));
}
@ -637,15 +629,15 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isAttendance.value == 1 ? true : false,
onChanged: (value) {
logic.openCheckingInData((checkingInInfoDataEntity) {
value: state.isAttendance.value == 1,
onChanged: (bool value) {
logic.openCheckingInData((CheckingInInfoDataEntity checkingInInfoDataEntity) {
if (checkingInInfoDataEntity.data!.companyId == 0) {
// logic.showCupertinoAlertDialog(context);
ShowTipView().showIosTipWithContentDialog("创建公司后,考勤功能才能使用".tr, () {
ShowTipView().showIosTipWithContentDialog('创建公司后,考勤功能才能使用'.tr, () {
//
Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: {'lockSetInfoData': state.lockSetInfoData.value});
arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
});
} else {
logic.setLockSetGeneralSetting();
@ -661,11 +653,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isLockPickingReminder.value == 1 ? true : false,
onChanged: (value) {
setState(() {
logic.setLockPickingReminder();
});
value: state.isLockPickingReminder.value == 1,
onChanged: (bool value) {
setState(logic.setLockPickingReminder);
},
);
}
@ -676,8 +666,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: (state.isOpenLockNeedOnline.value) == 1 ? true : false,
onChanged: (value) {
value: state.isOpenLockNeedOnline.value == 1,
onChanged: (bool value) {
setState(() {
logic.sendBurglarAlarm(55);
});
@ -721,8 +711,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: (state.isOpenBlueBroadcast.value) == 1 ? true : false,
onChanged: (value) {
value: state.isOpenBlueBroadcast.value == 1,
onChanged: (bool value) {
setState(() {
logic.sendBurglarAlarm(56);
});
@ -736,15 +726,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: false,
onChanged: (value) {
logic.showToast("功能暂未开放");
onChanged: (bool value) {
logic.showToast('功能暂未开放');
},
);
}
@override
void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
///
@ -753,7 +742,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
@ -773,7 +761,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
super.didPop();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
// if (state.deletWaitScanTimer != null) {
// state.deletWaitScanTimer!.cancel();
// }
@ -798,7 +788,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
super.didPushNext();
logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false;
}
}

View File

@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/showTFView.dart';
import 'package:star_lock/tools/showTipView.dart';
@ -24,10 +25,9 @@ class PasswordKeyDetailPage extends StatefulWidget {
State<PasswordKeyDetailPage> createState() => _PasswordKeyDetailPageState();
}
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
with RouteAware {
final logic = Get.put(PasswordKeyDetailLogic());
final state = Get.find<PasswordKeyDetailLogic>().state;
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with RouteAware {
final PasswordKeyDetailLogic logic = Get.put(PasswordKeyDetailLogic());
final PasswordKeyDetailState state = Get.find<PasswordKeyDetailLogic>().state;
@override
Widget build(BuildContext context) {
@ -37,22 +37,20 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
barTitle: TranslationLoader.lanKeys!.passwordDetail!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
actionsList: <Widget>[
IconButton(
icon: Image.asset(
'images/icon_bar_share.png',
height: 30.h,
width: 30.w,
),
onPressed: () {
_openModalBottomSheet();
},
onPressed: _openModalBottomSheet,
),
],
),
body: SingleChildScrollView(
child: Column(
children: [
children: <Widget>[
Obx(() => Visibility(
visible: state.itemData.value.isCustom! == 1,
child: CommonItem(
@ -64,8 +62,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.password!.tr,
rightTitle: state.keyboardPwd.value,
isHaveDirection:
state.itemData.value.isCustom! == 1 ? true : false,
isHaveDirection: state.itemData.value.isCustom! == 1,
isHaveLine: true,
action: () {
if (state.itemData.value.isCustom! != 1) {
@ -85,11 +82,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
context, state.inputNameController);
})),
Obx(() => CommonItem(
leftTitel: "有效期",
leftTitel: '有效期',
rightTitle: logic.getUseDateStr(),
isHaveLine: state.isCirculation.value,
isHaveDirection:
state.itemData.value.isCustom! == 1 ? true : false,
isHaveDirection: state.itemData.value.isCustom! == 1,
allHeight:
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
action: () async {
@ -98,14 +94,14 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
}
var backData = await Get.toNamed(
Routers.passwordKeyDetailChangeDatePage,
arguments: {
arguments: <String, PasswordKeyListItem>{
'itemData': state.itemData.value,
});
if (backData != null) {
state.itemData.value.startDate =
int.parse(backData["beginTimeTimestamp"]);
int.parse(backData['beginTimeTimestamp']);
state.itemData.value.endDate =
int.parse(backData["endTimeTimestamp"]);
int.parse(backData['endTimeTimestamp']);
//
state.itemData.value.keyboardPwdType = 3;
setState(() {});
@ -132,10 +128,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
Obx(() => Visibility(
visible: state.itemData.value.isCustom! == 1,
child: Column(
children: [
children: <Widget>[
CommonItem(
leftTitel: "是否为管理员".tr,
rightTitle: "",
leftTitel: '是否为管理员'.tr,
rightTitle: '',
isTipsImg: false,
isHaveRightWidget: true,
rightWidget: SizedBox(
@ -146,10 +142,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
rightTitle: "",
rightTitle: '',
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 1,
'id': state.itemData.value.keyboardPwdId.toString(),
'recordName': state.itemData.value.keyboardPwdName
@ -169,8 +165,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () {
Navigator.pushNamed(context, Routers.cardListPage,
arguments: {
"lockId": state.itemData.value.lockId,
arguments: <String, int?>{
'lockId': state.itemData.value.lockId,
});
},
child: Text(
@ -191,8 +187,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () {
Navigator.pushNamed(context, Routers.fingerprintListPage,
arguments: {
"lockId": state.itemData.value.lockId,
arguments: <String, int?>{
'lockId': state.itemData.value.lockId,
});
},
child: Text(
@ -214,8 +210,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
onPressed: () {
Navigator.pushNamed(
context, Routers.remoteControlListPage,
arguments: {
"lockId": state.itemData.value.lockId,
arguments: <String, int?>{
'lockId': state.itemData.value.lockId,
});
},
child: Text(
@ -235,7 +231,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () {
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () {
state.isDeletPasswordKey.value = true;
logic.senderCustomPasswords();
});
@ -247,15 +243,15 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
Widget bottomTip(){
return Column(
children: [
children: <Widget>[
Container(
padding: EdgeInsets.all(20.w),
child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Expanded(
child: Text(
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。".tr,
'密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。'.tr,
textAlign: TextAlign.start,
style: TextStyle(fontSize: 20.sp),
)),
@ -273,7 +269,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isAdministrator.value,
onChanged: (value) {
onChanged: (bool value) {
// state.isAdministrator.value = value;
// state.isDeletPasswordKey.value = false;
// logic.senderCustomPasswords();
@ -297,11 +293,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
state.ifCurrentScreen.value = true;
return ShowTFView(
title: inputController == state.inputNameController
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
? '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}'
: '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}',
tipTitle: inputController.text.isNotEmpty
? inputController.text
: "请输入6-9位密码",
: '请输入6-9位密码',
controller: inputController,
keyboardType: inputController == state.inputNameController
? TextInputType.text
@ -317,7 +313,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
if (inputController.text.isEmpty ||
inputController.text.length < 6 ||
inputController.text.length > 9) {
logic.showToast("请输入6-9位密码");
logic.showToast('请输入6-9位密码');
return;
}
}
@ -346,7 +342,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
constraints: BoxConstraints(maxHeight: 270.h),
builder: (BuildContext context) {
return Column(
children: [
children: <Widget>[
SizedBox(
width: ScreenUtil().screenWidth,
height: 180.h,
@ -377,7 +373,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
}
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
List<Widget> widgetList = <Widget>[];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
@ -397,7 +393,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Image.asset(
imageName,
width: 50.w,

View File

@ -215,8 +215,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
);
if (entity.errorCode!.codeIsSuccessful) {
senderCustomPasswords();
} else {
showToast('${entity.errorMsg}');
}
}
@ -438,7 +436,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 3:
//
if (state.isPermanent.value == false) {
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
useDateStr = '类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
} else {
useDateStr = '类型:自定义-永久';
}
@ -466,7 +464,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_initReplySubscription();
@ -475,13 +472,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
_replySubscription.cancel();
}
}

View File

@ -223,8 +223,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
return Column(
children: <Widget>[
Visibility(
visible:
CommonDataManage().currentKeyInfo.vendor == 'XHJ' ? false : true,
visible: CommonDataManage().currentKeyInfo.vendor == 'XHJ',
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.beginTime.value,
@ -333,7 +332,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
Widget keyIfAdministratorWidget() {
return Visibility(
visible:
CommonDataManage().currentKeyInfo.isLockOwner == 1 ? true : false,
CommonDataManage().currentKeyInfo.isLockOwner == 1,
child: Column(
children: <Widget>[
// SizedBox(height: 10.h),
@ -375,14 +374,12 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
showPickerView(context, pickerDataList);
}),
Visibility(
visible: (CommonDataManage().currentKeyInfo.vendor ==
visible: CommonDataManage().currentKeyInfo.vendor ==
IoModelVendor.vendor_XL &&
(CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_BLE ||
CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_WIFI))
? true
: false,
IoModelVendor.model_XL_WIFI),
child: CommonItem(
leftTitel: '结束日期',
rightTitle: state.endTime.value,
@ -411,7 +408,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
state.loopEffectiveDate.value =
DateTool().getYMDHNDateString(p, 5);
state.loopStartHours.value = p.hour!;
});
}, hourShow24: true);
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
@ -425,7 +422,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
state.loopFailureDate.value =
DateTool().getYMDHNDateString(p, 5);
state.loopEndHours.value = p.hour!;
});
}, hourShow24: true);
}),
],
);
@ -620,7 +617,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
);
}
_switch() {
CupertinoSwitch _switch() {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
@ -694,7 +691,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
onTap: (int index) {
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
tabs: _itemTabs.map(_tab).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
@ -718,14 +715,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
Tab _tab(ItemView item) {
return Tab(
// text: item.title,
child: Container(
// width: item.title.length > 2 ? 1.sw / 8 : 1.sw / 12,
// margin: EdgeInsets.all(10.w),
// color: Colors.red,
child: Text(
item.title,
textAlign: TextAlign.center,
),
child: Text(
item.title,
textAlign: TextAlign.center,
),
);
}
@ -735,7 +727,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
child: TabBarView(
controller: state.tabController,
children: _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget()))
.map((ItemView item) => Obx(indexChangeWidget))
.toList(),
),
);
@ -827,7 +819,6 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
@override
void dispose() {
// TODO: implement dispose
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/mine/starLockMine_state.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
@ -80,7 +80,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
child: ClipRRect(
borderRadius: BorderRadius.circular(52.5.w),
child: CustomNetworkImage(
url: state.userHeadUrl.value ?? "",
url: state.userHeadUrl.value,
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
@ -99,7 +99,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
// logic.showToast('请先添加锁');
// } else {
Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {
arguments: <String, int>{
'webBuyType': XSConstantMacro.webBuyTypeVip,
});
// }

View File

@ -28,7 +28,7 @@ class _GetDeviceListPageState extends State<GetDeviceListPage> {
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Padding(
padding: EdgeInsets.only(
left: 30.w, top: 16.w, right: 30.w, bottom: 16.w),
@ -48,25 +48,25 @@ class _GetDeviceListPageState extends State<GetDeviceListPage> {
//
Widget _permissionDeviceList() {
return Column(
children: [
children: <Widget>[
Expanded(
child: ListView.separated(
itemBuilder: (context, index) {
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "大门锁");
context, index, 'images/icon_lock.png', '大门锁');
} else if (index == 1) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "办公室锁");
context, index, 'images/icon_lock.png', '办公室锁');
} else if (index == 2) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "会议室锁");
context, index, 'images/icon_lock.png', '会议室锁');
} else {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "宴会厅锁");
context, index, 'images/icon_lock.png', '宴会厅锁');
}
},
separatorBuilder: (context, index) {
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
@ -94,7 +94,7 @@ class _GetDeviceListPageState extends State<GetDeviceListPage> {
color: Colors.white,
width: ScreenUtil().screenWidth,
child: Row(
children: [
children: <Widget>[
SizedBox(
width: 30.w,
),

View File

@ -225,7 +225,7 @@ class _AddAuthorizedAdministratorPageState
maxLines: 1,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18),
LengthLimitingTextInputFormatter(50),
],
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -14,6 +14,7 @@ import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import '../../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/showTipView.dart';
import '../../../../tools/storage.dart';
import 'authorizedAdministratorList_logic.dart';
@ -195,7 +196,19 @@ class _AuthorizedAdministratorListPageState
SizedBox(
width: 30.w,
),
Image.asset('images/controls_user.png', width: 60.w, height: 60.w),
SizedBox(
width: 60.w,
height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: itemData.headUrl ?? '',
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
),
SizedBox(width: 20.w),
Expanded(
child: Column(

View File

@ -5,10 +5,12 @@ import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_state.dart';
import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/EasyRefreshTool.dart';
import '../../../../../tools/customNetworkImage.dart';
import '../../../../../tools/noData.dart';
import 'expireLockList_logic.dart';
@ -20,8 +22,8 @@ class ExpireLockListPage extends StatefulWidget {
}
class _ExpireLockListPageState extends State<ExpireLockListPage> {
final logic = Get.put(ExpireLockListLogic());
final state = Get.find<ExpireLockListLogic>().state;
final ExpireLockListLogic logic = Get.put(ExpireLockListLogic());
final ExpireLockListState state = Get.find<ExpireLockListLogic>().state;
Future<void> getHttpData() async {
logic.expireLockListRequest().then((ExpireLockListEntity value){
@ -46,7 +48,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
onLoad: (){
getHttpData();
},
child: Obx(() => _buildMainUI())
child: Obx(_buildMainUI)
);
}
@ -56,14 +58,14 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
: SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.dataList.length,
itemBuilder: (c, index) {
itemBuilder: (BuildContext c, int index) {
ExpireLockItem indexEntity = state.dataList[index];
return Slidable(
key:ValueKey(indexEntity.uid),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
children: <Widget>[
SlidableAction(
onPressed: (BuildContext context){
logic.deletKeyLogic(indexEntity);
@ -93,9 +95,9 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
onTap: () async {
if(itemData.keyType! == 4){
//
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
"pushType": 0,
"expireLockItem": itemData,
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: <String, Object>{
'pushType': 0,
'expireLockItem': itemData,
});
if(data != null) {
// setState(() {
@ -109,9 +111,9 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
getHttpData();
}
}else{
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
"pushType": 0,
"expireLockItem": itemData,
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: <String, Object>{
'pushType': 0,
'expireLockItem': itemData,
});
if(data != null) {
setState(() {
@ -129,14 +131,22 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
height: 90.h,
color: Colors.white,
child: Row(
children: [
children: <Widget>[
SizedBox(
width: 30.w,
),
Image.asset(
'images/controls_user.png',
SizedBox(
width: 60.w,
height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: itemData.headUrl ?? '',
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
),
SizedBox(
width: 20.w,
@ -144,10 +154,10 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
children: <Widget>[
Text(
itemData.nickname ?? '',
style: TextStyle(
@ -167,7 +177,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
children: <Widget>[
Text(
logic.getExpireDateStr(itemData),
style: TextStyle(

View File

@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_state.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../../../appRouters.dart';
@ -10,6 +11,7 @@ import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/showIosTipView.dart';
import 'lockUserManageList_logic.dart';
@ -22,12 +24,14 @@ class LockUserManageListPage extends StatefulWidget {
}
class _LockUserManageListPageState extends State<LockUserManageListPage> {
final logic = Get.put(LockUserManageListLogic());
final state = Get.find<LockUserManageListLogic>().state;
final LockUserManageListLogic logic = Get.put(LockUserManageListLogic());
final LockUserManageListState state = Get.find<LockUserManageListLogic>().state;
Future<void> getHttpData() async {
logic.lockUserListRequest().then((LockUserListEntity value) {
if (mounted) setState(() {});
if (mounted) {
setState(() {});
}
});
}
@ -46,7 +50,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
barTitle: TranslationLoader.lanKeys!.lockUserManagement!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
actionsList: <Widget>[
TextButton(
child: Text(
TranslationLoader.lanKeys!.aboutToExpire!.tr,
@ -67,7 +71,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
getHttpData();
},
child: Column(
children: [
children: <Widget>[
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
@ -89,7 +93,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
onPressed: () {
Navigator.pushNamed(
context, Routers.massSendElectronicKeyManagePage)
.then((value) {
.then((Object? value) {
logic.lockUserListRequest();
});
},
@ -121,22 +125,22 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
: SlidableAutoCloseBehavior(
child: ListView.separated(
itemCount: state.dataList.length,
itemBuilder: (c, index) {
LockUserItemData indexEntity = state.dataList[index];
itemBuilder: (BuildContext c, int index) {
final LockUserItemData indexEntity = state.dataList[index];
if (index < state.dataList.length) {
return Slidable(
key: ValueKey(indexEntity.uid),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
children: [
children: <Widget>[
SlidableAction(
onPressed: (BuildContext context) {
showIosTipViewDialog(context, indexEntity);
},
backgroundColor: Colors.red,
foregroundColor: Colors.white,
label: '删除',
label: '删除'.tr,
padding: EdgeInsets.only(left: 5.w, right: 5.w),
),
],
@ -161,7 +165,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
return GestureDetector(
onTap: () {
Navigator.pushNamed(context, Routers.ownedKeyListPage,
arguments: {'uid': itemData.uid});
arguments: <String, int?>{'uid': itemData.uid});
},
child: Container(
height: 90.h,
@ -171,14 +175,20 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
// borderRadius: BorderRadius.circular(10.w),
// ),
child: Row(
children: [
children: <Widget>[
SizedBox(width: 30.w),
SizedBox(
width: 30.w,
),
Image.asset(
'images/controls_user.png',
width: 60.w,
height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: itemData.headUrl ?? '',
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
),
SizedBox(
width: 20.w,
@ -186,10 +196,10 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
children: <Widget>[
Text(
itemData.nickname ?? '',
style: TextStyle(
@ -200,7 +210,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
SizedBox(height: 5.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
children: <Widget>[
Text(
itemData.userid ?? '',
style: TextStyle(

View File

@ -182,7 +182,8 @@ class Pickers {
DateCallback? onChanged,
DateCallback? onConfirm,
Function(bool isCancel)? onCancel,
bool overlapTabBar = false}) {
bool overlapTabBar = false,
bool hourShow24 = false}) {
pickerStyle ??= DefaultPickerStyle();
pickerStyle.context ??= context;
@ -212,6 +213,7 @@ class Pickers {
}
}
AppLog.log('picker Tip >>> hourShow24 : $hourShow24');
Navigator.of(context, rootNavigator: overlapTabBar).push(DatePickerRoute(
mode: mode,
initDate: selectDate,
@ -225,6 +227,7 @@ class Pickers {
// theme: Theme.of(context, shadowThemeOnly: true),
theme: Theme.of(context),
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
hourShow24: hourShow24,
));
}
}

View File

@ -35,6 +35,7 @@ class DatePickerRoute<T> extends PopupRoute<T> {
this.onCancel,
this.theme,
this.barrierLabel,
this.hourShow24,
RouteSettings? settings,
}) : super(settings: settings);
@ -48,6 +49,7 @@ class DatePickerRoute<T> extends PopupRoute<T> {
final DateCallback? onConfirm;
final Function(bool isCancel)? onCancel;
final PickerStyle? pickerStyle;
bool? hourShow24;
@override
Duration get transitionDuration => const Duration(milliseconds: 200);
@ -96,6 +98,7 @@ class DatePickerRoute<T> extends PopupRoute<T> {
minDate: minDate,
pickerStyle: pickerStyle!,
route: this,
hourShow24: hourShow24 ?? false,
),
);
if (theme != null) {
@ -115,6 +118,7 @@ class _PickerContentView extends StatefulWidget {
required this.maxDate,
required this.minDate,
required this.route,
this.hourShow24 = false,
}) : super(key: key);
final DateMode? mode;
@ -126,9 +130,12 @@ class _PickerContentView extends StatefulWidget {
late final PDuration maxDate;
late final PDuration minDate;
// 24
late final bool hourShow24;
@override
State<StatefulWidget> createState() => _PickerState(
this.mode, this.initData, this.maxDate, this.minDate, this.pickerStyle);
mode, initData, maxDate, minDate, pickerStyle, hourShow24);
}
class _PickerState extends State<_PickerContentView> {
@ -150,6 +157,9 @@ class _PickerState extends State<_PickerContentView> {
late final PDuration maxDate;
late final PDuration minDate;
// 24
bool hourShow24 = false;
Animation<double>? animation;
Map<DateType, FixedExtentScrollController> scrollCtrl = {};
@ -157,9 +167,9 @@ class _PickerState extends State<_PickerContentView> {
late double pickerItemHeight;
_PickerState(DateMode? mode, this._initSelectData, this.maxDate, this.minDate,
this._pickerStyle) {
this._dateItemModel = DateItemModel.parse(mode!);
this.pickerItemHeight = _pickerStyle.pickerItemHeight;
this._pickerStyle, this.hourShow24) {
_dateItemModel = DateItemModel.parse(mode!);
pickerItemHeight = _pickerStyle.pickerItemHeight;
_init();
}
@ -246,7 +256,7 @@ class _PickerState extends State<_PickerContentView> {
if (_dateItemModel.hour) {
index = 0;
int begin = 0;
int end = 23;
int end = hourShow24 ? 24 : 23;
//
if (intNotEmpty(minDate.hour)) {
begin = minDate.hour!;
@ -255,7 +265,7 @@ class _PickerState extends State<_PickerContentView> {
end = maxDate.hour!;
}
_dateTimeData.hour = TimeUtils.calcHour(begin: begin, end: end);
_dateTimeData.hour = TimeUtils.calcHour(begin: begin, end: end, hourShow24: hourShow24);
if (_initSelectData.hour != null) {
index = _dateTimeData.hour.indexOf(_initSelectData.hour);

View File

@ -22,9 +22,10 @@ class TimeUtils {
}
///
static List calcHour({int begin = 0, int end = 23}) {
static List calcHour({int begin = 0, int end = 23, bool hourShow24 = false}) {
begin = begin < 0 ? 0 : begin;
end = end > 23 ? 23 : end;
int hour = hourShow24 ? 24 : 23;
end = end > hour ? hour : end;
return _calcCount(begin, end);
}

View File

@ -1,5 +1,6 @@
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';
@ -95,14 +96,15 @@ class ShowTipView {
}
void showTFViewAlertDialog(TextEditingController controller, String title,
String tipTitle, Function sureClick) {
String tipTitle, Function sureClick, {List<TextInputFormatter>? inputFormatters}) {
//
showDialog(
context: Get.context!,
builder: (BuildContext context) {
return ShowTFView(
title: title,
tipTitle: tipTitle ?? "",
tipTitle: tipTitle,
inputFormatters: inputFormatters,
controller: controller,
sureClick: () {
//

View File

@ -10,6 +10,20 @@ import '../app_settings/app_colors.dart';
* */
class SubmitBtn extends StatelessWidget {
SubmitBtn({
required this.btnName, Key? key,
this.borderRadius,
this.color,
this.padding,
this.onClick,
this.margin,
this.width,
this.backgroundColorList,
this.isDelete,
this.fontSize,
this.isDisabled,
}) : super(key: key);
String? btnName;
Function()? onClick;
@ -32,21 +46,6 @@ class SubmitBtn extends StatelessWidget {
bool? isDisabled;
SubmitBtn({
Key? key,
required this.btnName,
this.borderRadius,
this.color,
this.padding,
this.onClick,
this.margin,
this.width,
this.backgroundColorList,
this.isDelete,
this.fontSize,
this.isDisabled,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
@ -113,16 +112,15 @@ class SubmitBtn extends StatelessWidget {
* */
class AddBottomWhiteBtn extends StatelessWidget {
AddBottomWhiteBtn({
required this.btnName, Key? key,
this.onClick,
}) : super(key: key);
String? btnName;
Function()? onClick;
AddBottomWhiteBtn({
Key? key,
required this.btnName,
this.onClick,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
@ -167,16 +165,15 @@ class AddBottomWhiteBtn extends StatelessWidget {
* */
class OutLineBtn extends StatelessWidget {
OutLineBtn({
required this.btnName, Key? key,
this.onClick,
}) : super(key: key);
String? btnName;
Function()? onClick;
OutLineBtn({
Key? key,
required this.btnName,
this.onClick,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(