Merge remote-tracking branch 'origin/master'

This commit is contained in:
魏少阳 2023-08-08 09:42:49 +08:00
commit e84d07d707
35 changed files with 2897 additions and 275 deletions

File diff suppressed because it is too large Load Diff

View File

@ -191,6 +191,9 @@
"lanChinese":"Chinese",
"multilingual":"Multilingual",
"addLock":"Add Lock",
"selectLockType":"Select lock type",
"videoIntercomDoorLock":"Video intercom door lock",
"NFCPassiveLock":"NFC Passive Lock",
"addDevice":"Add device",
"gateway":"Gateway",
"message":"Message",

View File

@ -191,6 +191,9 @@
"lanChinese":"lanChinese",
"multilingual":"multilingual",
"addLock":"addLock",
"selectLockType":"selectLockType",
"videoIntercomDoorLock":"videoIntercomDoorLock",
"NFCPassiveLock":"NFCPassiveLock",
"addDevice":"addDevice",
"gateway":"gateway",
"message":"message",

View File

@ -191,6 +191,9 @@
"lanChinese":"中文",
"multilingual":"多语言",
"addLock":"添加锁",
"selectLockType":"选择锁类型",
"videoIntercomDoorLock":"可视对讲门锁",
"NFCPassiveLock":"NFC无源锁",
"addDevice":"添加设备",
"gateway":"网关",
"message":"消息",

View File

@ -0,0 +1,9 @@
import 'package:get/get.dart';
import 'starLock_forgetPassword_logic.dart';
class StarLockForgetPasswordBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => StarLockForgetPasswordLogic());
}
}

View File

@ -0,0 +1,88 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
import '../../network/api_repository.dart';
import '../../tools/baseGetXController.dart';
import '../../tools/toast.dart';
class StarLockForgetPasswordLogic extends BaseGetXController {
final StarLockForgetPasswordState state = StarLockForgetPasswordState();
late Timer _timer;
void _startTimer() {
_timer = Timer.periodic(1.seconds, (timer) {
if (state.currentSecond > 1) {
state.currentSecond--;
} else {
_cancelTimer();
state.currentSecond = state.totalSeconds;
}
state.resetResend();
});
}
void _cancelTimer() {
_timer.cancel();
// _timer = null;
}
void resetPassword() async {
var entity = await ApiRepository.to.resetPassword(
state.countryCode.value,
state.phoneStr.value,
state.date.value,
state.pwd.value,
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
state.verificationCode.value);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '重置成功');
Get.back();
} else {
print('Error');
}
}
void sendValidationCode() async {
var entity = await ApiRepository.to.sendValidationCode(
// state.countryCode.value,
"+86",
state.phoneStr.value,
// state.isIphoneType.value ? "1" : "2",
'1',
state.codeType.value,
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) {
_startTimer();
} else {}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if (controller == state.phoneController) {
state.phoneStr.value = controller.text;
state.phoneStrIsOK.value = state.phoneStr.value.isNotEmpty;
}
if (controller == state.pwdController) {
state.pwd.value = controller.text;
}
if (controller == state.sureController) {
state.surePwd.value = controller.text;
}
if (controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub() {
state.canSub.value = state.pwdIsOK && state.codeIsOK;
print("22222:${state.canSub.value}");
}
}

View File

@ -4,6 +4,7 @@ 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/login/forgetPassword/starLock_forgetPassword_logic.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
@ -22,13 +23,8 @@ class StarLockForgetPasswordPage extends StatefulWidget {
class _StarLockForgetPasswordPageState
extends State<StarLockForgetPasswordPage> {
final TextEditingController _phoneController = TextEditingController();
final TextEditingController _pwdController = TextEditingController();
final TextEditingController _codeController = TextEditingController();
late Timer _timer;
int _seconds = 60;
final logic = Get.put(StarLockForgetPasswordLogic());
final state = Get.find<StarLockForgetPasswordLogic>().state;
@override
Widget build(BuildContext context) {
@ -44,7 +40,11 @@ class _StarLockForgetPasswordPageState
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: [
LoginInput(
controller: _phoneController,
controller: state.phoneController,
onchangeAction: (v) {
print("3333333:${v}");
logic.checkNext(state.phoneController);
},
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
@ -63,7 +63,10 @@ class _StarLockForgetPasswordPageState
]),
SizedBox(height: 10.h),
LoginInput(
controller: _pwdController,
controller: state.pwdController,
onchangeAction: (v) {
logic.checkNext(state.pwdController);
},
isPwd: true,
leftWidget: Padding(
padding: EdgeInsets.only(
@ -87,7 +90,10 @@ class _StarLockForgetPasswordPageState
),
SizedBox(height: 10.w),
LoginInput(
controller: _pwdController,
controller: state.sureController,
onchangeAction: (v) {
logic.checkNext(state.sureController);
},
isPwd: true,
leftWidget: Padding(
padding: EdgeInsets.only(
@ -108,21 +114,17 @@ class _StarLockForgetPasswordPageState
children: [
Expanded(
child: LoginInput(
controller: _codeController,
isPwd: true,
controller: state.codeController,
onchangeAction: (v) {
logic.checkNext(state.codeController);
},
leftWidget: Padding(
padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
child: SizedBox(
width: 36.w,
height: 36.w,
)
// Image.asset(
// 'images/main/icon_main_search.png',
// width: 40.w,
// height: 40.w,
// ),
),
padding: EdgeInsets.only(right: 10.w, left: 5.w),
child: SizedBox(
width: 30.w,
height: 30.w,
),
),
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
inputFormatters: [
@ -130,48 +132,62 @@ class _StarLockForgetPasswordPageState
]),
),
SizedBox(
width: 20.w,
width: 10.w,
),
GestureDetector(
child: Container(
width: 160.w,
height: 60.h,
padding: EdgeInsets.all(5.h),
decoration: BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(
_seconds == 60
? '${TranslationLoader.lanKeys!.getTip!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}'
: (_seconds < 10)
? '0$_seconds s'
: '$_seconds s',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 26.sp,
)),
),
),
onTap: () {
if (_seconds == 60) {
// _setVerify();
} else {
// Toast.show(msg: '正在获取验证码');
}
},
)
Obx(() => GestureDetector(
onTap: state.phoneStrIsOK.value
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
var result = await Navigator.pushNamed(
context, Routers.safetyVerificationPage,
arguments: {
"countryCode": "+86",
"account": state.phoneStr.value
});
logic.state.xWidth.value =
(result as Map<String, dynamic>)['xWidth'];
logic.sendValidationCode();
}
: null,
child: Container(
width: 180.w,
height: 60.h,
padding: EdgeInsets.all(5.h),
decoration: BoxDecoration(
color: state.phoneStrIsOK.value
? AppColors.mainColor
: AppColors.btnDisableColor,
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(state.btnText.value,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
)),
),
),
))
],
),
// ],
// ),
SizedBox(height: 50.w),
SubmitBtn(
btnName:
"${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}",
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
Obx(() {
return SubmitBtn(
btnName:
"${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}",
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
logic.resetPassword();
}
: null);
}),
],
));
}

View File

@ -0,0 +1,55 @@
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../translations/trans_lib.dart';
class StarLockForgetPasswordState {
final TextEditingController phoneController = TextEditingController();
final TextEditingController pwdController = TextEditingController();
final TextEditingController sureController = TextEditingController();
final TextEditingController codeController = TextEditingController();
static int currentTimeMillis() {
return DateTime.now().millisecondsSinceEpoch;
}
var countryCode = '+86'.obs;
var countryId = '9'.obs;
var codeType = '2'.obs;
var pwd = ''.obs;
var surePwd = ''.obs;
var verificationCode = ''.obs;
var xWidth = ''.obs; //
var canSub = false.obs;
var phoneStr = ''.obs;
var phoneStrIsOK = false.obs;
var date = currentTimeMillis().toString().obs;
bool get isIphone => RegexUtil.isMobileSimple(phoneStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value);
bool get codeIsOK => verificationCode.value.isNotEmpty;
var canResend = false.obs;
var btnText = ''.obs;
var totalSeconds = 120;
var currentSecond = 120;
StarLockForgetPasswordState() {
resetResend();
}
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
}
void onClose() {
phoneController.dispose();
pwdController.dispose();
sureController.dispose();
codeController.dispose();
}
}

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
@ -9,15 +8,15 @@ import '../../tools/baseGetXController.dart';
import '../../tools/toast.dart';
import 'starLock_register_state.dart';
class StarLockRegisterLogic extends BaseGetXController{
class StarLockRegisterLogic extends BaseGetXController {
final StarLockRegisterState state = StarLockRegisterState();
late Timer _timer;
void _startTimer() {
_timer = Timer.periodic(1.seconds, (timer) {
if(state.currentSecond > 1){
if (state.currentSecond > 1) {
state.currentSecond--;
}else {
} else {
_cancelTimer();
state.currentSecond = state.totalSeconds;
}
@ -30,38 +29,33 @@ class StarLockRegisterLogic extends BaseGetXController{
// _timer = null;
}
void register() async{
void register() async {
var entity = await ApiRepository.to.register(
state.countryCode.value,
state.countryId.value,
state.phoneOrEmailStr.value,
state.pwd.value,
"477E6814-289D-402A-9F49-F89A8BD05D63",
state.verificationCode.value
);
if(entity.errorCode!.codeIsSuccessful){
state.verificationCode.value);
if (entity.errorCode!.codeIsSuccessful) {
// await loginSuccess(loginEntity: entity);
Toast.show(msg: "注册成功");
Get.back();
} else {
}
} else {}
}
void sendValidationCode() async{
void sendValidationCode() async {
var entity = await ApiRepository.to.sendValidationCode(
// state.countryCode.value,
"+86",
state.phoneOrEmailStr.value,
state.isIphoneType.value?"1":"2",
state.isIphoneType.value ? "1" : "2",
'1',
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
state.xWidth.value.toString()
);
if(entity.errorCode!.codeIsSuccessful){
state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) {
_startTimer();
} else {
}
} else {}
}
void checkNext(TextEditingController controller) {
@ -69,25 +63,26 @@ class StarLockRegisterLogic extends BaseGetXController{
}
void changeInput(TextEditingController controller) {
if(controller == state.phoneOrEmailController){
if (controller == state.phoneOrEmailController) {
state.phoneOrEmailStr.value = controller.text;
state.phoneOrEmailStrIsOK.value = state.phoneOrEmailStr.value.isNotEmpty;
}
if(controller == state.pwdController) {
if (controller == state.pwdController) {
state.pwd.value = controller.text;
}
if(controller == state.sureController) {
if (controller == state.sureController) {
state.surePwd.value = controller.text;
}
if(controller == state.codeController) {
if (controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub(){
state.canSub.value = state.pwdIsOK && state.codeIsOK && (state.isIphoneType.value ? state.isIphone : state.isEmail);
void _resetCanSub() {
state.canSub.value = state.pwdIsOK &&
state.codeIsOK &&
(state.isIphoneType.value ? state.isIphone : state.isEmail);
print("22222:${state.canSub.value}");
}
}
}

View File

@ -1,25 +1,23 @@
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../translations/trans_lib.dart';
class StarLockRegisterState{
class StarLockRegisterState {
final TextEditingController phoneOrEmailController = TextEditingController();
final TextEditingController pwdController = TextEditingController();
final TextEditingController sureController = TextEditingController();
final TextEditingController codeController = TextEditingController();
var countryCode = ''.obs;
var countryId = ''.obs;
var countryCode = '+86'.obs;
var countryId = '9'.obs;
var phoneOrEmailStr = ''.obs;
var phoneOrEmailStrIsOK = false.obs;
var pwd = ''.obs;
var surePwd = ''.obs;
var verificationCode = ''.obs;
var xWidth = ''.obs;//
var xWidth = ''.obs; //
var isIphoneType = true.obs;
var canSub = false.obs;
@ -33,13 +31,15 @@ class StarLockRegisterState{
var totalSeconds = 120;
var currentSecond = 120;
StarLockRegisterState(){
StarLockRegisterState() {
resetResend();
}
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value ? '$currentSecond s' : btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
}
void onClose() {
@ -48,4 +48,4 @@ class StarLockRegisterState{
sureController.dispose();
codeController.dispose();
}
}
}

View File

@ -0,0 +1,54 @@
import 'package:azlistview/azlistview.dart';
import 'index.dart';
class CountriesModel extends ISuspensionBean {
String? short;
late String name;
String? en;
late String tel;
String? pinyin;
String? tagIndex;
CountriesModel(
{this.short,
required this.name,
this.en,
required this.tel,
this.pinyin,
this.tagIndex});
CountriesModel.fromJson(Map<String, dynamic> json) {
if (json["short"] is String) {
short = json["short"];
}
if (json["name"] is String) {
name = json["name"];
}
if (json["en"] is String) {
en = json["en"];
}
if (json["tel"] is String) {
tel = json["tel"];
}
if (json["pinyin"] is String) {
pinyin = json["pinyin"];
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["short"] = short;
data["name"] = name;
data["en"] = en;
data["tel"] = tel;
data["pinyin"] = pinyin;
return data;
}
@override
String getSuspensionTag() => tagIndex!;
@override
String toString() => json.encode(this);
}

View File

@ -0,0 +1,8 @@
export 'utils.dart';
export 'res.dart';
export 'dart:convert';
export 'package:common_utils/common_utils.dart';
export 'package:lpinyin/lpinyin.dart';

View File

@ -0,0 +1,108 @@
import 'dart:convert';
import 'package:azlistview/azlistview.dart';
import 'package:flutter/material.dart';
class CityModel extends ISuspensionBean {
String name;
String? tagIndex;
String? namePinyin;
CityModel({
required this.name,
this.tagIndex,
this.namePinyin,
});
CityModel.fromJson(Map<String, dynamic> json) : name = json['name'];
Map<String, dynamic> toJson() => {
'name': name,
// 'tagIndex': tagIndex,
// 'namePinyin': namePinyin,
// 'isShowSuspension': isShowSuspension
};
@override
String getSuspensionTag() => tagIndex!;
@override
String toString() => json.encode(this);
}
class ContactInfo extends ISuspensionBean {
String name;
String? tagIndex;
String? namePinyin;
Color? bgColor;
IconData? iconData;
String? img;
String? id;
String? firstletter;
ContactInfo({
required this.name,
this.tagIndex,
this.namePinyin,
this.bgColor,
this.iconData,
this.img,
this.id,
this.firstletter,
});
ContactInfo.fromJson(Map<String, dynamic> json)
: name = json['name'],
img = json['img'],
id = json['id']?.toString(),
firstletter = json['firstletter'];
Map<String, dynamic> toJson() => {
// 'id': id,
'name': name,
'img': img,
// 'firstletter': firstletter,
// 'tagIndex': tagIndex,
// 'namePinyin': namePinyin,
// 'isShowSuspension': isShowSuspension
};
@override
String getSuspensionTag() => tagIndex!;
@override
String toString() => json.encode(this);
}
// class Languages extends GithubLanguage with ISuspensionBean {
// String? tagIndex;
// String? pinyin;
// String? shortPinyin;
// Languages.fromJson(Map<String, dynamic> json) : super.fromJson(json);
// @override
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> map = super.toJson();
// void addIfNonNull(String fieldName, dynamic value) {
// if (value != null) {
// map[fieldName] = value;
// }
// }
// // addIfNonNull('tagIndex', tagIndex);
// return map;
// }
// @override
// String getSuspensionTag() {
// return tagIndex!;
// }
// @override
// String toString() {
// return json.encode(this);
// }
// }

View File

@ -0,0 +1,170 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/login/seletCountryRegion/common/countries_model.dart';
import 'package:star_lock/login/seletCountryRegion/common/models.dart';
import 'index.dart';
class Utils {
static String getImgPath(String name, {String format: 'png'}) {
return 'assets/images/$name.$format';
}
static void showSnackBar(BuildContext context, String msg) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(msg),
duration: Duration(seconds: 2),
),
);
}
static Widget getSusItem(BuildContext context, String tag,
{double susHeight = 40}) {
if (tag == '') {
tag = '★ 热门城市';
}
return Container(
height: susHeight,
width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.only(left: 16.0),
color: const Color(0xFFF3F4F5),
alignment: Alignment.centerLeft,
child: Text(
tag,
softWrap: false,
style: const TextStyle(
fontSize: 14.0,
color: Color(0xFF666666),
),
),
);
}
static Widget getListItem(BuildContext context, CountriesModel model,
{double susHeight = 40}) {
return GestureDetector(
child: SizedBox(
height: 80.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 20.w,
),
Text(
model.name,
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 24.sp),
),
Expanded(
child: SizedBox(
width: 30.w,
)),
Text(
'+${model.tel}',
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
),
SizedBox(
width: 60.w,
)
],
),
// Divider(
// height: 1,
// color: AppColors.greyLineColor,
// endIndent: 0,
// indent: 20.w,
// )
),
onTap: () {
LogUtil.e("onItemClick : $model");
Utils.showSnackBar(context, 'onItemClick : ${model.name}');
},
);
// return ListTile(
// title: Text('${model.name} +${model.tel}'),
// onTap: () {
// LogUtil.e("onItemClick : $model");
// Utils.showSnackBar(context, 'onItemClick : ${model.name}');
// },
// );
// return Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Offstage(
// offstage: !(model.isShowSuspension == true),
// child: getSusItem(context, model.getSuspensionTag(),
// susHeight: susHeight),
// ),
// ListTile(
// title: Text(model.name),
// onTap: () {
// LogUtil.e("onItemClick : $model");
// Utils.showSnackBar(context, 'onItemClick : ${model.name}');
// },
// )
// ],
// );
}
static Widget getWeChatListItem(
BuildContext context,
ContactInfo model, {
double susHeight = 40,
Color? defHeaderBgColor,
}) {
return getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor);
// return Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Offstage(
// offstage: !(model.isShowSuspension == true),
// child: getSusItem(context, model.getSuspensionTag(),
// susHeight: susHeight),
// ),
// getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor),
// ],
// );
}
static Widget getWeChatItem(
BuildContext context,
ContactInfo model, {
Color? defHeaderBgColor,
}) {
DecorationImage? image;
// if (model.img != null && model.img.isNotEmpty) {
// image = DecorationImage(
// image: CachedNetworkImageProvider(model.img),
// fit: BoxFit.contain,
// );
// }
return ListTile(
leading: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(4.0),
color: model.bgColor ?? defHeaderBgColor,
image: image,
),
child: model.iconData == null
? null
: Icon(
model.iconData,
color: Colors.white,
size: 20,
),
),
title: Text(model.name),
onTap: () {
LogUtil.e("onItemClick : $model");
Utils.showSnackBar(context, 'onItemClick : ${model.name}');
},
);
}
}

View File

@ -1,10 +1,13 @@
import 'package:azlistview/azlistview.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import '../../app_settings/app_colors.dart';
import '../../tools/titleAppBar.dart';
import '../../translations/trans_lib.dart';
import 'common/countries_model.dart';
import 'common/index.dart';
class SeletCountryRegionPage extends StatefulWidget {
const SeletCountryRegionPage({Key? key}) : super(key: key);
@ -14,14 +17,67 @@ class SeletCountryRegionPage extends StatefulWidget {
}
class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
List<CountriesModel> countriesList = [];
@override
void initState() {
super.initState();
SuspensionUtil.setShowSuspensionStatus(
countriesList.cast<ISuspensionBean>());
Future.delayed(const Duration(milliseconds: 500), () {
loadData();
});
}
Future<String> loadJsonFromAssets(String assetsPath) async {
return await rootBundle.loadString(assetsPath);
}
void loadData() async {
//
String jsonData = await loadJsonFromAssets('assets/countries.json');
countriesList.clear();
List list = json.decode(jsonData);
for (var v in list) {
countriesList.add(CountriesModel.fromJson(v));
}
_handleList(countriesList);
}
void _handleList(List<CountriesModel> list) {
if (list.isEmpty) return;
for (int i = 0, length = list.length; i < length; i++) {
CountriesModel countryModel = list[i];
// String pinyin = PinyinHelper.getPinyinE(list[i].name);
String tag = countryModel.pinyin!.substring(0, 1).toUpperCase();
// list[i].pinyin = pinyin;
if (RegExp('[A-Z]').hasMatch(tag)) {
list[i].tagIndex = tag;
} else {
list[i].tagIndex = '#';
}
}
// A-Z sort.
SuspensionUtil.sortListBySuspensionTag(list);
// show sus tag.
SuspensionUtil.setShowSuspensionStatus(countriesList);
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(barTitle: "${TranslationLoader.lanKeys!.selet!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", haveBack:true, backgroundColor: AppColors.mainColor, actionsList: [
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(
barTitle:
"${TranslationLoader.lanKeys!.selet!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor,
actionsList: [
TextButton(
child: Text(
TranslationLoader.lanKeys!.reset!.tr,
@ -31,18 +87,23 @@ class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
Navigator.pop(context, {'code': "+86", "countryId": "9"});
},
),
],),
body:ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: [
],
)
],
),
body: AzListView(
data: countriesList,
itemCount: countriesList.length,
itemBuilder: (BuildContext context, int index) {
CountriesModel model = countriesList[index];
return Utils.getListItem(context, model);
},
padding: EdgeInsets.zero,
susItemBuilder: (BuildContext context, int index) {
CountriesModel model = countriesList[index];
String tag = model.getSuspensionTag();
return Utils.getSusItem(context, tag);
},
indexBarData: ['', ...kIndexBarData],
),
);
}
_backBtnAction(){
}
}

View File

@ -124,8 +124,8 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
child: Container(
// margin: EdgeInsets.only(left: 20.w),
child: Image(
width: 40.w,
height: 40.w,
width: 30.w,
height: 30.w,
image: const AssetImage("images/icon_left_black.png"),
),
),
@ -135,7 +135,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
),
Text("$_year-$_month",
style: TextStyle(
fontSize: 34.sp,
fontSize: 28.sp,
color: Colors.black,
fontWeight: FontWeight.w500)),
SizedBox(
@ -148,8 +148,8 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
child: Container(
// margin: EdgeInsets.only(right: 20.sp),
child: Image(
width: 40.w,
height: 40.h,
width: 30.w,
height: 30.w,
image: const AssetImage("images/icon_right_black.png"),
),
),
@ -195,7 +195,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
color: index == 5 || index == 6
? const Color(0xFFC4C8D0)
: const Color(0xFF3C3E43),
fontSize: 30.sp),
fontSize: 26.sp),
));
},
),
@ -267,13 +267,13 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
//
style: _datas[index].isSelect!
? TextStyle(
fontSize: 32.sp, color: const Color(0xFFFFFFFF))
fontSize: 24.sp, color: const Color(0xFFFFFFFF))
: (index % 7 == 5 || index % 7 == 6
? TextStyle(
fontSize: 32.sp,
fontSize: 24.sp,
color: const Color(0xFFC4C8D0))
: TextStyle(
fontSize: 32.sp,
fontSize: 24.sp,
color: const Color(0xFF3C3E43))),
),
),
@ -316,7 +316,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
"月统计",
style: TextStyle(
color: Colors.white,
fontSize: 32.sp,
fontSize: 26.sp,
fontWeight: FontWeight.w500),
),
),
@ -344,22 +344,22 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
children: [
SizedBox(width: 20.w),
Container(
width: 35.w,
height: 35.w,
width: 30.w,
height: 30.w,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.all(Radius.circular(35.h))),
borderRadius: BorderRadius.all(Radius.circular(30.h))),
),
SizedBox(width: 20.w),
Expanded(
child: Text(leftTitel,
style: TextStyle(
fontSize: 28.sp, fontWeight: FontWeight.w500))),
fontSize: 24.sp, fontWeight: FontWeight.w500))),
SizedBox(width: 20.w),
Text(rightTitle,
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500)),
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500)),
SizedBox(width: 10.w),
],
),

View File

@ -121,11 +121,17 @@ class _LockSetPageState extends State<LockSetPage> {
CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockQRCode!.tr,
rightTitle: "",
isHaveLine: false,
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.unlockQRCodePage);
}),
CommonItem(
leftTitel: 'WiFi配网',
rightTitle: "",
isHaveLine: false,
isHaveDirection: true,
action: () {}),
SizedBox(
height: 10.h,
),

View File

@ -149,6 +149,15 @@ class _LockDetailPageState extends State<LockDetailPage> {
Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
arguments: 2);
}),
//->
bottomItem('images/main/icon_main_fingerprint.png', '人脸', () {
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
// arguments: 1);
}),
bottomItem('images/main/icon_main_fingerprint.png', '监控', () {
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
// arguments: 1);
}),
bottomItem('images/main/icon_main_authorizedAdmin.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
Navigator.pushNamed(context, Routers.authorizedAdminListPage);

View File

@ -83,7 +83,13 @@ class _OtherTypeKeyDetailPageState extends State<OtherTypeKeyDetailPage> {
action: () {
Navigator.pushNamed(context, Routers.keyOperationRecordPage);
}),
Container(height: 40.h),
SizedBox(
height: 40.h,
),
addControlsBtn(type),
SizedBox(
height: 30.h,
),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.delete!.tr,
isDelete: true,
@ -97,6 +103,96 @@ class _OtherTypeKeyDetailPageState extends State<OtherTypeKeyDetailPage> {
);
}
Widget addControlsBtn(int type) {
List<Widget> widgetList = [];
List<Map<String, dynamic>> routerList = [];
//
if (type == 0) {
routerList.add({
'btnTitle': '设置密码',
'routerName': Routers.passwordKeyDetailPage,
'type': 9
});
routerList.add({
'btnTitle': '设置指纹',
'routerName': Routers.otherTypeKeyManagePage,
'type': 1
});
routerList.add({
'btnTitle': '设置遥控',
'routerName': Routers.otherTypeKeyManagePage,
'type': 2
});
} else if (type == 1) {
//
routerList.add({
'btnTitle': '设置密码',
'routerName': Routers.passwordKeyDetailPage,
'type': 9
});
routerList.add({
'btnTitle': '设置卡',
'routerName': Routers.otherTypeKeyManagePage,
'type': 0
});
routerList.add({
'btnTitle': '设置遥控',
'routerName': Routers.otherTypeKeyManagePage,
'type': 2
});
} else if (type == 2) {
//
routerList.add({
'btnTitle': '设置密码',
'routerName': Routers.passwordKeyDetailPage,
'type': 9
});
routerList.add({
'btnTitle': '设置卡',
'routerName': Routers.otherTypeKeyManagePage,
'type': 0
});
routerList.add({
'btnTitle': '设置指纹',
'routerName': Routers.otherTypeKeyManagePage,
'type': 1
});
}
for (int i = 0; i < routerList.length; i++) {
widgetList.add(SizedBox(
width: ScreenUtil().screenWidth - 40.w,
height: 60.h,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
// backgroundColor: Colors.white,
side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () {
if (routerList[i]['type'] == 9) {
Navigator.pushNamed(context, Routers.passwordKeyManagePage);
} else {
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
arguments: routerList[i]['type']);
}
},
child: Text(
routerList[i]['btnTitle'],
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
)),
));
widgetList.add(
SizedBox(
height: 10.h,
),
);
}
return Column(
children: widgetList,
);
}
String getAppBarTitle(int type) {
String title = "";
switch (type) {

View File

@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/shareModule/sharePopup.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -90,6 +91,63 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
Navigator.pushNamed(context, Routers.keyOperationRecordPage);
}),
Container(height: 40.h),
SizedBox(
width: ScreenUtil().screenWidth - 40.w,
height: 60.h,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
// backgroundColor: Colors.white,
side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () {
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
arguments: 0);
},
child: Text(
'设置卡',
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
)),
),
SizedBox(
height: 10.h,
),
SizedBox(
width: ScreenUtil().screenWidth - 40.w,
height: 60.h,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
// backgroundColor: Colors.white,
side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () {
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
arguments: 1);
},
child: Text(
'设置指纹',
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
)),
),
SizedBox(
height: 10.h,
),
SizedBox(
width: ScreenUtil().screenWidth - 40.w,
height: 60.h,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
// backgroundColor: Colors.white,
side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () {
Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
arguments: 2);
},
child: Text(
'设置遥控',
style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
)),
),
SizedBox(
height: 30.h,
),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.delete!.tr,
isDelete: true,

View File

@ -22,7 +22,7 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.addLock!.tr,
barTitle: TranslationLoader.lanKeys!.selectLockType!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
@ -41,6 +41,10 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
TranslationLoader.lanKeys!.doorLock!.tr, () {
Navigator.pushNamed(context, Routers.addLockPage);
}),
lockTypeItem('images/lockType/lockType_doorLock.png',
TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () {
Navigator.pushNamed(context, Routers.addLockPage);
}),
lockTypeItem('images/lockType/lockType_padlock.png',
TranslationLoader.lanKeys!.padlock!.tr, () {
Navigator.pushNamed(context, Routers.addLockPage);

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/tools/ExpandedListView.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart';
@ -97,20 +98,14 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
child: ListView.separated(
itemBuilder: (context, index) {
if (index == 0) {
return _buildNameWidget(
context, index, 'images/icon_password.png', '密码1');
return _buildNameExpandedList(context, index, "张三");
} else if (index == 1) {
return _buildNameWidget(
context, index, 'images/icon_card.png', '卡1');
return _buildNameExpandedList(context, index, "李四");
} else if (index == 2) {
return _buildNameWidget(
context, index, 'images/icon_fingerprint.png', '指纹1');
} else if (index == 3) {
return _buildNameWidget(
context, index, 'images/icon_card.png', '遥控1');
return _buildNameExpandedList(context, index, "王二");
} else {
return _buildNameExpandedList(context, index, "麻子");
}
return null;
// return _buildNameWidget(context, index);
},
separatorBuilder: (context, index) {
return const Divider(
@ -141,17 +136,13 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
child: ListView.separated(
itemBuilder: (context, index) {
if (index == 0) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "大门锁");
return _buildDeviceExpandedList(context, index, "大门锁");
} else if (index == 1) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "办公室锁");
return _buildDeviceExpandedList(context, index, "办公室锁");
} else if (index == 2) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "会议室锁");
return _buildDeviceExpandedList(context, index, "会议室锁");
} else {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "宴会厅锁");
return _buildDeviceExpandedList(context, index, "宴会厅锁");
}
},
separatorBuilder: (context, index) {
@ -172,10 +163,85 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
);
}
//
Widget _buildDeviceExpandedList(context, index, deviceName) {
return ExpandedListTile(
onTap: () => print("onTap."),
title: deviceName,
imgName: 'images/icon_lock.png',
typeImgList: const [],
child: ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 10,
itemBuilder: (_, index) {
if (index == 0) {
return _buildNameWidget(
context, index, 'images/icon_password.png', '张三');
} else if (index == 1) {
return _buildNameWidget(
context, index, 'images/icon_card.png', '李四');
} else if (index == 2) {
return _buildNameWidget(
context, index, 'images/icon_fingerprint.png', '王二');
} else if (index == 3) {
return _buildNameWidget(
context, index, 'images/icon_card.png', '麻子');
} else {
return null;
}
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
),
);
}
//
Widget _buildNameExpandedList(context, index, deviceName) {
return ExpandedListTile(
onTap: () => print("onTap."),
title: deviceName,
imgName: 'images/controls_user.png',
typeImgList: const ['images/icon_password.png', 'images/icon_card.png'],
child: ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 5,
itemBuilder: (_, index) {
if (index == 0) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "大门锁");
} else if (index == 1) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "办公室锁");
} else if (index == 2) {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "会议室锁");
} else {
return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "宴会厅锁");
}
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
),
);
}
//
Widget _buildNameWidget(context, index, imageName, getName) {
return GestureDetector(
child: Container(
height: 90.h,
height: 60.h,
color: Colors.white,
width: ScreenUtil().screenWidth,
child: Row(
@ -184,7 +250,7 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
width: 30.w,
),
Image.asset(
imageName,
'images/controls_user.png',
width: 36.w,
height: 36.w,
),
@ -193,18 +259,8 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
),
Text(
getName,
style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor),
),
Expanded(
child: SizedBox(
width: 20.w,
)),
Image.asset(
isNameSelect == false
? 'images/icon_round_unSelet.png'
: 'images/icon_round_selet.png',
width: 30.sp,
height: 30.sp,
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(
width: 30.w,
@ -223,10 +279,11 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
);
}
//
Widget _buildDeviceWidget(context, index, imageName, deviceName) {
return GestureDetector(
child: Container(
height: 90.h,
height: 60.h,
color: Colors.white,
width: ScreenUtil().screenWidth,
child: Row(
@ -244,18 +301,8 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
),
Text(
deviceName,
style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor),
),
Expanded(
child: SizedBox(
width: 20.w,
)),
Image.asset(
isDeviceSelect == false
? 'images/icon_round_unSelet.png'
: 'images/icon_round_selet.png',
width: 30.sp,
height: 30.sp,
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(
width: 30.w,

View File

@ -54,16 +54,16 @@ class _GetNameListPageState extends State<GetNameListPage> {
itemBuilder: (context, index) {
if (index == 0) {
return _buildNameWidget(
context, index, 'images/icon_password.png', '密码1');
context, index, 'images/controls_user.png', '张三');
} else if (index == 1) {
return _buildNameWidget(
context, index, 'images/icon_card.png', '卡1');
context, index, 'images/controls_user.png', '李四');
} else if (index == 2) {
return _buildNameWidget(
context, index, 'images/icon_fingerprint.png', '指纹1');
context, index, 'images/controls_user.png', '王二');
} else if (index == 3) {
return _buildNameWidget(
context, index, 'images/icon_card.png', '遥控1');
context, index, 'images/controls_user.png', '麻子');
}
return null;
},

View File

@ -1,8 +1,6 @@
abstract class Api {
// final String baseUrl = "http://test.lock.star-lock.cn/api"; //
final String baseUrl = "https://lock.star-lock.cn/api";//
final String baseUrl = "https://lock.star-lock.cn/api"; //
//
final String getVerificationCodeUrl = '/user/sendValidationCode';
@ -10,5 +8,5 @@ abstract class Api {
final String getSliderVerifyImgUrl = '/user/getSliderVerifyImg';
final String checkImgUrl = '/user/isSliderValid';
final String loginUrl = '/user/login';
final String resetPasswordURL = '/user/resetPassword'; //
}

View File

@ -1,70 +1,96 @@
import 'dart:convert';
import 'package:get/get.dart';
import 'api_provider_base.dart';
class ApiProvider extends BaseProvider {
Future<Response> getVerificationCode(String countryCode, String account,
String channel, String codeType, String uniqueid, String xWidth) =>
post(
getVerificationCodeUrl.toUrl,
jsonEncode({
'countryCode': countryCode,
'account': account,
"channel": channel,
'codeType': codeType,
"uniqueid": uniqueid,
'xWidth': xWidth,
}));
Future<Response> getVerificationCode(
String countryCode,
String account,
String channel,
String uniqueid,
String xWidth) => post(getVerificationCodeUrl.toUrl, null, query: {
'countryCode':countryCode,
'account':account,
"channel":channel,
'codeType':"1",
"uniqueid":uniqueid,
'xWidth':xWidth,
});
Future<Response> register(String countryCode, String countryId, String mobile,
String password, String uniqueid, String verificationCode) =>
post(registerUrl.toUrl, null, query: {
'countryCode': countryCode,
'countryId': countryId,
"mobile": mobile,
'password': password,
'platId': "2",
"uniqueid": uniqueid,
'verificationCode': verificationCode,
});
Future<Response> register(
String countryCode,
String countryId,
String mobile,
String password,
String uniqueid,
String verificationCode) => post(registerUrl.toUrl, null,query: {
'countryCode':countryCode,
'countryId':countryId,
"mobile":mobile,
'password':password,
'platId':"2",
"uniqueid":uniqueid,
'verificationCode':verificationCode,
});
// post(
// registerUrl.toUrl,
// jsonEncode({
// 'countryCode': countryCode,
// 'countryId': countryId,
// "mobile": mobile,
// 'password': password,
// 'platId': "2",
// "uniqueid": uniqueid,
// 'verificationCode': verificationCode,
// }));
Future<Response> getSliderVerifyImg(
String countryCode,
String account) => post(getSliderVerifyImgUrl.toUrl, null,query: {
'countryCode':countryCode,
'account':account,
});
Future<Response> getSliderVerifyImg(String countryCode, String account) =>
post(
getSliderVerifyImgUrl.toUrl,
jsonEncode({
'countryCode': countryCode,
'account': account,
}));
Future<Response> checkSliderVerifyImg(
String countryCode,
String account,
String xWidth) => post(checkImgUrl.toUrl, null,query: {
'countryCode':countryCode,
'account':account,
'xWidth':xWidth,
});
String countryCode, String account, String xWidth) =>
post(
checkImgUrl.toUrl,
jsonEncode({
'countryCode': countryCode,
'account': account,
'xWidth': xWidth,
}));
Future<Response> login(
String loginType,
String password,
String countryCode,
String username) => post(loginUrl.toUrl, null,query: {
'loginType':loginType,
'password':password,
"platId":"2",
'uniqueid':"477E6814-289D-402A-9F49-F89A8BD05D63",
'countryCode':countryCode,
"username":username
});
Future<Response> login(String loginType, String password, String countryCode,
String username) =>
post(
loginUrl.toUrl,
jsonEncode({
'loginType': loginType,
'password': password,
"platId": "2",
'uniqueid': "477E6814-289D-402A-9F49-F89A8BD05D63",
'countryCode': countryCode,
"username": username
}));
Future<Response> resetPassword(
String countryCode,
String account,
String date,
String newPassword,
String uniqueid,
String verificationCode) =>
post(
resetPasswordURL.toUrl,
jsonEncode({
'countryCode': countryCode,
'account': account,
"date": date,
'newPassword': newPassword,
"uniqueid": uniqueid,
'verificationCode': verificationCode,
}));
}
extension ExtensionString on String {
String get toUrl => '$this';
}
}

View File

@ -1,3 +1,4 @@
import 'dart:convert';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
@ -20,11 +21,23 @@ class BaseProvider extends GetConnect with Api {
}
@override
Future<Response<T>> post<T>(String? url, body, {String? contentType, Map<String, String>? headers, Map<String, dynamic>? query, Decoder<T>? decoder, Progress? uploadProgress}) async {
Future<Response<T>> post<T>(String? url, body,
{String? contentType,
Map<String, String>? headers,
Map<String, dynamic>? query,
Decoder<T>? decoder,
Progress? uploadProgress}) async {
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
var res = await super.post(url, body, contentType: contentType, headers:headers, query: query, decoder:decoder, uploadProgress: uploadProgress);
if(res.body == null){
if(EasyLoading.isShow)EasyLoading.dismiss(animation: true);
print('哈喽请求body体为${body}');
var res = await super.post(url, body,
contentType: contentType,
headers: headers,
query: query,
decoder: decoder,
uploadProgress: uploadProgress);
if (res.body == null) {
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
var rs = {
"errorMsg": "Network Error!",
"errorCode": -1,
@ -42,5 +55,4 @@ class BaseProvider extends GetConnect with Api {
}
return res;
}
}
}

View File

@ -1,5 +1,3 @@
import 'package:get/get.dart';
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
@ -13,15 +11,16 @@ class ApiRepository {
static ApiRepository get to => Get.find<ApiRepository>();
ApiRepository(this.apiProvider);
//
// 12345
Future<SendValidationCodeEntity> sendValidationCode(
String countryCode,
String account,
String channel,
String codeType,
String uniqueid,
String xWidth
) async {
final res = await apiProvider.getVerificationCode(countryCode, account, channel, uniqueid, xWidth);
String xWidth) async {
final res = await apiProvider.getVerificationCode(
countryCode, account, channel, codeType, uniqueid, xWidth);
return SendValidationCodeEntity.fromJson(res.body);
}
@ -32,38 +31,44 @@ class ApiRepository {
String mobile,
String password,
String uniqueid,
String verificationCode
) async {
final res = await apiProvider.register(countryCode, countryId, mobile, password, uniqueid, verificationCode);
String verificationCode) async {
final res = await apiProvider.register(
countryCode, countryId, mobile, password, uniqueid, verificationCode);
return LoginEntity.fromJson(res.body);
}
//
Future<SafetyVerificationEntity> getSliderVerifyImg(
String countryCode,
String account
) async {
String countryCode, String account) async {
final res = await apiProvider.getSliderVerifyImg(countryCode, account);
return SafetyVerificationEntity.fromJson(res.body);
}
//
Future<CheckSafetyVerificationEntity> checkSliderVerifyImg(
String countryCode,
String account,
String xWidth) async {
final res = await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth);
String countryCode, String account, String xWidth) async {
final res =
await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth);
return CheckSafetyVerificationEntity.fromJson(res.body);
}
Future<LoginEntity> login(
String loginType,
String password,
String countryCode,
String username) async {
final res = await apiProvider.login(loginType, password, countryCode, username);
Future<LoginEntity> login(String loginType, String password,
String countryCode, String username) async {
final res =
await apiProvider.login(loginType, password, countryCode, username);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> resetPassword(
String countryCode,
String account,
String date,
String newPassword,
String uniqueid,
String verificationCode) async {
final res = await apiProvider.resetPassword(
countryCode, account, date, newPassword, uniqueid, verificationCode);
return LoginEntity.fromJson(res.body);
}
}

View File

@ -1,13 +1,12 @@
import 'dart:async';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:get/get_connect/http/src/request/request.dart';
FutureOr<Request> requestLogInterceptor(Request request) async {
Get.log('GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
Get.log(
'GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
Get.log(request.headers.toString());
EasyLoading.show();
return request;
}
}

View File

@ -0,0 +1,127 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/app_settings/app_colors.dart';
class ExpandedListTile extends StatefulWidget {
const ExpandedListTile(
{Key? key,
required this.title,
this.child,
this.onTap,
required this.typeImgList,
required this.imgName})
: super(key: key);
final String title;
final String imgName;
final Widget? child;
final List typeImgList;
final Function()? onTap;
@override
_ExpandedListTileState createState() => _ExpandedListTileState();
}
class _ExpandedListTileState extends State<ExpandedListTile> {
bool _isExpanded = false;
final Duration _animationDuration = const Duration(milliseconds: 200);
bool _isCheck = false;
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
color: Colors.white,
height: 80.h,
child: Row(
children: _buildExpandRowList(),
),
),
ClipRect(
child: AnimatedAlign(
heightFactor: _isExpanded ? 1.0 : 0.0,
alignment: Alignment.center,
duration: _animationDuration,
child: widget.child),
),
],
);
}
List<Widget> _buildExpandRowList() {
List<Widget> widgetList = [];
widgetList.add(GestureDetector(
child: Container(
color: Colors.white,
width: 80.w,
child: Row(
children: [
SizedBox(
width: 30.w,
),
Image.asset(
_isCheck
? "images/icon_round_selet.png"
: "images/icon_round_unSelet.png",
width: 30.w,
height: 30.w,
),
SizedBox(
width: 20.w,
)
],
),
),
onTap: () {
//
setState(() {
_isCheck = !_isCheck;
});
},
));
widgetList.add(GestureDetector(
child: Container(
width: ScreenUtil().screenWidth - 80.w,
color: Colors.white,
child: Row(
children: [
Image.asset(
widget.imgName,
width: 36.w,
height: 36.w,
),
SizedBox(
width: 10.w,
),
Text(
widget.title,
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
),
Expanded(
child: SizedBox(
width: 10.w,
)),
AnimatedRotation(
turns: _isExpanded ? 0 : -0.5,
duration: _animationDuration,
child: const Icon(Icons.keyboard_arrow_down),
),
SizedBox(
width: 30.w,
)
],
),
),
onTap: () {
//
setState(() {
_isExpanded = !_isExpanded;
});
widget.onTap?.call();
},
));
return widgetList;
}
}

View File

@ -0,0 +1,105 @@
import 'package:flutter/material.dart';
class SharePopup extends StatelessWidget {
List<String> nameItems = <String>[
'微信',
'朋友圈',
'QQ',
'QQ空间',
'微博',
'FaceBook',
'邮件',
'链接'
];
List<String> urlItems = <String>[
'icon_wechat.png',
'icon_wechat_moments.png',
'icon_qq.png',
'icon_qzone.png',
'icon_sina.png',
'icon_facebook.png',
'icon_email.png',
'icon_copylink.png'
];
SharePopup({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return _shareWidget(context);
// Scaffold(
// appBar: AppBar(
// title: const Text("分享页面"),
// ),
// body: _shareWidget(context)
/*
Center(
child: Builder(builder: (BuildContext context) {
return ElevatedButton(
onPressed: () {
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return _shareWidget(context);
});
},
child: const Text("我要分享"),
// color: Colors.blue
);
}),
)
*/
// );
}
Widget _shareWidget(BuildContext context) {
return SizedBox(
height: 250.0,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
child: SizedBox(
height: 190.0,
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
mainAxisSpacing: 5.0,
childAspectRatio: 1.0),
itemBuilder: (BuildContext context, int index) {
return Column(
children: <Widget>[
Padding(
padding:
const EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 6.0),
child: Image.asset(
'images/${urlItems[index]}',
width: 50.0,
height: 50.0,
fit: BoxFit.fill,
)),
Text(nameItems[index])
],
);
},
itemCount: nameItems.length,
),
),
),
Container(
height: 0.5,
color: Colors.blueGrey,
),
const Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0),
child: Text(
'取 消',
style: TextStyle(fontSize: 18.0, color: Colors.blueGrey),
)),
)
],
),
);
}
}

View File

@ -54,7 +54,7 @@ class SubmitBtn extends StatelessWidget {
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: isDisabled == false
? Colors.grey
? AppColors.btnDisableColor
: (isDelete == true ? Colors.red : AppColors.mainColor),
),
onPressed: () {

View File

@ -188,6 +188,9 @@ class LanKeyEntity {
this.lanChinese,
this.multilingual,
this.addLock,
this.selectLockType,
this.videoIntercomDoorLock,
this.NFCPassiveLock,
this.addDevice,
this.gateway,
this.message,
@ -570,6 +573,9 @@ class LanKeyEntity {
lanChinese = json['lanChinese'];
multilingual = json['multilingual'];
addLock = json['addLock'];
selectLockType = json['selectLockType'];
videoIntercomDoorLock = json['videoIntercomDoorLock'];
NFCPassiveLock = json['NFCPassiveLock'];
addDevice = json['addDevice'];
gateway = json['gateway'];
message = json['message'];
@ -969,6 +975,9 @@ class LanKeyEntity {
String? lanChinese;
String? multilingual;
String? addLock;
String? selectLockType;
String? videoIntercomDoorLock;
String? NFCPassiveLock;
String? addDevice;
String? gateway;
String? message;
@ -1365,6 +1374,9 @@ class LanKeyEntity {
map['lanChinese'] = lanChinese;
map['multilingual'] = multilingual;
map['addLock'] = addLock;
map['selectLockType'] = selectLockType;
map['videoIntercomDoorLock'] = videoIntercomDoorLock;
map['NFCPassiveLock'] = NFCPassiveLock;
map['addDevice'] = addDevice;
map['gateway'] = gateway;
map['message'] = message;

View File

@ -80,6 +80,10 @@ dependencies:
flutter_easyloading: ^3.0.5
#图形验证码
aj_captcha_flutter: ^0.0.1
#国家选择
azlistview: ^2.0.0
common_utils: ^2.0.0
lpinyin: ^2.0.3
dev_dependencies:
flutter_test:
@ -111,6 +115,7 @@ flutter:
- images/lan/
- images/mine/
- images/lockType/
- assets/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware