import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:url_launcher/url_launcher.dart'; import '../styles/colors.dart'; import 'dart:ui'; import '../plugins/ScreenStramPlugin.dart'; import '../net/HttpManager.dart'; import '../net/Result.dart'; import 'package:flutter_redux/flutter_redux.dart'; import '../redux/AppState.dart'; import '../model/HouseInfo.dart'; import '../styles/totast.dart'; import 'StartWindow.dart'; import '../model/PlayerInfo.dart'; import '../widget/VideoWidget.dart'; import 'dart:async'; import '../widget/Dialog.dart'; import 'SecondRoomInfo.dart'; import 'package:flutter/cupertino.dart'; import 'UserGuid.dart'; import 'VideoPlayer.dart'; import './CompetitionNotice.dart'; class RoomInfo extends StatefulWidget { RoomInfo(this.houseInfo, {Key key}) : super(key: key); final HouseInfo houseInfo; // 用来储存传递过来的值 @override RoomInfoState createState() => RoomInfoState(); } class RoomInfoState extends State with SingleTickerProviderStateMixin { TabController mController; Map roomInfo; HouseInfo houseInfo; bool isJoin = true; PlayerInfo playerInfo; bool isPop = false; bool showBack = false; Timer timer; List> roomTipsList = []; ScrollController _tipController; String _myUrl; int tabIndex = 0; int myRank = 0; int myPoints = 0; //获取房间信息 Future getRoomInfo() async { Result res = await HttpManager.get('houseInfo/getOne', data: {'id': houseInfo.id}); if (res.success) { setState(() { roomInfo = res.data; houseInfo = HouseInfo.fromJson(res.data); }); } else {} checkJoinInfo(); } //开始比赛 Future startGame() async { Toast.show(context, '加载中', -1, 'loading'); Result res = await HttpManager.post('houseInfo/handBegin', data: {'id': houseInfo.id}); Toast.hide(); } //隔一秒检查是否开始 Future getNowStatus() async { Result res = await HttpManager.get('houseInfo/getPlayerNum', data: {'id': houseInfo.id}); if (res.success) { if (houseInfo.statusFlag == 0 && res.data['statusFlag'] == 2) { showStart(); // timer.cancel(); } setState(() { houseInfo.playerNumber = res.data['playerNumber']; houseInfo.statusFlag = res.data['statusFlag']; houseInfo.bonus = res.data['bonus']; houseInfo.beginTime = res.data['beginTime']; }); } } //开始比赛确认按钮 Future showStart() async { if (!isJoin) { return; } bool result = await Navigator.of(context).push( PageRouteBuilder( opaque: false, transitionDuration: Duration(milliseconds: 300), transitionsBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { return FadeTransition( opacity: CurvedAnimation(parent: animation, curve: Curves.linear), child: child, ); }, pageBuilder: (BuildContext context, _, __) { return StartWindow(); }, ), ); Map data = {'id': playerInfo.id}; bool success = true; if (result) { success = await ScreenStreamPlugin.start(playerInfo.id.toString()); if (success) { data['statusFlag'] = 2; data['played'] = true; } else { data['statusFlag'] = 6; data['played'] = false; } } else { data['statusFlag'] = 6; data['played'] = false; } Result res = await HttpManager.post('playerInfo/update', data: data); // MyDialog.showDialog(context, '自动启动游戏失败,请手动切换到游戏app开始竞赛', submitText: '知道了'); // Timer(Duration(seconds: 10), () { // showSucessInfo(); // }); // return; if (res.success) { if (data['statusFlag'] == 2) { const url = 'pubgmhd1106467070://'; if (await canLaunch(url)) { Timer(Duration(seconds: 1), () async { await launch(url); showSucessInfo(); }); } else { showCustomDialog(context, '自动启动游戏失败,请手动切换到游戏app开始竞赛', submitText: '知道了'); Timer(Duration(seconds: 10), () { showSucessInfo(); }); } } else { showBackDialog(success ? 1 : 0); } } } //开始录屏提示框 void showSucessInfo() { showCustomDialog(context, '您已经完成比赛了吗,确认完成,那就点击下方完成竞赛按钮,上传本次成绩,祝您赢取大奖', title: '完成比赛', submitText: '我已完成比赛', onsubmit: () async { HttpManager.post('playerInfo/update', data: {'id': playerInfo.id, 'statusFlag': 3}); bool success = await ScreenStreamPlugin.stop(); Timer(Duration(seconds: 1), () { getEndTips(); }); setState(() { playerInfo.statusFlag = 3; }); }); } Future getEndTips() async { Result res = await HttpManager.get('playerInfo/endNum', data: {'houseId': houseInfo.id}); if (res.success) { int time = houseInfo.beginTime + 1 * 3600 * 1000 - DateTime.now().millisecondsSinceEpoch; var nowTime = (time ~/ 1000 ~/ 60) % 60; setState(() { roomTipsList.add(['你已完成本次比赛,当前完成人数 ', res.data.toString(), '人,比赛需要等待所有人完成后方可结算奖励', '', ',你可以先去参加其他竞赛,稍后在“个人中心-我的战绩”中可以查看本次竞赛排名及领取奖励']); }); } } //未确认比赛弹窗 void showBackDialog(type) { showCustomDialog(context, (type == 1 ? '由于您未在十秒内点击开始按钮' : '由于您未授权录屏') + ',系统已经判定您放弃比赛,谢谢您的参与。', title: '很遗憾'); } //检查加入信息 Future checkJoinInfo() async { Result res = await HttpManager.get('playerInfo/getOne', data: {'userId': StoreProvider.of(context).state.userInfo.id, 'houseId': houseInfo.id}); if (res.success) { if (res.data == null) { setState(() { isJoin = false; }); if (houseInfo.statusFlag == 0) { if (houseInfo.scoreType == 0) { roomTipsList.add([ '上方奖金为当前本次竞赛的总奖金,根据当前人数的增加,奖金也就越多,竞赛的第一名获得${houseInfo.houseLevel.firstRatio}%,第二名获得${houseInfo.houseLevel.secondRatio}%,第三名获得${houseInfo.houseLevel.thirdRatio}%,其他名次算作失败没有奖励,祝你取得好成绩。注:奖金池的${houseInfo.houseLevel.feeRatio}%为平台方运营服务费, 奖金池的${houseInfo.houseLevel.poolRatio}%流入赛季总奖金。' ]); } else { roomTipsList.add([ '同房间内的玩家进行竞赛,所有吃上鸡的玩家均可获得奖金,即平分总奖金池的${houseInfo.houseLevel.avgRatio}%。注:奖金池的${houseInfo.houseLevel.feeRatio}%为平台方运营服务费, 奖金池的${houseInfo.houseLevel.poolRatio}%流入赛季总奖金。' ]); } } } else { playerInfo = PlayerInfo.fromJson(res.data); myPoints = playerInfo.points; if (houseInfo.statusFlag == 4) { _myUrl = await ScreenStreamPlugin.getVideo(playerInfo.id.toString()); print('本地视频' + playerInfo.id.toString()); print(_myUrl); Result rankRes = await HttpManager.get('playerInfo/userRank', data: {'id': playerInfo.id}); if (rankRes.success) { myRank = rankRes.data; } } setState(() { isJoin = true; }); if (houseInfo.statusFlag == 0) { if (houseInfo.createUser == StoreProvider.of(context).state.userInfo.id.toString()) { roomTipsList.add(['房间创建成功,待人数满员时会自动开启比赛,请在此页面耐心等待其他人的加入,退出房间则视为自动放弃比赛,已支付金币概不退换,快快点击右上角分享给好友加入战局吧']); } else { // roomTipsList.add([ // '请在此页面耐心等待,竞赛即将开始,届时玩家有10秒的时间进行确认,点击确认方可正式进入竞赛,若没有点击,则视为自动放弃此次竞赛,已支付金币概不退换' // ]); } // Timer(Duration(seconds: 1), () { // roomTipsList.add([ // '游戏开始后会有弹窗提示授权进行录屏的操作,', // '请一定点击“确定”或“允许”此操作', // ',系统会自动跳转打开游戏app,若长时间没有自动跳转,请手动打开游戏app进行比赛,在游戏比赛结束后,请', // '一定要点击查看游戏最后的��数名次结算页面', // ',返回游戏主页,最后再切换到我们竞赛app中,点击完成比赛,方可成功上传本次成绩。从游戏开始一小时之内必须返回全民App点击完成比赛,否则判定游戏失败,祝你取得好成绩。' // ]); // changeScroll(); // }); } else if (houseInfo.statusFlag != 4) { if (playerInfo.statusFlag == 3 || playerInfo.statusFlag == 8 || playerInfo.statusFlag == 9) { getEndTips(); } } } } if (isJoin && houseInfo.statusFlag != 4) { timer = Timer.periodic(Duration(seconds: 1), (timer) { getNowStatus(); }); } } //加入房间 Future joinRoom() async { Toast.show(context, '加载中', -1, 'loading'); Result res = await HttpManager.post('houseInfo/join', data: {'houseId': houseInfo.id, 'userId': StoreProvider.of(context).state.userInfo.id}); Toast.hide(); if (res.success) { Toast.show(context, '加入成功', 1500, 'success'); checkJoinInfo(); } else { Toast.show(context, res.error, 1500, 'info'); } } //获取分秒 String getSecondsMIn(int time) { if (time == null) { return ''; } else { return ((time ~/ 1000 ~/ 60) % 60).toString() + '分' + (time ~/ 1000 % 60).toString() + '秒'; } } @override void initState() { super.initState(); houseInfo = widget.houseInfo; mController = TabController( length: 2, vsync: this, ); mController.addListener(() { setState(() { tabIndex = mController.index; }); print(tabIndex); }); _tipController = ScrollController(); roomInfo = {}; Future.delayed(Duration.zero, () async { getRoomInfo(); final prefs = await SharedPreferences.getInstance(); final bool showGuid3 = prefs.getBool('showGuid3') ?? true; if (showGuid3) { await prefs.setBool('showGuid3', false); await showUserGuide3(context); } }); } @override void dispose() { super.dispose(); mController.dispose(); if (timer != null) { timer.cancel(); } } @override Widget build(BuildContext context) { ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context); int status = 0; if (houseInfo != null) { status = houseInfo.statusFlag; } return WillPopScope( child: Scaffold( appBar: AppBar( title: Container( child: TabBar( controller: mController, labelColor: PRIMARY_COLOR, unselectedLabelColor: Color(0xCCFFFFFF), labelStyle: TextStyle(fontSize: 16.0), indicatorColor: PRIMARY_COLOR, indicatorWeight: 3, indicatorSize: TabBarIndicatorSize.label, tabs: [ Tab(text: '房间信息'), Tab(text: '参赛成员'), ], ), ), centerTitle: true, elevation: 0, ), body: Container( color: BG_SUB_COLOR, child: TabBarView( controller: mController, children: [_firstPage(), SecondPage(houseInfo)], )), floatingActionButton: _joinBtn(), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, ), onWillPop: () { if (houseInfo == null || (houseInfo.statusFlag != 0) || !isJoin) { if (timer != null) { timer.cancel(); } isPop = true; Toast.hide(); Navigator.of(context).pop(); return Future.value(false); } else { showCustomDialog(context, '比赛即将开始,确定离开房间?', isCancel: true, onsubmit: () { Navigator.of(context).pop(); }); } return Future.value(false); }, ); } Widget _firstPage() { int statuFlag = 0; if (houseInfo != null) { if (houseInfo.statusFlag != null) { statuFlag = houseInfo.statusFlag; } } return LayoutBuilder( builder: (BuildContext context, BoxConstraints viewportConstraints) { return Container( child: RefreshIndicator( color: PRIMARY_COLOR, backgroundColor: Colors.white, displacement: 10, onRefresh: () async { await Future.delayed(const Duration(seconds: 1)); }, child: SingleChildScrollView( controller: _tipController, physics: AlwaysScrollableScrollPhysics(), child: Column( children: [ houseInfo != null ? VideoWidget(videoSrc: houseInfo.video) : Container(), // Image.network(topImg, width: double.infinity), Container( height: 60, padding: EdgeInsets.fromLTRB(15, 0, 15, 0), child: Row( children: [ Expanded( child: Text( houseInfo.houseName, style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.white), ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'images/icon_renshu.png', width: 20, ), Text( (houseInfo != null ? (houseInfo.playerNumber ?? 0).toString() : '0') + '/' + (houseInfo != null ? houseInfo.maxNumber.toString() : '0'), style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xFFB1B2C0)), ), ], ) ], ), ), Container( height: 40, margin: EdgeInsets.fromLTRB(15, 0, 15, 0), color: Color(0x1A1990F8), child: Row( children: [ Expanded( flex: 1, child: CupertinoButton( padding: EdgeInsets.all(0), onPressed: () { if (houseInfo == null || (houseInfo.statusFlag != 0) || !isJoin) { if (timer != null) { timer.cancel(); } isPop = true; Toast.hide(); Navigator.of(context).pop(); return Future.value(false); } else { showCustomDialog(context, '比赛即将开始,确定离开房间?', isCancel: true, onsubmit: () { Navigator.of(context).pop(); }); } }, child: Text( '返回锦标赛', style: TextStyle(color: PRIMARY_COLOR, fontSize: 14, fontWeight: FontWeight.bold), ), ), ), Container( width: 1, height: 12, color: PRIMARY_COLOR, ), Expanded( flex: 1, child: CupertinoButton( padding: EdgeInsets.all(0), onPressed: () { showNotice(context); }, child: Text( '竞赛须知', style: TextStyle(color: PRIMARY_COLOR, fontSize: 14, fontWeight: FontWeight.bold), ), ), ), ], ), ), // Container( // height: 40, // margin: EdgeInsets.fromLTRB(15, 10, 15, 0), // decoration: BoxDecoration( // color: Color(0x1AFFFF00), // border: Border.all( // width: 1, // color: Colors.yellow, // )), // child: Row( // mainAxisAlignment: MainAxisAlignment.spaceAround, // children: [ // Text('积分 加成+0%', style: TextStyle(color: Colors.yellow, fontSize: 12)), // Text('保底 0积分', style: TextStyle(color: Colors.yellow, fontSize: 12)), // ], // ), // ), statuFlag != 4 ? TipsListContent(tipsList: roomTipsList, houseInfo: houseInfo) : RankContent( roomId: houseInfo.id.toString(), ), Container( width: double.infinity, height: 78, ) ], ))), ); }, ); } Widget _joinBtn() { int joinMoney = 0; int statusFlag = houseInfo != null ? houseInfo.statusFlag : 1; int playerStatus = playerInfo != null ? playerInfo.statusFlag : 0; if (!isJoin && statusFlag == 0) { return Container( color: BG_SUB_COLOR, width: ScreenUtil().setWidth(375), height: 48 + ScreenUtil().setHeight(40), padding: EdgeInsets.only(top: ScreenUtil().setHeight(20), bottom: ScreenUtil().setHeight(20), left: 15, right: 15), child: RaisedButton( textColor: Colors.white, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( margin: EdgeInsets.only(left: 20), child: Text( '加入房间', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold), )) ], ), onPressed: () => joinRoom()), ); } else if (!isJoin && statusFlag == 2) { return Container( width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20), height: 88, child: RaisedButton( disabledColor: Color(0xFF914244), disabledTextColor: Color(0xFF252532), child: Text( '房间已经开始,加入通道关闭', style: TextStyle(fontSize: 16), ), onPressed: null, ), ); } else if (isJoin && statusFlag == 0) { int _time; if (houseInfo != null) { _time = houseInfo.createTime + 600000 - DateTime.now().millisecondsSinceEpoch; } if (houseInfo != null && houseInfo.createUser == StoreProvider.of(context).state.userInfo.id.toString()) { return Container( width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20), height: 88, child: RaisedButton( child: Text.rich(TextSpan(children: [ TextSpan( text: '开始比赛', style: TextStyle(fontSize: 16), ), TextSpan( text: '(${getSecondsMIn(_time)}秒后将自动开始)', style: TextStyle(fontSize: 12), ) ])), onPressed: () { showCustomDialog(context, '确认要开始比赛吗?', isCancel: true, onsubmit: () { print('开始'); startGame(); }); }, ), ); } else { return Container( width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20), height: 88, child: RaisedButton( disabledColor: Color(0xFF1990F8), disabledTextColor: Color(0xFF252532), child: Text( '预计' + getSecondsMIn(_time) + '后开始', style: TextStyle(fontSize: 16), ), onPressed: null, ), ); } } else if (isJoin && statusFlag == 8) { return Container( width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20), height: 88, child: RaisedButton( disabledColor: Color(0xFF1990F8), disabledTextColor: Color(0xFF252532), child: Text( '正在努力解析视频中', style: TextStyle(fontSize: 16), ), onPressed: null, ), ); } else if (isJoin && (statusFlag == 2 || statusFlag == 3)) { int _time; if (houseInfo != null) { _time = houseInfo.beginTime + 3600000 - DateTime.now().millisecondsSinceEpoch; } return Container( width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20), height: 88, child: RaisedButton( disabledColor: Color(0xFF1990F8), disabledTextColor: Color(0xFF252532), child: Text( '最迟在' + getSecondsMIn(_time) + '后结算', style: TextStyle(fontSize: 16), ), onPressed: null, ), ); } else if (statusFlag == 4 && tabIndex == 0) { return Container( width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20), height: 88, child: RaisedButton( disabledColor: Color(0xFF1990F8), disabledTextColor: Color(0xFF15151D), child: Text( '已结束', style: TextStyle(fontSize: 16), ), onPressed: null, ), ); } else if (statusFlag == 4 && tabIndex == 1) { return Builder( builder: (context) { return Container( height: 48, color: SUB_COLOR, child: Row( children: [ Container( width: 57, child: Center( child: Container( width: 22, height: 22, color: PRIMARY_COLOR, child: Center( child: Text( myRank.toString(), style: TextStyle(fontSize: 12, color: Colors.white), ), )), )), Container( width: 30, height: 30, margin: EdgeInsets.only(right: 10), child: CircleAvatar( backgroundImage: NetworkImage(StoreProvider.of(context).state.userInfo.icon), ), ), Expanded( flex: 1, child: Text( StoreProvider.of(context).state.userInfo.nickname, style: TextStyle( fontSize: 14, color: Colors.white, ), ), ), _myUrl != null ? Container( width: 68, height: 24, margin: EdgeInsets.only(right: 10), child: OutlineButton( textColor: BG_SUB_COLOR, borderSide: BorderSide(color: BG_SUB_COLOR), padding: EdgeInsets.all(0), highlightColor: PRIMARY_COLOR.withOpacity(0.8), highlightedBorderColor: BG_SUB_COLOR, child: Text( '查看回放', style: TextStyle(fontSize: 12), ), onPressed: () { Navigator.push(context, CupertinoPageRoute(builder: (context) => VideoPlayerPage(videoUrl: _myUrl, fileType: 'file'))); }, ), ) : Container() ], ), ); }, ); } else { return Container(); } } } //房间的提示信息 class TipsListContent extends StatelessWidget { TipsListContent({Key key, this.tipsList, this.houseInfo}) : super(key: key); final List> tipsList; final HouseInfo houseInfo; @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(top: 15), width: double.infinity, child: Column( children: _list(), ), ); } List _list() { List myList = []; for (int i = 0; i < tipsList.length; i++) { myList.add(Tips(content: tipsList[i], showTongzhi: (tipsList[i].length == 1 && i == 0) ? true : false, houseInfo: houseInfo)); } return myList; } } class Tips extends StatelessWidget { Tips({Key key, this.content, this.showTongzhi, this.houseInfo}) : super(key: key); final List content; final bool showTongzhi; final HouseInfo houseInfo; @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(15), margin: EdgeInsets.fromLTRB(15, 10, 15, 0), color: Color(0xFF293354), child: Column( children: [ content.length == 1 ? Text( content[0], style: TextStyle(color: Colors.white, fontSize: 13), ) : _textList(), showTongzhi ? FlatButton( padding: EdgeInsets.all(0), textColor: PRIMARY_COLOR, highlightColor: Colors.transparent, splashColor: Colors.transparent, child: Text( '查看竞赛须知', style: TextStyle( decoration: TextDecoration.underline, ), ), onPressed: () { showNotice(context); }, ) : Container() ], )); } Widget _textList() { return Text.rich(TextSpan( style: TextStyle(color: Colors.white, fontSize: 13), children: [ TextSpan(text: content[0]), TextSpan( text: content[1], style: TextStyle(color: PRIMARY_COLOR, fontSize: 13, fontWeight: FontWeight.bold), ), TextSpan(text: content[2]), TextSpan(text: content[3]), TextSpan(text: content[4]) ], )); } } //比赛结束排名 class RankContent extends StatefulWidget { RankContent({Key key, this.roomId}) : super(key: key); final String roomId; // 用来储存传递过来的值 @override RankContentState createState() => RankContentState(); } class RankContentState extends State { List topList = []; Future getTopList() async { Toast.show(context, '加载中', -1, 'loading'); Result res = await HttpManager.get('playerInfo/rankPage', data: {'houseId': widget.roomId, 'currentPage': 1, 'pageNumber': 3}); Toast.hide(); List list = []; if (res.success) { for (var item in res.data['pp']) { PlayerInfo jonPlayer = PlayerInfo.fromJson(item); list.add(jonPlayer); } } else {} setState(() { topList = list; }); } @override void initState() { super.initState(); Future.delayed(Duration.zero, () { getTopList(); }); } @override Widget build(BuildContext context) { return Container( width: double.infinity, height: 180, margin: EdgeInsets.only(top: 15), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [_rankItem(2), _rankItem(1), _rankItem(3)], ), ); } Widget _rankItem(int _num) { if (_num > topList.length) { return Container( width: 107, height: 60, ); } List colorList = [ [Color(0xFFD48E00), Color(0xFFFECF01)], [Color(0xFFC5C5C5), Color(0xFFE3E3E3)], [Color(0xFFE77023), Color(0xFFF89E58)] ]; return Container( padding: EdgeInsets.only(left: 15, right: 15, top: _num == 1 ? 0 : 15), width: 107, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( child: Stack( children: [ Positioned( top: 0, left: _num == 1 ? 19 : 14, child: Center( child: Image.asset( 'images/icon_paihangbang_0' + '$_num.png', width: 32, ), ), ), Container( margin: EdgeInsets.only(top: 27, bottom: 20), width: _num == 1 ? 70 : 60, height: _num == 1 ? 70 : 60, decoration: BoxDecoration( gradient: LinearGradient(colors: colorList[_num - 1], begin: Alignment.topLeft, end: Alignment.bottomRight), borderRadius: BorderRadius.all(Radius.circular(100)), ), child: Center( child: Container( width: _num == 1 ? 60 : 50, height: _num == 1 ? 60 : 50, child: CircleAvatar(backgroundImage: NetworkImage(topList[_num - 1].userInfo.icon)), )), ), Positioned( bottom: 0, child: Center( child: Image.asset( 'images/ph_yinpai_no' + '$_num.png', width: 67, ), ), ), ], ), ), Text( topList[_num - 1].userInfo.nickname, style: TextStyle( color: Color(0xFFFDC372), fontSize: 12, ), overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, ), SizedBox( height: 5, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset('images/icon_jifen.png', width: 20), Text('×' + (topList[_num - 1].points != null ? topList[_num - 1].points.toString() : '0'), style: TextStyle(color: PRIMARY_COLOR, fontSize: 12)) ], ) ], ), ); } }