feat: 增加防丢失页面海报生成

This commit is contained in:
2026-01-12 18:49:07 -08:00
parent 26f6c10557
commit 2e7658c4fd
9 changed files with 82 additions and 96 deletions
@@ -8,80 +8,50 @@ class HIAntiLostShareCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Fixed width for the generated image, independent of screen size
final double cardWidth = 375.0;
final double cardHeight = 600.0; // Approx height
// Fixed dimensions for the generated image
final double cardWidth = 375.0;
final double cardHeight = 812.0;
return Container(
width: cardWidth,
// minimal height or let it expand
padding: EdgeInsets.all(20),
color: Colors.black, // Dark background
child: Column(
mainAxisSize: MainAxisSize.min,
height: cardHeight,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/lost-poster-bg.png'),
fit: BoxFit.cover,
),
),
child: Stack(
children: [
SizedBox(height: 40),
// Title
Text(
'保存二维码,防止失联',
style: TextStyle(
color: const Color(0xFFCCFF00),
fontSize: 24,
fontWeight: FontWeight.bold,
fontFamily: 'AlibabaPuHuiTi-Medium',
),
),
SizedBox(height: 20),
// Description
Text(
'建议保存Hi快VPN防丢二维码到相册\n永久保障您的互联网自由',
textAlign: TextAlign.center,
style: TextStyle(
color: const Color(0xFFCCFF00),
fontSize: 14,
height: 1.5,
fontFamily: 'AlibabaPuHuiTi-Regular',
),
),
SizedBox(height: 40),
// QR Code Card
Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(color: const Color(0xFFCCFF00), width: 3),
borderRadius: BorderRadius.circular(20),
),
child: QrImageView(
data: 'https://github.com/hi-vpn/hi-client', // Replace with actual URL
version: QrVersions.auto,
size: 200,
backgroundColor: Colors.transparent,
eyeStyle: const QrEyeStyle(
eyeShape: QrEyeShape.square,
color: Color(0xFFCCFF00),
),
dataModuleStyle: const QrDataModuleStyle(
dataModuleShape: QrDataModuleShape.square,
color: Color(0xFFCCFF00),
),
embeddedImage: const AssetImage('assets/images/kr-logo.png'),
embeddedImageStyle: const QrEmbeddedImageStyle(
size: Size(50, 50),
Positioned(
top: 32,
right: 30,
child: SizedBox(
width: 108,
height: 108,
child: QrImageView(
data:
'https://github.com/hi-vpn/hi-client', // Replace with actual URL
version: QrVersions.auto,
size: 108,
padding: EdgeInsets.zero,
backgroundColor: Colors.transparent,
eyeStyle: const QrEyeStyle(
eyeShape: QrEyeShape.square,
color: Colors.white,
),
),
),
SizedBox(height: 40),
// Footer branding
Text(
'HiVPN',
style: TextStyle(
color: Colors.white.withOpacity(0.5),
fontSize: 12,
letterSpacing: 2,
),
),
SizedBox(height: 20),
dataModuleStyle: const QrDataModuleStyle(
dataModuleShape: QrDataModuleShape.square,
color: Colors.white,
),
embeddedImage: const AssetImage(
'assets/images/lost-poster-logo-white.png'),
embeddedImageStyle: const QrEmbeddedImageStyle(
size: Size(42, 42),
),
),
),
),
],
),
);