Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release

This commit is contained in:
Daisy 2024-06-05 18:25:05 +08:00
commit fe5b3089a3
36 changed files with 745 additions and 657 deletions

View File

@ -7,9 +7,13 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/blue/blue_manage.dart';
import 'package:star_lock/flavors.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/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/app_manager.dart';
import 'package:star_lock/tools/bindings/app_binding.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/tools/storage.dart';
import 'package:star_lock/translations/app_dept.dart'; import 'package:star_lock/translations/app_dept.dart';
@ -22,15 +26,13 @@ import 'tools/appRouteObserver.dart';
import 'tools/store_service.dart'; import 'tools/store_service.dart';
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
const MyApp({GlobalKey? key}) : super(key: key); MyApp({required this.isLogin, GlobalKey? key}) : super(key: key);
bool isLogin;
@override @override
State<MyApp> createState() => _MyAppState(); State<MyApp> createState() => _MyAppState();
} }
// RouteObserver navigation observer.
// final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget { class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,72 +41,84 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
builder: (BuildContext w, Widget? a) => _initMaterialApp()); builder: (BuildContext w, Widget? a) => _initMaterialApp());
} }
GetMaterialApp _initMaterialApp() => GetMaterialApp( GetMaterialApp _initMaterialApp() {
// enableLog: false, //
title: F.navTitle, String initialRoute;
navigatorObservers: <NavigatorObserver>[AppRouteObserver().routeObserver], if (widget.isLogin) {
translations: TranslationMessage(), initialRoute = Routers.starLockMain;
supportedLocales: appDept.deptSupportedLocales, } else {
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[ initialRoute = Routers.login;
GlobalMaterialLocalizations.delegate, }
GlobalCupertinoLocalizations.delegate, return GetMaterialApp(
GlobalWidgetsLocalizations.delegate, // enableLog: false,
], title: F.navTitle,
localeResolutionCallback: navigatorObservers: <NavigatorObserver>[
(Locale? locale, Iterable<Locale> supportedLocales) { AppRouteObserver().routeObserver
if (!supportedLocales.contains(locale)) { ],
final int idx = appSupportedLocales.indexWhere( translations: TranslationMessage(),
(Locale element) => element.languageCode == locale!.languageCode); supportedLocales: appDept.deptSupportedLocales,
if (idx != -1) { localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
locale = appSupportedLocales[idx]; GlobalMaterialLocalizations.delegate,
} else { GlobalCupertinoLocalizations.delegate,
locale = const Locale('zh', 'CN'); 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(
AppManager() code: '${locale!.languageCode}_${locale.countryCode}');
.setLanCode(code: '${locale!.languageCode}_${locale.countryCode}'); return locale;
return locale; },
}, locale: StoreService.to.getLanguageCode()!.isNotEmpty
locale: StoreService.to.getLanguageCode()!.isNotEmpty ? appDept.deptSupportedLocales
? appDept.deptSupportedLocales .where((Locale element) =>
.where((Locale element) => element.languageCode == StoreService.to.getLanguageCode())
element.languageCode == StoreService.to.getLanguageCode()) .first
.first : Get.deviceLocale,
: Get.deviceLocale, // locale: Get.deviceLocale,
// locale: Get.deviceLocale, fallbackLocale: const Locale('zh', 'CN'),
fallbackLocale: const Locale('zh', 'CN'), theme: ThemeData(
theme: ThemeData( scaffoldBackgroundColor: const Color(0xFFF6F6F6),
scaffoldBackgroundColor: const Color(0xFFF6F6F6), backgroundColor: const Color(0xFFF6F6F6),
backgroundColor: const Color(0xFFF6F6F6), primaryColor: const Color(0xFFFFFFFF),
primaryColor: const Color(0xFFFFFFFF), textTheme: TextTheme(
textTheme: TextTheme( //Material组件上的文字显示,
//Material组件上的文字显示, bodyText1:
bodyText1: TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)), //Material组件上的文字显示
//Material组件上的文字显示 bodyText2:
bodyText2: TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)), button: TextStyle(fontSize: 28.sp)),
button: TextStyle(fontSize: 28.sp)), iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)), appBarTheme: AppBarTheme(
appBarTheme: AppBarTheme( backgroundColor: const Color(0xFFFFFFFF),
backgroundColor: const Color(0xFFFFFFFF), elevation: 0,
elevation: 0, centerTitle: true,
centerTitle: true, iconTheme:
iconTheme: IconThemeData(color: const Color(0xff333333), size: 36.sp), IconThemeData(color: const Color(0xff333333), size: 36.sp),
titleTextStyle: TextStyle( titleTextStyle: TextStyle(
color: const Color(0xff333333), color: const Color(0xff333333),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 36.sp), fontSize: 36.sp),
),
splashColor: Colors.transparent,
//
highlightColor: Colors.transparent,
), ),
splashColor: Colors.transparent, debugShowCheckedModeBanner: false,
// getPages: AppRouters.routePages,
highlightColor: Colors.transparent, builder: EasyLoading.init(),
), initialBinding: AppBindings(),
debugShowCheckedModeBanner: false, initialRoute: initialRoute );
getPages: AppRouters.routePages, }
builder: EasyLoading.init(),
initialBinding: AppBindings(),
initialRoute: '/');
@override @override
void initState() { void initState() {
@ -153,3 +167,15 @@ Future<bool> getLoginStatus() async {
} }
return false; 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 ?? '');
}

View File

@ -486,6 +486,8 @@ abstract class Routers {
'/advancedFunctionRecordPage'; // '/advancedFunctionRecordPage'; //
static const String administratorAssociationLockPage = static const String administratorAssociationLockPage =
'/administratorAssociationLockPage'; //-- '/administratorAssociationLockPage'; //--
static const String login = '/login'; //
} }
abstract class AppRouters { abstract class AppRouters {
@ -494,6 +496,12 @@ abstract class AppRouters {
name: Routers.initial, name: Routers.initial,
page: () => const StarLockApplication(), page: () => const StarLockApplication(),
), ),
GetPage<dynamic>(
name: Routers.login,
page: () => F.sw(
skyCall: () => const StarLockLoginPage(),
xhjCall: () => const StarLockLoginXHJPage()),
),
GetPage<dynamic>( GetPage<dynamic>(
name: Routers.starLockMain, name: Routers.starLockMain,
page: () => F.sw( page: () => F.sw(

View File

@ -3,14 +3,17 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/flavors.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/customer_tool.dart';
import 'package:star_lock/tools/storage.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
import '../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../tools/commonItem.dart'; import '../../tools/commonItem.dart';
import '../../tools/tf_loginInput.dart';
import '../../tools/submitBtn.dart'; import '../../tools/submitBtn.dart';
import '../../tools/tf_loginInput.dart';
import '../../tools/titleAppBar.dart'; import '../../tools/titleAppBar.dart';
import '../../translations/trans_lib.dart'; import '../../translations/trans_lib.dart';
import 'starLock_login_logic.dart'; import 'starLock_login_logic.dart';
@ -23,8 +26,16 @@ class StarLockLoginPage extends StatefulWidget {
} }
class _StarLockLoginPageState extends State<StarLockLoginPage> { class _StarLockLoginPageState extends State<StarLockLoginPage> {
final logic = Get.put(StarLockLoginLogic()); final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
final state = Get.find<StarLockLoginLogic>().state; final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,7 +46,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
barTitle: TranslationLoader.lanKeys!.login!.tr, barTitle: TranslationLoader.lanKeys!.login!.tr,
haveBack: false, haveBack: false,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
const IconButton( const IconButton(
onPressed: CustomerTool.openCustomerService, onPressed: CustomerTool.openCustomerService,
icon: Icon( icon: Icon(
@ -62,7 +73,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
), ),
body: ListView( body: ListView(
padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w), padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w),
children: [ children: <Widget>[
Container( Container(
padding: EdgeInsets.all(10.w), padding: EdgeInsets.all(10.w),
child: Center( child: Center(
@ -111,7 +122,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
hintText: hintText:
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
// keyboardType: TextInputType.number, // keyboardType: TextInputType.number,
inputFormatters: [ inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp('[0-9]')), // FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(30), LengthLimitingTextInputFormatter(30),
]), ]),
@ -135,13 +146,13 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
), ),
hintText: hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}", "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
inputFormatters: [ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
// SizedBox(height: 15.h), // SizedBox(height: 15.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Obx(() => GestureDetector( Obx(() => GestureDetector(
onTap: () { onTap: () {
state.agree.value = !state.agree.value; state.agree.value = !state.agree.value;
@ -168,7 +179,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
text: TranslationLoader.lanKeys!.readAndAgree!.tr, text: TranslationLoader.lanKeys!.readAndAgree!.tr,
style: TextStyle( style: TextStyle(
color: const Color(0xff333333), fontSize: 20.sp), color: const Color(0xff333333), fontSize: 20.sp),
children: [ children: <InlineSpan>[
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: GestureDetector( child: GestureDetector(
@ -178,7 +189,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
'url': XSConstantMacro.userAgreementURL, 'url': XSConstantMacro.userAgreementURL,
'title': '用户协议'.tr 'title': '用户协议'.tr
}); });
@ -193,7 +204,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
'url': XSConstantMacro.privacyPolicyURL, 'url': XSConstantMacro.privacyPolicyURL,
'title': '隐私政策'.tr 'title': '隐私政策'.tr
}); });
@ -224,7 +235,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
SizedBox(height: 50.w), SizedBox(height: 50.w),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
GestureDetector( GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
@ -284,9 +295,9 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
width: 1.sp, width: 1.sp,
// height: 200.h, // height: 200.h,
child: Column( child: Column(
children: [ children: <Widget>[
Row( Row(
children: [ children: <Widget>[
Container( Container(
color: Colors.red, color: Colors.red,
child: Image.asset( child: Image.asset(

View File

@ -1,20 +1,18 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/login/starLock_login_state.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/customer_tool.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:star_lock/tools/storage.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
import '../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../tools/commonItem.dart';
import '../../tools/tf_loginInput.dart';
import '../../tools/submitBtn.dart'; import '../../tools/submitBtn.dart';
import '../../tools/titleAppBar.dart'; import '../../tools/tf_loginInput.dart';
import '../../translations/trans_lib.dart'; import '../../translations/trans_lib.dart';
import 'starLock_login_logic.dart'; import 'starLock_login_logic.dart';
@ -29,290 +27,296 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
final StarLockLoginLogic logic = Get.put(StarLockLoginLogic()); final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
final StarLockLoginState state = Get.find<StarLockLoginLogic>().state; final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF), backgroundColor: const Color(0xFFFFFFFF),
body: ListView( body: SizedBox(
padding: EdgeInsets.only( width: Get.width,
top: 110.h, child: ListView(
), padding: EdgeInsets.only(
children: <Widget>[ top: 110.h,
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),
],
),
), ),
GestureDetector( children: <Widget>[
onTap: () { Padding(
state.agree.value = !state.agree.value; padding: EdgeInsets.symmetric(horizontal: 40.w),
logic.changeAgreeState(); child: Column(
}, crossAxisAlignment: CrossAxisAlignment.start,
child: Container(
color: Colors.transparent,
padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Obx( Row(
() => Container( children: <Widget>[
padding: EdgeInsets.only( Expanded(
left: 5.w, child: Text(
right: 10.w, '${"欢迎使用".tr}${F.title}',
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 48.sp,
),
),
), ),
child: Image.asset( IconButton(
state.agree.value onPressed: CustomerTool.openCustomerService,
? 'images/icon_round_select.png' icon: Icon(
: 'images/icon_round_unSelect.png', Icons.support_agent,
width: 20.w, color: AppColors.mainColor,
height: 20.w, )),
],
),
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( LoginInput(
child: RichText( controller: state.emailOrPhoneController,
text: TextSpan( onchangeAction: (v) {
text: TranslationLoader.lanKeys!.readAndAgree!.tr, logic.checkNext(state.emailOrPhoneController);
style: TextStyle( },
color: const Color(0xff333333), fontSize: 20.sp), leftWidget: Padding(
children: <InlineSpan>[ padding: EdgeInsets.only(
WidgetSpan( top: 30.w,
alignment: PlaceholderAlignment.middle, bottom: 20.w,
child: GestureDetector( ),
child: Text( ),
'${TranslationLoader.lanKeys!.userAgreement!.tr}', rightSlot: IconButton(
style: TextStyle( icon: const Icon(Icons.close),
color: AppColors.mainColor, onPressed: () {},
fontSize: 20.sp)), ),
onTap: () { label: TranslationLoader
Get.toNamed(Routers.webviewShowPage, .lanKeys!.pleaseEnterNumberOrEmail!.tr,
arguments: <String, String>{ // keyboardType: TextInputType.number,
'url': XSConstantMacro.userAgreementURL, inputFormatters: <TextInputFormatter>[
'title': '用户协议'.tr LengthLimitingTextInputFormatter(30),
}); ]),
}, LoginInput(
)), controller: state.pwdController,
WidgetSpan( onchangeAction: (v) {
alignment: PlaceholderAlignment.middle, logic.checkNext(state.pwdController);
child: GestureDetector( },
child: Text( isPwd: true,
'${TranslationLoader.lanKeys!.privacyPolicy!.tr}', // isSuffixIcon: 2,
style: TextStyle( leftWidget: Padding(
color: AppColors.mainColor, padding: EdgeInsets.only(
fontSize: 20.sp)), top: 30.w,
onTap: () { bottom: 20.w,
Get.toNamed(Routers.webviewShowPage, ),
arguments: <String, String>{ ),
'url': XSConstantMacro.privacyPolicyURL, label:
'title': '隐私政策'.tr '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
}); inputFormatters: <TextInputFormatter>[
}, LengthLimitingTextInputFormatter(20),
)), ]),
], SizedBox(height: 10.h),
)),
)
], ],
), ),
), ),
), GestureDetector(
Padding( onTap: () {
padding: EdgeInsets.symmetric(horizontal: 40.w), state.agree.value = !state.agree.value;
child: Column( logic.changeAgreeState();
crossAxisAlignment: CrossAxisAlignment.start, },
children: <Widget>[ child: Container(
SizedBox(height: 5.w), color: Colors.transparent,
Obx(() => SubmitBtn( padding:
btnName: TranslationLoader.lanKeys!.login!.tr, EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
fontSize: 28.sp, child: Row(
borderRadius: 20.w, mainAxisAlignment: MainAxisAlignment.start,
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>[ children: <Widget>[
GestureDetector( Obx(
child: SizedBox( () => Container(
// width: 150.w, padding: EdgeInsets.only(
height: 50.h, left: 5.w,
// color: Colors.red, right: 10.w,
child: Center( ),
child: Text( child: Image.asset(
'${TranslationLoader.lanKeys!.forgetPassword!.tr}', state.agree.value
style: TextStyle( ? 'images/icon_round_select.png'
fontSize: 22.sp, : 'images/icon_round_unSelect.png',
color: AppColors.mainColor)), width: 20.w,
height: 20.w,
), ),
), ),
onTap: () {
Navigator.pushNamed(
context, Routers.starLockForgetPasswordPage);
},
), ),
Expanded( Row(children: <Widget>[
child: SizedBox( Text(TranslationLoader.lanKeys!.readAndAgree!.tr,
width: 10.sp, style: TextStyle(
)), color: const Color(0xff333333),
if (F.isLite) fontSize: 20.sp)),
Container() GestureDetector(
else 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( GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
height: 50.h, height: 50.h,
// color: Colors.red, // color: Colors.red,
child: Center( child: Center(
child: Text('演示模式'.tr, child: Text(
'${TranslationLoader.lanKeys!.forgetPassword!.tr}',
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 22.sp,
color: AppColors.mainColor)), color: AppColors.mainColor)),
), ),
), ),
onTap: () { 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);
},
)
],
),
],
),
)
],
),
)); ));
} }

View File

@ -1,14 +1,16 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/flavors.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/bugly/bugly_tool.dart';
import 'package:star_lock/tools/device_info_service.dart'; import 'package:star_lock/tools/device_info_service.dart';
import 'package:star_lock/tools/platform_info_services.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/tools/xs_jPhush.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/translations/trans_lib.dart';
@ -25,12 +27,20 @@ FutureOr<void> main() async {
// //
await _initTranslation(); await _initTranslation();
// bugly错误日志监控 final bool isLogin = await getLoginStatus();
await BuglyTool.init(); 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) { if (AppPlatform.isAndroid) {
const SystemUiOverlayStyle systemUiOverlayStyle = 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', zhSource: 'images/lan/lan_zh.json',
enSource: 'images/lan/lan_en.json', enSource: 'images/lan/lan_en.json',
keySource: 'images/lan/lan_keys.json', keySource: 'images/lan/lan_keys.json',
); );
// //
Future _setCommonServices() async { Future<void> _setCommonServices() async {
await Get.putAsync(() => StoreService().init()); await Get.putAsync(() => StoreService().init());
await Get.putAsync(() => PlatformInfoService().init()); Get.put(ApiProvider());
Get.put(ApiRepository(Get.find<ApiProvider>()));
if (F.isLite) { if (F.isLite) {
// //
// await Get.putAsync(() => DeviceInfoService().init()); // await Get.putAsync(() => DeviceInfoService().init());
@ -57,3 +68,10 @@ Future _setCommonServices() async {
await Get.putAsync(() => DeviceInfoService().init()); await Get.putAsync(() => DeviceInfoService().init());
} }
} }
//
Future<void> privacySDKInitialization() async {
await Get.putAsync(() => PlatformInfoService().init());
await BuglyTool.init();
await XSJPushProvider().initJPushService();
}

View File

@ -325,21 +325,13 @@ class AuthorizedAdminLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
} }
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
_replySubscription.cancel(); _replySubscription.cancel();
} }
} }

View File

@ -1,10 +1,10 @@
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../tools/showTipView.dart';
import 'volumeAuthorizationLock_state.dart'; import 'volumeAuthorizationLock_state.dart';
class VolumeAuthorizationLockLogic extends BaseGetXController { class VolumeAuthorizationLockLogic extends BaseGetXController {
@ -46,11 +46,13 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.isSendSuccess.value = true; state.isSendSuccess.value = true;
} else { } else {
EasyLoading.showToast('${entity.errorMsg}', duration: 2000.milliseconds);
if (entity.errorCode == 425) { if (entity.errorCode == 425) {
// //
state.isCreateUser.value = true; ShowTipView().showIosTipWithContentDialog(
addAuthorizedAdminRequest(); '${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}', () {
state.isCreateUser.value = true;
addAuthorizedAdminRequest();
});
} }
} }
} }

View File

@ -181,6 +181,9 @@ class CardDetailLogic extends BaseGetXController {
cardRight: state.isAdministrator.value ? 1 : 0, cardRight: state.isAdministrator.value ? 1 : 0,
); );
if (entity.errorCode!.codeIsSuccessful) { 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: () { showToast('修改成功'.tr, something: () {
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
}); });

View File

@ -11,12 +11,14 @@ class massSendLockGroupCell extends StatelessWidget {
required this.lockListByGroup, required this.lockListByGroup,
required this.selectLockAction, required this.selectLockAction,
required this.isVip, required this.isVip,
required this.isShowBtn,
Key? key}) Key? key})
: super(key: key); : super(key: key);
final int currentIndex; final int currentIndex;
List lockListByGroup; List lockListByGroup;
final _CallBack selectLockAction; final _CallBack selectLockAction;
bool isVip; bool isVip;
bool isShowBtn;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -65,26 +67,28 @@ class massSendLockGroupCell extends StatelessWidget {
child: SizedBox( child: SizedBox(
width: 20.w, width: 20.w,
)), )),
Image.asset( Visibility(
itemData.isChecked visible: isShowBtn,
? 'images/icon_round_select.png' child: Image.asset(
: 'images/icon_round_unSelect.png', itemData.isChecked
width: 30.w, ? 'images/icon_round_select.png'
height: 30.w, : 'images/icon_round_unSelect.png',
color: !isVip ? Colors.grey : AppColors.mainColor, width: 30.w,
), height: 30.w,
color: !isVip ? Colors.grey : AppColors.mainColor,
),),
SizedBox( SizedBox(
width: 30.w, width: 30.w,
) )
], ],
), ),
), ),
onTap: () { onTap: isShowBtn ? () {
if (isVip == false) { if (isVip == false) {
return; return;
} }
selectLockAction(itemIndex, itemData.lockId.toString()); selectLockAction(itemIndex, itemData.lockId.toString());
}, } : null,
); );
} }
} }

View File

@ -131,12 +131,14 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
} }
setState(() {}); setState(() {});
}, },
isShowBtn: true,
typeImgList: const [], typeImgList: const [],
groupItem: itemData, groupItem: itemData,
child: massSendLockGroupCell(index, child: massSendLockGroupCell(index,
currentIndex: index, currentIndex: index,
lockListByGroup: lockItemList, lockListByGroup: lockItemList,
isVip: state.isVip.value, isVip: state.isVip.value,
isShowBtn: true,
selectLockAction: (selectIndex, selectLockId) { selectLockAction: (selectIndex, selectLockId) {
LockListItem lockItem = lockItemList[selectIndex]; LockListItem lockItem = lockItemList[selectIndex];
lockItem.isChecked = !lockItem.isChecked; lockItem.isChecked = !lockItem.isChecked;

View File

@ -170,7 +170,7 @@ class FaceDetailLogic extends BaseGetXController {
faceName: state.changeNameController.text, faceName: state.changeNameController.text,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.typeName.value = state.changeNameController.text; state.faceItemData.value.fingerprintName = state.changeNameController.text;
showToast('修改成功', something: () { showToast('修改成功', something: () {
Get.back(result: 'addScuess'); Get.back(result: 'addScuess');
}); });
@ -194,7 +194,9 @@ class FaceDetailLogic extends BaseGetXController {
faceRight: state.isAdministrator.value ? 1 : 0, faceRight: state.isAdministrator.value ? 1 : 0,
); );
if (entity.errorCode!.codeIsSuccessful) { 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'); Get.back(result: 'addScuess');
}); });
} }
@ -203,7 +205,7 @@ class FaceDetailLogic extends BaseGetXController {
String getKeyTypeShowDateTime() { String getKeyTypeShowDateTime() {
String useDateStr = ''; String useDateStr = '';
if (state.keyType.value == 1) { if (state.keyType.value == 1) {
useDateStr = '永久'; useDateStr = '永久'.tr;
} else if (state.keyType.value == 2) { } else if (state.keyType.value == 2) {
useDateStr = useDateStr =
'${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}'; '${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}';

View File

@ -176,6 +176,9 @@ class FingerprintDetailLogic extends BaseGetXController{
fingerRight: state.isAdministrator.value ? 1 : 0, fingerRight: state.isAdministrator.value ? 1 : 0,
); );
if(entity.errorCode!.codeIsSuccessful){ 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: (){ showToast('修改成功'.tr, something: (){
eventBus.fire(OtherTypeRefreshListEvent()); eventBus.fire(OtherTypeRefreshListEvent());
}); });

View File

@ -522,5 +522,18 @@ class LockDetailLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
super.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();
}
});
} }
} }

View File

@ -29,15 +29,14 @@ import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart'; import 'lockDetail_logic.dart';
class LockDetailPage extends StatefulWidget { class LockDetailPage extends StatefulWidget {
const LockDetailPage(
{required this.isOnlyOneData,
required this.lockListInfoItemEntity,
Key? key})
: super(key: key);
final bool isOnlyOneData; final bool isOnlyOneData;
final LockListInfoItemEntity lockListInfoItemEntity; final LockListInfoItemEntity lockListInfoItemEntity;
const LockDetailPage(
{Key? key,
required this.isOnlyOneData,
required this.lockListInfoItemEntity})
: super(key: key);
@override @override
State<LockDetailPage> createState() => _LockDetailPageState(); State<LockDetailPage> createState() => _LockDetailPageState();
} }
@ -50,7 +49,6 @@ class _LockDetailPageState extends State<LockDetailPage>
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
listeningAnimations(); listeningAnimations();
@ -1438,8 +1436,9 @@ class _LockDetailPageState extends State<LockDetailPage>
state.closedUnlockSuccessfulTimer?.cancel(); state.closedUnlockSuccessfulTimer?.cancel();
_lockRefreshLockDetailInfoDataEvent?.cancel(); _lockRefreshLockDetailInfoDataEvent?.cancel();
state.replySubscription.cancel(); state.replySubscription.cancel();
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent! state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent
.cancel(); ?.cancel();
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
if (state.animationController != null) { if (state.animationController != null) {
state.animationController!.dispose(); state.animationController!.dispose();
state.animationController = null; state.animationController = null;

View File

@ -12,44 +12,45 @@ class LockDetailState {
late StreamSubscription<Reply> replySubscription; late StreamSubscription<Reply> replySubscription;
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent; StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
StreamSubscription? LockSetChangeSetRefreshLockDetailWithTypeSubscription;
String lockNetToken = "0"; String lockNetToken = '0';
int differentialTime = 0; int differentialTime = 0;
int lockUserNo = 0; int lockUserNo = 0;
var senderUserId = 0; int senderUserId = 0;
var isOnlyOneData = false; bool isOnlyOneData = false;
var isAttendance = 0.obs; // RxInt isAttendance = 0.obs; //
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网 RxInt isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
var electricQuantity = 0.obs; // RxInt electricQuantity = 0.obs; //
var electricQuantityStandby = 0.obs; // RxInt electricQuantityStandby = 0.obs; //
var isOpenPassageMode = 0.obs; // RxInt isOpenPassageMode = 0.obs; //
var lockAlias = "".obs; // RxString lockAlias = ''.obs; //
// var currentDeviceUUid = "".obs; // uuid // var currentDeviceUUid = "".obs; // uuid
var ifCurrentScreen = true.obs; // , RxBool ifCurrentScreen = true.obs; // ,
var iSClosedUnlockSuccessfulPopup = false.obs; // RxBool iSClosedUnlockSuccessfulPopup = false.obs; //
var iSOpenLock = true.obs; // RxBool iSOpenLock = true.obs; //
Timer? closedUnlockSuccessfulTimer; Timer? closedUnlockSuccessfulTimer;
var bottomBtnisEable = true.obs; // RxBool bottomBtnisEable = true.obs; //
var openDoorBtnisUneable = true.obs; // 使使, RxBool openDoorBtnisUneable = true.obs; // 使使,
var openDoorModel = 0;// 线0, 线2 线32 线34 int openDoorModel = 0;// 线0, 线2 线32 线34
// //
AnimationController? animationController; AnimationController? animationController;
// var lockState = 0.obs;// 0 1() 2 3 4 5 // 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 // var connectState = 0.obs;// 0 1
final PageController pageController = PageController(); final PageController pageController = PageController();
var currentPage = 0.obs; RxInt currentPage = 0.obs;
var operateDate = 0; // int operateDate = 0; //
var logCountPage = 10; // int logCountPage = 10; //
var nextAuthTime = 0.obs; // RxInt nextAuthTime = 0.obs; //
// LockDetailState() { // LockDetailState() {
// Map map = Get.arguments; // Map map = Get.arguments;
// lockCount = map["lockCount"]; // lockCount = map["lockCount"];

View File

@ -20,6 +20,7 @@ class BasicInformationLogic extends BaseGetXController {
// //
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
StreamSubscription? lockSetChangeSetRefreshLockDetailWithTypeSubscription;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
@ -29,6 +30,19 @@ class BasicInformationLogic extends BaseGetXController {
state.lockSetInfoData.value = event.lockSetInfoData; state.lockSetInfoData.value = event.lockSetInfoData;
blockSetStateCallback(); 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 @override
@ -43,5 +57,6 @@ class BasicInformationLogic extends BaseGetXController {
void onClose() { void onClose() {
super.onClose(); super.onClose();
_passCurrentLockInformationEvent?.cancel(); _passCurrentLockInformationEvent?.cancel();
lockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
} }
} }

View File

@ -23,19 +23,22 @@ class UploadElectricQuantityLogic extends BaseGetXController {
final UploadElectricQuantityState state = UploadElectricQuantityState(); final UploadElectricQuantityState state = UploadElectricQuantityState();
// //
Future<void> uploadElectricQuantityRequest(String electricQuantity, String electricQuantityStandby) async { Future<void> uploadElectricQuantityRequest(
final KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity( String electricQuantity, String electricQuantityStandby) async {
electricQuantity:electricQuantity, final KeyOperationRecordEntity entity = await ApiRepository.to
electricQuantityStandby: electricQuantityStandby, .uploadElectricQuantity(
lockId: state.lockSetInfoData.value.lockId.toString(), electricQuantity: electricQuantity,
isUnShowLoading: false electricQuantityStandby: electricQuantityStandby,
); lockId: state.lockSetInfoData.value.lockId.toString(),
isUnShowLoading: false);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('锁电量更新成功'.tr, something: () { showToast('锁电量更新成功'.tr, something: () {
eventBus eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); .fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire( eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(4, <String,dynamic>{
LockSetChangeSetRefreshLockDetailWithType(4, electricQuantity)); 'electricQuantity': electricQuantity,
'uploadElectricQuantityDate': state.uploadElectricQuantityDate.value,
}));
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
} }
@ -57,8 +60,10 @@ class UploadElectricQuantityLogic extends BaseGetXController {
(BluetoothConnectionState deviceConnectionState) async { (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
dismissEasyLoading(); dismissEasyLoading();
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
@ -67,7 +72,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
isBeforeAddUser: false, isBeforeAddUser: false,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) { } else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
@ -80,6 +86,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
@ -102,20 +109,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
// //
final int battRemCap = reply.data[132]; final int battRemCap = reply.data[132];
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap; state.lockSetInfoData.value.lockBasicInfo!.electricQuantity =
battRemCap;
// //
final int battRemCapStandby = reply.data[133]; 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.uploadElectricQuantityDate.value =
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate = DateTime.now().millisecondsSinceEpoch; DateTime.now().millisecondsSinceEpoch;
uploadElectricQuantityRequest(battRemCap.toString(), battRemCapStandby.toString()); state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate =
DateTime.now().millisecondsSinceEpoch;
uploadElectricQuantityRequest(
battRemCap.toString(), battRemCapStandby.toString());
break; break;
case 0x06: case 0x06:
// //
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
@ -125,7 +139,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
break; break;
default: default:
// //
@ -134,22 +147,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
} }
// //
Future<void> getServerDatetime() async{ Future<void> getServerDatetime() async {
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(); final GetServerDatetimeEntity entity =
if(entity.errorCode!.codeIsSuccessful){ await ApiRepository.to.getServerDatetimeData();
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000; 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}"); // AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
} }
} }
int getLocalTime(){ int getLocalTime() {
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime; return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
state.differentialTime;
} }
int getUTCTime(){ int getUTCTime() {
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true); 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); final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue'); AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
return utcTimeValue ~/ 1000; return utcTimeValue ~/ 1000;

View File

@ -111,9 +111,11 @@ class PasswordKeyDetailLogic extends BaseGetXController {
if(changType == 1){ if(changType == 1){
// //
state.keyboardPwdName.value = state.inputNameController.text; state.keyboardPwdName.value = state.inputNameController.text;
state.itemData.value.keyboardPwdName = state.keyboardPwdName.value;
}else if(changType == 2){ }else if(changType == 2){
// //
state.keyboardPwd.value = state.inputPwdController.text; state.keyboardPwd.value = state.inputPwdController.text;
state.itemData.value.keyboardPwd = state.keyboardPwd.value;
} }
eventBus.fire(GetPasswordListRefreshUI()); eventBus.fire(GetPasswordListRefreshUI());
}); });

View File

@ -147,6 +147,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
BuildContext context, int index, GroupList itemData) { BuildContext context, int index, GroupList itemData) {
final List<LockListInfoItemEntity> lockItemList = final List<LockListInfoItemEntity> lockItemList =
itemData.lockList ?? <LockListInfoItemEntity>[]; itemData.lockList ?? <LockListInfoItemEntity>[];
final List<Widget> list = forItems(lockItemList);
return LockListGroupView( return LockListGroupView(
onTap: () { onTap: () {
setState(() {}); setState(() {});
@ -155,15 +156,20 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
typeImgList: const <dynamic>[], typeImgList: const <dynamic>[],
groupItem: itemData, 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), padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
maxCrossAxisExtent: Get.width * .6,
childAspectRatio: 1.2,
crossAxisSpacing: 15.w,
mainAxisSpacing: 15.h,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), 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( Visibility(
visible: keyInfo.passageMode == 1, visible: keyInfo.passageMode == 1,
child: Container( child: Container(
padding: padding: EdgeInsets.only(
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( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w), borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor, color: AppColors.openPassageModeColor,
@ -338,7 +344,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
children: <Widget>[ children: <Widget>[
Container( Container(
padding: EdgeInsets.only( 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( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w), borderRadius: BorderRadius.circular(5.w),
color: AppColors.mainColor, color: AppColors.mainColor,

View File

@ -50,9 +50,13 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
if (clearScanDevices) { if (clearScanDevices) {
BlueManage().scanDevices.clear(); BlueManage().scanDevices.clear();
} }
if (mounted) {
WidgetsBinding.instance.addPostFrameCallback((_) async {
setState(() {}); setState(() {});
} });
// if (mounted) {
// setState(() {});
// }
} }
@override @override

View File

@ -174,6 +174,7 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
}, },
// title: deviceName, // title: deviceName,
// imgName: 'images/icon_lock.png', // imgName: 'images/icon_lock.png',
isShowBtn: true,
typeImgList: const [], typeImgList: const [],
groupItem: GroupListItem(), groupItem: GroupListItem(),
child: ListView.separated( child: ListView.separated(
@ -214,6 +215,7 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
}, },
// title: deviceName, // title: deviceName,
// imgName: 'images/controls_user.png', // imgName: 'images/controls_user.png',
isShowBtn: true,
typeImgList: const ['images/icon_password.png', 'images/icon_card.png'], typeImgList: const ['images/icon_password.png', 'images/icon_card.png'],
groupItem: GroupListItem(), groupItem: GroupListItem(),
child: ListView.separated( child: ListView.separated(

View File

@ -75,12 +75,14 @@ class _AdministratorAssociationLockPageState
onTap: () { onTap: () {
}, },
isShowBtn: false,
typeImgList: const [], typeImgList: const [],
groupItem: getItemData, groupItem: getItemData,
child: massSendLockGroupCell(index, child: massSendLockGroupCell(index,
currentIndex: index, currentIndex: index,
lockListByGroup: lockItemList, lockListByGroup: lockItemList,
isVip: true, isVip: true,
isShowBtn: false,
selectLockAction: (int selectIndex, String selectLockId) { selectLockAction: (int selectIndex, String selectLockId) {
}), }),

View File

@ -12,31 +12,33 @@ class GroupEditLockLogic extends BaseGetXController {
// //
Future<void> lockGroupAddLock(List lockIds) async { Future<void> lockGroupAddLock(List lockIds) async {
if (lockIds.isEmpty) { if (lockIds.isEmpty) {
showToast("请选择锁".tr); showToast('请选择锁'.tr);
return; return;
} }
var entity = await ApiRepository.to.lockGroupAddLock( var entity = await ApiRepository.to.lockGroupAddLock(
lockIds: lockIds, groupId: state.selectGroupListItem.keyGroupId!); lockIds: lockIds, groupId: state.selectGroupListItem.keyGroupId!);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("添加成功"); showToast('添加成功', something: () {
eventBus.fire(LockGroupEditGroupLockRefreshEvent()); eventBus.fire(LockGroupEditGroupLockRefreshEvent());
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
Get.close(2); Get.close(2);
});
} }
} }
// //
Future<void> lockGroupDeletLock(List lockIds) async { Future<void> lockGroupDeletLock(List lockIds) async {
if (lockIds.isEmpty) { if (lockIds.isEmpty) {
showToast("请选择锁".tr); showToast('请选择锁'.tr);
return; return;
} }
var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds); var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功"); showToast('删除成功', something: () {
eventBus.fire(LockGroupEditGroupLockRefreshEvent()); eventBus.fire(LockGroupEditGroupLockRefreshEvent());
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
Get.close(2); Get.close(2);
});
} }
} }

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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/showCupertinoAlertView.dart';
import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/noData.dart';
@ -19,8 +20,8 @@ class GroupEditLockPage extends StatefulWidget {
} }
class _GroupEditLockPageState extends State<GroupEditLockPage> { class _GroupEditLockPageState extends State<GroupEditLockPage> {
final logic = Get.put(GroupEditLockLogic()); final GroupEditLockLogic logic = Get.put(GroupEditLockLogic());
final state = Get.find<GroupEditLockLogic>().state; final GroupEditLockState state = Get.find<GroupEditLockLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,15 +34,15 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
Obx(() => Visibility( Obx(() => Visibility(
visible: state.isVip.value ? false : true, visible: !state.isVip.value,
child: ShowCupertinoAlertView() child: ShowCupertinoAlertView()
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))), .topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
Container( Container(
margin: EdgeInsets.all(15.w), margin: EdgeInsets.all(15.w),
child: Row( child: Row(
children: [ children: <Widget>[
Text( Text(
TranslationLoader TranslationLoader
.lanKeys!.selectTheLockToJoinTheGroup!.tr, .lanKeys!.selectTheLockToJoinTheGroup!.tr,
@ -51,13 +52,13 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
), ),
Expanded(child: _buildMainUI()), Expanded(child: _buildMainUI()),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.isVip.value ? true : false, visible: state.isVip.value,
child: SubmitBtn( child: SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr, btnName: TranslationLoader.lanKeys!.sure!.tr,
onClick: () async { onClick: () async {
var idList = []; final List idList = [];
for (int i = 0; i < state.lockList.length; i++) { for (int i = 0; i < state.lockList.length; i++) {
LockListItem lockListItem = state.lockList[i]; final LockListItem lockListItem = state.lockList[i];
if (lockListItem.isChecked == true) { if (lockListItem.isChecked == true) {
idList.add(lockListItem.lockId); idList.add(lockListItem.lockId);
} }
@ -78,8 +79,8 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
Widget _buildMainUI() { Widget _buildMainUI() {
return state.lockList.isNotEmpty return state.lockList.isNotEmpty
? ListView.separated( ? ListView.separated(
itemBuilder: (context, index) { itemBuilder: (BuildContext context, int index) {
LockListItem itemData = state.lockList[index]; final LockListItem itemData = state.lockList[index];
return _listItemView(itemData); return _listItemView(itemData);
}, },
itemCount: state.lockList.length, itemCount: state.lockList.length,
@ -109,24 +110,35 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 20.w, width: 20.w,
), ),
Image.asset( Image.asset(
'images/icon_lockGroup_item.png', 'images/icon_lockGroup_item.png',
width: 36, width: 50.w,
height: 36, height: 50.w,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
), ),
Text( Expanded(
itemData.lockAlias ?? '', child: SizedBox(
style: TextStyle(fontSize: 24.sp), 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( Image.asset(
itemData.isChecked itemData.isChecked
? 'images/icon_round_select.png' ? 'images/icon_round_select.png'

View File

@ -108,17 +108,22 @@ class _LockItemListPageState extends State<LockItemListPage> {
), ),
Image.asset( Image.asset(
'images/icon_lockGroup_item.png', 'images/icon_lockGroup_item.png',
width: 36, width: 50.w,
height: 36, height: 50.w,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
), ),
Text( Expanded(child:
itemData.lockAlias ?? '', Text(itemData.lockAlias ?? '',
style: TextStyle(fontSize: 24.sp), 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) { } else if (getSelectIndex == 1) {
Get.toNamed(Routers.groupEditLockPage, arguments: {'groupListItem': groupListItem, 'ungrouped': ungrouped, 'type': 1}); Get.toNamed(Routers.groupEditLockPage, arguments: {'groupListItem': groupListItem, 'ungrouped': ungrouped, 'type': 1});
} }
}, },
); );
}); });

View File

@ -13,8 +13,8 @@ class LockGroupListLogic extends BaseGetXController {
final LockGroupListState state = LockGroupListState(); final LockGroupListState state = LockGroupListState();
// //
void mockNetworkDataRequest() async { Future<void> mockNetworkDataRequest() async {
var entity = await ApiRepository.to.lockGroupList('0'); final MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('0');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) { if (entity.data != null) {
state.lockNum = 0; state.lockNum = 0;
@ -25,58 +25,53 @@ class LockGroupListLogic extends BaseGetXController {
// //
Future<void> addLockGroupRequest() async { Future<void> addLockGroupRequest() async {
MassSendLockGroupListEntity entity = final MassSendLockGroupListEntity entity =
await ApiRepository.to.addLockGroup(state.changeNameController.text, '0'); await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("创建成功".tr); showToast('创建成功'.tr, something: (){
mockNetworkDataRequest(); mockNetworkDataRequest();
});
} }
} }
// //
Future<void> editLockGroupRequest(int groupId) async { 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) { if (entity.errorCode!.codeIsSuccessful) {
showToast("编辑成功".tr); showToast('编辑成功'.tr, something: (){
mockNetworkDataRequest(); mockNetworkDataRequest();
});
} }
} }
// //
Future<void> deleteLockGroupRequest(int groupId) async { 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) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功".tr); showToast('删除成功'.tr, something: (){
mockNetworkDataRequest(); mockNetworkDataRequest();
});
} }
} }
// //
late StreamSubscription _teamEvent; late StreamSubscription _teamEvent;
void _initRefreshAction() { void _initRefreshAction() {
_teamEvent = eventBus.on<LockGroupEditGroupLockRefreshEvent>().listen((event) { _teamEvent = eventBus.on<LockGroupEditGroupLockRefreshEvent>().listen((LockGroupEditGroupLockRefreshEvent event) {
mockNetworkDataRequest(); mockNetworkDataRequest();
}); });
} }
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initRefreshAction(); _initRefreshAction();
mockNetworkDataRequest(); mockNetworkDataRequest();
} }
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
_teamEvent.cancel(); _teamEvent.cancel();
} }

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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 'package:star_lock/tools/showTipView.dart';
import '../../../../../../appRouters.dart'; import '../../../../../../appRouters.dart';
@ -11,7 +12,6 @@ import '../../../../../../tools/titleAppBar.dart';
import '../../../../../../translations/trans_lib.dart'; import '../../../../../../translations/trans_lib.dart';
import '../../../../tools/left_slide_actions.dart'; import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/noData.dart'; import '../../../../tools/noData.dart';
import '../../../../tools/showIosTipView.dart';
import 'lockGroupList_logic.dart'; import 'lockGroupList_logic.dart';
class LockGroupListPage extends StatefulWidget { class LockGroupListPage extends StatefulWidget {
@ -22,8 +22,8 @@ class LockGroupListPage extends StatefulWidget {
} }
class _LockGroupListPageState extends State<LockGroupListPage> { class _LockGroupListPageState extends State<LockGroupListPage> {
final logic = Get.put(LockGroupListLogic()); final LockGroupListLogic logic = Get.put(LockGroupListLogic());
final state = Get.find<LockGroupListLogic>().state; final LockGroupListState state = Get.find<LockGroupListLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,7 +32,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.lockGroup!.tr, barTitle: TranslationLoader.lanKeys!.lockGroup!.tr,
haveBack: true, haveBack: true,
actionsList: [ actionsList: <Widget>[
IconButton( IconButton(
icon: Image.asset( icon: Image.asset(
'images/icon_add_white.png', 'images/icon_add_white.png',
@ -41,7 +41,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
), ),
onPressed: () { onPressed: () {
// - // -
state.changeNameController.text = ""; state.changeNameController.text = '';
// showCupertinoAlertDialog(context, true, 0); // showCupertinoAlertDialog(context, true, 0);
ShowTipView().showTFViewAlertDialog( ShowTipView().showTFViewAlertDialog(
state.changeNameController, state.changeNameController,
@ -61,7 +61,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
], ],
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
Expanded( Expanded(
child: Obx(() => state.itemDataList.value.isEmpty child: Obx(() => state.itemDataList.value.isEmpty
? NoData() ? NoData()
@ -73,16 +73,16 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
Widget _buildMainUI() { Widget _buildMainUI() {
for (int i = 0; i < state.itemDataList.value.length; i++) { 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; state.lockNum += itemData.lockList!.length;
} }
return ListView.separated( return ListView.separated(
itemCount: state.itemDataList.value.length + 1, itemCount: state.itemDataList.value.length + 1,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
if (index == state.itemDataList.value.length) { if (index == state.itemDataList.value.length) {
return Center( return Center(
child: Column( child: Column(
children: [ children: <Widget>[
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
@ -98,7 +98,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
), ),
); );
} else { } else {
GroupListItem itemData = state.itemDataList.value[index]; final GroupListItem itemData = state.itemDataList.value[index];
if (itemData.groupType == 0) { if (itemData.groupType == 0) {
state.ungrouped = itemData; state.ungrouped = itemData;
} }
@ -107,23 +107,22 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
key: Key(itemData.keyGroupId!.toString()), key: Key(itemData.keyGroupId!.toString()),
actionsWidth: itemData.groupType != 0 ? 200.w : 0, actionsWidth: itemData.groupType != 0 ? 200.w : 0,
actions: itemData.groupType != 0 actions: itemData.groupType != 0
? [ ? <Widget>[
_buildEditBtn(itemData), _buildEditBtn(itemData),
_buildDeleteBtn(itemData), _buildDeleteBtn(itemData),
] ]
: [], : <Widget>[],
decoration: const BoxDecoration( decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(1)), borderRadius: BorderRadius.all(Radius.circular(1)),
), ),
child: CommonItem( child: CommonItem(
leftTitel: leftTitel: '${itemData.keyGroupName}(${itemData.lockList?.length})',
'${itemData.keyGroupName}(${itemData.lockList?.length})', rightTitle: '',
rightTitle: "",
allHeight: 70.h, allHeight: 70.h,
action: () { action: () {
Get.toNamed(Routers.lockItemListPage, arguments: { Get.toNamed(Routers.lockItemListPage, arguments: <String, GroupListItem>{
'groupListItem': itemData, '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) { Widget _buildDeleteBtn(GroupListItem groupListItem) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
// : // :
// showIosTipViewDialog(context, groupListItem); // showIosTipViewDialog(context, groupListItem);
ShowTipView().showIosTipWithContentDialog("分组下的锁将被移到未分组里".tr, () { ShowTipView().showIosTipWithContentDialog('分组下的锁将被移到未分组里'.tr, () {
logic.deleteLockGroupRequest(groupListItem.keyGroupId!); logic.deleteLockGroupRequest(groupListItem.keyGroupId!);
}); });
}, },
@ -203,9 +173,10 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
ShowTipView().showTFViewAlertDialog( ShowTipView().showTFViewAlertDialog(
state.changeNameController, state.changeNameController,
TranslationLoader.lanKeys!.createNewGroup!.tr, '修改名称'.tr,
TranslationLoader.lanKeys!.pleaseEnter!.tr, () { TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
if (state.changeNameController.text.isNotEmpty) { if (state.changeNameController.text.isNotEmpty) {
Get.back();
logic.editLockGroupRequest(groupListItem.keyGroupId!); logic.editLockGroupRequest(groupListItem.keyGroupId!);
} else { } else {
logic.showToast( logic.showToast(
@ -218,7 +189,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
color: AppColors.mainColor, color: AppColors.mainColor,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
"重命名".tr, '重命名'.tr,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, 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();
// },
// );
// }
// );
// }
} }

View File

@ -6,8 +6,8 @@ import '../../../../main/lockDetail/electronicKey/massSendElectronicKey/massSend
class LockGroupListState { class LockGroupListState {
TextEditingController changeNameController = TextEditingController(); TextEditingController changeNameController = TextEditingController();
var itemDataList = <GroupListItem>[].obs; RxList<GroupListItem> itemDataList = <GroupListItem>[].obs;
int lockNum = 0; int lockNum = 0;
var ungrouped = GroupListItem(); GroupListItem ungrouped = GroupListItem();
} }

View File

@ -11,7 +11,7 @@ import '../tools/storage.dart';
String getUserAgent() { String getUserAgent() {
//便 //便
String ua = 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; return ua;
} }

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:star_lock/app.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/login/app_get_version.dart'; import 'package:star_lock/login/login/app_get_version.dart';
import 'package:star_lock/login/login/starLock_login_page.dart'; import 'package:star_lock/login/login/starLock_login_page.dart';
@ -23,12 +24,7 @@ class _StarLockApplicationState extends State<StarLockApplication> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
bool? openDeBug = await Storage.getBool(isOpenDeBug);
if (openDeBug == true) {
DeBug.showFloatWidget();
}
});
} }
@override @override
@ -37,7 +33,7 @@ class _StarLockApplicationState extends State<StarLockApplication> {
return FutureBuilder<bool>( return FutureBuilder<bool>(
future: getLoginStatus(), future: getLoginStatus(),
builder: (context, snapshot) { builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
// //
return const CircularProgressIndicator(); 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 ?? '');
}
} }

View File

@ -7,17 +7,16 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
class ExpandedListTile extends StatefulWidget { class ExpandedListTile extends StatefulWidget {
const ExpandedListTile( const ExpandedListTile(
{Key? key, {required this.isShowBtn, required this.groupItem, required this.typeImgList, Key? key,
this.child, this.child,
this.onTap, this.onTap})
required this.groupItem,
required this.typeImgList})
: super(key: key); : super(key: key);
final Widget? child; final Widget? child;
final List typeImgList; final List typeImgList;
final Function()? onTap; final Function()? onTap;
final GroupListItem groupItem; final GroupListItem groupItem;
final bool isShowBtn;
@override @override
_ExpandedListTileState createState() => _ExpandedListTileState(); _ExpandedListTileState createState() => _ExpandedListTileState();
@ -53,44 +52,48 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
List<Widget> _buildExpandRowList() { List<Widget> _buildExpandRowList() {
List<Widget> widgetList = []; List<Widget> widgetList = [];
widgetList.add(GestureDetector(
child: Container( if(widget.isShowBtn){
color: Colors.white, widgetList.add(GestureDetector(
width: 80.w, child: Container(
child: Row( color: Colors.white,
children: [ width: 80.w,
SizedBox( child: Row(
width: 30.w, children: [
), SizedBox(
Image.asset( width: 30.w,
_isCheck ),
? "images/icon_round_select.png" Image.asset(
: "images/icon_round_unSelect.png", _isCheck
width: 30.w, ? 'images/icon_round_select.png'
height: 30.w, : 'images/icon_round_unSelect.png',
color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey, width: 30.w,
), height: 30.w,
SizedBox( color: widget.groupItem.isVip ? AppColors.mainColor : Colors.grey,
width: 20.w, ),
) SizedBox(
], width: 20.w,
)
],
),
), ),
), onTap: () {
onTap: () { if (widget.groupItem.isVip == false) {
if (widget.groupItem.isVip == false) { return;
return; }
} //
// setState(() {
setState(() { _isCheck = !_isCheck;
_isCheck = !_isCheck; widget.groupItem.isChecked = _isCheck;
widget.groupItem.isChecked = _isCheck; });
}); widget.onTap?.call();
widget.onTap?.call(); },
}, ));
)); }
widgetList.add(GestureDetector( widgetList.add(GestureDetector(
child: Container( child: Container(
width: ScreenUtil().screenWidth - 80.w, width: ScreenUtil().screenWidth - (widget.isShowBtn ? 80.w : 0),
color: Colors.white, color: Colors.white,
child: Row( child: Row(
children: [ children: [
@ -100,7 +103,7 @@ class _ExpandedListTileState extends State<ExpandedListTile> {
// height: 36.w, // height: 36.w,
// ), // ),
SizedBox( SizedBox(
width: 10.w, width: widget.isShowBtn ? 10.w :30.w,
), ),
Text( Text(
widget.groupItem.keyGroupName ?? '', widget.groupItem.keyGroupName ?? '',

View File

@ -6,14 +6,18 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.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/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/login/app_get_version.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/network/api_repository.dart';
import 'package:star_lock/tools/customer_tool.dart'; import 'package:star_lock/tools/customer_tool.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
import '../versionUndate/versionUndateTool.dart'; import '../versionUndate/versionUndateTool.dart';
import 'bugly/bugly_tool.dart';
import 'xs_jPhush.dart';
class AppFirstEnterHandle { class AppFirstEnterHandle {
Future<void> getAppFirstEnter(String flagStr) async { Future<void> getAppFirstEnter(String flagStr) async {
@ -24,6 +28,7 @@ class AppFirstEnterHandle {
await showPrivacyAgreementAlert(); await showPrivacyAgreementAlert();
} }
getAppInfo(); getAppInfo();
await privacySDKInitialization();
break; break;
case isAgreePosition: // case isAgreePosition: //
if (getFlag != isAgreePosition) { if (getFlag != isAgreePosition) {
@ -49,7 +54,7 @@ class AppFirstEnterHandle {
Future<void> showPrivacyAgreementAlert() async { Future<void> showPrivacyAgreementAlert() async {
await showCupertinoDialog( await showCupertinoDialog(
context: Get.context!, context: Get.context!,
builder: (context) { builder: (BuildContext context) {
return PopScope( return PopScope(
canPop: false, canPop: false,
child: F.sw( child: F.sw(
@ -72,7 +77,7 @@ class AppFirstEnterHandle {
TextSpan( TextSpan(
text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr, text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr,
style: const TextStyle(fontSize: 16.0), style: const TextStyle(fontSize: 16.0),
children: [ children: <InlineSpan>[
TextSpan( TextSpan(
text: '《用户协议》'.tr, text: '《用户协议》'.tr,
style: const TextStyle( style: const TextStyle(
@ -80,7 +85,7 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
"url": XSConstantMacro.userAgreementURL, "url": XSConstantMacro.userAgreementURL,
"title": '用户协议'.tr "title": '用户协议'.tr
}); });
@ -94,7 +99,7 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
"url": XSConstantMacro.privacyPolicyURL, "url": XSConstantMacro.privacyPolicyURL,
"title": '隐私政策'.tr "title": '隐私政策'.tr
}); });
@ -106,15 +111,13 @@ class AppFirstEnterHandle {
], ],
), ),
), ),
actions: [ actions: <Widget>[
CupertinoDialogAction( CupertinoDialogAction(
child: Text( child: Text(
'不同意'.tr, '不同意'.tr,
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
onPressed: () { onPressed: _exitApp,
_exitApp();
},
), ),
CupertinoDialogAction( CupertinoDialogAction(
child: Text( child: Text(
@ -140,7 +143,7 @@ class AppFirstEnterHandle {
TextSpan( TextSpan(
text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr, text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr,
style: const TextStyle(fontSize: 16.0), style: const TextStyle(fontSize: 16.0),
children: [ children: <InlineSpan>[
TextSpan( TextSpan(
text: '《用户协议》'.tr, text: '《用户协议》'.tr,
style: TextStyle( style: TextStyle(
@ -149,7 +152,7 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
"url": XSConstantMacro.userAgreementURL, "url": XSConstantMacro.userAgreementURL,
"title": '用户协议'.tr "title": '用户协议'.tr
}); });
@ -164,7 +167,7 @@ class AppFirstEnterHandle {
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
// //
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
"url": XSConstantMacro.privacyPolicyURL, "url": XSConstantMacro.privacyPolicyURL,
"title": '隐私政策'.tr "title": '隐私政策'.tr
}); });
@ -176,15 +179,13 @@ class AppFirstEnterHandle {
], ],
), ),
), ),
actions: [ actions: <Widget>[
CupertinoDialogAction( CupertinoDialogAction(
child: Text( child: Text(
'不同意'.tr, '不同意'.tr,
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
onPressed: () { onPressed: _exitApp,
_exitApp();
},
), ),
CupertinoDialogAction( CupertinoDialogAction(
child: Text( child: Text(
@ -205,13 +206,13 @@ class AppFirstEnterHandle {
void showPositionAlert() { void showPositionAlert() {
showCupertinoDialog( showCupertinoDialog(
context: Get.context!, context: Get.context!,
builder: (context) { builder: (BuildContext context) {
return PopScope( return PopScope(
canPop: false, canPop: false,
child: CupertinoAlertDialog( child: CupertinoAlertDialog(
title: const Text('位置权限'), title: const Text('位置权限'),
content: const Text('请开启位置权限,应用需要位置权限才可以完成智能锁和网关的蓝牙操作'), content: const Text('请开启位置权限,应用需要位置权限才可以完成智能锁和网关的蓝牙操作'),
actions: [ actions: <Widget>[
CupertinoDialogAction( CupertinoDialogAction(
child: Text('取消'.tr), child: Text('取消'.tr),
onPressed: () { onPressed: () {
@ -235,13 +236,13 @@ class AppFirstEnterHandle {
void showCameraAlert() { void showCameraAlert() {
showCupertinoDialog( showCupertinoDialog(
context: Get.context!, context: Get.context!,
builder: (context) { builder: (BuildContext context) {
return PopScope( return PopScope(
canPop: false, canPop: false,
child: CupertinoAlertDialog( child: CupertinoAlertDialog(
title: const Text('相机/相册权限'), title: const Text('相机/相册权限'),
content: const Text('请开启本地存储权限,允许应用读写设备上的照片及文件'), content: const Text('请开启本地存储权限,允许应用读写设备上的照片及文件'),
actions: [ actions: <Widget>[
CupertinoDialogAction( CupertinoDialogAction(
child: const Text('取消'), child: const Text('取消'),
onPressed: () { onPressed: () {

View File

@ -7,8 +7,6 @@ import '../../network/api_repository.dart';
class AppBindings extends Bindings { class AppBindings extends Bindings {
@override @override
void dependencies() { void dependencies() {
Get.put(ApiProvider());
Get.put(ApiRepository(Get.find<ApiProvider>()));
} }
} }

View File

@ -77,7 +77,7 @@ class LockGroupEditGroupLockRefreshEvent {
/// ///
class LockSetChangeSetRefreshLockDetailWithType { class LockSetChangeSetRefreshLockDetailWithType {
int type; // 0 1 2 3 4 5 int type; // 0 1 2 3 4 5
String setResult; dynamic setResult;
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult); LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
} }

View File

@ -3,7 +3,12 @@ import 'package:get/get.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
class PlatformInfoService extends GetxService { 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; late PackageInfo _packageInfo;
PackageInfo get info => _packageInfo; PackageInfo get info => _packageInfo;
Future<PlatformInfoService> init() async { Future<PlatformInfoService> init() async {

View File

@ -63,8 +63,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.53+2024052804xhj 线上环境,提审 修改鑫锁名字为星星锁 # 1.0.53+2024052804xhj 线上环境,提审 修改鑫锁名字为星星锁
# 1.0.54+2024053001xhj 线上环境,对外发布,提交测试 # 1.0.54+2024053001xhj 线上环境,对外发布,提交测试
# 1.0.56+2024060401xhj 线上环境,对外发布,提交测试 # 1.0.56+2024060401xhj 线上环境,对外发布,提交测试
# 1.0.56+2024060502xhj 线上环境,对外发布,提交测试
version: 1.0.56+2024060401 version: 1.0.56+2024060502
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'