panhui 6 лет назад
Родитель
Сommit
e9ddcc77bd
2 измененных файлов с 216 добавлено и 88 удалено
  1. 159 85
      lib/pages/TipInfo.dart
  2. 57 3
      lib/pages/TipList.dart

+ 159 - 85
lib/pages/TipInfo.dart

@@ -96,96 +96,133 @@ class TipInfoState extends State<TipInfo> {
             color: Color(0xFF2B2B42),
             width: double.infinity,
             height: double.infinity,
-            child: Column(
-              children: <Widget>[
-                Padding(
-                  padding: EdgeInsets.only(left: 15, right: 15),
-                  child: Column(
-                    crossAxisAlignment: CrossAxisAlignment.start,
-                    children: <Widget>[
-                      Padding(
-                        padding: EdgeInsets.symmetric(vertical: 12),
-                        child: Text(readTimestamp(tipInfo.createTime, 'yyyy.MM.dd HH:mm:ss'), style: TextStyle(color: Colors.white24, fontSize: 13)),
-                      ),
-                      Container(
-                        height: 1,
-                        color: Colors.black26,
-                      ),
-                      Padding(
-                        padding: EdgeInsets.only(top: 10, bottom: 0),
-                        child: Text(
-                          tipInfo.content,
-                          style: TextStyle(color: Colors.white, fontSize: 14),
+            child: SingleChildScrollView(
+              child: Column(
+                children: <Widget>[
+                  Padding(
+                    padding: EdgeInsets.only(left: 15, right: 15),
+                    child: Column(
+                      crossAxisAlignment: CrossAxisAlignment.start,
+                      children: <Widget>[
+                        Padding(
+                          padding: EdgeInsets.symmetric(vertical: 12),
+                          child: Text(readTimestamp(tipInfo.createTime, 'yyyy.MM.dd HH:mm:ss'), style: TextStyle(color: Colors.white24, fontSize: 13)),
                         ),
-                      ),
-                       houseInfo != null ?Text('下方为优胜用户:',style:TextStyle(color: Colors.white, fontSize: 14)):Container(),
-                    ],
+                        Container(
+                          height: 1,
+                          color: Colors.black26,
+                        ),
+                        Padding(
+                            padding: EdgeInsets.only(top: 10, bottom: 0),
+                            child: Text.rich(TextSpan(style: TextStyle(color: Colors.white, fontSize: 14), children: _tipContent(tipInfo.content, context)))),
+                      ],
+                    ),
                   ),
-                ),
-                houseInfo != null ? RankContent(roomId: houseInfo.id.toString()) : Container(),
-                houseInfo != null && type != 3 ? houseItem(roomInfo: houseInfo, gameInfo: gameInfo) : Container(),
-                (type == 2 || type == 3)
-                    ? Container(
-                        width: double.infinity,
-                        height: 48,
-                        padding: EdgeInsets.symmetric(horizontal: 15),
-                        child: status == 0
-                            ? LinearButton(
-                                btntext: '立即领取',
-                                onTapHomeMenu: () async {
-                                  Toast.show(context, '加载中', -1, 'loading');
-                                  Result res = type == 2
-                                      ? await HttpManager.post('playerInfo/receive', data: {'id': tipInfo.playerId})
-                                      : await HttpManager.post('systemNotice/receive', data: {'id': widget.tipId});
-                                  Toast.hide();
-                                  if (res.success) {
-                                    if (tipInfo.playerInfo != null) {
-                                      showSuccess(tipInfo.playerInfo.bonus);
+                  tipInfo.typeFlag == 4
+                      ? Padding(
+                          padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
+                          child: DefaultTextStyle(
+                            style: TextStyle(
+                              fontSize: 13,
+                              color: Colors.white54,
+                            ),
+                            child: Column(
+                              crossAxisAlignment: CrossAxisAlignment.start,
+                              children: <Widget>[
+                                Text('造成此情况等原因可能是:'),
+                                Text('1、确认开始游戏后没有授权系统进行录屏'),
+                                Text('2、视频没有录制到最后的分数名次结算页面就回到APP点击完成比赛了 '),
+                                Text('3、在游戏过程中,猿人点击APP后台进程被退出 '),
+                                Text('4、没有实际进行游戏比赛 '),
+                                Text('5、使用作弊手段录制视频'),
+                              ],
+                            ),
+                          ),
+                        )
+                      : Container(),
+                  tipInfo.typeFlag == 5
+                      ? Padding(
+                          padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
+                          child: DefaultTextStyle(
+                            style: TextStyle(
+                              fontSize: 13,
+                              color: Colors.white54,
+                            ),
+                            child: Column(
+                              crossAxisAlignment: CrossAxisAlignment.start,
+                              children: <Widget>[
+                                Text('造成此情况等原因可能是:'),
+                                Text('1、游戏结束后没有在规定时间内返回APP点击完成比赛按钮'),
+                              ],
+                            ),
+                          ),
+                        )
+                      : Container(),
+                  houseInfo != null && tipInfo.typeFlag != 4 && tipInfo.typeFlag != 5 ? RankContent(roomId: houseInfo.id.toString()) : Container(),
+                  houseInfo != null && type != 3 ? houseItem(roomInfo: houseInfo, gameInfo: gameInfo) : Container(),
+                  (type == 2 || type == 3)
+                      ? Container(
+                          width: double.infinity,
+                          height: 48,
+                          padding: EdgeInsets.symmetric(horizontal: 15),
+                          child: status == 0
+                              ? LinearButton(
+                                  btntext: '立即领取',
+                                  onTapHomeMenu: () async {
+                                    Toast.show(context, '加载中', -1, 'loading');
+                                    Result res = type == 2
+                                        ? await HttpManager.post('playerInfo/receive', data: {'id': tipInfo.playerId})
+                                        : await HttpManager.post('systemNotice/receive', data: {'id': widget.tipId});
+                                    Toast.hide();
+                                    if (res.success) {
+                                      if (tipInfo.playerInfo != null) {
+                                        showSuccess(tipInfo.playerInfo.bonus);
+                                      } else {
+                                        showSuccess(tipInfo.bonus);
+                                      }
+                                      getInfo();
                                     } else {
-                                      showSuccess(tipInfo.bonus);
+                                      Toast.show(context, res.error, 1000, 'info');
                                     }
-                                    getInfo();
-                                  } else {
-                                    Toast.show(context, res.error, 1000, 'info');
-                                  }
-                                },
-                              )
-                            : LinearButton(btntext: '已领取', colorList: [Color(0xFFC99C09), Color(0xFFC7873E)], textColor: Color(0xFF252532)),
-                      )
+                                  },
+                                )
+                              : LinearButton(btntext: '已领取', colorList: [Color(0xFFC99C09), Color(0xFFC7873E)], textColor: Color(0xFF252532)),
+                        )
 
-                    // RaisedButton(
-                    //   textColor: Colors.white,
-                    //   disabledColor: Color(0xFF763939),
-                    //   disabledTextColor: Color(0xFF252532),
-                    //   child: Text(status==0?'立即领取':'已领取'),
-                    //   onPressed: status==0?() async {
-                    //     Toast.show(context, '加载中', -1, 'loading');
-                    //     Result res = type == 2
-                    //         ? await HttpManager.post('playerInfo/receive',
-                    //             data: {'id': tipInfo.playerId})
-                    //         : await HttpManager.post('systemNotice/receive',
-                    //             data: {'id': widget.tipId});
-                    //     Toast.hide();
-                    //     if (res.success) {
-                    //       if (tipInfo.playerInfo != null) {
-                    //         showSuccess(tipInfo.playerInfo.bonus);
-                    //       } else {
-                    //         showSuccess(tipInfo.bonus);
-                    //       }
-                    //       getInfo();
-                    //     } else {
-                    //       Toast.show(context, res.error, 1000, 'info');
-                    //     }
-                    //   }:null,
-                    // ),
+                      // RaisedButton(
+                      //   textColor: Colors.white,
+                      //   disabledColor: Color(0xFF763939),
+                      //   disabledTextColor: Color(0xFF252532),
+                      //   child: Text(status==0?'立即领取':'已领取'),
+                      //   onPressed: status==0?() async {
+                      //     Toast.show(context, '加载中', -1, 'loading');
+                      //     Result res = type == 2
+                      //         ? await HttpManager.post('playerInfo/receive',
+                      //             data: {'id': tipInfo.playerId})
+                      //         : await HttpManager.post('systemNotice/receive',
+                      //             data: {'id': widget.tipId});
+                      //     Toast.hide();
+                      //     if (res.success) {
+                      //       if (tipInfo.playerInfo != null) {
+                      //         showSuccess(tipInfo.playerInfo.bonus);
+                      //       } else {
+                      //         showSuccess(tipInfo.bonus);
+                      //       }
+                      //       getInfo();
+                      //     } else {
+                      //       Toast.show(context, res.error, 1000, 'info');
+                      //     }
+                      //   }:null,
+                      // ),
 
-                    : Container(),
-                // CustomPaint(
-                //   painter: CircleProgressBarPainter(
-                //       Color(0xFFDCA659), Color(0xFFAE4945), 0.0, 270.0, 360.0, 18.0),
-                //   size: Size(108.0, 108.0),
-                // )
-              ],
+                      : Container(),
+                  // CustomPaint(
+                  //   painter: CircleProgressBarPainter(
+                  //       Color(0xFFDCA659), Color(0xFFAE4945), 0.0, 270.0, 360.0, 18.0),
+                  //   size: Size(108.0, 108.0),
+                  // )
+                ],
+              ),
             ),
           )),
       onWillPop: () {
@@ -195,6 +232,41 @@ class TipInfoState extends State<TipInfo> {
       },
     );
   }
+
+  List<TextSpan> _tipContent(content, context) {
+    // String content = '很遗憾,你在2019-06-05 09:23开始的游戏竞赛 [15166的吃鸡房间],[无有效结果],无法获得奖励,该局参赛人数[2]人。';
+    List<String> contentlist1 = content.split('[');
+    List<Map> totalContent = [];
+    contentlist1.forEach((item) {
+      List _list = item.split(']');
+      if (_list.length > 1) {
+        totalContent.add({
+          "content": _list[0],
+          "isImport": true,
+        });
+        totalContent.add({
+          "content": _list[1],
+          "isImport": false,
+        });
+      } else {
+        totalContent.add({
+          "content": _list[0],
+          "isImport": false,
+        });
+      }
+    });
+
+    List<TextSpan> _widgetList = [];
+    totalContent.forEach((item) {
+      if (item['isImport']) {
+        _widgetList.add(TextSpan(text: ' ' + item['content'] + ' ', style: TextStyle(color: Theme.of(context).primaryColor, fontWeight: FontWeight.w600)));
+      } else {
+        _widgetList.add(TextSpan(text: item['content']));
+      }
+    });
+
+    return _widgetList;
+  }
 }
 
 class houseItem extends StatelessWidget {
@@ -243,7 +315,9 @@ class houseItem extends StatelessWidget {
                               overflow: TextOverflow.ellipsis,
                             ),
                           ),
-                            Container(width: 5,),
+                          Container(
+                            width: 5,
+                          ),
                           ScoreType(roomInfo.scoreType)
                           // Container(
                           //   margin: EdgeInsets.only(left: 6),

+ 57 - 3
lib/pages/TipList.dart

@@ -155,7 +155,7 @@ class TipItem extends StatelessWidget {
                     children: <Widget>[
                       Text(readTimestamp(tipInfo.createTime, 'yyyy.MM.dd HH:mm:ss'), style: TextStyle(color: Color(0xFF9BA0AE), fontSize: 13)),
                       tipInfo.statusFlag == 0
-                          ? Text('未读', style: TextStyle(color:Theme.of(context).primaryColor, fontSize: 13, fontWeight: FontWeight.w600))
+                          ? Text('未读', style: TextStyle(color: Theme.of(context).primaryColor, fontSize: 13, fontWeight: FontWeight.w600))
                           : Text('已读', style: TextStyle(color: Color(0xFF000000), fontSize: 13, fontWeight: FontWeight.w600))
                     ],
                   ),
@@ -164,10 +164,24 @@ class TipItem extends StatelessWidget {
                   height: 1,
                   color: Colors.black26,
                 ),
+                // _tipContent(tipInfo.content),
                 Padding(
                   padding: EdgeInsets.only(top: 10, bottom: 15),
-                  child: Text(tipInfo.content, style: TextStyle(color: Colors.white, fontSize: 14)),
-                )
+                  child:Text.rich( TextSpan(
+                    style: TextStyle(color: Colors.white, fontSize: 14),
+                    children:_tipContent(tipInfo.content,context)
+                  )
+                  // DefaultTextStyle(
+                  //   //1.设置文本默认样式
+                  //   style: TextStyle(color: Colors.white, fontSize: 14),
+                  //   textAlign: TextAlign.start,
+                  //   child: Row(
+                  //     crossAxisAlignment: CrossAxisAlignment.start,
+                  //     children:_tipContent(tipInfo.content),
+                  //   ),
+                  // ),
+                  
+                ))
               ],
             ),
           ),
@@ -176,4 +190,44 @@ class TipItem extends StatelessWidget {
       ),
     );
   }
+
+  List<TextSpan> _tipContent(content,context) {
+    // String content = '很遗憾,你在2019-06-05 09:23开始的游戏竞赛 [15166的吃鸡房间],[无有效结果],无法获得奖励,该局参赛人数[2]人。';
+    List<String> contentlist1 = content.split('[');
+    List<Map> totalContent = [];
+    contentlist1.forEach((item) {
+      List _list = item.split(']');
+      if (_list.length > 1) {
+        totalContent.add({
+          "content": _list[0],
+          "isImport": true,
+        });
+        totalContent.add({
+          "content": _list[1],
+          "isImport": false,
+        });
+      } else {
+        totalContent.add({
+          "content": _list[0],
+          "isImport": false,
+        });
+      }
+    });
+    print(totalContent);
+
+    List<TextSpan> _widgetList=[];
+    totalContent.forEach((item){
+      if(item['isImport']){
+        _widgetList.add(TextSpan(text:' '+item['content']+' ',style:TextStyle(
+          color: Theme.of(context).primaryColor,
+          fontWeight:FontWeight.w600
+        )));
+      }
+      else{
+        _widgetList.add(TextSpan(text:item['content']));
+      }
+    });
+
+    return _widgetList;
+  }
 }