This commit is contained in:
Daisy 2023-07-29 09:42:59 +08:00
commit bb725a7592
26 changed files with 938 additions and 83 deletions

View File

@ -1,4 +1,6 @@
PODS:
- aj_captcha_flutter (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- Flutter (1.0.0)
@ -16,11 +18,15 @@ PODS:
- Flutter
- Protobuf (~> 3.5)
- SwiftProtobuf (~> 1.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- SwiftProtobuf (1.22.0)
- url_launcher_ios (0.0.1):
- Flutter
DEPENDENCIES:
- aj_captcha_flutter (from `.symlinks/plugins/aj_captcha_flutter/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`)
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
@ -28,6 +34,7 @@ DEPENDENCIES:
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- reactive_ble_mobile (from `.symlinks/plugins/reactive_ble_mobile/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
SPEC REPOS:
@ -36,6 +43,8 @@ SPEC REPOS:
- SwiftProtobuf
EXTERNAL SOURCES:
aj_captcha_flutter:
:path: ".symlinks/plugins/aj_captcha_flutter/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
Flutter:
@ -50,10 +59,13 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
reactive_ble_mobile:
:path: ".symlinks/plugins/reactive_ble_mobile/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS:
aj_captcha_flutter: dd7af1aa064bdd621ae335b819bab07309c3c023
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
@ -62,6 +74,7 @@ SPEC CHECKSUMS:
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
Protobuf: c6bc59bbab3d38a71c67f62d7cb7ca8f8ea4eca1
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
SwiftProtobuf: 40bd808372cb8706108f22d28f8ab4a6b9bc6989
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4

View File

@ -1,7 +1,7 @@
import 'package:get/get.dart';
import 'package:star_lock/login/register/starLock_register_binding.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/ownedKeyList_page.dart';
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_page.dart';
import 'package:star_lock/mine/mineSet/mineSet_page.dart';
@ -10,6 +10,7 @@ import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation_pa
import 'package:star_lock/mine/mineSet/transferSmartLock/selectBranch_page.dart';
import 'package:star_lock/mine/mineSet/transferSmartLock/transferSmartLock_page.dart';
import 'common/safetyVerification_page.dart';
import 'login/forgetPassword/starLock_forgetPassword_page.dart';
import 'login/login/starLock_login_page.dart';
import 'login/register/starLock_register_page.dart';
@ -95,6 +96,7 @@ import 'mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetwor
import 'mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart';
import 'mine/mineSet/lockGroup/lockItemList_page.dart';
import 'mine/mineSet/lockScreen/lockScreen_page.dart';
import 'mine/mineSet/lockUserManage/ownedKeyList_page.dart';
import 'mine/mine_page.dart';
import 'mine/supportStaff/supportStaff_page.dart';
import 'mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart';
@ -239,33 +241,28 @@ abstract class Routers {
'/ValueAddedServicesListEmailTemplatePage'; // -
static const valueAddedServicesAddEmailTemplatePage =
'/ValueAddedServicesAddEmailTemplatePage'; // -
static const valueAddedServicesBuyAndUseRecordManagePage =
'/ValueAddedServicesBuyAndUseRecordManagePage'; // -使
static const valueAddedServicesBuyAndUseRecordManagePage = '/ValueAddedServicesBuyAndUseRecordManagePage'; // -使
static const lockScreenPage = '/LockScreenPage'; // -
static const aPPUnlockNeedMobileNetworkingLockPage =
'/APPUnlockNeedMobileNetworkingLockPage'; // -app开锁时需手机连网的锁
static const hideInvalidUnlockPermissionsPage =
'/HideInvalidUnlockPermissionsPage'; // -
static const aPPUnlockNeedMobileNetworkingLockPage = '/APPUnlockNeedMobileNetworkingLockPage'; // -app开锁时需手机连网的锁
static const hideInvalidUnlockPermissionsPage = '/HideInvalidUnlockPermissionsPage'; // -
static const lockUserManageLisPage = '/LockUserManageLisPage'; //-
static const authorizedAdministratorListPage =
'/AuthorizedAdministratorListPage'; //-
static const authorizedAdministratorListPage = '/AuthorizedAdministratorListPage'; //-
static const lockGroupListPage = '/LockGroupListPage'; //-
static const lockItemListPage = '/LockItemListPage'; //-
static const transferSmartLockPage = '/transferSmartLockPage'; //
static const recipientInformationPage = '/recipientInformationPage'; //
static const selectBranchPage = '/SelectBranchPage'; //
static const selectGetewayListPage = '/selectGetewayListPage'; //
static const addAuthorizedAdministratorPage =
'/addAuthorizedAdministratorPage'; //
static const addAuthorizedAdministratorPage = '/addAuthorizedAdministratorPage'; //
static const ownedKeyListPage = '/ownedKeyListPage'; //
static const starLockLoginPage = '/StarLockLoginPage'; //
static const starLockRegisterPage = '/StarLockRegisterPage'; //
static const starLockForgetPasswordPage =
'/StarLockForgetPasswordPage'; //
static const starLockForgetPasswordPage = '/StarLockForgetPasswordPage'; //
static const seletCountryRegionPage = '/SeletCountryRegionPage'; //
static const safetyVerificationPage = '/SafetyVerificationPage'; //
}
abstract class AppRouters {
@ -388,7 +385,7 @@ abstract class AppRouters {
),
GetPage(
name: Routers.starLockRegisterPage,
page: () => const StarLockRegisterPage(),
page: () => const StarLockRegisterPage(), binding:StarLockRegisterBinding()
),
GetPage(
name: Routers.starLockForgetPasswordPage,
@ -664,32 +661,47 @@ abstract class AppRouters {
),
GetPage(
name: Routers.authorizedAdministratorListPage,
page: () => const AuthorizedAdministratorListPage()),
page: () => const AuthorizedAdministratorListPage()
),
GetPage(
name: Routers.lockUserManageLisPage,
page: () => const LockUserManageListListPage()),
page: () => const LockUserManageListListPage()
),
GetPage(
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()),
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()
),
GetPage(
name: Routers.lockItemListPage, page: () => const LockItemListPage()),
name: Routers.lockItemListPage, page: () => const LockItemListPage()
),
GetPage(
name: Routers.transferSmartLockPage,
page: () => const TransferSmartLockPage()),
page: () => const TransferSmartLockPage()
),
GetPage(
name: Routers.recipientInformationPage,
page: () => const RecipientInformationPage()),
page: () => const RecipientInformationPage()
),
GetPage(
name: Routers.selectBranchPage, page: () => const SelectBranchPage()),
name: Routers.selectBranchPage, page: () => const SelectBranchPage()
),
GetPage(
name: Routers.selectGetewayListPage,
page: () => const SelectGetewayListPage()),
page: () => const SelectGetewayListPage()
),
GetPage(
name: Routers.minePersonInfoEditEmailPage,
page: () => const MinePersonInfoEditEmailPage()),
page: () => const MinePersonInfoEditEmailPage()
),
GetPage(
name: Routers.addAuthorizedAdministratorPage,
page: () => const AddAuthorizedAdministratorPage()),
page: () => const AddAuthorizedAdministratorPage()
),
GetPage(
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage())
name: Routers.safetyVerificationPage,
page: () => const SafetyVerificationPage()
),
GetPage(
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()
)
];
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
import 'package:get/get.dart';
class StarLockLoginLogic extends GetxController{
}

View File

@ -0,0 +1,5 @@
class StarLockLoginState{
}

View File

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

View File

@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import '../../network/api_repository.dart';
import '../../tools/baseGetXController.dart';
import 'starLock_register_state.dart';
class StarLockRegisterLogic extends BaseGetXController{
final StarLockRegisterState state = StarLockRegisterState();
void register() async{
var entity = await ApiRepository.to.register(
state.countryCode.value,
state.countryCode.value,
state.phoneOrEmailStr.value,
state.pwd.value,
"gdasdfasdfasdf",
state.verificationCode.value
);
if(entity.code!.codeIsSuccessful){
await loginSuccess(loginEntity: entity);
} else {
}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if(controller == state.phoneOrEmailController){
state.phoneOrEmailStr.value = controller.text;
}
if(controller == state.pwdController) {
state.pwd.value = controller.text;
}
if(controller == state.sureController) {
state.surePwd.value = controller.text;
}
if(controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub(){
state.canSub.value = state.pwdIsOK && state.codeIsOK && (state.isIphoneType.value ? state.isIphone : state.isEmail);
print("22222:${state.canSub.value}");
}
}

View File

@ -12,6 +12,7 @@ import '../../tools/tf_loginInput.dart';
import '../../tools/submitBtn.dart';
import '../../tools/titleAppBar.dart';
import '../../translations/trans_lib.dart';
import 'starLock_register_logic.dart';
class StarLockRegisterPage extends StatefulWidget {
const StarLockRegisterPage({Key? key}) : super(key: key);
@ -21,12 +22,12 @@ class StarLockRegisterPage extends StatefulWidget {
}
class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
final TextEditingController _phoneController = TextEditingController();
final TextEditingController _pwdController = TextEditingController();
final TextEditingController _codeController = TextEditingController();
final logic = Get.find<StarLockRegisterLogic>();
final state = Get.find<StarLockRegisterLogic>().state;
late Timer _timer;
int _seconds = 60;
final int _seconds = 60;
@override
Widget build(BuildContext context) {
@ -41,10 +42,21 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
right: 40.w
),
children: [
topSeletCountryAndRegionWidget (),
middleTFWidget (),
SubmitBtn(btnName: "${TranslationLoader.lanKeys!.reset!.tr} ${TranslationLoader.lanKeys!.password!.tr}", fontSize: 30.sp, borderRadius: 20.w, padding: EdgeInsets.only(top: 25.w, bottom: 25.w), onClick: (){
topSeletCountryAndRegionWidget(),
middleTFWidget(),
Obx(() {
print("11111:${state.canSub.value}");
return SubmitBtn(
btnName: TranslationLoader.lanKeys!.register!.tr,
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value ? (){
logic.register();
}:null
);
}),
],
)
@ -123,8 +135,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
),
SizedBox(height:60.h),
GestureDetector(
onTap: (){
onTap: () async {
Navigator.pushNamed(context, Routers.seletCountryRegionPage);
var result = await Navigator.pushNamed(context, Routers.seletCountryRegionPage);
logic.state.countryCode.value = (result as Map<String, dynamic>)['code'];
logic.state.countryId.value = result["countryId"];
// print("路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
},
child: Container(
height: 70.h,
@ -133,12 +149,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: Row(
children: [
SizedBox(width:5.w),
Expanded(child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr, style: TextStyle(fontSize: 30.sp, fontWeight: FontWeight.w500))),
Expanded(child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr, style: TextStyle(fontSize: 26.sp))),
SizedBox(width:20.w),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text("中国+86", textAlign: TextAlign.end, style: TextStyle(fontSize: 30.sp, fontWeight: FontWeight.w500),)
Text("中国+86", textAlign: TextAlign.end, style: TextStyle(fontSize: 26.sp),)
],
),
SizedBox(width:5.w),
@ -156,7 +172,11 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
return Column(
children: [
LoginInput(
controller: _phoneController,
controller: state.phoneOrEmailController,
onchangeAction: (v) {
print("3333333:${v}");
logic.checkNext(state.phoneOrEmailController);
},
leftWidget:Padding(
padding: EdgeInsets.only(top:30.w, bottom: 20.w, right: 20.w, left: 5.w),
child: Image.asset('images/main/icon_main_search.png', width: 40.w, height: 40.w,),
@ -170,7 +190,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
),
SizedBox(height: 10.w),
LoginInput(
controller: _pwdController,
controller: state.pwdController,
onchangeAction: (v) {
logic.checkNext(state.pwdController);
},
isPwd: true,
leftWidget:Padding(
padding: EdgeInsets.only(top:30.w, bottom: 20.w, right: 20.w, left: 5.w),
@ -185,7 +208,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Text(TranslationLoader.lanKeys!.registerPasswordTip!.tr, style: TextStyle(color: const Color(0xFF999999), fontSize: 26.sp),),
SizedBox(height: 10.w),
LoginInput(
controller: _pwdController,
controller: state.sureController,
onchangeAction: (v) {
logic.checkNext(state.sureController);
},
isPwd: true,
leftWidget:Padding(
padding: EdgeInsets.only(top:30.w, bottom: 20.w, right: 20.w, left: 5.w),
@ -201,8 +227,11 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
children: [
Expanded(
child: LoginInput(
controller: _codeController,
controller: state.codeController,
isPwd: true,
onchangeAction: (v) {
logic.checkNext(state.codeController);
},
leftWidget:Padding(
padding: EdgeInsets.only(top:30.w, bottom: 20.w, right: 20.w, left: 5.w),
child: Image.asset('images/main/icon_main_search.png', width: 40.w, height: 40.w,),
@ -231,6 +260,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
),
),
onTap: (){
Navigator.pushNamed(context, Routers.safetyVerificationPage);
if(_seconds==60){
// _setVerify();
}else{

View File

@ -0,0 +1,32 @@
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class StarLockRegisterState{
final TextEditingController phoneOrEmailController = TextEditingController();
final TextEditingController pwdController = TextEditingController();
final TextEditingController sureController = TextEditingController();
final TextEditingController codeController = TextEditingController();
var countryCode = ''.obs;
var countryId = ''.obs;
var phoneOrEmailStr = ''.obs;
var pwd = ''.obs;
var surePwd = ''.obs;
var verificationCode = ''.obs;
var isIphoneType = true.obs;
var canSub = false.obs;
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value);
bool get codeIsOK => verificationCode.value.isNotEmpty;
void onClose() {
phoneOrEmailController.dispose();
pwdController.dispose();
sureController.dispose();
codeController.dispose();
}
}

View File

@ -14,12 +14,24 @@ class SeletCountryRegionPage extends StatefulWidget {
}
class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(barTitle: "${TranslationLoader.lanKeys!.selet!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", haveBack:true, backgroundColor: AppColors.mainColor),
appBar: TitleAppBar(barTitle: "${TranslationLoader.lanKeys!.selet!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", haveBack:true, backgroundColor: AppColors.mainColor, actionsList: [
TextButton(
child: Text(
TranslationLoader.lanKeys!.reset!.tr,
style: const TextStyle(color: Colors.white),
),
onPressed: () {
Navigator.pop(context, {'code': "+86", "countryId": "9"});
},
),
],),
body:ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: [
@ -28,4 +40,9 @@ class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
)
);
}
_backBtnAction(){
}
}

View File

@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/app_manager.dart';
import 'package:star_lock/tools/bindings/app_binding.dart';
import 'package:star_lock/tools/device_info_service.dart';
import 'package:star_lock/tools/platform_info_services.dart';
import 'package:star_lock/tools/reactiveBlueTool/getx_ble.dart';
@ -94,6 +96,8 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
),
debugShowCheckedModeBanner: false,
getPages: AppRouters.routePages,
builder: EasyLoading.init(),
initialBinding: AppBindings(),
initialRoute: '/');
@override

View File

@ -31,29 +31,39 @@ class _StarLockMainState extends State<StarLockMain> with BaseWidget {
@override
Widget build(BuildContext context) {
// final logic = Get.put(GetxBle());
// // Get.lazyPut(()=>GetxBle());
// logic.scanner.startScan([]);
final logic = Get.put(GetxBle());
// Get.lazyPut(()=>GetxBle());
logic.scanner.startScan([]);
return Scaffold(
backgroundColor: const Color(0xFFF5F5F5),
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.starLock!.tr,
haveBack: false,
haveOtherLeftWidget: true,
leftWidget: Builder(
builder: (context) => IconButton(
icon: Image.asset(
"images/main/mainLeft_menu_icon.png",
color: Colors.white,
width: 44.w,
height: 44.w,
),
onPressed: () {
Scaffold.of(context).openDrawer();
},
)),
backgroundColor: AppColors.mainColor),
barTitle: TranslationLoader.lanKeys!.starLock!.tr,
haveBack: false,
haveOtherLeftWidget: true,
leftWidget: Builder(
builder: (context) => IconButton(
icon: Image.asset(
"images/main/mainLeft_menu_icon.png",
color: Colors.white,
width: 44.w,
height: 44.w,
),
onPressed: () {
Scaffold.of(context).openDrawer();
},
)),
backgroundColor: AppColors.mainColor,
actionsList: [
TextButton(
child: Text("", style: const TextStyle(color: Colors.white)),
onPressed: () {
Navigator.pushNamed(context, Routers.starLockLoginPage);
},
),
],
),
drawer: Drawer(
width: 1.sw / 3 * 2,
child: StarLockMinePage(),

View File

@ -1,12 +1,11 @@
abstract class Api {
final String baseUrl = "";
// final String baseUrl = "http://test.lock.star-lock.cn/api"; //
final String baseUrl = "https://lock.star-lock.cn/api";//
final String getVerificationCodeUrl = '/api/v1/vcode/email';
final String registerUrl = '/api/v1/vcode/email';
final String registerUrl = '/user/register';
final String loginUrl = '/api/v1/vcode/email';
}

View File

@ -8,10 +8,14 @@ class ApiProvider extends BaseProvider {
'email':email,
});
Future<Response> register(String email, String vCode,String password) => post(registerUrl.toUrl, null,query: {
'email':email,
'vCode':vCode,
"password":password
Future<Response> register(String countryCode, String countryId, String mobile, String password, String uniqueid, String verificationCode) => post(registerUrl.toUrl, null,query: {
'countryCode':countryCode,
'countryId':countryId,
"mobile":mobile,
'password':password,
'platId':"2",
"uniqueid":uniqueid,
'verificationCode':verificationCode,
});
Future<Response> login(String email,String password) => post(loginUrl.toUrl, null,query: {'email':email,'password':password});
@ -19,5 +23,5 @@ class ApiProvider extends BaseProvider {
}
extension ExtensionString on String {
String get toUrl => '/$this';
String get toUrl => '$this';
}

View File

@ -1,6 +1,7 @@
import 'package:get/get.dart';
import '../login/login/entity/LoginEntity.dart';
import 'api_provider.dart';
class ApiRepository {
@ -14,11 +15,11 @@ class ApiRepository {
// return VerficationCodeEntity.fromJson(res.body);
// }
//
// Future<LoginEntity> register(String email, String vCode,String password) async {
// final res = await apiProvider.register(email,vCode,SecrecyUtils.md5EncodeUpperCase(input: password));
// return LoginEntity.fromJson(res.body);
// }
//
Future<LoginEntity> register(String countryCode, String countryId, String mobile, String password, String uniqueid, String verificationCode) async {
final res = await apiProvider.register(countryCode, countryId, mobile, password, uniqueid, verificationCode);
return LoginEntity.fromJson(res.body);
}
// Future<LoginEntity> login({String? email,String? password}) async {
// final res = await apiProvider.login(email,SecrecyUtils.md5EncodeUpperCase(input: password));
// return LoginEntity.fromJson(res.body);

View File

@ -8,8 +8,9 @@ import '../tools/platform_info_services.dart';
import '../tools/store_service.dart';
FutureOr<Request> requestInterceptor(Request request) async {
request.headers['User-Agent'] = 'Mower/CANDELA_18E/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
request.headers['User-Agent'] = 'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
request.headers['Accept-Language'] = 'zh_CN';
request.headers['token'] = StoreService.to.userToken!;
// request.headers['token'] = StoreService.to.userToken!;
request.headers['Authorization'] = "Bearer ${StoreService.to.userToken!}";
return request;
}

View File

@ -0,0 +1,94 @@
import 'dart:async';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import '../login/login/entity/LoginEntity.dart';
import '../translations/trans_lib.dart';
import 'manager/client_manager.dart';
class BaseGetXController extends GetxController{
int currentTimeSeconds = 0;
bool currentPage = true;
@override
void onReady() {
super.onReady();
Get.log('$runtimeType onReady');
currentPage = true;
}
@override
// TODO: implement onDelete
InternalFinalCallback<void> get onDelete => super.onDelete;
@override
// TODO: implement onStart
InternalFinalCallback<void> get onStart => super.onStart;
@override
void onInit() {
// TODO: implement onInit
Get.log('$runtimeType onInit ');
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
currentPage = false;
Get.log('onClose -----> $runtimeType');
}
operationFailedCallBack(e){
showOperationFailed();
}
Future delay({Duration? duration,Function? something}) => Future.delayed(duration ?? 500. milliseconds,something as FutureOr Function()?);
void showEasyLoading() => EasyLoading.show();
void dismissEasyLoading() => EasyLoading.dismiss();
void showToast(String status,{Function? something}) {
EasyLoading.showToast(status,duration: 2000.milliseconds);
if(something != null) {
delay(duration: 2100.milliseconds,something: something);
}
}
void showError(String status,{Function? something}) {
EasyLoading.showError(status,duration: 2000.milliseconds);
if(something != null) {
delay(duration: 2100.milliseconds,something: something);
}
}
void showSuccess(String status,{Function? something}) {
EasyLoading.showSuccess(status,duration: 1500.milliseconds);
if(something != null) {
delay(duration: 2000.milliseconds,something: something);
}
}
void showOperationSuccessful({String? status,Function? something}) => showSuccess( status ?? "成功",something: something);
void showOperationFailed({String? status, Function? something}) => showError( status ?? "失败",something: something);
void logOff() async {
await ClientManager().logOff();
Get.offAllNamed(Routers.starLockLoginPage);
}
Future loginSuccess({LoginEntity? loginEntity, bool byToken = false}) async => ClientManager().loginSuccess(loginEntity: loginEntity,byToken: byToken);
}
///Extension_Int
extension Extension_Int on int {
bool get codeIsSuccessful => this == 1;
bool get msgCodeIsSuccessful => this == 1;
}

View File

@ -0,0 +1,14 @@
import 'package:get/get.dart';
import '../../network/api_provider.dart';
import '../../network/api_repository.dart';
class AppBindings extends Bindings {
@override
void dependencies() {
Get.put(ApiProvider());
Get.put(ApiRepository(Get.find<ApiProvider>()));
}
}

View File

@ -30,6 +30,7 @@ class SubmitBtn extends StatelessWidget {
bool? isDelete;
bool? isDisabled;
SubmitBtn(
{Key? key,
required this.btnName,
@ -41,7 +42,9 @@ class SubmitBtn extends StatelessWidget {
this.width,
this.backgroundColorList,
this.isDelete,
this.fontSize})
this.fontSize,
this.isDisabled,
})
: super(key: key);
@override
@ -51,8 +54,7 @@ class SubmitBtn extends StatelessWidget {
height: 60.h,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
isDelete == true ? Colors.red : AppColors.mainColor,
backgroundColor: isDisabled == false ? Colors.grey : (isDelete == true ? Colors.red : AppColors.mainColor),
),
onPressed: () {
if (onClick != null) {

View File

@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
* input
* */
typedef BlockStrCallback = void Function(dynamic textStr);
class LoginInput extends StatelessWidget {
TextEditingController? controller;
List<TextInputFormatter>? inputFormatters;
@ -18,6 +19,7 @@ class LoginInput extends StatelessWidget {
String? label;
bool? isPwd;
Widget? rightSlot;
BlockStrCallback? onchangeAction;
LoginInput(
{Key? key,
required this.controller,
@ -29,7 +31,8 @@ class LoginInput extends StatelessWidget {
this.background,
this.hintText,
this.isHaveLeftWidget = true,
this.leftWidget})
this.leftWidget,
this.onchangeAction})
: super(key: key);
@override
@ -44,6 +47,7 @@ class LoginInput extends StatelessWidget {
//
maxLines: 1,
controller: controller,
onChanged: onchangeAction,
autofocus: false,
decoration: InputDecoration(
//

View File

@ -6,10 +6,14 @@
#include "generated_plugin_registrant.h"
#include <aj_captcha_flutter/aj_captcha_flutter_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) aj_captcha_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "AjCaptchaFlutterPlugin");
aj_captcha_flutter_plugin_register_with_registrar(aj_captcha_flutter_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);

View File

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
aj_captcha_flutter
file_selector_linux
url_launcher_linux
)

View File

@ -5,16 +5,20 @@
import FlutterMacOS
import Foundation
import aj_captcha_flutter
import device_info_plus
import file_selector_macos
import package_info_plus
import path_provider_foundation
import shared_preferences_foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AjCaptchaFlutterPlugin.register(with: registry.registrar(forPlugin: "AjCaptchaFlutterPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}

View File

@ -38,6 +38,8 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
# 常用工具类
flustars: ^2.0.1
# 状态管理
get: ^4.6.5
# 获取设备信息
@ -69,11 +71,12 @@ dependencies:
#蓝牙
flutter_reactive_ble: ^5.1.1
# flutter_blue_plus: ^1.10.5
#
event_bus: ^2.0.0
#菊花
flutter_easyloading: ^3.0.5
#图形验证码
aj_captcha_flutter: ^0.0.1
dev_dependencies:
flutter_test:
sdk: flutter

View File

@ -6,10 +6,13 @@
#include "generated_plugin_registrant.h"
#include <aj_captcha_flutter/aj_captcha_flutter_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
AjCaptchaFlutterPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AjCaptchaFlutterPluginCApi"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
UrlLauncherWindowsRegisterWithRegistrar(

View File

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
aj_captcha_flutter
file_selector_windows
url_launcher_windows
)