import 'package:easy_rich_text/easy_rich_text.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:hgdj/assets_tool/app_colors.dart'; import 'package:hgdj/config/config.dart'; import 'package:hgdj/hj_utils/screen.dart'; import 'package:hgdj/routers/jump_router.dart'; import 'package:hgdj/tools_base/widget/common_dialog.dart'; class LineErrorDialog extends StatelessWidget { static Future show({Function? callback}) { return Get.dialog( LineErrorDialog(callback: callback), barrierDismissible: false, ); } final Function? callback; const LineErrorDialog({super.key, this.callback}); String get url => '91porn01.cc'; @override Widget build(BuildContext context) { return CommonDialog( //线路异常必须让用户处理,Get.dialog 的 barrierDismissible 到不了这层 barrierDismissible: false, canTapClose: false, child: Column( mainAxisSize: MainAxisSize.min, children: [ Text( '系统提示', style: TextStyle( color: Colors.white.withValues(alpha: .9), fontSize: 20, fontWeight: FontWeight.w500, ), ), 12.sizeBoxH, 0.5.line, 12.sizeBoxH, Row( children: [ Text( "APP线路检测失败", style: TextStyle( color: Color(0xffF52C56), fontSize: 12, ), ), ], ), 12.sizeBoxH, Container( alignment: Alignment.centerLeft, child: const Text( "解决方案:", style: TextStyle( color: Color(0xff656565), fontSize: 12, fontWeight: FontWeight.w500), ), ), 12.sizeBoxH, EasyRichText( '''1.请检测您的网络是否正常,手机是否开了VPN或10分钟后再尝试访问。 2.前往官网地址 $url下载最新版。 3.前往Telegram${Config.appName}官方交流群 ''', defaultStyle: TextStyle(fontSize: 12, color: Color(0xff656565), height: 1.8), patternList: [ EasyRichTextPattern( targetString: url, style: TextStyle(color: AppColors.primaryHighColor), recognizer: TapGestureRecognizer() ..onTap = () { launchUrlToWeb('https://$url'); }, ), ], ), 18.sizeBoxH, SizedBox( height: 38, child: Row( children: [ GestureDetector( onTap: () async { Get.back(); callback?.call(); }, child: Container( width: 96, height: 42, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(3), color: Colors.white.withValues(alpha: .1), ), child: Text( "切换路线", style: TextStyle( color: Color(0xff989898), fontSize: 14, fontWeight: FontWeight.w500, ), ), ), ), 12.sizeBoxW, Expanded( child: GestureDetector( onTap: () { launchUrlToWeb('https://t.me/hougong9527'); }, child: Container( height: 42, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(3), color: AppColors.actionRed, ), child: const Text( "前往群聊", style: TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500, ), ), ), ), ) ], ), ) ], ), ); } }