import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import '../beans/reconnect_bean.dart'; class ReconnectDialog extends StatefulWidget { final Function onTap; final ReconnectBean reconnectBean; ReconnectDialog({super.key, required this.reconnectBean, required this.onTap}); @override State createState() => _ReconnectDialogState(); } class _ReconnectDialogState extends State { @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; final w57 = size.width / 6.31578947368; return Material( type: MaterialType.transparency, color: const Color(0x1A000000), child: Center( child: Container( width: size.width, margin: EdgeInsets.only(left: 32, right: 32), decoration: BoxDecoration( color: Color(0xFF202530), borderRadius: BorderRadius.all(Radius.circular(11)), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( margin: EdgeInsets.only(top: 10), child: CachedNetworkImage( width: 60, height: 60, imageUrl: '${widget.reconnectBean.gameIconImage}', errorWidget: (context, url, error) => const Icon(Icons.error), ), ), Container( margin: EdgeInsets.only(top: 10), child: Text( '${widget.reconnectBean.gameName}', style: TextStyle(fontSize: 16, color: Colors.white), ), ), Container( margin: EdgeInsets.only(top: 20), child: Text( '检测到可重连游戏,是否重连', style: TextStyle(fontSize: 14, color: Color(0xFFD6D6D7)), ), ), Container( margin: EdgeInsets.only(top: 50, bottom: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ GestureDetector( onTap: () { Navigator.pop(context); widget.onTap(widget.reconnectBean.gameId, 0); }, child: Container( width: 102, height: 32, alignment: Alignment.center, decoration: BoxDecoration( border: Border.all(color: Color(0x80898989), width: 1), borderRadius: BorderRadius.all(Radius.circular(18)), ), child: Text( "取消", style: TextStyle(fontSize: 13, color: Color(0x80898989)), ), ), ), GestureDetector( onTap: () { Navigator.pop(context); widget.onTap(widget.reconnectBean.gameId, 1); }, child: Container( width: 102, height: 32, alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFF074CE7), borderRadius: BorderRadius.all(Radius.circular(18)), ), child: Text( "连接", style: TextStyle(fontSize: 13, color: Colors.white), ), ), ), ], ), ), ], ), ), ), ); } }