Merge branch 'master_hyx'

This commit is contained in:
anfe 2024-04-29 14:31:28 +08:00
commit 912475dab5
9 changed files with 277 additions and 213 deletions

View File

@ -109,8 +109,8 @@ class F {
case Flavor.sky:
return 'https://lock.skychip.top';
case Flavor.xhj:
// return 'https://lock.xhjcn.ltd';
return 'https://pre.lock.star-lock.cn';
return 'https://lock.xhjcn.ltd';
// return 'https://pre.lock.star-lock.cn';
default:
throw Exception('flavor[$name] apiPrefix not found');
}

View File

@ -99,7 +99,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
child: GridView.extent(
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
maxCrossAxisExtent: Get.width * .6,
childAspectRatio: 1.4,
childAspectRatio: 1.2,
crossAxisSpacing: 15.w,
mainAxisSpacing: 15.h,
shrinkWrap: true,
@ -185,9 +185,10 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
borderRadius: BorderRadius.circular(20.w),
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 20.h),
padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 10.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
@ -197,13 +198,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
height: 32.r,
color: AppColors.mainColor,
),
Spacer(),
Text(
logic.getUseKeyTypeStr(
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType),
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
)
],
),
SizedBox(
@ -313,6 +307,13 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
),
],
),
Text(
Characters(logic.getUseKeyTypeStr(
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType))
.join('\u{200B}'),
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
)
],
),
),

View File

@ -56,7 +56,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
widget: SafeArea(
bottom: false,
child: LockMallPage(
showAppBar: false,
allowReturn: false,
),
),
logic: logic,

View File

@ -17,7 +17,7 @@ class LockMallLogic extends BaseGetXController {
late LockMallState state;
LockMallLogic({required bool allowReturn})
: state = LockMallState(allowReturn: allowReturn);
: state = LockMallState(allowReturn: allowReturn );
//
Future<void> getMallURLRequest() async {
@ -35,6 +35,7 @@ class LockMallLogic extends BaseGetXController {
},
onPageFinished: (String url) {
state.webProgress.value = 1.0;
refreshGoBack();
},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) async {
@ -99,12 +100,25 @@ class LockMallLogic extends BaseGetXController {
bool canGoBack = await state.mallWebView.canGoBack();
if (canGoBack) {
await state.mallWebView.goBack();
} else {
if (state.allowReturn) Get.back();
} else if (state.allowReturn) {
Get.back();
}
refreshGoBack();
return false;
}
//
void refreshGoBack(){
//退
if(state.allowReturn){
return;
}
state.mallWebView.canGoBack().then((value) {
state.canGoBack = value;
update();
});
}
@override
Future<void> onReady() async {
super.onReady();

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/mall/lockMall_logic.dart';
import 'package:star_lock/tools/titleAppBar.dart';
import 'package:webview_flutter/webview_flutter.dart';
@ -30,36 +31,46 @@ class _LockMallPageState extends State<LockMallPage> {
return GetBuilder<LockMallLogic>(
init: LockMallLogic(allowReturn: widget.allowReturn),
builder: (LockMallLogic logic) {
return PopScope(
onPopInvoked: logic.canGoBack,
canPop: false,
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: widget.showAppBar
? TitleAppBar(
barTitle: getWebTitle(logic),
haveBack: true,
backgroundColor: AppColors.mainColor,
)
: null,
body: Obx(() => Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(bottom: 10.w),
child: LinearProgressIndicator(
value: logic.state.webProgress.value,
backgroundColor: Colors.grey,
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.mainColor),
),
),
Expanded(
child: WebViewWidget(
controller: logic.state.mallWebView),
),
],
))),
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: widget.showAppBar
? TitleAppBar(
barTitle: getWebTitle(logic),
haveBack: logic.state.canGoBack || logic.state.allowReturn,
backgroundColor: F.sw(
defaultCall: () => AppColors.mainColor,
xhjCall: () => Colors.white),
titleColor: F.sw(
defaultCall: () => null,
xhjCall: () => AppColors.blackColor),
iconColor: F.sw(
defaultCall: () => null,
xhjCall: () => AppColors.blackColor),
backAction: () => logic.canGoBack(false),
)
: null,
body: Obx(() => Column(
children: <Widget>[
PopScope(
onPopInvoked: logic.canGoBack,
canPop: false,
child: SizedBox(),
),
Container(
padding: EdgeInsets.only(bottom: 10.w),
child: LinearProgressIndicator(
value: logic.state.webProgress.value,
backgroundColor: Colors.grey,
valueColor:
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
),
),
Expanded(
child: WebViewWidget(controller: logic.state.mallWebView),
),
],
)),
);
});
}

View File

@ -9,6 +9,7 @@ class LockMallState {
var lockMallUrl = "".obs;
var webProgress = 0.0.obs;
bool allowReturn;
bool canGoBack = false;
late WebViewController mallWebView = initWebViewController();
//webView控制器

View File

@ -39,174 +39,215 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
: null,
body: Column(
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "",
allHeight: 100.h,
isHaveLine: true,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: ClipRRect(
borderRadius: BorderRadius.circular(36.w),
child: CustomNetworkImage(
url: state.headUrl.value,
defaultUrl: 'images/controls_user.png',
width: 72.w,
height: 72.w),
Container(
width: 1.sw,
height: 0.2.sw,
margin: EdgeInsets.symmetric(horizontal: 15.w),
padding: EdgeInsets.symmetric(horizontal: 25.w),
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('images/xhj_main_bg.jpg'),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(20.r),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 10.r,
spreadRadius: 0,
),
action: () async {
_openModalBottomSheet();
},
)),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage,
arguments: {'mineInfoData': state.mineInfoData.value})
.then((value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
rightTitle: state.mineInfoData.value.mobile != null
? state.mineInfoData.value.mobile!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.email!.tr,
rightTitle: state.mineInfoData.value.email != null
? state.mineInfoData.value.email!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
}
})),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
}),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle:
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置".tr : "",
isHaveLine: true,
isHaveDirection: true,
action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoViewSafetyProblemPage);
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
isHaveLine: true,
isHaveDirection: false)),
if (F.isLite == false && widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
],
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.set!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.mineSetPage);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'系统设置',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 28.sp,
fontWeight: FontWeight.w600,
),
),
Text(
'系统的全局配置在此项内进行设置',
style: TextStyle(
color: AppColors.blackColor.withOpacity(0.6),
fontSize: 20.sp,
fontWeight: FontWeight.w600,
),
),
],
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.about!.tr,
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.aboutPage);
},
),
SizedBox(
height: 20.h,
),
Container(
margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 15.w),
child: ClipRRect(
borderRadius: BorderRadius.circular(20.r),
child: Column(
children: [
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "",
allHeight: 100.h,
isHaveLine: true,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: ClipRRect(
borderRadius: BorderRadius.circular(36.w),
child: CustomNetworkImage(
url: state.headUrl.value,
defaultUrl: 'images/controls_user.png',
width: 72.w,
height: 72.w),
),
action: () async {
_openModalBottomSheet();
},
)),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage,
arguments: {
'mineInfoData': state.mineInfoData.value
}).then((value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
rightTitle: state.mineInfoData.value.mobile != null
? state.mineInfoData.value.mobile!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage,
arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.email!.tr,
rightTitle: state.mineInfoData.value.email != null
? state.mineInfoData.value.email!
: TranslationLoader.lanKeys!.goBind!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
// isFrom1 2
if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
}
})),
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
}),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
? "去设置".tr
: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(context,
Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(context,
Routers.minePersonInfoViewSafetyProblemPage);
}
})),
Obx(() => CommonItem(
leftTitel:
TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
isHaveLine: true,
isHaveDirection: false)),
if (F.isLite == false && widget.showAbout)
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.set!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.mineSetPage);
},
),
if (widget.showAbout)
CommonItem(
leftTitel: TranslationLoader.lanKeys!.about!.tr,
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.aboutPage);
},
),
],
),
),
),
],
));
}
//
// void showPermissionDeniedDialog() {
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: const Text('权限被拒绝'),
// content: const Text('请手动在系统设置中开启相册权限以继续使用应用。'),
// actions: <Widget>[
// TextButton(
// child: const Text('去设置'),
// onPressed: () {
// Navigator.of(context).pop(); //
// openAppSettings(); //
// },
// ),
// ],
// );
// },
// );
// }
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,

View File

@ -83,7 +83,7 @@ class CommonItem extends StatelessWidget {
),
],
),
isHaveDirection! ? SizedBox(width: 3.w) : Container(),
isHaveDirection! ? SizedBox(width: 15.w) : Container(),
isHaveDirection!
? Image.asset(
'images/icon_right_grey.png',

View File

@ -40,8 +40,6 @@ class TitleAppBar extends AppBar {
class _TitleAppBarState extends State<TitleAppBar> {
@override
Widget build(BuildContext context) {
Color defaultColor = F.sw(
defaultCall: () => Colors.white, xhjCall: () => AppColors.blackColor);
return AppBar(
elevation: 0,
leading: widget.haveOtherLeftWidget!
@ -49,7 +47,7 @@ class _TitleAppBarState extends State<TitleAppBar> {
: (widget.haveBack ?? false
? IconButton(
icon: Icon(Icons.arrow_back_ios,
color: widget.iconColor ?? defaultColor),
color: widget.iconColor ?? Colors.white),
onPressed: () {
if (widget.backAction != null) {
widget.backAction!();
@ -61,14 +59,12 @@ class _TitleAppBarState extends State<TitleAppBar> {
}
})
: Container()),
backgroundColor: F.sw(
defaultCall: () => widget.backgroundColor ?? defaultColor,
xhjCall: () => Colors.white),
backgroundColor: widget.backgroundColor ?? Colors.white,
title: widget.haveTitleWidget!
? widget.titleWidget
: Text(widget.barTitle ?? '',
style: TextStyle(
color: widget.titleColor ?? defaultColor,
color: widget.titleColor ?? Colors.white,
fontSize: 28.sp,
fontWeight: FontWeight.w600)),
centerTitle: true,