初始化
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgdj/tools_base/global_store/store.dart';
|
||||
|
||||
import '../../../hj_model/user/user_info_model.dart';
|
||||
|
||||
class MineIdentityLogic extends GetxController {
|
||||
MineIdentityLogic get to => Get.find<MineIdentityLogic>();
|
||||
|
||||
UserInfoModel? meInfo = globalStore.meInfo;
|
||||
|
||||
GlobalKey boundaryKey = GlobalKey();
|
||||
String qrCodeStr = '';
|
||||
|
||||
int? inviterNum;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
loadData();
|
||||
}
|
||||
|
||||
void loadData() async {
|
||||
globalStore.updateUserInfo();
|
||||
qrCodeStr = await MineService.certificateQR() ?? '';
|
||||
update();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
import 'package:easy_rich_text/easy_rich_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/app_colors.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/config/address.dart';
|
||||
import 'package:hgdj/config/config.dart';
|
||||
import 'package:hgdj/hj_utils/image_util.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/toast.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
import '../../../tools_base/global_store/store.dart';
|
||||
import '../../../tools_base/widget/net_image_widget.dart';
|
||||
import 'mine_identity_logic.dart';
|
||||
|
||||
//账号凭证页面
|
||||
class MineAccountIdentityPage extends StatelessWidget {
|
||||
const MineAccountIdentityPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MineIdentityLogic>(
|
||||
init: MineIdentityLogic(),
|
||||
builder: (controller) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Center(
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
width: 300,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
RepaintBoundary(
|
||||
key: controller.boundaryKey,
|
||||
child: Stack(
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
child: Image.asset('share_bg.webp'.mineImgPath,
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
30.sizeBoxH,
|
||||
Consumer<GlobalStore>(
|
||||
builder: (_, provider, __) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
border: Border.all(
|
||||
color: Color(0x4DF68804), width: 3),
|
||||
),
|
||||
child: NetworkImageLoader(
|
||||
imageUrl:
|
||||
provider.meInfo?.portrait ?? '',
|
||||
width: 82,
|
||||
height: 82,
|
||||
borderRadius: 50,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
10.sizeBoxH,
|
||||
Text(
|
||||
'账号凭证',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: .9),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
10.sizeBoxH,
|
||||
Text(
|
||||
'ID ${globalStore.meInfo?.uid ?? ""}',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: .55),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
30.sizeBoxH,
|
||||
Text("提示*可通过官方客服找回账号",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFFF68804))),
|
||||
10.sizeBoxH,
|
||||
Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(11.w),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
"code_bg.webp".mineImgPath),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(6.w),
|
||||
color: Colors.white,
|
||||
child: controller.qrCodeStr.isNotEmpty
|
||||
? QrImageView(
|
||||
data: controller.qrCodeStr,
|
||||
version: QrVersions.auto,
|
||||
padding: EdgeInsets.zero,
|
||||
size: 100,
|
||||
)
|
||||
: SizedBox(
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: Center(
|
||||
child:
|
||||
CupertinoActivityIndicator(
|
||||
color: AppColors.actionRed,
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
18.h.sizeBoxH,
|
||||
EasyRichText(
|
||||
"APP更新可能会导致会员账号掉线\n请勿删除此凭证,此凭证是您永久有\n效的登陆途径。",
|
||||
textAlign: TextAlign.center,
|
||||
defaultStyle: TextStyle(
|
||||
color:
|
||||
Colors.white.withValues(alpha: .55),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1.5),
|
||||
patternList: [
|
||||
EasyRichTextPattern(
|
||||
targetString: '请勿删除此凭证',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF52C56),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 30,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 18, vertical: 3),
|
||||
child: Text(
|
||||
'${Config.appName} 官网地址 ${Address.groundUrl ?? ""}',
|
||||
style: TextStyle(
|
||||
color:
|
||||
Colors.white.withValues(alpha: .55),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
20.sizeBoxH,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
10.sizeBoxH,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var success = await ImageUtil.saveWidgetToAlbum(
|
||||
controller.boundaryKey);
|
||||
if (success) {
|
||||
showToast("保存成功");
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 220,
|
||||
height: 44,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.actionRed,
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"立即保存",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
20.sizeBoxH,
|
||||
InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: () => Get.back(result: false),
|
||||
child: Image.asset("close_button.png".commonImgPath,
|
||||
width: 32),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user