import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:hgdj/hj_utils/screen.dart'; import 'package:hgdj/tools_base/widget/sheet_handle_bar.dart'; import '../../config/address.dart'; import '../../hj_model/splash/domain_source_model.dart'; import '../../tools_base/global_store/store.dart'; import '../mine/vip_level_dialog.dart'; class VideoLineMenuAlert extends StatelessWidget { /// 返回 true 表示切换了线路,调用方据此重新起播 static Future show() async { return await Get.bottomSheet(VideoLineMenuAlert()) ?? false; } VideoLineMenuAlert({super.key}); @override Widget build(BuildContext context) { return Material( color: Colors.transparent, child: Container( width: screen.screenWidth, padding: EdgeInsets.only(bottom: screen.paddingBottom), decoration: BoxDecoration( color: Color(0xff0F0F0F), borderRadius: BorderRadius.only( topLeft: Radius.circular(20), topRight: Radius.circular(20), ), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ 18.sizeBoxH, const SheetHandleBar(), 4.sizeBoxH, ...Address.cdnAddressLists.map(_lineItem), ], ), ), ); } Widget _lineItem(Domain domain) { final isSelected = domain.url == Address.cdnAddress; return InkWell( enableFeedback: false, onTap: () { if (!globalStore.isVIP) { showVipLevelDialog("该线路仅限会员使用\n\n" "开通会员立享 极速观影体验"); } else if (isSelected) { Get.back(); } else { Address.cdnAddress = domain.url; Get.back(result: true); // 带回切换结果,由调用方重新起播 } }, child: Container( height: 56, padding: EdgeInsets.symmetric(horizontal: 16), child: Column( mainAxisSize: MainAxisSize.min, children: [ Expanded( child: Center( child: Text( domain.desc ?? "", style: TextStyle( fontSize: 14, color: isSelected ? Color(0xfff68804) : Colors.white.withValues(alpha: 0.45), fontWeight: isSelected ? FontWeight.w500 : FontWeight.w400, ), ), ), ), Container( color: Colors.white.withValues(alpha: 0.05), height: 1, ), ], ), ), ); } }