import 'dart:ui'; import 'package:easy_rich_text/easy_rich_text.dart'; import 'package:flutter/material.dart'; import 'package:hgdj/assets_tool/images.dart'; import 'package:hgdj/config/config.dart'; import 'package:hgdj/routers/jump_router.dart'; import '../hj_utils/screen.dart'; import '../tools_base/widget/net_image_widget.dart'; /// 暗网板块未开通会员时的全屏毛玻璃遮罩:配了运营图走整图样式,否则走默认文案样式 class AwPermissionAlert extends StatelessWidget { const AwPermissionAlert({super.key}); @override Widget build(BuildContext context) { return ColoredBox( color: Colors.black.withValues(alpha: .4), child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20), child: Config.darkWebImg?.isNotEmpty == true ? _imageView() : _normalView(), ), ); } //运营配置的整图样式,点哪都去开通 Widget _imageView() { return GestureDetector( onTap: () => pushToWalletPage(vipId: Config.darkWebVipId), //用 DecoratedBox 不用 ColoredBox:后者 hitTest 是 opaque,会让图片没加载出来时整屏都可点,和原行为不一致 child: DecoratedBox( decoration: BoxDecoration(color: Colors.black.withValues(alpha: .7)), child: NetworkImageLoader( imageUrl: Config.darkWebImg, fit: BoxFit.cover, borderRadius: 0, ), ), ); } //默认文案样式 Widget _normalView() { final vipName = Config.darkWebVipName ?? ''; return Center( child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => pushToWalletPage(tabPosition: 0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset('aw_warning.webp'.homePath, height: 96), 28.sizeBoxH, const Text( '系统警告\n' '【暗网】含有百万全球禁播封杀资源,全球\n' '上流社会权贵的私密丑闻!\n\n' '萝莉岛事件,N号房,暴力重口,巴以/俄\n' '乌/中东战争,血腥缅北,呦呦破处,变态\n' '恐怖,暗网交易,等稀缺资源!', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500), ), 18.sizeBoxH, //会员卡名标红 EasyRichText( '马上开通\n$vipName\n进入世界的黑暗面!', textAlign: TextAlign.center, defaultStyle: const TextStyle( color: Colors.white, fontSize: 14, height: 1.5), patternList: [ if (vipName.isNotEmpty) EasyRichTextPattern( targetString: vipName, matchWordBoundaries: false, // 纯中文无 \b 词边界,关掉才能匹配上 hasSpecialCharacters: true, // 卡名是服务端下发的,带 ()+ 等正则符会构造出非法正则崩掉 style: const TextStyle(color: Color(0xffC40F0B)), ), ], ), 18.sizeBoxH, GestureDetector( onTap: () => pushToWalletPage(vipId: Config.darkWebVipId), child: Image.asset('aw_button.webp'.homePath, height: 62), ), 30.sizeBoxH, Text( '此板块为黑客破解内容,真实稀缺资源,\n' '可能会引起极度不适,请谨慎进入!\n', textAlign: TextAlign.center, style: TextStyle( color: Colors.white.withValues(alpha: .6), fontSize: 12), ), ], ), ), ); } }