66 lines
2.2 KiB
Dart
66 lines
2.2 KiB
Dart
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/mine/mall/lockMall_logic.dart';
|
||
import 'package:star_lock/tools/titleAppBar.dart';
|
||
import 'package:webview_flutter/webview_flutter.dart';
|
||
|
||
import '../../translations/trans_lib.dart';
|
||
|
||
class LockMallPage extends StatefulWidget {
|
||
const LockMallPage({Key? key}) : super(key: key);
|
||
|
||
@override
|
||
State<LockMallPage> createState() => _LockMallPageState();
|
||
}
|
||
|
||
class _LockMallPageState extends State<LockMallPage> {
|
||
final logic = Get.put(LockMallLogic());
|
||
final state = Get.find<LockMallLogic>().state;
|
||
|
||
@override
|
||
void initState() {
|
||
super.initState();
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
// FIXME 如果未登录状态,应先跳转登录页
|
||
// FIXME url应该使用接口获取,接口名称 “获取商城跳转地址:/mall/getUrl“ POST请求,无参数,需要登录
|
||
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
|
||
return Scaffold(
|
||
resizeToAvoidBottomInset: false,
|
||
backgroundColor: const Color(0xFFFFFFFF),
|
||
appBar: TitleAppBar(
|
||
barTitle: getWebTitle(),
|
||
haveBack: true,
|
||
backgroundColor: AppColors.mainColor,
|
||
),
|
||
body: Obx(() => Column(
|
||
children: <Widget>[
|
||
Container(
|
||
padding: EdgeInsets.only(bottom: 10.w),
|
||
child: LinearProgressIndicator(
|
||
value: state.webProgress.value,
|
||
backgroundColor: Colors.grey,
|
||
valueColor:
|
||
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
||
),
|
||
),
|
||
Expanded(
|
||
child: WebViewWidget(controller: state.mallWebView),
|
||
),
|
||
],
|
||
)));
|
||
}
|
||
|
||
String getWebTitle() {
|
||
String webTitleStr = TranslationLoader.lanKeys!.shoppingCart!.tr;
|
||
state.mallWebView.getTitle().then((result) {
|
||
webTitleStr = result!;
|
||
});
|
||
return webTitleStr;
|
||
}
|
||
}
|