Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release
This commit is contained in:
commit
fe5b3089a3
162
lib/app.dart
162
lib/app.dart
@ -7,9 +7,13 @@ import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/app_get_version.dart';
|
||||
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/app_manager.dart';
|
||||
import 'package:star_lock/tools/bindings/app_binding.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import 'package:star_lock/translations/app_dept.dart';
|
||||
@ -22,15 +26,13 @@ import 'tools/appRouteObserver.dart';
|
||||
import 'tools/store_service.dart';
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({GlobalKey? key}) : super(key: key);
|
||||
MyApp({required this.isLogin, GlobalKey? key}) : super(key: key);
|
||||
bool isLogin;
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
// 注册 RouteObserver 作为 navigation observer.
|
||||
// final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
||||
|
||||
class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -39,72 +41,84 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
builder: (BuildContext w, Widget? a) => _initMaterialApp());
|
||||
}
|
||||
|
||||
GetMaterialApp _initMaterialApp() => GetMaterialApp(
|
||||
// enableLog: false,
|
||||
title: F.navTitle,
|
||||
navigatorObservers: <NavigatorObserver>[AppRouteObserver().routeObserver],
|
||||
translations: TranslationMessage(),
|
||||
supportedLocales: appDept.deptSupportedLocales,
|
||||
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
localeResolutionCallback:
|
||||
(Locale? locale, Iterable<Locale> supportedLocales) {
|
||||
if (!supportedLocales.contains(locale)) {
|
||||
final int idx = appSupportedLocales.indexWhere(
|
||||
(Locale element) => element.languageCode == locale!.languageCode);
|
||||
if (idx != -1) {
|
||||
locale = appSupportedLocales[idx];
|
||||
} else {
|
||||
locale = const Locale('zh', 'CN');
|
||||
GetMaterialApp _initMaterialApp() {
|
||||
//判断是不是登录
|
||||
String initialRoute;
|
||||
if (widget.isLogin) {
|
||||
initialRoute = Routers.starLockMain;
|
||||
} else {
|
||||
initialRoute = Routers.login;
|
||||
}
|
||||
return GetMaterialApp(
|
||||
// enableLog: false,
|
||||
title: F.navTitle,
|
||||
navigatorObservers: <NavigatorObserver>[
|
||||
AppRouteObserver().routeObserver
|
||||
],
|
||||
translations: TranslationMessage(),
|
||||
supportedLocales: appDept.deptSupportedLocales,
|
||||
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
localeResolutionCallback:
|
||||
(Locale? locale, Iterable<Locale> supportedLocales) {
|
||||
if (!supportedLocales.contains(locale)) {
|
||||
final int idx = appSupportedLocales.indexWhere((Locale element) =>
|
||||
element.languageCode == locale!.languageCode);
|
||||
if (idx != -1) {
|
||||
locale = appSupportedLocales[idx];
|
||||
} else {
|
||||
locale = const Locale('zh', 'CN');
|
||||
}
|
||||
}
|
||||
}
|
||||
AppManager()
|
||||
.setLanCode(code: '${locale!.languageCode}_${locale.countryCode}');
|
||||
return locale;
|
||||
},
|
||||
locale: StoreService.to.getLanguageCode()!.isNotEmpty
|
||||
? appDept.deptSupportedLocales
|
||||
.where((Locale element) =>
|
||||
element.languageCode == StoreService.to.getLanguageCode())
|
||||
.first
|
||||
: Get.deviceLocale,
|
||||
// locale: Get.deviceLocale,
|
||||
fallbackLocale: const Locale('zh', 'CN'),
|
||||
theme: ThemeData(
|
||||
scaffoldBackgroundColor: const Color(0xFFF6F6F6),
|
||||
backgroundColor: const Color(0xFFF6F6F6),
|
||||
primaryColor: const Color(0xFFFFFFFF),
|
||||
textTheme: TextTheme(
|
||||
//用在非Material组件上的文字显示,
|
||||
bodyText1:
|
||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||
//Material组件上的文字显示
|
||||
bodyText2:
|
||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||
button: TextStyle(fontSize: 28.sp)),
|
||||
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
iconTheme: IconThemeData(color: const Color(0xff333333), size: 36.sp),
|
||||
titleTextStyle: TextStyle(
|
||||
color: const Color(0xff333333),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 36.sp),
|
||||
AppManager().setLanCode(
|
||||
code: '${locale!.languageCode}_${locale.countryCode}');
|
||||
return locale;
|
||||
},
|
||||
locale: StoreService.to.getLanguageCode()!.isNotEmpty
|
||||
? appDept.deptSupportedLocales
|
||||
.where((Locale element) =>
|
||||
element.languageCode == StoreService.to.getLanguageCode())
|
||||
.first
|
||||
: Get.deviceLocale,
|
||||
// locale: Get.deviceLocale,
|
||||
fallbackLocale: const Locale('zh', 'CN'),
|
||||
theme: ThemeData(
|
||||
scaffoldBackgroundColor: const Color(0xFFF6F6F6),
|
||||
backgroundColor: const Color(0xFFF6F6F6),
|
||||
primaryColor: const Color(0xFFFFFFFF),
|
||||
textTheme: TextTheme(
|
||||
//用在非Material组件上的文字显示,
|
||||
bodyText1:
|
||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||
//Material组件上的文字显示
|
||||
bodyText2:
|
||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||
button: TextStyle(fontSize: 28.sp)),
|
||||
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
iconTheme:
|
||||
IconThemeData(color: const Color(0xff333333), size: 36.sp),
|
||||
titleTextStyle: TextStyle(
|
||||
color: const Color(0xff333333),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 36.sp),
|
||||
),
|
||||
splashColor: Colors.transparent,
|
||||
// 点击时的高亮效果设置为透明
|
||||
highlightColor: Colors.transparent,
|
||||
),
|
||||
splashColor: Colors.transparent,
|
||||
// 点击时的高亮效果设置为透明
|
||||
highlightColor: Colors.transparent,
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
getPages: AppRouters.routePages,
|
||||
builder: EasyLoading.init(),
|
||||
initialBinding: AppBindings(),
|
||||
initialRoute: '/');
|
||||
debugShowCheckedModeBanner: false,
|
||||
getPages: AppRouters.routePages,
|
||||
builder: EasyLoading.init(),
|
||||
initialBinding: AppBindings(),
|
||||
initialRoute: initialRoute );
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -153,3 +167,15 @@ Future<bool> getLoginStatus() async {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> getAgreePrivacyShowUpdate() async {
|
||||
final String? data = await Storage.getString(isAgreePrivacy);
|
||||
if (data == isAgreePrivacy) {
|
||||
AppFirstEnterHandle().getAppFirstEnter(isShowUpdateVersion);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getAppInfo() async {
|
||||
final GetAppInfo entity = await ApiRepository.to.getAppInfo();
|
||||
CustomerTool.init(entity.data?.wechatServiceUrl ?? '');
|
||||
}
|
||||
@ -486,6 +486,8 @@ abstract class Routers {
|
||||
'/advancedFunctionRecordPage'; //高级功能购买记录
|
||||
static const String administratorAssociationLockPage =
|
||||
'/administratorAssociationLockPage'; //我的设置-授权管理员-关联锁
|
||||
|
||||
static const String login = '/login'; //登录
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -494,6 +496,12 @@ abstract class AppRouters {
|
||||
name: Routers.initial,
|
||||
page: () => const StarLockApplication(),
|
||||
),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.login,
|
||||
page: () => F.sw(
|
||||
skyCall: () => const StarLockLoginPage(),
|
||||
xhjCall: () => const StarLockLoginXHJPage()),
|
||||
),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.starLockMain,
|
||||
page: () => F.sw(
|
||||
|
||||
@ -3,14 +3,17 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/starLock_login_state.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import '../../tools/commonItem.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_login_logic.dart';
|
||||
@ -23,8 +26,16 @@ class StarLockLoginPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
final logic = Get.put(StarLockLoginLogic());
|
||||
final state = Get.find<StarLockLoginLogic>().state;
|
||||
final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
|
||||
final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -35,7 +46,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
barTitle: TranslationLoader.lanKeys!.login!.tr,
|
||||
haveBack: false,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
actionsList: <Widget>[
|
||||
const IconButton(
|
||||
onPressed: CustomerTool.openCustomerService,
|
||||
icon: Icon(
|
||||
@ -62,7 +73,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w),
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(10.w),
|
||||
child: Center(
|
||||
@ -111,7 +122,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
hintText:
|
||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
// keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
@ -135,13 +146,13 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
inputFormatters: [
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
// SizedBox(height: 15.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => GestureDetector(
|
||||
onTap: () {
|
||||
state.agree.value = !state.agree.value;
|
||||
@ -168,7 +179,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333), fontSize: 20.sp),
|
||||
children: [
|
||||
children: <InlineSpan>[
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
@ -178,7 +189,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
|
||||
'url': XSConstantMacro.userAgreementURL,
|
||||
'title': '用户协议'.tr
|
||||
});
|
||||
@ -193,7 +204,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
|
||||
'url': XSConstantMacro.privacyPolicyURL,
|
||||
'title': '隐私政策'.tr
|
||||
});
|
||||
@ -224,7 +235,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
SizedBox(height: 50.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
@ -284,9 +295,9 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
width: 1.sp,
|
||||
// height: 200.h,
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
color: Colors.red,
|
||||
child: Image.asset(
|
||||
|
||||
@ -1,20 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/starLock_login_state.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import '../../tools/commonItem.dart';
|
||||
import '../../tools/tf_loginInput.dart';
|
||||
import '../../tools/submitBtn.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../tools/tf_loginInput.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'starLock_login_logic.dart';
|
||||
|
||||
@ -29,290 +27,296 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||
final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
|
||||
final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
top: 110.h,
|
||||
),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${"欢迎使用".tr}${F.title}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 48.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: CustomerTool.openCustomerService,
|
||||
icon: Icon(
|
||||
Icons.support_agent,
|
||||
color: AppColors.mainColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 30.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
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'];
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
Text(
|
||||
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
Obx(() {
|
||||
return Text(
|
||||
'${state.countryName.value} +${state.countryCode.value}',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.mainColor),
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
LoginInput(
|
||||
controller: state.emailOrPhoneController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
rightSlot: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () {},
|
||||
),
|
||||
label: TranslationLoader
|
||||
.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
// keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
LoginInput(
|
||||
controller: state.pwdController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
// isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
label:
|
||||
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
SizedBox(height: 10.h),
|
||||
],
|
||||
),
|
||||
body: SizedBox(
|
||||
width: Get.width,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
top: 110.h,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
state.agree.value = !state.agree.value;
|
||||
logic.changeAgreeState();
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
() => Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 5.w,
|
||||
right: 10.w,
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${"欢迎使用".tr}${F.title}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 48.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Image.asset(
|
||||
state.agree.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
IconButton(
|
||||
onPressed: CustomerTool.openCustomerService,
|
||||
icon: Icon(
|
||||
Icons.support_agent,
|
||||
color: AppColors.mainColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 30.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
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'];
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
Text(
|
||||
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
Obx(() {
|
||||
return Text(
|
||||
'${state.countryName.value} +${state.countryCode.value}',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor),
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333), fontSize: 20.sp),
|
||||
children: <InlineSpan>[
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.userAgreement!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{
|
||||
'url': XSConstantMacro.userAgreementURL,
|
||||
'title': '用户协议'.tr
|
||||
});
|
||||
},
|
||||
)),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{
|
||||
'url': XSConstantMacro.privacyPolicyURL,
|
||||
'title': '隐私政策'.tr
|
||||
});
|
||||
},
|
||||
)),
|
||||
],
|
||||
)),
|
||||
)
|
||||
LoginInput(
|
||||
controller: state.emailOrPhoneController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
rightSlot: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () {},
|
||||
),
|
||||
label: TranslationLoader
|
||||
.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
// keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
LoginInput(
|
||||
controller: state.pwdController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
// isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
label:
|
||||
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
SizedBox(height: 10.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 5.w),
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.login!.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value
|
||||
? () {
|
||||
if (state.agree.value == false) {
|
||||
logic.showToast('请先同意用户协议及隐私政策'.tr);
|
||||
return;
|
||||
} else {
|
||||
logic.login();
|
||||
}
|
||||
}
|
||||
: null)),
|
||||
SizedBox(height: 10.h),
|
||||
SizedBox(
|
||||
width: Get.width,
|
||||
child: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final dynamic data =
|
||||
await Get.toNamed(Routers.starLockRegisterPage);
|
||||
if (data != null) {
|
||||
state.emailOrPhoneController.text =
|
||||
data['phoneOrEmailStr'];
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
state.pwdController.text = data['pwd'];
|
||||
logic.checkNext(state.pwdController);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.mainColor),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.register!.tr,
|
||||
style: TextStyle(fontSize: 22.sp, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
state.agree.value = !state.agree.value;
|
||||
logic.changeAgreeState();
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
Obx(
|
||||
() => Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 5.w,
|
||||
right: 10.w,
|
||||
),
|
||||
child: Image.asset(
|
||||
state.agree.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.starLockForgetPasswordPage);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.sp,
|
||||
)),
|
||||
if (F.isLite)
|
||||
Container()
|
||||
else
|
||||
Row(children: <Widget>[
|
||||
Text(TranslationLoader.lanKeys!.readAndAgree!.tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333),
|
||||
fontSize: 20.sp)),
|
||||
GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.userAgreement!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{
|
||||
'url': XSConstantMacro.userAgreementURL,
|
||||
'title': '用户协议'.tr
|
||||
});
|
||||
},
|
||||
),
|
||||
GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{
|
||||
'url': XSConstantMacro.privacyPolicyURL,
|
||||
'title': '隐私政策'.tr
|
||||
});
|
||||
},
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 5.w),
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.login!.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value
|
||||
? () {
|
||||
if (state.agree.value == false) {
|
||||
logic.showToast('请先同意用户协议及隐私政策'.tr);
|
||||
return;
|
||||
} else {
|
||||
logic.login();
|
||||
}
|
||||
}
|
||||
: null)),
|
||||
SizedBox(height: 10.h),
|
||||
SizedBox(
|
||||
width: Get.width,
|
||||
child: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final dynamic data =
|
||||
await Get.toNamed(Routers.starLockRegisterPage);
|
||||
if (data != null) {
|
||||
state.emailOrPhoneController.text =
|
||||
data['phoneOrEmailStr'];
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
state.pwdController.text = data['pwd'];
|
||||
logic.checkNext(state.pwdController);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.mainColor),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.register!.tr,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式'.tr,
|
||||
child: Text(
|
||||
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
Navigator.pushNamed(
|
||||
context, Routers.starLockForgetPasswordPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.sp,
|
||||
)),
|
||||
if (F.isLite)
|
||||
Container()
|
||||
else
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/about/debug/debug_tool.dart';
|
||||
import 'package:star_lock/network/api_provider.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/bugly/bugly_tool.dart';
|
||||
import 'package:star_lock/tools/device_info_service.dart';
|
||||
import 'package:star_lock/tools/platform_info_services.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import 'package:star_lock/tools/xs_jPhush.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
@ -25,12 +27,20 @@ FutureOr<void> main() async {
|
||||
// 设置国际化信息
|
||||
await _initTranslation();
|
||||
|
||||
// bugly错误日志监控
|
||||
await BuglyTool.init();
|
||||
final bool isLogin = await getLoginStatus();
|
||||
if (isLogin) {
|
||||
await privacySDKInitialization();
|
||||
Future<void>.delayed(const Duration(milliseconds: 500), getAppInfo);
|
||||
}
|
||||
|
||||
await XSJPushProvider().initJPushService();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
final bool? openDeBug = await Storage.getBool(isOpenDeBug);
|
||||
if (openDeBug == true) {
|
||||
DeBug.showFloatWidget();
|
||||
}
|
||||
});
|
||||
|
||||
runApp(const MyApp());
|
||||
runApp(MyApp(isLogin: isLogin));
|
||||
|
||||
if (AppPlatform.isAndroid) {
|
||||
const SystemUiOverlayStyle systemUiOverlayStyle =
|
||||
@ -40,16 +50,17 @@ FutureOr<void> main() async {
|
||||
}
|
||||
|
||||
// 设置国际化信息
|
||||
Future _initTranslation() async => TranslationLoader.loadTranslation(
|
||||
Future<void> _initTranslation() async => TranslationLoader.loadTranslation(
|
||||
zhSource: 'images/lan/lan_zh.json',
|
||||
enSource: 'images/lan/lan_en.json',
|
||||
keySource: 'images/lan/lan_keys.json',
|
||||
);
|
||||
|
||||
// 设置包名服务设备信息
|
||||
Future _setCommonServices() async {
|
||||
Future<void> _setCommonServices() async {
|
||||
await Get.putAsync(() => StoreService().init());
|
||||
await Get.putAsync(() => PlatformInfoService().init());
|
||||
Get.put(ApiProvider());
|
||||
Get.put(ApiRepository(Get.find<ApiProvider>()));
|
||||
if (F.isLite) {
|
||||
//上架审核注释 获取设备信息
|
||||
// await Get.putAsync(() => DeviceInfoService().init());
|
||||
@ -57,3 +68,10 @@ Future _setCommonServices() async {
|
||||
await Get.putAsync(() => DeviceInfoService().init());
|
||||
}
|
||||
}
|
||||
|
||||
//关于隐私协议的初始化
|
||||
Future<void> privacySDKInitialization() async {
|
||||
await Get.putAsync(() => PlatformInfoService().init());
|
||||
await BuglyTool.init();
|
||||
await XSJPushProvider().initJPushService();
|
||||
}
|
||||
|
||||
@ -325,21 +325,13 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.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 '../../../../tools/showTipView.dart';
|
||||
import 'volumeAuthorizationLock_state.dart';
|
||||
|
||||
class VolumeAuthorizationLockLogic extends BaseGetXController {
|
||||
@ -46,11 +46,13 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isSendSuccess.value = true;
|
||||
} else {
|
||||
EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds);
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
state.isCreateUser.value = true;
|
||||
addAuthorizedAdminRequest();
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}', () {
|
||||
state.isCreateUser.value = true;
|
||||
addAuthorizedAdminRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +181,9 @@ class CardDetailLogic extends BaseGetXController {
|
||||
cardRight: state.isAdministrator.value ? 1 : 0,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.fingerprintItemData.value.cardName = state.changeNameController.text;
|
||||
state.fingerprintItemData.value.isCoerced = state.isStressCard.value ? 1 : 2;
|
||||
state.fingerprintItemData.value.cardRight = state.isAdministrator.value ? 1 : 0;
|
||||
showToast('修改成功'.tr, something: () {
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
});
|
||||
|
||||
@ -11,12 +11,14 @@ class massSendLockGroupCell extends StatelessWidget {
|
||||
required this.lockListByGroup,
|
||||
required this.selectLockAction,
|
||||
required this.isVip,
|
||||
required this.isShowBtn,
|
||||
Key? key})
|
||||
: super(key: key);
|
||||
final int currentIndex;
|
||||
List lockListByGroup;
|
||||
final _CallBack selectLockAction;
|
||||
bool isVip;
|
||||
bool isShowBtn;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -65,26 +67,28 @@ class massSendLockGroupCell extends StatelessWidget {
|
||||
child: SizedBox(
|
||||
width: 20.w,
|
||||
)),
|
||||
Image.asset(
|
||||
itemData.isChecked
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
color: !isVip ? Colors.grey : AppColors.mainColor,
|
||||
),
|
||||
Visibility(
|
||||
visible: isShowBtn,
|
||||
child: Image.asset(
|
||||
itemData.isChecked
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
color: !isVip ? Colors.grey : AppColors.mainColor,
|
||||
),),
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
onTap: isShowBtn ? () {
|
||||
if (isVip == false) {
|
||||
return;
|
||||
}
|
||||
selectLockAction(itemIndex, itemData.lockId.toString());
|
||||
},
|
||||
} : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,12 +131,14 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
isShowBtn: true,
|
||||
typeImgList: const [],
|
||||
groupItem: itemData,
|
||||
child: massSendLockGroupCell(index,
|
||||
currentIndex: index,
|
||||
lockListByGroup: lockItemList,
|
||||
isVip: state.isVip.value,
|
||||
isShowBtn: true,
|
||||
selectLockAction: (selectIndex, selectLockId) {
|
||||
LockListItem lockItem = lockItemList[selectIndex];
|
||||
lockItem.isChecked = !lockItem.isChecked;
|
||||
|
||||
@ -170,7 +170,7 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
faceName: state.changeNameController.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.typeName.value = state.changeNameController.text;
|
||||
state.faceItemData.value.fingerprintName = state.changeNameController.text;
|
||||
showToast('修改成功', something: () {
|
||||
Get.back(result: 'addScuess');
|
||||
});
|
||||
@ -194,7 +194,9 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
faceRight: state.isAdministrator.value ? 1 : 0,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('修改成功', something: () {
|
||||
state.faceItemData.value.isCoerced = state.isStressFace.value ? 1 : 2;
|
||||
state.faceItemData.value.faceRight = state.isAdministrator.value ? 1 : 0;
|
||||
showToast('修改成功'.tr, something: () {
|
||||
Get.back(result: 'addScuess');
|
||||
});
|
||||
}
|
||||
@ -203,7 +205,7 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
String getKeyTypeShowDateTime() {
|
||||
String useDateStr = '';
|
||||
if (state.keyType.value == 1) {
|
||||
useDateStr = '永久';
|
||||
useDateStr = '永久'.tr;
|
||||
} else if (state.keyType.value == 2) {
|
||||
useDateStr =
|
||||
'${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}';
|
||||
|
||||
@ -176,6 +176,9 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
fingerRight: state.isAdministrator.value ? 1 : 0,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.fingerprintItemData.value.fingerprintName = state.changeNameController.text;
|
||||
state.fingerprintItemData.value.isCoerced = state.isStressFingerprint.value ? 1 : 2;
|
||||
state.fingerprintItemData.value.fingerRight = state.isAdministrator.value ? 1 : 0;
|
||||
showToast('修改成功'.tr, something: (){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
});
|
||||
|
||||
@ -522,5 +522,18 @@ class LockDetailLogic extends BaseGetXController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription = eventBus
|
||||
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
||||
if (event.type == 4) {
|
||||
final int electricQuantity =
|
||||
int.tryParse(event.setResult['electricQuantity']) ?? 0;
|
||||
state.electricQuantity.value = electricQuantity;
|
||||
state.keyInfos.value.electricQuantity = electricQuantity;
|
||||
state.keyInfos.value.electricQuantityDate =
|
||||
event.setResult['uploadElectricQuantityDate'] ?? 0;
|
||||
state.keyInfos.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,15 +29,14 @@ import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||
import 'lockDetail_logic.dart';
|
||||
|
||||
class LockDetailPage extends StatefulWidget {
|
||||
const LockDetailPage(
|
||||
{required this.isOnlyOneData,
|
||||
required this.lockListInfoItemEntity,
|
||||
Key? key})
|
||||
: super(key: key);
|
||||
final bool isOnlyOneData;
|
||||
final LockListInfoItemEntity lockListInfoItemEntity;
|
||||
|
||||
const LockDetailPage(
|
||||
{Key? key,
|
||||
required this.isOnlyOneData,
|
||||
required this.lockListInfoItemEntity})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<LockDetailPage> createState() => _LockDetailPageState();
|
||||
}
|
||||
@ -50,7 +49,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
listeningAnimations();
|
||||
@ -1438,8 +1436,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
state.closedUnlockSuccessfulTimer?.cancel();
|
||||
_lockRefreshLockDetailInfoDataEvent?.cancel();
|
||||
state.replySubscription.cancel();
|
||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!
|
||||
.cancel();
|
||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent
|
||||
?.cancel();
|
||||
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
|
||||
if (state.animationController != null) {
|
||||
state.animationController!.dispose();
|
||||
state.animationController = null;
|
||||
|
||||
@ -12,44 +12,45 @@ class LockDetailState {
|
||||
|
||||
late StreamSubscription<Reply> replySubscription;
|
||||
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||
StreamSubscription? LockSetChangeSetRefreshLockDetailWithTypeSubscription;
|
||||
|
||||
String lockNetToken = "0";
|
||||
String lockNetToken = '0';
|
||||
int differentialTime = 0;
|
||||
int lockUserNo = 0;
|
||||
var senderUserId = 0;
|
||||
var isOnlyOneData = false;
|
||||
int senderUserId = 0;
|
||||
bool isOnlyOneData = false;
|
||||
|
||||
var isAttendance = 0.obs; // 是否开启考勤
|
||||
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||
var electricQuantity = 0.obs; // 电量
|
||||
var electricQuantityStandby = 0.obs; // 备用电池电量
|
||||
var isOpenPassageMode = 0.obs; // 是否开启了常开模式
|
||||
var lockAlias = "".obs; // 锁名字
|
||||
RxInt isAttendance = 0.obs; // 是否开启考勤
|
||||
RxInt isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||
RxInt electricQuantity = 0.obs; // 电量
|
||||
RxInt electricQuantityStandby = 0.obs; // 备用电池电量
|
||||
RxInt isOpenPassageMode = 0.obs; // 是否开启了常开模式
|
||||
RxString lockAlias = ''.obs; // 锁名字
|
||||
|
||||
// var currentDeviceUUid = "".obs; // 当前设备的uuid
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var iSClosedUnlockSuccessfulPopup = false.obs; // 是否关闭了开锁成功弹窗
|
||||
var iSOpenLock = true.obs; // 是开锁还是关锁
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
RxBool iSClosedUnlockSuccessfulPopup = false.obs; // 是否关闭了开锁成功弹窗
|
||||
RxBool iSOpenLock = true.obs; // 是开锁还是关锁
|
||||
Timer? closedUnlockSuccessfulTimer;
|
||||
|
||||
var bottomBtnisEable = true.obs; // 是否不可用 用于限制底部按钮是否可用
|
||||
var openDoorBtnisUneable = true.obs; // 当钥匙状态不能使用的情况下开锁按钮禁止使用,默认可用
|
||||
RxBool bottomBtnisEable = true.obs; // 是否不可用 用于限制底部按钮是否可用
|
||||
RxBool openDoorBtnisUneable = true.obs; // 当钥匙状态不能使用的情况下开锁按钮禁止使用,默认可用
|
||||
|
||||
var openDoorModel = 0;// 离线开门0, 在线开门2 离线关门32 在线关门34
|
||||
int openDoorModel = 0;// 离线开门0, 在线开门2 离线关门32 在线关门34
|
||||
|
||||
//过渡动画控制器
|
||||
AnimationController? animationController;
|
||||
// var lockState = 0.obs;// 0未连接普通状态 1连接开锁中(展示动画) 2已连接开锁成功 3检测可用性 4连接失败 5连接失败重连中
|
||||
var openLockBtnState = 0.obs; // 0普通状态(未转动) 1连接中(转动状态)
|
||||
RxInt openLockBtnState = 0.obs; // 0普通状态(未转动) 1连接中(转动状态)
|
||||
// var connectState = 0.obs;// 0未连接 1连接
|
||||
|
||||
final PageController pageController = PageController();
|
||||
var currentPage = 0.obs;
|
||||
RxInt currentPage = 0.obs;
|
||||
|
||||
var operateDate = 0; // 按日期查询消息记录的时间戳
|
||||
var logCountPage = 10; // 蓝牙记录一页多少个
|
||||
var nextAuthTime = 0.obs; // 下次认证时间
|
||||
int operateDate = 0; // 按日期查询消息记录的时间戳
|
||||
int logCountPage = 10; // 蓝牙记录一页多少个
|
||||
RxInt nextAuthTime = 0.obs; // 下次认证时间
|
||||
// LockDetailState() {
|
||||
// Map map = Get.arguments;
|
||||
// lockCount = map["lockCount"];
|
||||
|
||||
@ -20,6 +20,7 @@ class BasicInformationLogic extends BaseGetXController {
|
||||
|
||||
// 下级界面修改成功后传递数据
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
StreamSubscription? lockSetChangeSetRefreshLockDetailWithTypeSubscription;
|
||||
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
@ -29,6 +30,19 @@ class BasicInformationLogic extends BaseGetXController {
|
||||
state.lockSetInfoData.value = event.lockSetInfoData;
|
||||
blockSetStateCallback();
|
||||
});
|
||||
|
||||
lockSetChangeSetRefreshLockDetailWithTypeSubscription = eventBus
|
||||
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
||||
if (event.type == 4) {
|
||||
final int electricQuantity =
|
||||
int.tryParse(event.setResult['electricQuantity']) ?? 0;
|
||||
state.lockBasicInfo.value.electricQuantity = electricQuantity;
|
||||
state.lockBasicInfo.value.electricQuantityDate =
|
||||
event.setResult['uploadElectricQuantityDate'];
|
||||
state.lockBasicInfo.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@ -43,5 +57,6 @@ class BasicInformationLogic extends BaseGetXController {
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
_passCurrentLockInformationEvent?.cancel();
|
||||
lockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,19 +23,22 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
final UploadElectricQuantityState state = UploadElectricQuantityState();
|
||||
|
||||
//电量更新请求
|
||||
Future<void> uploadElectricQuantityRequest(String electricQuantity, String electricQuantityStandby) async {
|
||||
final KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(
|
||||
electricQuantity:electricQuantity,
|
||||
electricQuantityStandby: electricQuantityStandby,
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
isUnShowLoading: false
|
||||
);
|
||||
Future<void> uploadElectricQuantityRequest(
|
||||
String electricQuantity, String electricQuantityStandby) async {
|
||||
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: () {
|
||||
eventBus
|
||||
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(
|
||||
LockSetChangeSetRefreshLockDetailWithType(4, electricQuantity));
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(4, <String,dynamic>{
|
||||
'electricQuantity': electricQuantity,
|
||||
'uploadElectricQuantityDate': state.uploadElectricQuantityDate.value,
|
||||
}));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
}
|
||||
@ -57,8 +60,10 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
dismissEasyLoading();
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
@ -67,7 +72,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
isBeforeAddUser: false,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
@ -80,6 +86,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||
@ -102,20 +109,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
|
||||
// 电池剩余电量
|
||||
final int battRemCap = reply.data[132];
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity =
|
||||
battRemCap;
|
||||
|
||||
// 备用电池剩余电量
|
||||
final int battRemCapStandby = reply.data[133];
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityStandby = battRemCapStandby;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityStandby =
|
||||
battRemCapStandby;
|
||||
|
||||
state.uploadElectricQuantityDate.value = DateTime.now().millisecondsSinceEpoch;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate = DateTime.now().millisecondsSinceEpoch;
|
||||
uploadElectricQuantityRequest(battRemCap.toString(), battRemCapStandby.toString());
|
||||
state.uploadElectricQuantityDate.value =
|
||||
DateTime.now().millisecondsSinceEpoch;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate =
|
||||
DateTime.now().millisecondsSinceEpoch;
|
||||
uploadElectricQuantityRequest(
|
||||
battRemCap.toString(), battRemCapStandby.toString());
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
@ -125,7 +139,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -134,22 +147,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 从服务器获取锁的时间 开锁时传入
|
||||
Future<void> getServerDatetime() async{
|
||||
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData();
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
Future<void> getServerDatetime() async {
|
||||
final GetServerDatetimeEntity entity =
|
||||
await ApiRepository.to.getServerDatetimeData();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.differentialTime = entity.data!.date! ~/ 1000 -
|
||||
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
||||
}
|
||||
}
|
||||
|
||||
int getLocalTime(){
|
||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
||||
int getLocalTime() {
|
||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
||||
state.differentialTime;
|
||||
}
|
||||
|
||||
int getUTCTime(){
|
||||
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true);
|
||||
int getUTCTime() {
|
||||
final DateTime utcTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000, isUtc: true);
|
||||
|
||||
final String appointmentDate = DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
|
||||
final String appointmentDate =
|
||||
DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
|
||||
final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
|
||||
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
|
||||
return utcTimeValue ~/ 1000;
|
||||
|
||||
@ -111,9 +111,11 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
if(changType == 1){
|
||||
// 修改名字
|
||||
state.keyboardPwdName.value = state.inputNameController.text;
|
||||
state.itemData.value.keyboardPwdName = state.keyboardPwdName.value;
|
||||
}else if(changType == 2){
|
||||
// 修改密码
|
||||
state.keyboardPwd.value = state.inputPwdController.text;
|
||||
state.itemData.value.keyboardPwd = state.keyboardPwd.value;
|
||||
}
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
});
|
||||
|
||||
@ -147,6 +147,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
BuildContext context, int index, GroupList itemData) {
|
||||
final List<LockListInfoItemEntity> lockItemList =
|
||||
itemData.lockList ?? <LockListInfoItemEntity>[];
|
||||
final List<Widget> list = forItems(lockItemList);
|
||||
return LockListGroupView(
|
||||
onTap: () {
|
||||
setState(() {});
|
||||
@ -155,15 +156,20 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
backgroundColor: Colors.transparent,
|
||||
typeImgList: const <dynamic>[],
|
||||
groupItem: itemData,
|
||||
child: GridView.extent(
|
||||
child: GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 15.w,
|
||||
mainAxisSpacing: 15.h,
|
||||
childAspectRatio: 1.1,
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
|
||||
maxCrossAxisExtent: Get.width * .6,
|
||||
childAspectRatio: 1.2,
|
||||
crossAxisSpacing: 15.w,
|
||||
mainAxisSpacing: 15.h,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: forItems(lockItemList),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return list[index];
|
||||
},
|
||||
itemCount: list.length,
|
||||
));
|
||||
}
|
||||
|
||||
@ -317,8 +323,8 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
Visibility(
|
||||
visible: keyInfo.passageMode == 1,
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.only(top: 2.h, right: 3.w, left: 3.w,bottom: 1.h),
|
||||
padding: EdgeInsets.only(
|
||||
top: 2.h, right: 3.w, left: 3.w, bottom: 1.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: AppColors.openPassageModeColor,
|
||||
@ -338,7 +344,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 2.h, right: 3.w, left: 3.w,bottom: 1.h),
|
||||
top: 2.h, right: 3.w, left: 3.w, bottom: 1.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: AppColors.mainColor,
|
||||
|
||||
@ -50,9 +50,13 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
if (clearScanDevices) {
|
||||
BlueManage().scanDevices.clear();
|
||||
}
|
||||
if (mounted) {
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
// if (mounted) {
|
||||
// setState(() {});
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -174,6 +174,7 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
|
||||
},
|
||||
// title: deviceName,
|
||||
// imgName: 'images/icon_lock.png',
|
||||
isShowBtn: true,
|
||||
typeImgList: const [],
|
||||
groupItem: GroupListItem(),
|
||||
child: ListView.separated(
|
||||
@ -214,6 +215,7 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
|
||||
},
|
||||
// title: deviceName,
|
||||
// imgName: 'images/controls_user.png',
|
||||
isShowBtn: true,
|
||||
typeImgList: const ['images/icon_password.png', 'images/icon_card.png'],
|
||||
groupItem: GroupListItem(),
|
||||
child: ListView.separated(
|
||||
|
||||
@ -75,12 +75,14 @@ class _AdministratorAssociationLockPageState
|
||||
onTap: () {
|
||||
|
||||
},
|
||||
isShowBtn: false,
|
||||
typeImgList: const [],
|
||||
groupItem: getItemData,
|
||||
child: massSendLockGroupCell(index,
|
||||
currentIndex: index,
|
||||
lockListByGroup: lockItemList,
|
||||
isVip: true,
|
||||
isShowBtn: false,
|
||||
selectLockAction: (int selectIndex, String selectLockId) {
|
||||
|
||||
}),
|
||||
|
||||
@ -12,31 +12,33 @@ class GroupEditLockLogic extends BaseGetXController {
|
||||
//锁分组里面添加锁
|
||||
Future<void> lockGroupAddLock(List lockIds) async {
|
||||
if (lockIds.isEmpty) {
|
||||
showToast("请选择锁".tr);
|
||||
showToast('请选择锁'.tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.lockGroupAddLock(
|
||||
lockIds: lockIds, groupId: state.selectGroupListItem.keyGroupId!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("添加成功");
|
||||
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
Get.close(2);
|
||||
showToast('添加成功', something: () {
|
||||
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
Get.close(2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//锁分组里面添加锁
|
||||
Future<void> lockGroupDeletLock(List lockIds) async {
|
||||
if (lockIds.isEmpty) {
|
||||
showToast("请选择锁".tr);
|
||||
showToast('请选择锁'.tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功");
|
||||
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
Get.close(2);
|
||||
showToast('删除成功', something: () {
|
||||
eventBus.fire(LockGroupEditGroupLockRefreshEvent());
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
Get.close(2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockGroup/groupEditLock/groupEditLock_state.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
|
||||
@ -19,8 +20,8 @@ class GroupEditLockPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
final logic = Get.put(GroupEditLockLogic());
|
||||
final state = Get.find<GroupEditLockLogic>().state;
|
||||
final GroupEditLockLogic logic = Get.put(GroupEditLockLogic());
|
||||
final GroupEditLockState state = Get.find<GroupEditLockLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,15 +34,15 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => Visibility(
|
||||
visible: state.isVip.value ? false : true,
|
||||
visible: !state.isVip.value,
|
||||
child: ShowCupertinoAlertView()
|
||||
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
|
||||
Container(
|
||||
margin: EdgeInsets.all(15.w),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
TranslationLoader
|
||||
.lanKeys!.selectTheLockToJoinTheGroup!.tr,
|
||||
@ -51,13 +52,13 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
),
|
||||
Expanded(child: _buildMainUI()),
|
||||
Obx(() => Visibility(
|
||||
visible: state.isVip.value ? true : false,
|
||||
visible: state.isVip.value,
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
onClick: () async {
|
||||
var idList = [];
|
||||
final List idList = [];
|
||||
for (int i = 0; i < state.lockList.length; i++) {
|
||||
LockListItem lockListItem = state.lockList[i];
|
||||
final LockListItem lockListItem = state.lockList[i];
|
||||
if (lockListItem.isChecked == true) {
|
||||
idList.add(lockListItem.lockId);
|
||||
}
|
||||
@ -78,8 +79,8 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
Widget _buildMainUI() {
|
||||
return state.lockList.isNotEmpty
|
||||
? ListView.separated(
|
||||
itemBuilder: (context, index) {
|
||||
LockListItem itemData = state.lockList[index];
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final LockListItem itemData = state.lockList[index];
|
||||
return _listItemView(itemData);
|
||||
},
|
||||
itemCount: state.lockList.length,
|
||||
@ -109,24 +110,35 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_lockGroup_item.png',
|
||||
width: 36,
|
||||
height: 36,
|
||||
width: 50.w,
|
||||
height: 50.w,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 1.sw - 80.w - 75.w,
|
||||
child: Text(
|
||||
itemData.lockAlias ?? '',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)
|
||||
)
|
||||
),
|
||||
Expanded(child: SizedBox(width: 10.w)),
|
||||
// Text(
|
||||
// itemData.lockAlias ?? '',
|
||||
// style: TextStyle(fontSize: 24.sp),
|
||||
// ),
|
||||
SizedBox(width: 10.w),
|
||||
Image.asset(
|
||||
itemData.isChecked
|
||||
? 'images/icon_round_select.png'
|
||||
|
||||
@ -108,17 +108,22 @@ class _LockItemListPageState extends State<LockItemListPage> {
|
||||
),
|
||||
Image.asset(
|
||||
'images/icon_lockGroup_item.png',
|
||||
width: 36,
|
||||
height: 36,
|
||||
width: 50.w,
|
||||
height: 50.w,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
itemData.lockAlias ?? '',
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)
|
||||
Expanded(child:
|
||||
Text(itemData.lockAlias ?? '',
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)
|
||||
),
|
||||
// Text(
|
||||
// itemData.lockAlias ?? '',
|
||||
// style: TextStyle(fontSize: 24.sp),
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -142,7 +147,6 @@ class _LockItemListPageState extends State<LockItemListPage> {
|
||||
} else if (getSelectIndex == 1) {
|
||||
Get.toNamed(Routers.groupEditLockPage, arguments: {'groupListItem': groupListItem, 'ungrouped': ungrouped, 'type': 1});
|
||||
}
|
||||
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@ -13,8 +13,8 @@ class LockGroupListLogic extends BaseGetXController {
|
||||
final LockGroupListState state = LockGroupListState();
|
||||
|
||||
//分组列表请求
|
||||
void mockNetworkDataRequest() async {
|
||||
var entity = await ApiRepository.to.lockGroupList('0');
|
||||
Future<void> mockNetworkDataRequest() async {
|
||||
final MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
state.lockNum = 0;
|
||||
@ -25,58 +25,53 @@ class LockGroupListLogic extends BaseGetXController {
|
||||
|
||||
//创建锁分组请求
|
||||
Future<void> addLockGroupRequest() async {
|
||||
MassSendLockGroupListEntity entity =
|
||||
final MassSendLockGroupListEntity entity =
|
||||
await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("创建成功".tr);
|
||||
mockNetworkDataRequest();
|
||||
showToast('创建成功'.tr, something: (){
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//编辑锁名字
|
||||
Future<void> editLockGroupRequest(int groupId) async {
|
||||
var entity = await ApiRepository.to.editLockGroupRequest(groupId:groupId, groupName:state.changeNameController.text);
|
||||
final MassSendLockGroupListEntity entity = await ApiRepository.to.editLockGroupRequest(groupId:groupId, groupName:state.changeNameController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("编辑成功".tr);
|
||||
mockNetworkDataRequest();
|
||||
showToast('编辑成功'.tr, something: (){
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//删除组
|
||||
Future<void> deleteLockGroupRequest(int groupId) async {
|
||||
var entity = await ApiRepository.to.deleteGroup(groupId);
|
||||
final MassSendLockGroupListEntity entity = await ApiRepository.to.deleteGroup(groupId);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功".tr);
|
||||
mockNetworkDataRequest();
|
||||
showToast('删除成功'.tr, something: (){
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 监听修改完详情之后刷新列表
|
||||
late StreamSubscription _teamEvent;
|
||||
void _initRefreshAction() {
|
||||
_teamEvent = eventBus.on<LockGroupEditGroupLockRefreshEvent>().listen((event) {
|
||||
_teamEvent = eventBus.on<LockGroupEditGroupLockRefreshEvent>().listen((LockGroupEditGroupLockRefreshEvent event) {
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
_initRefreshAction();
|
||||
|
||||
mockNetworkDataRequest();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
_teamEvent.cancel();
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_state.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../../../../appRouters.dart';
|
||||
@ -11,7 +12,6 @@ import '../../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../../translations/trans_lib.dart';
|
||||
import '../../../../tools/left_slide_actions.dart';
|
||||
import '../../../../tools/noData.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import 'lockGroupList_logic.dart';
|
||||
|
||||
class LockGroupListPage extends StatefulWidget {
|
||||
@ -22,8 +22,8 @@ class LockGroupListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
final logic = Get.put(LockGroupListLogic());
|
||||
final state = Get.find<LockGroupListLogic>().state;
|
||||
final LockGroupListLogic logic = Get.put(LockGroupListLogic());
|
||||
final LockGroupListState state = Get.find<LockGroupListLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,7 +32,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.lockGroup!.tr,
|
||||
haveBack: true,
|
||||
actionsList: [
|
||||
actionsList: <Widget>[
|
||||
IconButton(
|
||||
icon: Image.asset(
|
||||
'images/icon_add_white.png',
|
||||
@ -41,7 +41,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
),
|
||||
onPressed: () {
|
||||
// 处理操作按钮的点击事件-添加锁分组
|
||||
state.changeNameController.text = "";
|
||||
state.changeNameController.text = '';
|
||||
// showCupertinoAlertDialog(context, true, 0);
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.changeNameController,
|
||||
@ -61,7 +61,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
],
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Obx(() => state.itemDataList.value.isEmpty
|
||||
? NoData()
|
||||
@ -73,16 +73,16 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
|
||||
Widget _buildMainUI() {
|
||||
for (int i = 0; i < state.itemDataList.value.length; i++) {
|
||||
GroupListItem itemData = state.itemDataList.value[i];
|
||||
final GroupListItem itemData = state.itemDataList.value[i];
|
||||
state.lockNum += itemData.lockList!.length;
|
||||
}
|
||||
return ListView.separated(
|
||||
itemCount: state.itemDataList.value.length + 1,
|
||||
itemBuilder: (c, index) {
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
if (index == state.itemDataList.value.length) {
|
||||
return Center(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
@ -98,7 +98,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
GroupListItem itemData = state.itemDataList.value[index];
|
||||
final GroupListItem itemData = state.itemDataList.value[index];
|
||||
if (itemData.groupType == 0) {
|
||||
state.ungrouped = itemData;
|
||||
}
|
||||
@ -107,23 +107,22 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
key: Key(itemData.keyGroupId!.toString()),
|
||||
actionsWidth: itemData.groupType != 0 ? 200.w : 0,
|
||||
actions: itemData.groupType != 0
|
||||
? [
|
||||
? <Widget>[
|
||||
_buildEditBtn(itemData),
|
||||
_buildDeleteBtn(itemData),
|
||||
]
|
||||
: [],
|
||||
: <Widget>[],
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
),
|
||||
child: CommonItem(
|
||||
leftTitel:
|
||||
'${itemData.keyGroupName}(${itemData.lockList?.length})',
|
||||
rightTitle: "",
|
||||
leftTitel: '${itemData.keyGroupName}(${itemData.lockList?.length})',
|
||||
rightTitle: '',
|
||||
allHeight: 70.h,
|
||||
action: () {
|
||||
Get.toNamed(Routers.lockItemListPage, arguments: {
|
||||
Get.toNamed(Routers.lockItemListPage, arguments: <String, GroupListItem>{
|
||||
'groupListItem': itemData,
|
||||
"ungrouped": state.ungrouped
|
||||
'ungrouped': state.ungrouped
|
||||
});
|
||||
}),
|
||||
);
|
||||
@ -139,41 +138,12 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
});
|
||||
}
|
||||
|
||||
// void showCupertinoAlertDialog(BuildContext context, bool isAdd, int groupId) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return ShowTFView(
|
||||
// title: isAdd ? TranslationLoader.lanKeys!.createNewGroup!.tr : "修改名称",
|
||||
// tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
// controller: state.changeNameController,
|
||||
// sureClick: () {
|
||||
// //发送编辑钥匙名称请求
|
||||
// if (state.changeNameController.text.isNotEmpty) {
|
||||
// if(isAdd == true){
|
||||
// logic.addLockGroupRequest();
|
||||
// }else{
|
||||
// logic.editLockGroupRequest(groupId);
|
||||
// }
|
||||
// Get.back();
|
||||
// } else {
|
||||
// logic.showToast(TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
|
||||
// }
|
||||
// },
|
||||
// cancelClick: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget _buildDeleteBtn(GroupListItem groupListItem) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// 省略: 弹出是否删除的确认对话框。
|
||||
// showIosTipViewDialog(context, groupListItem);
|
||||
ShowTipView().showIosTipWithContentDialog("分组下的锁将被移到未分组里".tr, () {
|
||||
ShowTipView().showIosTipWithContentDialog('分组下的锁将被移到未分组里'.tr, () {
|
||||
logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
|
||||
});
|
||||
},
|
||||
@ -203,9 +173,10 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.changeNameController,
|
||||
TranslationLoader.lanKeys!.createNewGroup!.tr,
|
||||
'修改名称'.tr,
|
||||
TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
|
||||
if (state.changeNameController.text.isNotEmpty) {
|
||||
Get.back();
|
||||
logic.editLockGroupRequest(groupListItem.keyGroupId!);
|
||||
} else {
|
||||
logic.showToast(
|
||||
@ -218,7 +189,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
color: AppColors.mainColor,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"重命名".tr,
|
||||
'重命名'.tr,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
@ -229,23 +200,4 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// void showIosTipViewDialog(BuildContext context, GroupListItem groupListItem) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return ShowIosTipView(
|
||||
// title: TranslationLoader.lanKeys!.hint!.tr,
|
||||
// tipTitle: "分组下的锁将被移到未分组里",
|
||||
// sureClick: () {
|
||||
// Get.back();
|
||||
// logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
|
||||
// },
|
||||
// cancelClick: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@ import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSend
|
||||
class LockGroupListState {
|
||||
|
||||
TextEditingController changeNameController = TextEditingController();
|
||||
var itemDataList = <GroupListItem>[].obs;
|
||||
RxList<GroupListItem> itemDataList = <GroupListItem>[].obs;
|
||||
int lockNum = 0;
|
||||
var ungrouped = GroupListItem();
|
||||
GroupListItem ungrouped = GroupListItem();
|
||||
|
||||
}
|
||||
@ -11,7 +11,7 @@ import '../tools/storage.dart';
|
||||
String getUserAgent() {
|
||||
//赋值变量方便调试
|
||||
String ua =
|
||||
'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
|
||||
'StarLock/${PlatformInfoService.to?.info.version}/${PlatformInfoService.to?.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
|
||||
return ua;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:star_lock/app.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/app_get_version.dart';
|
||||
import 'package:star_lock/login/login/starLock_login_page.dart';
|
||||
@ -23,12 +24,7 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
bool? openDeBug = await Storage.getBool(isOpenDeBug);
|
||||
if (openDeBug == true) {
|
||||
DeBug.showFloatWidget();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -37,7 +33,7 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
|
||||
return FutureBuilder<bool>(
|
||||
future: getLoginStatus(),
|
||||
builder: (context, snapshot) {
|
||||
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
// 如果异步操作尚未完成,返回一个加载指示器或其他等待状态的小部件
|
||||
return const CircularProgressIndicator();
|
||||
@ -66,23 +62,5 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> getLoginStatus() async {
|
||||
final data = await Storage.getString(saveUserLoginData);
|
||||
if (data != null && data.isNotEmpty) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<void> getAgreePrivacyShowUpdate() async {
|
||||
final data = await Storage.getString(isAgreePrivacy);
|
||||
if (data == isAgreePrivacy) {
|
||||
AppFirstEnterHandle().getAppFirstEnter(isShowUpdateVersion);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getAppInfo() async {
|
||||
final GetAppInfo entity = await ApiRepository.to.getAppInfo();
|
||||
CustomerTool.init(entity.data?.wechatServiceUrl ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,17 +7,16 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
|
||||
|
||||
class ExpandedListTile extends StatefulWidget {
|
||||
const ExpandedListTile(
|
||||
{Key? key,
|
||||
{required this.isShowBtn, required this.groupItem, required this.typeImgList, Key? key,
|
||||
this.child,
|
||||
this.onTap,
|
||||
required this.groupItem,
|
||||
required this.typeImgList})
|
||||
this.onTap})
|
||||
: super(key: key);
|
||||
|
||||
final Widget? child;
|
||||
final List typeImgList;
|
||||
final Function()? onTap;
|
||||
final GroupListItem groupItem;
|
||||
final bool isShowBtn;
|
||||
|
||||
@override
|
||||
_ExpandedListTileState createState() => _ExpandedListTileState();
|
||||
@ -53,44 +52,48 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
||||
|
||||
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_select.png"
|
||||
: "images/icon_round_unSelect.png",
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
)
|
||||
],
|
||||
|
||||
if(widget.isShowBtn){
|
||||
widgetList.add(GestureDetector(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
width: 80.w,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
_isCheck
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (widget.groupItem.isVip == false) {
|
||||
return;
|
||||
}
|
||||
//点击左侧是否勾选按钮
|
||||
setState(() {
|
||||
_isCheck = !_isCheck;
|
||||
widget.groupItem.isChecked = _isCheck;
|
||||
});
|
||||
widget.onTap?.call();
|
||||
},
|
||||
));
|
||||
onTap: () {
|
||||
if (widget.groupItem.isVip == false) {
|
||||
return;
|
||||
}
|
||||
//点击左侧是否勾选按钮
|
||||
setState(() {
|
||||
_isCheck = !_isCheck;
|
||||
widget.groupItem.isChecked = _isCheck;
|
||||
});
|
||||
widget.onTap?.call();
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
widgetList.add(GestureDetector(
|
||||
child: Container(
|
||||
width: ScreenUtil().screenWidth - 80.w,
|
||||
width: ScreenUtil().screenWidth - (widget.isShowBtn ? 80.w : 0),
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
@ -100,7 +103,7 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
|
||||
// height: 36.w,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
width: widget.isShowBtn ? 10.w :30.w,
|
||||
),
|
||||
Text(
|
||||
widget.groupItem.keyGroupName ?? '',
|
||||
|
||||
@ -6,14 +6,18 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/app_get_version.dart';
|
||||
import 'package:star_lock/main.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/customer_tool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../versionUndate/versionUndateTool.dart';
|
||||
import 'bugly/bugly_tool.dart';
|
||||
import 'xs_jPhush.dart';
|
||||
|
||||
class AppFirstEnterHandle {
|
||||
Future<void> getAppFirstEnter(String flagStr) async {
|
||||
@ -24,6 +28,7 @@ class AppFirstEnterHandle {
|
||||
await showPrivacyAgreementAlert();
|
||||
}
|
||||
getAppInfo();
|
||||
await privacySDKInitialization();
|
||||
break;
|
||||
case isAgreePosition: // 位置权限
|
||||
if (getFlag != isAgreePosition) {
|
||||
@ -49,7 +54,7 @@ class AppFirstEnterHandle {
|
||||
Future<void> showPrivacyAgreementAlert() async {
|
||||
await showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
builder: (BuildContext context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: F.sw(
|
||||
@ -72,7 +77,7 @@ class AppFirstEnterHandle {
|
||||
TextSpan(
|
||||
text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr,
|
||||
style: const TextStyle(fontSize: 16.0),
|
||||
children: [
|
||||
children: <InlineSpan>[
|
||||
TextSpan(
|
||||
text: '《用户协议》'.tr,
|
||||
style: const TextStyle(
|
||||
@ -80,7 +85,7 @@ class AppFirstEnterHandle {
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 处理用户协议点击事件
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
|
||||
"url": XSConstantMacro.userAgreementURL,
|
||||
"title": '用户协议'.tr
|
||||
});
|
||||
@ -94,7 +99,7 @@ class AppFirstEnterHandle {
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 处理隐私政策点击事件
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
|
||||
"url": XSConstantMacro.privacyPolicyURL,
|
||||
"title": '隐私政策'.tr
|
||||
});
|
||||
@ -106,15 +111,13 @@ class AppFirstEnterHandle {
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
'不同意'.tr,
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
onPressed: () {
|
||||
_exitApp();
|
||||
},
|
||||
onPressed: _exitApp,
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
@ -140,7 +143,7 @@ class AppFirstEnterHandle {
|
||||
TextSpan(
|
||||
text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr,
|
||||
style: const TextStyle(fontSize: 16.0),
|
||||
children: [
|
||||
children: <InlineSpan>[
|
||||
TextSpan(
|
||||
text: '《用户协议》'.tr,
|
||||
style: TextStyle(
|
||||
@ -149,7 +152,7 @@ class AppFirstEnterHandle {
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 处理用户协议点击事件
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
|
||||
"url": XSConstantMacro.userAgreementURL,
|
||||
"title": '用户协议'.tr
|
||||
});
|
||||
@ -164,7 +167,7 @@ class AppFirstEnterHandle {
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 处理隐私政策点击事件
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: {
|
||||
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
|
||||
"url": XSConstantMacro.privacyPolicyURL,
|
||||
"title": '隐私政策'.tr
|
||||
});
|
||||
@ -176,15 +179,13 @@ class AppFirstEnterHandle {
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
'不同意'.tr,
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
onPressed: () {
|
||||
_exitApp();
|
||||
},
|
||||
onPressed: _exitApp,
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
@ -205,13 +206,13 @@ class AppFirstEnterHandle {
|
||||
void showPositionAlert() {
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
builder: (BuildContext context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: CupertinoAlertDialog(
|
||||
title: const Text('位置权限'),
|
||||
content: const Text('请开启位置权限,应用需要位置权限才可以完成智能锁和网关的蓝牙操作'),
|
||||
actions: [
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'.tr),
|
||||
onPressed: () {
|
||||
@ -235,13 +236,13 @@ class AppFirstEnterHandle {
|
||||
void showCameraAlert() {
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
builder: (BuildContext context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: CupertinoAlertDialog(
|
||||
title: const Text('相机/相册权限'),
|
||||
content: const Text('请开启本地存储权限,允许应用读写设备上的照片及文件'),
|
||||
actions: [
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: const Text('取消'),
|
||||
onPressed: () {
|
||||
|
||||
@ -7,8 +7,6 @@ import '../../network/api_repository.dart';
|
||||
class AppBindings extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put(ApiProvider());
|
||||
Get.put(ApiRepository(Get.find<ApiProvider>()));
|
||||
}
|
||||
|
||||
}
|
||||
@ -77,7 +77,7 @@ class LockGroupEditGroupLockRefreshEvent {
|
||||
/// 锁设置里面开启关闭刷新锁详情
|
||||
class LockSetChangeSetRefreshLockDetailWithType {
|
||||
int type; // 0 考勤 1开锁时是否需联网 2常开模式 3修改了锁名字 4修改了电量 5远程开锁
|
||||
String setResult;
|
||||
dynamic setResult;
|
||||
|
||||
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
|
||||
}
|
||||
|
||||
@ -3,7 +3,12 @@ import 'package:get/get.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class PlatformInfoService extends GetxService {
|
||||
static PlatformInfoService get to => Get.find<PlatformInfoService>();
|
||||
static PlatformInfoService? get to {
|
||||
if(Get.isRegistered<PlatformInfoService>()){
|
||||
return Get.find<PlatformInfoService>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
late PackageInfo _packageInfo;
|
||||
PackageInfo get info => _packageInfo;
|
||||
Future<PlatformInfoService> init() async {
|
||||
|
||||
@ -63,8 +63,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.53+2024052804:xhj 线上环境,提审 修改鑫锁名字为星星锁
|
||||
# 1.0.54+2024053001:xhj 线上环境,对外发布,提交测试
|
||||
# 1.0.56+2024060401:xhj 线上环境,对外发布,提交测试
|
||||
# 1.0.56+2024060502:xhj 线上环境,对外发布,提交测试
|
||||
|
||||
version: 1.0.56+2024060401
|
||||
version: 1.0.56+2024060502
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user