Merge branch 'master_hyx'
This commit is contained in:
commit
e746bf6217
@ -53,23 +53,27 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
|||||||
index: 0,
|
index: 0,
|
||||||
),
|
),
|
||||||
pageView(
|
pageView(
|
||||||
widget: MessageListPage(
|
widget: MessageListPage(
|
||||||
showAppBar: false,
|
showAppBar: false,
|
||||||
),
|
),
|
||||||
logic: logic,
|
logic: logic,
|
||||||
index: 1),
|
index: 1,
|
||||||
|
),
|
||||||
pageView(
|
pageView(
|
||||||
widget: LockMallPage(
|
widget: LockMallPage(
|
||||||
showAppBar: false,
|
showAppBar: false,
|
||||||
),
|
),
|
||||||
logic: logic,
|
logic: logic,
|
||||||
index: 2),
|
index: 2,
|
||||||
|
),
|
||||||
pageView(
|
pageView(
|
||||||
widget: MinePersonInfoPage(
|
widget: MinePersonInfoPage(
|
||||||
showAppBar: false,
|
showAppBar: false,
|
||||||
),
|
showAbout: true,
|
||||||
logic: logic,
|
),
|
||||||
index: 3),
|
logic: logic,
|
||||||
|
index: 3,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -13,7 +13,10 @@ import 'package:webview_flutter/webview_flutter.dart';
|
|||||||
import '../../tools/baseGetXController.dart';
|
import '../../tools/baseGetXController.dart';
|
||||||
|
|
||||||
class LockMallLogic extends BaseGetXController {
|
class LockMallLogic extends BaseGetXController {
|
||||||
final LockMallState state = LockMallState();
|
late LockMallState state;
|
||||||
|
|
||||||
|
LockMallLogic({required bool allowReturn})
|
||||||
|
: state = LockMallState(allowReturn: allowReturn);
|
||||||
|
|
||||||
//获取商城跳转地址
|
//获取商城跳转地址
|
||||||
Future<void> getMallURLRequest() async {
|
Future<void> getMallURLRequest() async {
|
||||||
@ -96,7 +99,7 @@ class LockMallLogic extends BaseGetXController {
|
|||||||
if (canGoBack) {
|
if (canGoBack) {
|
||||||
await state.mallWebView.goBack();
|
await state.mallWebView.goBack();
|
||||||
} else {
|
} else {
|
||||||
Get.back();
|
if (state.allowReturn) Get.back();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,17 +7,16 @@ import 'package:star_lock/tools/titleAppBar.dart';
|
|||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
class LockMallPage extends StatefulWidget {
|
class LockMallPage extends StatefulWidget {
|
||||||
LockMallPage({Key? key, this.showAppBar = true}) : super(key: key);
|
LockMallPage({Key? key, this.showAppBar = true, this.allowReturn = true})
|
||||||
|
: super(key: key);
|
||||||
bool showAppBar;
|
bool showAppBar;
|
||||||
|
bool allowReturn;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<LockMallPage> createState() => _LockMallPageState();
|
State<LockMallPage> createState() => _LockMallPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LockMallPageState extends State<LockMallPage> {
|
class _LockMallPageState extends State<LockMallPage> {
|
||||||
final logic = Get.put(LockMallLogic());
|
|
||||||
final state = Get.find<LockMallLogic>().state;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -28,41 +27,46 @@ class _LockMallPageState extends State<LockMallPage> {
|
|||||||
// FIXME 如果未登录状态,应先跳转登录页
|
// FIXME 如果未登录状态,应先跳转登录页
|
||||||
// FIXME url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录
|
// FIXME url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录
|
||||||
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
|
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
|
||||||
return PopScope(
|
return GetBuilder<LockMallLogic>(
|
||||||
onPopInvoked: logic.canGoBack,
|
init: LockMallLogic(allowReturn: widget.allowReturn),
|
||||||
canPop: false,
|
builder: (LockMallLogic logic) {
|
||||||
child: Scaffold(
|
return PopScope(
|
||||||
resizeToAvoidBottomInset: false,
|
onPopInvoked: logic.canGoBack,
|
||||||
backgroundColor: const Color(0xFFFFFFFF),
|
canPop: false,
|
||||||
appBar: widget.showAppBar
|
child: Scaffold(
|
||||||
? TitleAppBar(
|
resizeToAvoidBottomInset: false,
|
||||||
barTitle: getWebTitle(),
|
backgroundColor: const Color(0xFFFFFFFF),
|
||||||
haveBack: true,
|
appBar: widget.showAppBar
|
||||||
backgroundColor: AppColors.mainColor,
|
? TitleAppBar(
|
||||||
)
|
barTitle: getWebTitle(logic),
|
||||||
: null,
|
haveBack: true,
|
||||||
body: Obx(() => Column(
|
backgroundColor: AppColors.mainColor,
|
||||||
children: <Widget>[
|
)
|
||||||
Container(
|
: null,
|
||||||
padding: EdgeInsets.only(bottom: 10.w),
|
body: Obx(() => Column(
|
||||||
child: LinearProgressIndicator(
|
children: <Widget>[
|
||||||
value: state.webProgress.value,
|
Container(
|
||||||
backgroundColor: Colors.grey,
|
padding: EdgeInsets.only(bottom: 10.w),
|
||||||
valueColor:
|
child: LinearProgressIndicator(
|
||||||
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
value: logic.state.webProgress.value,
|
||||||
),
|
backgroundColor: Colors.grey,
|
||||||
),
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
Expanded(
|
AppColors.mainColor),
|
||||||
child: WebViewWidget(controller: state.mallWebView),
|
),
|
||||||
),
|
),
|
||||||
],
|
Expanded(
|
||||||
))),
|
child: WebViewWidget(
|
||||||
);
|
controller: logic.state.mallWebView),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))),
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getWebTitle() {
|
String getWebTitle(LockMallLogic logic) {
|
||||||
String webTitleStr = "配件商城".tr;
|
String webTitleStr = "配件商城".tr;
|
||||||
state.mallWebView.getTitle().then((result) {
|
logic.state.mallWebView.getTitle().then((result) {
|
||||||
webTitleStr = result!;
|
webTitleStr = result!;
|
||||||
});
|
});
|
||||||
return webTitleStr;
|
return webTitleStr;
|
||||||
|
|||||||
@ -4,8 +4,11 @@ import 'package:star_lock/webview/webview_logic.dart';
|
|||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
class LockMallState {
|
class LockMallState {
|
||||||
|
LockMallState({required this.allowReturn});
|
||||||
|
|
||||||
var lockMallUrl = "".obs;
|
var lockMallUrl = "".obs;
|
||||||
var webProgress = 0.0.obs;
|
var webProgress = 0.0.obs;
|
||||||
|
bool allowReturn;
|
||||||
late WebViewController mallWebView = initWebViewController();
|
late WebViewController mallWebView = initWebViewController();
|
||||||
|
|
||||||
//初始化webView控制器
|
//初始化webView控制器
|
||||||
@ -16,5 +19,4 @@ class LockMallState {
|
|||||||
allWebView.setUserAgent(WebViewLogic.userAgent);
|
allWebView.setUserAgent(WebViewLogic.userAgent);
|
||||||
return allWebView;
|
return allWebView;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.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/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
||||||
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||||
|
|
||||||
@ -13,8 +14,10 @@ import '../../../tools/titleAppBar.dart';
|
|||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
class MinePersonInfoPage extends StatefulWidget {
|
class MinePersonInfoPage extends StatefulWidget {
|
||||||
MinePersonInfoPage({Key? key, this.showAppBar = true}) : super(key: key);
|
MinePersonInfoPage({Key? key, this.showAppBar = true, this.showAbout = false})
|
||||||
|
: super(key: key);
|
||||||
bool showAppBar;
|
bool showAppBar;
|
||||||
|
bool showAbout;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
|
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
|
||||||
@ -146,8 +149,28 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
|||||||
rightTitle: state.mineInfoData.value.countryName != null
|
rightTitle: state.mineInfoData.value.countryName != null
|
||||||
? state.mineInfoData.value.countryName!
|
? state.mineInfoData.value.countryName!
|
||||||
: "",
|
: "",
|
||||||
isHaveLine: false,
|
isHaveLine: true,
|
||||||
isHaveDirection: false)),
|
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!.about!.tr,
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.back();
|
||||||
|
Get.toNamed(Routers.aboutPage);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
|
|
||||||
typedef BlockStrCallback = void Function(dynamic textStr);
|
typedef BlockStrCallback = void Function(dynamic textStr);
|
||||||
typedef BlockClickCallback = void Function();
|
typedef BlockClickCallback = void Function();
|
||||||
|
|
||||||
class LoginInput extends StatelessWidget {
|
class LoginInput extends StatelessWidget {
|
||||||
TextEditingController? controller;
|
TextEditingController? controller;
|
||||||
FocusNode? focusNode;
|
FocusNode? focusNode;
|
||||||
@ -24,6 +25,7 @@ class LoginInput extends StatelessWidget {
|
|||||||
Widget? rightSlot;
|
Widget? rightSlot;
|
||||||
BlockStrCallback? onchangeAction;
|
BlockStrCallback? onchangeAction;
|
||||||
BlockClickCallback? onTapAction;
|
BlockClickCallback? onTapAction;
|
||||||
|
|
||||||
LoginInput(
|
LoginInput(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
@ -58,7 +60,7 @@ class LoginInput extends StatelessWidget {
|
|||||||
onChanged: onchangeAction,
|
onChanged: onchangeAction,
|
||||||
onTap: onTapAction,
|
onTap: onTapAction,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
inputFormatters:inputFormatters,
|
inputFormatters: inputFormatters,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding: const EdgeInsets.only(
|
contentPadding: const EdgeInsets.only(
|
||||||
@ -69,10 +71,12 @@ class LoginInput extends StatelessWidget {
|
|||||||
hintText: hintText,
|
hintText: hintText,
|
||||||
//不需要输入框下划线
|
//不需要输入框下划线
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
suffixIcon: isSuffixIcon! ? IconButton(
|
suffixIcon: (isSuffixIcon ?? false)
|
||||||
icon: const Icon(Icons.clear),
|
? IconButton(
|
||||||
onPressed: controller!.clear,
|
icon: const Icon(Icons.clear),
|
||||||
) : null,
|
onPressed: controller!.clear,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
//左边图标设置
|
//左边图标设置
|
||||||
icon: isHaveLeftWidget == true
|
icon: isHaveLeftWidget == true
|
||||||
? leftWidget
|
? leftWidget
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user