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: case Flavor.sky:
return 'https://lock.skychip.top'; return 'https://lock.skychip.top';
case Flavor.xhj: case Flavor.xhj:
// return 'https://lock.xhjcn.ltd'; return 'https://lock.xhjcn.ltd';
return 'https://pre.lock.star-lock.cn'; // return 'https://pre.lock.star-lock.cn';
default: default:
throw Exception('flavor[$name] apiPrefix not found'); throw Exception('flavor[$name] apiPrefix not found');
} }

View File

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

View File

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

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

View File

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

View File

@ -38,6 +38,58 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
backgroundColor: AppColors.mainColor) backgroundColor: AppColors.mainColor)
: null, : null,
body: Column( body: Column(
children: [
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,
),
],
),
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,
),
),
],
),
),
SizedBox(
height: 20.h,
),
Container(
margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 15.w),
child: ClipRRect(
borderRadius: BorderRadius.circular(20.r),
child: Column(
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr, leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
@ -68,8 +120,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
action: () { action: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage, context, Routers.minePersonInfoEditNamePage,
arguments: {'mineInfoData': state.mineInfoData.value}) arguments: {
.then((value) => logic.getUserInfoRequest()); 'mineInfoData': state.mineInfoData.value
}).then((value) => logic.getUserInfoRequest());
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr, leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
@ -89,7 +142,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
}).then((value) => logic.getUserInfoRequest()); }).then((value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: { context, Routers.mineBindPhoneOrEmailPage,
arguments: {
'mobile': state.mineInfoData.value.mobile!, 'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1' 'isFrom': '1'
}).then((value) => logic.getUserInfoRequest()); }).then((value) => logic.getUserInfoRequest());
@ -113,14 +167,16 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
}).then((value) => logic.getUserInfoRequest()); }).then((value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: { context, Routers.mineBindPhoneOrEmailPage,
arguments: {
'isFrom': '2', 'isFrom': '2',
'email': state.mineInfoData.value.email! 'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest()); }).then((value) => logic.getUserInfoRequest());
} }
})), })),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr, leftTitel:
TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
@ -130,22 +186,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
}), }),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置".tr : "", ? "去设置".tr
: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) { if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed( Navigator.pushNamed(context,
context, Routers.minePersonInfoSetSafetyProblemPage) Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest()); .then((value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed( Navigator.pushNamed(context,
context, Routers.minePersonInfoViewSafetyProblemPage); Routers.minePersonInfoViewSafetyProblemPage);
} }
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr, leftTitel:
TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName! ? state.mineInfoData.value.countryName!
: "", : "",
@ -153,7 +211,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
isHaveDirection: false)), isHaveDirection: false)),
if (F.isLite == false && widget.showAbout) if (F.isLite == false && widget.showAbout)
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr, leftTitel:
TranslationLoader.lanKeys!.valueAddedServices!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -182,31 +241,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
}, },
), ),
], ],
),
),
),
],
)); ));
} }
//
// 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 { Future _openModalBottomSheet() async {
showModalBottomSheet( showModalBottomSheet(
context: context, 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! isHaveDirection!
? Image.asset( ? Image.asset(
'images/icon_right_grey.png', 'images/icon_right_grey.png',

View File

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