feat: 增加防丢失页面

This commit is contained in:
2026-01-12 06:49:03 -08:00
parent 0474f3c9d9
commit 26f6c10557
16 changed files with 390 additions and 0 deletions
@@ -0,0 +1,152 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:kaer_with_panels/app/widgets/hi_base_scaffold.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:kaer_with_panels/app/widgets/kr_local_image.dart';
import 'package:kaer_with_panels/app/modules/hi_anti_lost/controllers/hi_anti_lost_controller.dart';
import 'package:kaer_with_panels/app/modules/hi_anti_lost/widgets/hi_anti_lost_share_card.dart';
class HIAntiLostView extends GetView<HIAntiLostController> {
const HIAntiLostView({super.key});
@override
Widget build(BuildContext context) {
return HIBaseScaffold(
showBack: true,
title: null,
topContentAreaHeight: 0,
backgroundColor: Colors.black, // Dark background
child: Stack(
fit: StackFit.expand,
children: [
// 1. Visible Content
Column(
children: [
SizedBox(height: 60.h),
// Card Container
Container(
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 40.w),
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 0.w),
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(25.r),
border: Border.all(
color: Theme.of(context).primaryColor, width: 4),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'保存二维码,防止失联',
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 24.sp,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 25.h),
Text(
'建议保存Hi快VPN防丢二维码到相册\n永久保障您的互联网自由',
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 14.sp,
height: 1.5,
),
),
SizedBox(height: 10.h),
// QR Code
LayoutBuilder(builder: (context, constraints) {
// Use a reasonable size for the QR code
return Container(
width: 124.w,
height: 124.w,
child: QrImageView(
data:
'https://github.com/hi-vpn/hi-client', // Replace with real URL
version: QrVersions.auto,
backgroundColor: Colors.transparent,
eyeStyle: QrEyeStyle(
eyeShape: QrEyeShape.square,
color: Theme.of(context).primaryColor,
),
dataModuleStyle: QrDataModuleStyle(
dataModuleShape: QrDataModuleShape.square,
color: Theme.of(context).primaryColor,
),
// center image
embeddedImage:
const AssetImage('assets/images/kr-logo.png'),
embeddedImageStyle: QrEmbeddedImageStyle(
size: Size(36.w, 36.w),
),
),
);
}),
],
),
),
SizedBox(height: 30.h),
// Save Button
GestureDetector(
onTap: controller.saveImage,
child: Container(
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 40.w),
height: 44.h,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(22.h),
),
child: Text(
'保存到本地',
style: TextStyle(
color: Colors.black,
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
),
),
),
SizedBox(height: 60.h),
],
),
// 2. Bottom Button (Follow us on X)
Positioned(
bottom: 40.h,
left: 0,
right: 0,
child: Center(
child: GestureDetector(
onTap: controller.openTwitter,
child: KrLocalImage(
imageName: 'followX',
width: 140,
height: 30,
imageType: ImageType
.png, // Assuming it is png as user said followX.png
),
),
),
),
// 3. Invisible Share Card for Generation
Positioned(
left: 10000,
child: RepaintBoundary(
key: controller.repaintKey,
child: const HIAntiLostShareCard(),
),
),
],
),
);
}
}