Bläddra i källkod

feat:v1.3版本的需求

Primroses 3 år sedan
förälder
incheckning
75acefa6fa

BIN
lib/assets/img/bbsmessage_icon_customerservice.png


BIN
lib/assets/img/bbsmessage_icon_like.png


BIN
lib/assets/img/bbsmessage_icon_notice.png


BIN
lib/assets/img/bbsmessage_icon_rank.png


BIN
lib/assets/img/bbsmessage_icon_reply.png


+ 29 - 24
lib/bean/post.dart

@@ -31,25 +31,26 @@ class Post {
   List<String> tags;
   String followStatus;
   String quoteData;
-
-  Post(
-      {this.id,
-      this.userId,
-      this.forumId,
-      this.title,
-      this.content,
-      this.images,
-      this.createdAt,
-      this.shareCount,
-      this.likeCount,
-      this.commentCount,
-      this.isGood,
-      this.nickname,
-      this.avatar,
-      this.createTime,
-      this.isLiked,
-      this.quoteData,
-      });
+  String gameName;
+  Post({
+    this.id,
+    this.userId,
+    this.forumId,
+    this.title,
+    this.content,
+    this.images,
+    this.createdAt,
+    this.shareCount,
+    this.likeCount,
+    this.commentCount,
+    this.isGood,
+    this.nickname,
+    this.avatar,
+    this.createTime,
+    this.isLiked,
+    this.quoteData,
+    this.gameName,
+  });
 
   Post.fromJson(Map<String, dynamic> json) {
     id = json['id'];
@@ -88,7 +89,9 @@ class Post {
     quoteCommentId = json['quote_comment_id'];
     forumName = json['forum_name'];
     forumCover = json['forum_cover'];
-    quoteSubject = json['quoteSubject'] != null ? new Post.fromJson(json['quoteSubject']) : null;
+    quoteSubject = json['quoteSubject'] != null
+        ? new Post.fromJson(json['quoteSubject'])
+        : null;
     tags = [];
     if (json['tags'] != null) {
       if (json['tags'] is List) {
@@ -103,6 +106,7 @@ class Post {
     }
     followStatus = json['follow_status'];
     quoteData = json['quote_data'];
+    gameName = json['game_name'];
   }
 
   Map<String, dynamic> toJson() {
@@ -131,6 +135,7 @@ class Post {
       data['quoteSubject'] = this.quoteSubject.toJson();
     }
     data['quote_data'] = this.quoteData;
+    data['game_name'] = this.gameName;
     return data;
   }
 
@@ -143,11 +148,11 @@ class Post {
     return max(0, likeCount + (isLiked ? 1 : -1));
   }
 
-  bool isFriend(){
+  bool isFriend() {
     return followStatus == "friends" || followStatus == "followed";
   }
-  bool isMe(int userId){
-    return int.parse(this.userId)  == userId;
+
+  bool isMe(int userId) {
+    return int.parse(this.userId) == userId;
   }
 }
-

+ 17 - 1
lib/bean/user.dart

@@ -121,6 +121,10 @@ class Achievement {
   String conditionDetail;
   String conditionMeasure;
   int userCount;
+  int seriesCount;
+  String seriesName;
+//  int conditionCount;
+//  int conditionProgress;
 
   Achievement(
       {this.id,
@@ -134,7 +138,11 @@ class Achievement {
         this.createdAt,
         this.conditionDetail,
         this.conditionMeasure,
-        this.userCount
+        this.userCount,
+        this.seriesCount,
+        this.seriesName,
+//        this.conditionCount,
+//        this.conditionProgress,
       });
 
   Achievement.fromJson(Map<String, dynamic> json) {
@@ -151,6 +159,10 @@ class Achievement {
     conditionDetail = json['condition_detail'];
     conditionMeasure = json['condition_measure'];
     userCount = json['user_count'];
+    seriesCount = json['series_count'];
+    seriesName = json['series_name'];
+//    conditionProgress = json['condition_progress'];
+//    conditionCount = json['condition_count'];
   }
 
   Map<String, dynamic> toJson() {
@@ -168,6 +180,10 @@ class Achievement {
     data['condition_detail'] = this.conditionDetail;
     data['condition_measure'] = this.conditionMeasure;
     data['user_count'] = this.userCount;
+    data['series_count'] = this.seriesCount;
+    data['series_name'] = this.seriesName;
+//    data['condition_progress'] = this.conditionProgress;
+//    data['condition_count'] = this.conditionCount;
     return data;
   }
 }

+ 18 - 3
lib/bean/user_friend.dart

@@ -1,7 +1,8 @@
+import 'package:azlistview/azlistview.dart';
 import 'package:sport/bean/user_info.dart';
 import 'package:sport/services/Converter.dart';
 
-class UserFriend {
+class UserFriend extends ISuspensionBean{
   int uid;
   String isFriends;
   int isIgnore;
@@ -9,14 +10,20 @@ class UserFriend {
   String createdAt;
   String updatedAt;
   UserInfo socialInfo;
-
+  String makeFrom;
+  String name;
+  String avatar;
   UserFriend(
       {this.uid,
       this.isFriends,
       this.groups,
       this.createdAt,
       this.updatedAt,
-      this.socialInfo});
+      this.socialInfo,
+      this.makeFrom,
+        this.name,
+        this.avatar,
+      });
 
   UserFriend.fromJson(Map<String, dynamic> json) {
     uid = Converter.toInt(json['uid']);
@@ -28,6 +35,9 @@ class UserFriend {
     socialInfo = json['socialInfo'] != null
         ? new UserInfo.fromJson(json['socialInfo'])
         : null;
+    makeFrom = json['make_from'];
+    name = json['name'];
+    avatar = json['avatar'];
   }
 
   Map<String, dynamic> toJson() {
@@ -40,8 +50,13 @@ class UserFriend {
     if (this.socialInfo != null) {
       data['socialInfo'] = this.socialInfo.toJson();
     }
+    data['make_from'] = this.makeFrom;
+    data['name'] = this.name;
+    data['avatar'] = this.avatar;
     return data;
   }
+  @override
+  String getSuspensionTag() => '$uid';
 }
 
 class NewFriend {

+ 2 - 1
lib/pages/home_page.dart

@@ -8,6 +8,7 @@ import 'package:sport/config_inject.dart';
 import 'package:sport/pages/game/index.dart';
 import 'package:sport/pages/home/home_info_page.dart';
 import 'package:sport/pages/my/my_page.dart';
+import 'package:sport/pages/social/new_social_index_page.dart';
 import 'package:sport/pages/social/social_index_page.dart';
 import 'package:sport/provider/bluetooth.dart';
 import 'package:sport/provider/message_model.dart';
@@ -32,7 +33,7 @@ class _HomePageState extends LifecycleState<HomePage> with ConfigInject {
   ValueNotifier<int> _valueNotifierIndex = ValueNotifier(0);
   final Duration _exitDuration = Duration(seconds: 2);
 
-  final List<Widget> _pages = <Widget>[HomeInfoPage(), GamePage(), SocialIndexPage(), MyPage()];
+  final List<Widget> _pages = <Widget>[HomeInfoPage(), GamePage(), NewSocialIndexPage(), MyPage()];
 
 
   @override

+ 411 - 159
lib/pages/my/achievement_detail_page.dart

@@ -5,7 +5,9 @@ import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_easyrefresh/easy_refresh.dart';
 import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
+import 'package:flutter_swiper/flutter_swiper.dart';
 import 'package:sport/bean/achievement_detail_info.dart';
+import 'package:sport/bean/user.dart';
 import 'package:sport/provider/lib/provider_widget.dart';
 import 'package:sport/provider/lib/simple_model.dart';
 import 'package:sport/services/api/inject_api.dart';
@@ -33,167 +35,177 @@ class _PageState extends State<AchievementDetailPage> with InjectLoginApi {
   @override
   void initState() {
     super.initState();
-    _model = SimpleModel((page) async {
-      return List()..add((await loginApi.getAchieveDetailInfo(widget.id, userId: widget.userId == 0 ? null : "${widget.userId}")).data);
-    });
+//    _model = SimpleModel((page) async {
+//      return List()..add((await loginApi.getAchieveDetailInfo(widget.id, userId: widget.userId == 0 ? null : "${widget.userId}")).data);
+//    });
   }
 
+//  @override
+//  Widget build(BuildContext context) {
+//    return Scaffold(
+////        backgroundColor: Color(0xffF1F1F1),
+//        body: ProviderWidget<SimpleModel>(
+//      model: _model,
+//      onModelReady: (model) => model.initData(),
+//      builder: (_, model, __) {
+//        AchieveDetailInfoData _data = _model.list?.isNotEmpty == true ? _model.list.first : AchieveDetailInfoData();
+//        return EasyRefresh.custom(
+//          controller: model.refreshController,
+//          enableControlFinishRefresh: true,
+//          enableControlFinishLoad: true,
+//          // onRefresh: () => model.refresh(),
+////              header: buildClassicalHeader(),
+////              footer: buildClassicalFooter(),
+//          slivers: <Widget>[
+//            buildSliverAppBar(context, "成就详情", backgroundColor: Theme.of(context).scaffoldBackgroundColor),
+//            if (model.isBusy)
+//              SliverToBoxAdapter(
+//                child: RequestLoadingWidget(),
+//              ),
+//            if (model.isIdle)
+//              SliverToBoxAdapter(
+//                child: BoxWidget(
+//                  body: Column(
+//                    crossAxisAlignment: CrossAxisAlignment.center,
+//                    children: <Widget>[
+//                      Space(height: 10.0),
+//                      CachedNetworkImage(
+//                        width: 130.0,
+//                        height: 130.0,
+//                        imageUrl: _data.logo ?? "",
+//                      ),
+//                      Space(height: 12.0),
+//                      Text("${_data.name}", style: Theme.of(context).textTheme.headline3),
+//                      Space(height: 17.0),
+//                      Divider(),
+//                      Space(height: 12.0),
+//                      Row(
+//                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+//                        children: <Widget>[
+//                          Text("成就名称:", style: Theme.of(context).textTheme.subtitle1),
+//                          Text("${_data.name}", style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor))
+//                        ],
+//                      ),
+//                      Space(height: 8.0),
+//                      Row(
+//                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+//                        children: <Widget>[
+//                          Text("成就条件:", style: Theme.of(context).textTheme.subtitle1),
+//                          Text("${_data.conditionDetail}", style: Theme.of(context).textTheme.bodyText2)
+//                        ],
+//                      ),
+//                      Space(height: 8.0),
+//                      Row(
+//                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+//                        children: <Widget>[
+//                          Text("获取时间:", style: Theme.of(context).textTheme.subtitle1),
+//                          Text("${_data.createdAt ?? '未获得成就'}", style: Theme.of(context).textTheme.bodyText2)
+//                        ],
+//                      ),
+//                      Space(height: 8.0),
+//                    ],
+//                  ),
+//                ),
+//              ),
+//            if (model.isIdle)
+//              SliverToBoxAdapter(
+//                child: BoxWidget(
+//                  body: Column(
+//                    crossAxisAlignment: CrossAxisAlignment.start,
+//                    children: <Widget>[
+//                      Row(
+//                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+//                        children: <Widget>[
+//                          Text("晋级奖励:", style: Theme.of(context).textTheme.subtitle1),
+//                          Text("经验值 +${_data.rewardExp} 积分+${_data.rewardScore}",
+//                              style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor))
+//                        ],
+//                      ),
+//                      Space(height: 4.0),
+//                      Divider(),
+//                      Space(height: 4.0),
+//                      Text("晋级进度: ", style: Theme.of(context).textTheme.subtitle1),
+//                      Padding(
+//                        padding: EdgeInsets.symmetric(vertical: 10.0),
+//                        child: ClipRRect(
+//                          borderRadius: BorderRadius.circular(12),
+//                          child: Container(
+//                            child: CustomPaint(
+//                              painter: _ProgressBar(
+//                                ((_data?.nextConditionCount ?? 0) > 0) ? _data.conditionProgress / _data.nextConditionCount : 0,
+//                              ),
+//                              child: Container(
+//                                height: 8,
+//                              ),
+//                            ),
+//                          ),
+//                        ),
+//                      ),
+//                      Row(
+//                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+//                        children: <Widget>[
+//                          Text('${_data.conditionProgress}${_data.conditionMeasure}', style: Theme.of(context).textTheme.bodyText1.copyWith(fontSize: 11.0)),
+//                          Text('${_data.nextConditionCount}${_data.conditionMeasure}', style: Theme.of(context).textTheme.bodyText1.copyWith(fontSize: 11.0))
+//                        ],
+//                      )
+//                    ],
+//                  ),
+//                ),
+//              ),
+//            if (model.isIdle)
+//              SliverToBoxAdapter(
+//                  child: Padding(
+//                padding: const EdgeInsets.all(12.0),
+//                child: Column(
+//                  children: <Widget>[
+//                    Row(
+//                      children: <Widget>[
+//                        Expanded(
+//                          child: Divider(
+//                            endIndent: 10.0,
+//                          ),
+//                        ),
+//                        Text("成就组"),
+//                        Expanded(
+//                            child: Divider(
+//                          indent: 10.0,
+//                        )),
+//                      ],
+//                    ),
+//                  ],
+//                ),
+//              )),
+//            if (_data.relateAchievements?.length == 0)
+//              Padding(padding: const EdgeInsets.all(24.0), child: Text("没有关联成就", style: Theme.of(context).textTheme.bodyText1)),
+//            if (model.isIdle && _data.relateAchievements.isNotEmpty)
+//              SliverToBoxAdapter(
+//                child: Text("${_data.relateAchievements}"),
+//              ),
+////              SliverToBoxAdapter(
+////                child: StaggeredGridView.countBuilder(
+////                  padding: EdgeInsets.symmetric(horizontal: 12.0),
+////                  shrinkWrap: true,
+////                  physics: NeverScrollableScrollPhysics(),
+////                  crossAxisCount: 4,
+////                  itemCount: _data.relateAchievements?.length,
+////                  itemBuilder: (BuildContext context, int index) =>
+////                      achievementWidget(context, _data.relateAchievements[index], replace: true, isRadius: false, jump: false),
+////                  mainAxisSpacing: 12.0,
+////                  crossAxisSpacing: 12.0,
+////                  staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
+////                ),
+////              )
+//          ],
+//        );
+//      },
+//    ));
+//  }
+
   @override
   Widget build(BuildContext context) {
-    return Scaffold(
-//        backgroundColor: Color(0xffF1F1F1),
-        body: ProviderWidget<SimpleModel>(
-      model: _model,
-      onModelReady: (model) => model.initData(),
-      builder: (_, model, __) {
-        AchieveDetailInfoData _data = _model.list?.isNotEmpty == true ? _model.list.first : AchieveDetailInfoData();
-        return EasyRefresh.custom(
-          controller: model.refreshController,
-          enableControlFinishRefresh: true,
-          enableControlFinishLoad: true,
-          // onRefresh: () => model.refresh(),
-//              header: buildClassicalHeader(),
-//              footer: buildClassicalFooter(),
-          slivers: <Widget>[
-            buildSliverAppBar(context, "成就详情", backgroundColor: Theme.of(context).scaffoldBackgroundColor),
-            if (model.isBusy)
-              SliverToBoxAdapter(
-                child: RequestLoadingWidget(),
-              ),
-            if (model.isIdle)
-              SliverToBoxAdapter(
-                child: BoxWidget(
-                  body: Column(
-                    crossAxisAlignment: CrossAxisAlignment.center,
-                    children: <Widget>[
-                      Space(height: 10.0),
-                      CachedNetworkImage(
-                        width: 130.0,
-                        height: 130.0,
-                        imageUrl: _data.logo ?? "",
-                      ),
-                      Space(height: 12.0),
-                      Text("${_data.name}", style: Theme.of(context).textTheme.headline3),
-                      Space(height: 17.0),
-                      Divider(),
-                      Space(height: 12.0),
-                      Row(
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                        children: <Widget>[
-                          Text("成就名称:", style: Theme.of(context).textTheme.subtitle1),
-                          Text("${_data.name}", style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor))
-                        ],
-                      ),
-                      Space(height: 8.0),
-                      Row(
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                        children: <Widget>[
-                          Text("成就条件:", style: Theme.of(context).textTheme.subtitle1),
-                          Text("${_data.conditionDetail}", style: Theme.of(context).textTheme.bodyText2)
-                        ],
-                      ),
-                      Space(height: 8.0),
-                      Row(
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                        children: <Widget>[
-                          Text("获取时间:", style: Theme.of(context).textTheme.subtitle1),
-                          Text("${_data.createdAt ?? '未获得成就'}", style: Theme.of(context).textTheme.bodyText2)
-                        ],
-                      ),
-                      Space(height: 8.0),
-                    ],
-                  ),
-                ),
-              ),
-            if (model.isIdle)
-              SliverToBoxAdapter(
-                child: BoxWidget(
-                  body: Column(
-                    crossAxisAlignment: CrossAxisAlignment.start,
-                    children: <Widget>[
-                      Row(
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                        children: <Widget>[
-                          Text("晋级奖励:", style: Theme.of(context).textTheme.subtitle1),
-                          Text("经验值 +${_data.rewardExp} 积分+${_data.rewardScore}",
-                              style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor))
-                        ],
-                      ),
-                      Space(height: 4.0),
-                      Divider(),
-                      Space(height: 4.0),
-                      Text("晋级进度: ", style: Theme.of(context).textTheme.subtitle1),
-                      Padding(
-                        padding: EdgeInsets.symmetric(vertical: 10.0),
-                        child: ClipRRect(
-                          borderRadius: BorderRadius.circular(12),
-                          child: Container(
-                            child: CustomPaint(
-                              painter: _ProgressBar(
-                                ((_data?.nextConditionCount ?? 0) > 0) ? _data.conditionProgress / _data.nextConditionCount : 0,
-                              ),
-                              child: Container(
-                                height: 8,
-                              ),
-                            ),
-                          ),
-                        ),
-                      ),
-                      Row(
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                        children: <Widget>[
-                          Text('${_data.conditionProgress}${_data.conditionMeasure}', style: Theme.of(context).textTheme.bodyText1.copyWith(fontSize: 11.0)),
-                          Text('${_data.nextConditionCount}${_data.conditionMeasure}', style: Theme.of(context).textTheme.bodyText1.copyWith(fontSize: 11.0))
-                        ],
-                      )
-                    ],
-                  ),
-                ),
-              ),
-            if (model.isIdle)
-              SliverToBoxAdapter(
-                  child: Padding(
-                padding: const EdgeInsets.all(12.0),
-                child: Column(
-                  children: <Widget>[
-                    Row(
-                      children: <Widget>[
-                        Expanded(
-                          child: Divider(
-                            endIndent: 10.0,
-                          ),
-                        ),
-                        Text("成就组"),
-                        Expanded(
-                            child: Divider(
-                          indent: 10.0,
-                        )),
-                      ],
-                    ),
-                  ],
-                ),
-              )),
-            if (_data.relateAchievements?.length == 0)
-              Padding(padding: const EdgeInsets.all(24.0), child: Text("没有关联成就", style: Theme.of(context).textTheme.bodyText1)),
-            if (model.isIdle && _data.relateAchievements.isNotEmpty)
-              SliverToBoxAdapter(
-                child: StaggeredGridView.countBuilder(
-                  padding: EdgeInsets.symmetric(horizontal: 12.0),
-                  shrinkWrap: true,
-                  physics: NeverScrollableScrollPhysics(),
-                  crossAxisCount: 4,
-                  itemCount: _data.relateAchievements?.length,
-                  itemBuilder: (BuildContext context, int index) =>
-                      achievementWidget(context, _data.relateAchievements[index], replace: true, isRadius: false, jump: false),
-                  mainAxisSpacing: 12.0,
-                  crossAxisSpacing: 12.0,
-                  staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
-                ),
-              )
-          ],
-        );
-      },
-    ));
+    // TODO: implement build
+//    throw UnimplementedError();
+    return Material(color: Colors.black.withOpacity(0.5), child: Column());
   }
 }
 
@@ -216,7 +228,9 @@ class _ProgressBar extends CustomPainter {
     double indicator = size.width * min(1.0, this.percent);
     canvas.save();
     var rect = Rect.fromLTRB(0, size.height - 13, size.width, size.height);
-    canvas.clipRRect(RRect.fromRectAndRadius(rect, Radius.circular(size.height / 2)), doAntiAlias: true);
+    canvas.clipRRect(
+        RRect.fromRectAndRadius(rect, Radius.circular(size.height / 2)),
+        doAntiAlias: true);
 
     canvas.drawRect(rect, _paint);
 
@@ -226,7 +240,10 @@ class _ProgressBar extends CustomPainter {
         end: Alignment.centerRight,
         colors: <Color>[Color(0xffFFE600), Color(0xffFF9100)],
       ).createShader(rect);
-    canvas.drawRect(Rect.fromLTRB(0, size.height - 13, size.width * this.percent, size.height), _valuePaint);
+    canvas.drawRect(
+        Rect.fromLTRB(
+            0, size.height - 13, size.width * this.percent, size.height),
+        _valuePaint);
 
     canvas.restore();
 
@@ -243,3 +260,238 @@ class _ProgressBar extends CustomPainter {
     return false;
   }
 }
+
+Future<bool> showSharePopup(
+    BuildContext context, List<Achievement> relateAchievements, int id) {
+  Iterable<Achievement> item =
+      relateAchievements.where((element) => element.id == id);
+  int startIndex = relateAchievements.indexOf(item.toList()[0]);
+  ValueNotifier<int> _valueNotifierIndex = ValueNotifier(startIndex);
+  int currentIndex = startIndex;
+
+  return showGeneralDialog<bool>(
+      context: context,
+      barrierDismissible: true,
+      barrierLabel: '',
+      barrierColor: Color(0xff241D19).withOpacity(0.8),
+      transitionDuration: Duration(milliseconds: 200),
+//                              useRootNavigator: false,
+      pageBuilder: (BuildContext context, Animation<double> animation,
+          Animation<double> secondaryAnimation) {
+        return Center(
+          child: Material(
+            color: Colors.transparent,
+            child: Column(
+              mainAxisSize: MainAxisSize.min,
+              children: <Widget>[
+                Space(
+                  height: MediaQuery.of(context).padding.top + 31,
+                ),
+                Center(
+                  child: Column(
+                    children: <Widget>[                Container(
+                        padding: EdgeInsets.symmetric(horizontal: 17.0),
+                        alignment: Alignment.centerRight,
+                        child: InkWell(
+                          child: Container(
+                            width: 22.0,
+                            height: 22.0,
+                            decoration: BoxDecoration(
+                                image: DecorationImage(
+                                    image: AssetImage(
+                                        "lib/assets/img/btn_close_white.png"))),
+                          ),
+                          onTap: () {
+                            Navigator.pop(context, false);
+                          },
+                        )),
+//                  Space(
+//                    height: 145,
+//                  ),
+                      Container(
+                        height: 278,
+                        child: new Swiper(
+                          index: startIndex,
+                          itemBuilder: (BuildContext context, int index) {
+                            return Column(
+                              children: <Widget>[
+                                relateAchievements[index].createdAt != ""
+                                    ? CachedNetworkImage(
+                                  imageUrl: relateAchievements[index].logo,
+                                  width: 180,
+                                  height: 180,
+                                )
+                                    : ColorFiltered(
+                                  colorFilter: ColorFilter.matrix(<double>[
+                                    0.2126,
+                                    0.7152,
+                                    0.0722,
+                                    0,
+                                    0,
+                                    0.2126,
+                                    0.7152,
+                                    0.0722,
+                                    0,
+                                    0,
+                                    0.2126,
+                                    0.7152,
+                                    0.0722,
+                                    0,
+                                    0,
+                                    0,
+                                    0,
+                                    0,
+                                    1,
+                                    0,
+                                  ]),
+                                  child: CachedNetworkImage(
+//                                      width: 70.0,
+//                                      height: 70.0,
+                                      imageUrl: relateAchievements[index].logo),
+                                ),
+                                if(index ==currentIndex)
+                                  Column(
+                                    children: <Widget>[
+                                      Space(
+                                        height: 20.0,
+                                      ),
+                                      Text(
+                                        "${relateAchievements[index].name}",
+                                        style:
+                                        TextStyle(fontSize: 18.0, color: Colors.white),
+                                      ),
+                                      Space(
+                                        height: 5.0,
+                                      ),
+                                      Text("${relateAchievements[index].conditionDetail}",
+                                          style: TextStyle(
+                                              fontSize: 14.0, color: Color(0xff999999))),
+                                    ],
+                                  )
+                              ],
+                            );
+                          },
+                          viewportFraction: 0.5,
+                          scale: 0.3,
+                          itemCount: relateAchievements.length,
+                          pagination: new SwiperPagination(
+                              margin: new EdgeInsets.symmetric(vertical: 0.0),
+                              builder: DotSwiperPaginationBuilder(
+                                  size: 6,
+                                  activeSize: 6,
+                                  activeColor: Theme.of(context).accentColor)),
+                          onIndexChanged: (index) {
+                            _valueNotifierIndex.value = index;
+                            currentIndex = index;
+                          },
+                        ),
+                      ),
+                      ConstrainedBox(
+                        constraints: BoxConstraints(minHeight: 250),
+                        child: ValueListenableBuilder(
+                            valueListenable: _valueNotifierIndex,
+                            builder: (BuildContext context, int value, Widget child) {
+                              if (currentIndex == value) {
+                                return relateAchievements[value].createdAt != ""
+                                    ? Column(
+                                  mainAxisSize: MainAxisSize.min,
+                                  children: <Widget>[
+                                    Space(
+                                      height: 57.0,
+                                    ),
+                                    Text(
+                                        "获取时间  ${relateAchievements[value].createdAt.split(" ")[0]}"),
+                                    Space(
+                                      height: 16.0,
+                                    ),
+                                    Container(
+                                      alignment: Alignment.center,
+                                      height: 25.0,
+                                      width:
+                                      MediaQuery.of(context).size.width * 0.7,
+                                      decoration: BoxDecoration(
+                                          image: DecorationImage(
+                                              image: AssetImage(
+                                                  "lib/assets/img/bg1_pop_achievement.png"))),
+                                      child: Text(
+                                        "晋级奖励 : 经验值 +${relateAchievements[value].rewardExp} 积分 +${relateAchievements[value].rewardScore}",
+                                        style: TextStyle(
+                                            fontSize: 14.0,
+                                            color: Theme.of(context).accentColor),
+                                      ),
+                                    ),
+                                  ],
+                                )
+                                    : Column(
+                                  children: <Widget>[
+                                    Space(
+                                      height: 57.0,
+                                    ),
+                                    Text("未获得"),
+                                    Space(
+                                      height: 14.0,
+                                    ),
+                                    Text(
+                                      "成就条件: ${relateAchievements[value].conditionDetail}",
+                                      style: TextStyle(
+                                          fontSize: 14.0,
+                                          color: Color(0xff999999)),
+                                    ),
+                                    Space(
+                                      height: 8.0,
+                                    ),
+                                    Text(
+                                      "晋级奖励 : 经验值 +${relateAchievements[value].rewardExp} 积分 +${relateAchievements[value].rewardScore}",
+                                      style: TextStyle(
+                                          fontSize: 14.0,
+                                          color: Color(0xff999999)),
+                                    ),
+                                    Space(
+                                      height: 16.0,
+                                    ),
+                                    Padding(
+                                      padding:
+                                      EdgeInsets.symmetric(vertical: 10.0),
+                                      child: ClipRRect(
+                                        borderRadius: BorderRadius.circular(12),
+                                        child: Container(
+                                          width:183.0,
+                                          child: CustomPaint(
+                                            painter: _ProgressBar(
+                                              ((relateAchievements[value]
+                                                  ?.conditionProgress ??
+                                                  0) >
+                                                  0)
+                                                  ? relateAchievements[value]
+                                                  .conditionProgress /
+                                                  relateAchievements[value]
+                                                      .conditionCount
+                                                  : 0,
+                                            ),
+                                            child: Container(
+                                              height: 8,
+                                            ),
+                                          ),
+                                        ),
+                                      ),
+                                    ),
+                                    Space(
+                                      height: 5.0,
+                                    ),
+                                    Text(
+                                        "${relateAchievements[value].conditionProgress} / ${relateAchievements[value].conditionCount}")
+                                  ],
+                                );
+                              } else {
+                                return Container();
+                              }
+                            }),
+                      )],
+                  ),
+                )
+              ],
+            ),
+          ),
+        );
+      });
+}

+ 257 - 119
lib/pages/my/achievement_page.dart

@@ -25,144 +25,261 @@ class AchievementPage extends StatefulWidget {
 
 class _PageState extends State<AchievementPage> {
   AchievementInfoModel _achievementInfoModel = new AchievementInfoModel(1);
-
+  ScrollController _controller;
+  double _expandedHeight = 0;
+  int _brightness = 0;
   @override
   void initState() {
     // TODO: implement initState
     super.initState();
     initData();
+    _controller = ScrollController()
+      ..addListener(() {
+//        print(
+//            "[_controller.position.pixels] -------------------------- ${_controller.position.pixels}");
+        print("[_brightness]--------------------------$_brightness");
+        if (_controller.position.pixels >= 70) {
+          if (_brightness == 0) {
+            setState(() {
+              _brightness = 1;
+            });
+          }
+        } else {
+          if (_brightness == 1) {
+            setState(() {
+              _brightness = 0;
+            });
+          }
+        }
+      });
   }
 
   initData() async {
     await _achievementInfoModel.getAchievementInfo();
   }
 
+  initScrollController() {}
+
   @override
   Widget build(BuildContext context) {
     return Scaffold(
-      // provider 只能有一个?
-      body: CustomScrollView(slivers: <Widget>[
-        buildSliverAppBar(context, "我的成就", backgroundColor: Theme.of(context).scaffoldBackgroundColor),
-        SliverToBoxAdapter(
-            child: Padding(
-          padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 13.0),
-          child: Column(
-            children: <Widget>[
-              Row(children: <Widget>[
-                Text("我的勋章: ", style: Theme.of(context).textTheme.bodyText2.copyWith(color: Color(0xff666666))),
-                Text("${widget.data.getAchievementCount}枚勋章已获得", style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor))
-              ]),
-              Padding(
-                padding: EdgeInsets.symmetric(vertical: 10.0),
-                child: ClipRRect(
-                  borderRadius: BorderRadius.circular(10),
-                  child: Container(
-                    child: CustomPaint(
-                      painter: _ProgressBar(
-//                                1.0
-                        widget.data.exp / (widget.data.nextLevelExp + widget.data.exp), Color(0xffdcdcdc)
-                      ),
-                      child: Container(
-                        height: 12,
-                      ),
-                    ),
-                  ),
-                ),
-              ),
-              Container(
-                alignment: Alignment.centerLeft,
-                child: Text("收集进度 ${widget.data.getAchievementPercent}%", style: Theme.of(context).textTheme.bodyText1.copyWith(fontSize: 11.0)),
-              ),
-            ],
+        body: Stack(
+      alignment: Alignment.topCenter,
+      children: <Widget>[
+        Container(
+          color: Color(0xff241D19),
+          height: double.infinity,
+        ),
+        Positioned(
+          top: 0,
+          left: 0,
+          right: 0,
+          child: Image.asset(
+            'lib/assets/img/myachievements_bg.png',
+            fit: BoxFit.fitWidth,
+          ),
+        ),
+        CustomScrollView(controller: _controller, slivers: <Widget>[
+          buildSliverAppBar(
+            context,
+            "我的成就",
+            backgroundColor: _brightness == 0
+                ? Color(0x00000000)
+                : Color(0xffffffff),
+            brightness: _brightness == 0 ? 1 : 0,
+            textStyle: _brightness == 0
+                ? TextStyle(
+                fontWeight: FontWeight.w600,
+                fontSize: 18.0,
+                color: Color(0xffffffff))
+                : TextStyle(
+                fontWeight: FontWeight.w600,
+                fontSize: 18.0,
+                color: Color(0xff333333)),
+            whiteBackButton: _brightness == 0 ? true : false,
+            canBack: _brightness == 0 ? false : true,
           ),
-        )),
-        SliverToBoxAdapter(
-          child: BoxWidget(
-            body: Column(
+          SliverToBoxAdapter(
+              child: Padding(
+            padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 13.0),
+            child: Column(
               children: <Widget>[
-                Padding(
-                  padding: const EdgeInsets.symmetric(vertical: 8.0),
-                  child: Row(
+                Row(
+                    crossAxisAlignment: CrossAxisAlignment.end,
                     children: <Widget>[
-                      Expanded(
-                        child: Divider(
-                          endIndent: 10.0,
+                      RichText(
+                        text: TextSpan(
+                          text: '累计获得',
+                          style: Theme.of(context)
+                              .textTheme
+                              .bodyText2
+                              .copyWith(color: Color(0xff666666)),
+                          children: <TextSpan>[
+                            TextSpan(
+                                text: "${widget.data.getAchievementCount}",
+                                style: Theme.of(context)
+                                    .textTheme
+                                    .bodyText2
+                                    .copyWith(
+                                        color: Theme.of(context).accentColor,
+                                        fontSize: 28.0)),
+                            TextSpan(
+                                text: '枚勋章',
+                                style: Theme.of(context)
+                                    .textTheme
+                                    .bodyText2
+                                    .copyWith(color: Color(0xff666666)))
+                          ],
+                        ),
+                      )
+                    ]),
+                Padding(
+                  padding: EdgeInsets.symmetric(vertical: 10.0),
+                  child: ClipRRect(
+                    borderRadius: BorderRadius.circular(10),
+                    child: Container(
+                      alignment: Alignment.centerLeft,
+                      child: CustomPaint(
+                        painter: _ProgressBar(
+//                                1.0
+                            widget.data.exp /
+                                (widget.data.nextLevelExp + widget.data.exp),
+                            Color(0xffdcdcdc)),
+                        child: Container(
+                          height: 12,
+                          width: 120,
                         ),
                       ),
-                      Text("已获得成就"
-                         , style: Theme.of(context).textTheme.bodyText1,),
-                      Expanded(
-                          child: Divider(
-                        indent: 10.0,
-                      )),
-                    ],
+                    ),
                   ),
                 ),
-                if (widget.data.getAchievementList.length == 0)
-                  Padding(
-                      padding: const EdgeInsets.all(24.0),
-                      child: Column(
-                        children: <Widget>[
-                          Image.asset("lib/assets/img/${RequestErrorWidget.ASSETS_NO_RANK}"),
-                          Padding(
-                            padding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
-                            child: Text("还未获得任何成就",style: Theme.of(context).textTheme.bodyText2,),
-                          ),
-                        ],
-                      )),
-                if (widget.data.getAchievementList.length > 0)
+                Container(
+                  alignment: Alignment.centerLeft,
+                  child: Text("收集进度 ${widget.data.getAchievementPercent}%",
+                      style: Theme.of(context)
+                          .textTheme
+                          .bodyText1
+                          .copyWith(fontSize: 11.0)),
+                ),
+              ],
+            ),
+          )),
+          SliverToBoxAdapter(
+            child: BoxWidget(
+              body: Column(
+                children: <Widget>[
                   Padding(
-                    padding: EdgeInsets.symmetric(vertical: 16.0),
-                    child: StaggeredGridView.countBuilder(
-                      padding: EdgeInsets.zero,
-                      shrinkWrap: true,
-                      physics: NeverScrollableScrollPhysics(),
-                      crossAxisCount: 3,
-                      itemCount: widget.data.getAchievementList.length,
-                      itemBuilder: (BuildContext context, int index) => achievementWidget(context, widget.data.getAchievementList[index], isRadius: false,w: 84),
-                      mainAxisSpacing: 18.0,
-                      crossAxisSpacing: 12.0,
-                      staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
-                    ),
-                  ),
-                if (widget.data.getAchievementList.length > 0)
-                  Center(
+                    padding: const EdgeInsets.symmetric(vertical: 8.0),
                     child: Row(
-                      mainAxisSize: MainAxisSize.min,
                       children: <Widget>[
-                        Image.asset("lib/assets/img/icon_problem.png"),
-                        SizedBox(width: 2,),
+                        Expanded(
+                          child: Divider(
+                            endIndent: 10.0,
+                          ),
+                        ),
                         Text(
-                          "默认排序按最近获得顺序",
-                          style: Theme.of(context).textTheme.bodyText1.copyWith(color: Color(0xffcecece)),
+                          "已获得成就",
+                          style: Theme.of(context).textTheme.bodyText1,
                         ),
+                        Expanded(
+                            child: Divider(
+                          indent: 10.0,
+                        )),
                       ],
                     ),
                   ),
-                Padding(
-                  padding: EdgeInsets.only(top: 31.0),
-                  child: Row(
-                    children: <Widget>[
-                      Expanded(
-                        child: Divider(
-                          endIndent: 10.0,
-                        ),
+                  if (widget.data.getAchievementList.length == 0)
+                    Padding(
+                        padding: const EdgeInsets.all(24.0),
+                        child: Column(
+                          children: <Widget>[
+                            Image.asset(
+                                "lib/assets/img/${RequestErrorWidget.ASSETS_NO_RANK}"),
+                            Padding(
+                              padding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
+                              child: Text(
+                                "还未获得任何成就",
+                                style: Theme.of(context).textTheme.bodyText2,
+                              ),
+                            ),
+                          ],
+                        )),
+                  if (widget.data.getAchievementList.length > 0)
+                    Padding(
+                      padding: EdgeInsets.symmetric(vertical: 16.0),
+                      child: StaggeredGridView.countBuilder(
+                        padding: EdgeInsets.zero,
+                        shrinkWrap: true,
+                        physics: NeverScrollableScrollPhysics(),
+                        crossAxisCount: 3,
+                        itemCount: widget.data.getAchievementList.length > 6
+                            ? widget.data.getAchievementList
+                                .sublist(0, 6)
+                                .length
+                            : widget.data.getAchievementList.length,
+                        itemBuilder: (BuildContext context, int index) =>
+                            achievementWidget(
+                                context, widget.data.getAchievementList[index],
+                                isRadius: false, w: 84, showCount: true),
+                        mainAxisSpacing: 18.0,
+                        crossAxisSpacing: 12.0,
+                        staggeredTileBuilder: (int index) =>
+                            StaggeredTile.fit(1),
                       ),
-                      Text("未获得成就", style: Theme.of(context).textTheme.bodyText1),
-                      Expanded(
+                    ),
+//                  if (widget.data.getAchievementList.length > 0)
+//                    Center(
+//                      child: Row(
+//                        mainAxisSize: MainAxisSize.min,
+//                        children: <Widget>[
+//                          Image.asset("lib/assets/img/icon_problem.png"),
+//                          SizedBox(
+//                            width: 2,
+//                          ),
+//                          Text(
+//                            "默认排序按最近获得顺序",
+//                            style: Theme.of(context)
+//                                .textTheme
+//                                .bodyText1
+//                                .copyWith(color: Color(0xffcecece)),
+//                          ),
+//                        ],
+//                      ),
+//                    ),
+                ],
+              ),
+            ),
+          ),
+          SliverToBoxAdapter(
+            child: BoxWidget(
+              body: Column(
+                children: <Widget>[
+                  Padding(
+                    padding: EdgeInsets.only(top: 31.0),
+                    child: Row(
+                      children: <Widget>[
+                        Expanded(
                           child: Divider(
-                        indent: 10.0,
-                      )),
-                    ],
+                            endIndent: 10.0,
+                          ),
+                        ),
+                        Text("未获得成就",
+                            style: Theme.of(context).textTheme.bodyText1),
+                        Expanded(
+                            child: Divider(
+                          indent: 10.0,
+                        )),
+                      ],
+                    ),
                   ),
-                ),
-                getList(widget.data)
-              ],
+                  getList(widget.data)
+                ],
+              ),
             ),
-          ),
-        ),
-      ]),
-    );
+          )
+        ])
+      ],
+    ));
   }
 }
 
@@ -184,8 +301,10 @@ ListView getList(data) {
                 Column(
                   children: <Widget>[
                     ColorFiltered(
-                      colorFilter: ColorFilter.mode(Colors.white, BlendMode.color),
-                      child: CachedNetworkImage(width: 70.0, height: 70.0, imageUrl: item.logo),
+                      colorFilter:
+                          ColorFilter.mode(Colors.white, BlendMode.color),
+                      child: CachedNetworkImage(
+                          width: 70.0, height: 70.0, imageUrl: item.logo),
                     ),
                   ],
                 ),
@@ -198,8 +317,14 @@ ListView getList(data) {
                     children: <Widget>[
                       Row(
                         children: <Widget>[
-                          Text("成就名称:", style: Theme.of(context).textTheme.subtitle1),
-                          Text("${item.name}", style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor))
+                          Text("成就名称:",
+                              style: Theme.of(context).textTheme.subtitle1),
+                          Text("${item.name}",
+                              style: Theme.of(context)
+                                  .textTheme
+                                  .bodyText2
+                                  .copyWith(
+                                      color: Theme.of(context).accentColor))
                         ],
                       ),
                       Space(
@@ -207,8 +332,10 @@ ListView getList(data) {
                       ),
                       Row(
                         children: <Widget>[
-                          Text("成就奖励:", style: Theme.of(context).textTheme.subtitle1),
-                          Text("经验值+${item.rewardExp},积分+${item.rewardScore}", style: Theme.of(context).textTheme.bodyText2)
+                          Text("成就奖励:",
+                              style: Theme.of(context).textTheme.subtitle1),
+                          Text("经验值+${item.rewardExp},积分+${item.rewardScore}",
+                              style: Theme.of(context).textTheme.bodyText2)
                         ],
                       ),
                       Space(
@@ -216,9 +343,11 @@ ListView getList(data) {
                       ),
                       Row(
                         children: <Widget>[
-                          Text("成就条件:", style: Theme.of(context).textTheme.subtitle1),
+                          Text("成就条件:",
+                              style: Theme.of(context).textTheme.subtitle1),
                           Expanded(
-                            child: Text("${item.conditionDetail}", style: Theme.of(context).textTheme.bodyText2),
+                            child: Text("${item.conditionDetail}",
+                                style: Theme.of(context).textTheme.bodyText2),
                           ),
                         ],
                         crossAxisAlignment: CrossAxisAlignment.start,
@@ -236,7 +365,8 @@ ListView getList(data) {
               children: <Widget>[
                 Text(
                   '${item.conditionProgress}',
-                  style: Theme.of(context).textTheme.subtitle1.copyWith(color: Theme.of(context).accentColor,fontSize: 12),
+                  style: Theme.of(context).textTheme.subtitle1.copyWith(
+                      color: Theme.of(context).accentColor, fontSize: 12),
                 ),
                 Text(
                   '/${item.conditionCount}',
@@ -251,7 +381,10 @@ ListView getList(data) {
               borderRadius: BorderRadius.circular(12),
               child: Container(
                 child: CustomPaint(
-                  painter: _ProgressBar(item.conditionProgress / (item.conditionCount + item.conditionProgress), Color(0xfff1f1f1)),
+                  painter: _ProgressBar(
+                      item.conditionProgress /
+                          (item.conditionCount + item.conditionProgress),
+                      Color(0xfff1f1f1)),
                   child: Container(
                     height: 8,
                   ),
@@ -267,7 +400,7 @@ ListView getList(data) {
 
 class _ProgressBar extends CustomPainter {
   final Color bg;
-   Paint _paint;
+  Paint _paint;
   final Paint _indicatorPaint = Paint()
     ..color = Color(0xffFFC400)
     ..isAntiAlias = true;
@@ -276,7 +409,7 @@ class _ProgressBar extends CustomPainter {
 
   double percent;
 
-  _ProgressBar(this.percent,this.bg){
+  _ProgressBar(this.percent, this.bg) {
     _paint = Paint()
       ..color = bg
       ..isAntiAlias = true;
@@ -287,7 +420,9 @@ class _ProgressBar extends CustomPainter {
     double indicator = size.width * min(1.0, this.percent);
     canvas.save();
     var rect = Rect.fromLTRB(0, size.height - 13, size.width, size.height);
-    canvas.clipRRect(RRect.fromRectAndRadius(rect, Radius.circular(size.height / 2)), doAntiAlias: true);
+    canvas.clipRRect(
+        RRect.fromRectAndRadius(rect, Radius.circular(size.height / 2)),
+        doAntiAlias: true);
 
     canvas.drawRect(rect, _paint);
 
@@ -297,7 +432,10 @@ class _ProgressBar extends CustomPainter {
         end: Alignment.centerRight,
         colors: <Color>[Color(0xffFFE600), Color(0xffFF9100)],
       ).createShader(rect);
-    canvas.drawRect(Rect.fromLTRB(0, size.height - 13, size.width * this.percent, size.height), _valuePaint);
+    canvas.drawRect(
+        Rect.fromLTRB(
+            0, size.height - 13, size.width * this.percent, size.height),
+        _valuePaint);
 
     canvas.restore();
 

+ 1 - 1
lib/pages/my/device_info_page.dart

@@ -114,7 +114,7 @@ class _PageState extends State<DeviceInfoPage> {
                       NavigatorUtil.goPage(context, (context) => DeviceScreen(device: device,));
                     }
                   },
-                )
+                ),
               ]).toList())),
       Padding(
         padding: labelPadding,

+ 298 - 195
lib/pages/my/level_page.dart

@@ -34,242 +34,340 @@ class LevelPage extends StatefulWidget {
 class _PageState extends State<LevelPage> with InjectLoginApi {
   SimpleModel _model;
   bool _max = false;
+  ScrollController _controller;
+  int _brightness = 0;
 
   @override
   void initState() {
     super.initState();
-    _model = SimpleModel((page) async => [(await loginApi.getAchievementInfo()).data]);
+    _model = SimpleModel(
+        (page) async => [(await loginApi.getAchievementInfo()).data]);
+    _controller = ScrollController()
+      ..addListener(() {
+//        print(
+//            "[_controller.position.pixels] -------------------------- ${_controller.position.pixels}");
+        print("[_brightness]--------------------------$_brightness");
+        if (_controller.position.pixels >= 70) {
+          if (_brightness == 0) {
+            setState(() {
+              _brightness = 1;
+            });
+          }
+        } else {
+          if (_brightness == 1) {
+            setState(() {
+              _brightness = 0;
+            });
+          }
+        }
+      });
   }
 
   @override
   Widget build(BuildContext context) {
     return Scaffold(
-        body: ProviderWidget<SimpleModel>(
-      model: _model,
-      onModelReady: (model) => model.initData(),
-      builder: (_, model, __) {
-        AchievementInfoData _data = model.list.isNotEmpty ? model.list.first : null;
-        return EasyRefresh.builder(
-            controller: model.refreshController,
-            enableControlFinishRefresh: true,
-            enableControlFinishLoad: true,
-            onRefresh: () => model.refresh(),
-            header: buildClassicalHeader(),
-            builder: (context, physics, header, footer) {
-              return CustomScrollView(
-                physics: physics,
-                slivers: <Widget>[
-                  buildSliverAppBar(context, "我的等级", backgroundColor: Theme.of(context).scaffoldBackgroundColor),
-                  header,
-                  if (model.isBusy)
-                    SliverToBoxAdapter(
-                      child: RequestLoadingWidget(),
-                    ),
-                  if (model.isIdle && _data != null)
-                    SliverToBoxAdapter(
-                        child: BoxWidget(
-                            body: Column(
-                      children: <Widget>[
-                        Padding(
-                          padding: const EdgeInsets.only(bottom: 8.0),
-                          child: Row(
-                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                            children: <Widget>[
-                              Row(
+        body: Stack(
+      children: <Widget>[
+        Positioned.fill(
+            child: Container(
+          decoration: BoxDecoration(
+              image: DecorationImage(
+                  image: AssetImage("lib/assets/img/mylevel_bg.png"),
+                  fit: BoxFit.cover)),
+        )),
+        ProviderWidget<SimpleModel>(
+          model: _model,
+          onModelReady: (model) => model.initData(),
+          builder: (_, model, __) {
+            AchievementInfoData _data =
+                model.list.isNotEmpty ? model.list.first : null;
+            return EasyRefresh.builder(
+                controller: model.refreshController,
+                enableControlFinishRefresh: true,
+                enableControlFinishLoad: true,
+                onRefresh: () => model.refresh(),
+                header: buildClassicalHeader(),
+                builder: (context, physics, header, footer) {
+                  return CustomScrollView(
+                    controller: _controller,
+                    physics: physics,
+                    slivers: <Widget>[
+                      buildSliverAppBar(
+                        context,
+                        "我的等级",
+                        backgroundColor: _brightness == 0
+                            ? Color(0x00000000)
+                            : Color(0xffffffff),
+                        brightness: _brightness == 0 ? 1 : 0,
+                        textStyle: _brightness == 0
+                            ? TextStyle(
+                                fontWeight: FontWeight.w600,
+                                fontSize: 18.0,
+                                color: Color(0xffffffff))
+                            : TextStyle(
+                                fontWeight: FontWeight.w600,
+                                fontSize: 18.0,
+                                color: Color(0xff333333)),
+                        whiteBackButton: _brightness == 0 ? true : false,
+                        canBack: _brightness == 0 ? false : true,
+                      ),
+//                        header,
+                      if (model.isBusy)
+                        SliverToBoxAdapter(
+                          child: RequestLoadingWidget(),
+                        ),
+                      if (model.isIdle && _data != null)
+                        SliverToBoxAdapter(
+                            child: BoxWidget(
+                                body: Column(
+                          children: <Widget>[
+                            Padding(
+                              padding: const EdgeInsets.only(bottom: 8.0),
+                              child: Row(
+                                mainAxisAlignment:
+                                    MainAxisAlignment.spaceBetween,
                                 children: <Widget>[
-                                  Text(
-                                    "积分:",
-                                    style: Theme.of(context).textTheme.subtitle1,
-                                  ),
-                                  Space(
-                                    width: 5.0,
+                                  Row(
+                                    children: <Widget>[
+                                      Text(
+                                        "积分:",
+                                        style: Theme.of(context)
+                                            .textTheme
+                                            .subtitle1,
+                                      ),
+                                      Space(
+                                        width: 5.0,
+                                      ),
+                                      Text(
+                                        '${_data.exp}',
+                                        style: TextStyle(
+                                            fontSize: 14.0,
+                                            color: Color(0xffFFC400)),
+                                      )
+                                    ],
                                   ),
-                                  Text(
-                                    '${_data.exp}',
-                                    style: TextStyle(fontSize: 14.0, color: Color(0xffFFC400)),
+                                  InkWell(
+                                    child: Row(
+                                      children: <Widget>[
+                                        Padding(
+                                          child: Text(
+                                            "积分商城",
+                                            style: Theme.of(context)
+                                                .textTheme
+                                                .bodyText1,
+                                          ),
+                                          padding: EdgeInsets.only(right: 5.0),
+                                        ),
+                                        arrowRight4()
+                                      ],
+                                    ),
+                                    onTap: () {
+                                      NavigatorUtil.go(
+                                          context, Routes.scoreShopPage);
+                                    },
                                   )
                                 ],
                               ),
-                              InkWell(
-                                child: Row(
+                            ),
+                            Padding(
+                                padding: const EdgeInsets.only(
+                                    top: 16.0, bottom: 8.0),
+                                child: Container(
+                                    width: 90.0,
+                                    height: 90.0,
+                                    child: CachedNetworkImage(
+                                        imageUrl: _data.level.logo ?? ""))),
+                            Text(
+                              "Lv.${_data.level.level}",
+                              style: Theme.of(context).textTheme.headline3,
+                            ),
+                            Space(
+                              height: 24,
+                            ),
+                            Row(
+                              mainAxisAlignment: MainAxisAlignment.end,
+                              children: <Widget>[
+                                Row(
                                   children: <Widget>[
-                                    Padding(
-                                      child: Text(
-                                        "积分商城",
-                                        style: Theme.of(context).textTheme.bodyText1,
-                                      ),
-                                      padding: EdgeInsets.only(right: 5.0),
+                                    Text(
+                                      "${_data.exp}",
+                                      style: TextStyle(
+                                          fontSize: 11,
+                                          color: Theme.of(context).accentColor),
                                     ),
-                                    arrowRight4()
+                                    Text("/${_data.exp + _data.nextLevelExp}",
+                                        style: TextStyle(fontSize: 11)),
                                   ],
                                 ),
-                                onTap: () {
-                                  NavigatorUtil.go(context, Routes.scoreShopPage);
-                                },
-                              )
-                            ],
-                          ),
-                        ),
-                        Padding(
-                            padding: const EdgeInsets.only(top: 16.0, bottom: 8.0),
-                            child: Container(width: 90.0, height: 90.0, child: CachedNetworkImage(imageUrl: _data.level.logo ?? ""))),
-                        Text(
-                          "Lv.${_data.level.level}",
-                          style: Theme.of(context).textTheme.headline3,
-                        ),
-                        Space(
-                          height: 24,
-                        ),
-                        Row(
-                          mainAxisAlignment: MainAxisAlignment.end,
-                          children: <Widget>[
-                            Row(
-                              children: <Widget>[
-                                Text(
-                                  "${_data.exp}",
-                                  style: TextStyle(fontSize: 11, color: Theme.of(context).accentColor),
-                                ),
-                                Text("/${_data.exp + _data.nextLevelExp}", style: TextStyle(fontSize: 11)),
                               ],
                             ),
-                          ],
-                        ),
-                        Space(
-                          height: 2,
-                        ),
-                        ClipRRect(
-                          borderRadius: BorderRadius.circular(10),
-                          child: Container(
-                            child: CustomPaint(
-                              painter: _ProgressBar(
-                                _data.exp / (_data.nextLevelExp + _data.exp),
-                              ),
+                            Space(
+                              height: 2,
+                            ),
+                            ClipRRect(
+                              borderRadius: BorderRadius.circular(10),
                               child: Container(
-                                height: 12,
+                                child: CustomPaint(
+                                  painter: _ProgressBar(
+                                    _data.exp /
+                                        (_data.nextLevelExp + _data.exp),
+                                  ),
+                                  child: Container(
+                                    height: 12,
+                                  ),
+                                ),
+//                      height: 12,
                               ),
                             ),
-//                      height: 12,
-                          ),
-                        ),
-                        Space(
-                          height: 8,
-                        ),
-                        Row(
-                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                          children: <Widget>[
+                            Space(
+                              height: 8,
+                            ),
                             Row(
+                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                               children: <Widget>[
-                                Text("经验值:", style: Theme.of(context).textTheme.subtitle1),
-                                Space(
-                                  width: 2.0,
+                                Row(
+                                  children: <Widget>[
+                                    Text("经验值:",
+                                        style: Theme.of(context)
+                                            .textTheme
+                                            .subtitle1),
+                                    Space(
+                                      width: 2.0,
+                                    ),
+                                    Text(
+                                      "${_data.exp}",
+                                      style: Theme.of(context)
+                                          .textTheme
+                                          .subtitle1
+                                          .copyWith(
+                                              color: Theme.of(context)
+                                                  .accentColor),
+                                    ),
+                                  ],
                                 ),
                                 Text(
-                                  "${_data.exp}",
-                                  style: Theme.of(context).textTheme.subtitle1.copyWith(color: Theme.of(context).accentColor),
+                                  "再获得 ${_data.nextLevelExp} 经验可升到下一段",
+                                  style: Theme.of(context).textTheme.bodyText1,
                                 ),
                               ],
                             ),
-                            Text(
-                              "再获得 ${_data.nextLevelExp} 经验可升到下一段",
-                              style: Theme.of(context).textTheme.bodyText1,
-                            ),
                           ],
-                        ),
-                      ],
-                    ))),
-                  if (model.isIdle && _data != null)
-                    SliverToBoxAdapter(
-                      child: BoxWidget(
-                        body: Column(
-                          children: <Widget>[
-                            Row(
-                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                        ))),
+                      if (model.isIdle && _data != null)
+                        SliverToBoxAdapter(
+                          child: BoxWidget(
+                            body: Column(
                               children: <Widget>[
-                                Text(
-                                  "我的成就",
-                                  style: Theme.of(context).textTheme.headline3,
-                                ),
-                                if (_data.getAchievementList.length > -1 || _max)
-                                  InkWell(
-                                    onTap: () {
+                                Row(
+                                  mainAxisAlignment:
+                                      MainAxisAlignment.spaceBetween,
+                                  children: <Widget>[
+                                    Text(
+                                      "我的成就",
+                                      style:
+                                          Theme.of(context).textTheme.headline3,
+                                    ),
+                                    if (_data.getAchievementList.length > -1 ||
+                                        _max)
+                                      InkWell(
+                                        onTap: () {
 //                                setState(() {
 //                                  _max = true;
 //                                });
 //                              NavigatorUtil.go(context, "achievement");
-                                      NavigatorUtil.go(context, "${Routes.achievement}?data=${Uri.encodeComponent(json.encode(_data))}");
-                                    },
-                                    child: Row(
-                                      children: <Widget>[
-                                        Text(
-                                          "查看全部  ",
-                                          style: Theme.of(context).textTheme.bodyText1,
-                                        ),
-                                        arrowRight4()
-                                      ],
-                                    ),
-                                  ),
-                              ],
-                            ),
-                            if (_data.getAchievementList.length == 0)
-                              Padding(
-                                  padding: const EdgeInsets.all(30.0),
-                                  child: Column(
-                                    children: <Widget>[
-                                      Image.asset("lib/assets/img/${RequestErrorWidget.ASSETS_NO_RANK}"),
-                                      Padding(
-                                        padding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
-                                        child: Text(
-                                          "还未获得任何成就",
-                                          style: Theme.of(context).textTheme.bodyText2,
+                                          NavigatorUtil.go(context,
+                                              "${Routes.achievement}?data=${Uri.encodeComponent(json.encode(_data))}");
+                                        },
+                                        child: Row(
+                                          children: <Widget>[
+                                            Text(
+                                              "查看全部  ",
+                                              style: Theme.of(context)
+                                                  .textTheme
+                                                  .bodyText1,
+                                            ),
+                                            arrowRight4()
+                                          ],
                                         ),
                                       ),
-                                    ],
-                                  )),
-                            if (_data.getAchievementList.length > 0)
-                              Padding(
-                                padding: EdgeInsets.symmetric(vertical: 16.0),
-                                child: StaggeredGridView.countBuilder(
-                                  padding: EdgeInsets.zero,
-                                  shrinkWrap: true,
-                                  physics: NeverScrollableScrollPhysics(),
-                                  crossAxisCount: 4,
-                                  itemCount: _max ? _data.getAchievementList.length : min(4, _data.getAchievementList.length),
-                                  itemBuilder: (BuildContext context, int index) =>
-                                      achievementWidget(context, _data.getAchievementList[index], isRadius: false),
-                                  mainAxisSpacing: 12.0,
-                                  crossAxisSpacing: 12.0,
-                                  staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
+                                  ],
                                 ),
-                              ),
-                            Center(
-                              child: Padding(
-                                padding: const EdgeInsets.all(1.0),
-                                child: Row(
-                                  children: <Widget>[
-                                    Expanded(
-                                      child: Divider(
-                                        endIndent: 20.0,
+                                if (_data.getAchievementList.length == 0)
+                                  Padding(
+                                      padding: const EdgeInsets.all(30.0),
+                                      child: Column(
+                                        children: <Widget>[
+                                          Image.asset(
+                                              "lib/assets/img/${RequestErrorWidget.ASSETS_NO_RANK}"),
+                                          Padding(
+                                            padding: const EdgeInsets.fromLTRB(
+                                                0, 12, 0, 12),
+                                            child: Text(
+                                              "还未获得任何成就",
+                                              style: Theme.of(context)
+                                                  .textTheme
+                                                  .bodyText2,
+                                            ),
+                                          ),
+                                        ],
+                                      )),
+                                if (_data.getAchievementList.length > 0)
+                                  Padding(
+                                    padding:
+                                        EdgeInsets.symmetric(vertical: 16.0),
+                                    child: StaggeredGridView.countBuilder(
+                                      padding: EdgeInsets.zero,
+                                      shrinkWrap: true,
+                                      physics: NeverScrollableScrollPhysics(),
+                                      crossAxisCount: 4,
+                                      itemCount: _max
+                                          ? _data.getAchievementList.length
+                                          : min(4,
+                                              _data.getAchievementList.length),
+                                      itemBuilder:
+                                          (BuildContext context, int index) =>
+                                              achievementWidget(
+                                        context,
+                                        _data.getAchievementList[index],
+                                        isRadius: false,
                                       ),
+                                      mainAxisSpacing: 12.0,
+                                      crossAxisSpacing: 12.0,
+                                      staggeredTileBuilder: (int index) =>
+                                          StaggeredTile.fit(1),
                                     ),
-                                    Text("未获得成就", style: Theme.of(context).textTheme.bodyText1),
-                                    Expanded(
-                                      child: Divider(
-                                        indent: 20.0,
-                                      ),
-                                    ),
-                                  ],
-                                ),
-                              ),
+                                  ),
+//                                  Center(
+//                                    child: Padding(
+//                                      padding: const EdgeInsets.all(1.0),
+//                                      child: Row(
+//                                        children: <Widget>[
+//                                          Expanded(
+//                                            child: Divider(
+//                                              endIndent: 20.0,
+//                                            ),
+//                                          ),
+//                                          Text("未获得成就", style: Theme.of(context).textTheme.bodyText1),
+//                                          Expanded(
+//                                            child: Divider(
+//                                              indent: 20.0,
+//                                            ),
+//                                          ),
+//                                        ],
+//                                      ),
+//                                    ),
+//                                  ),
+//                                  getList(_data)
+                              ],
                             ),
-                            getList(_data)
-                          ],
+                          ),
                         ),
-                      ),
-                    ),
-                ],
-              );
-            });
-      },
+                    ],
+                  );
+                });
+          },
+        )
+      ],
     ));
   }
 }
@@ -293,7 +391,9 @@ class _ProgressBar extends CustomPainter {
     double indicator = size.width * min(1.0, this.percent);
     canvas.save();
     var rect = Rect.fromLTRB(0, size.height - 13, size.width, size.height);
-    canvas.clipRRect(RRect.fromRectAndRadius(rect, Radius.circular(size.height / 2)), doAntiAlias: true);
+    canvas.clipRRect(
+        RRect.fromRectAndRadius(rect, Radius.circular(size.height / 2)),
+        doAntiAlias: true);
 
     canvas.drawRect(rect, _paint);
 
@@ -303,7 +403,10 @@ class _ProgressBar extends CustomPainter {
         end: Alignment.centerRight,
         colors: <Color>[Color(0xffFFE600), Color(0xffFF9100)],
       ).createShader(rect);
-    canvas.drawRect(Rect.fromLTRB(0, size.height - 13, size.width * this.percent, size.height), _valuePaint);
+    canvas.drawRect(
+        Rect.fromLTRB(
+            0, size.height - 13, size.width * this.percent, size.height),
+        _valuePaint);
 
     canvas.restore();
 

+ 1 - 1
lib/pages/social/message_list_subpage.dart

@@ -55,7 +55,7 @@ class _MessageListSubPageState extends State<MessageListSubPage>
     messageList = [];
     var unReadList = await MessageDB().getMessageUnRead();
 
-    print("[unReadList]:$unReadList---------------------------------------");
+    // print("[unReadList]:$unReadList---------------------------------------");
 
     if (unReadList != null && unReadList.length > 0) {
       List<int> ids = [];

+ 3 - 3
lib/pages/social/message_page.dart

@@ -230,7 +230,7 @@ class _PageState extends State<MessagePage>
                               padding: const EdgeInsets.symmetric(vertical: 12.0),
                               child: Row(children: <Widget>[
                                 Image.asset(
-                                    "lib/assets/img/bbsmessage_icon_reply.png"),
+                                    "lib/assets/img/bbsmessage_icon_color_reply.png",width: 44.0,height: 44.0,),
                                 SizedBox(
                                   width: 16.0,
                                 ),
@@ -287,7 +287,7 @@ class _PageState extends State<MessagePage>
                                   padding: const EdgeInsets.symmetric(vertical: 12.0),
                                   child: Row(children: <Widget>[
                                     Image.asset(
-                                        "lib/assets/img/bbsmessage_icon_like.png"),
+                                        "lib/assets/img/bbsmessage_icon_color_like.png",width: 44.0,height: 44.0,),
                                     SizedBox(
                                       width: 16.0,
                                     ),
@@ -372,7 +372,7 @@ class _PageState extends State<MessagePage>
                                 padding: const EdgeInsets.symmetric(vertical: 12.0),
                                 child: Row(children: <Widget>[
                                   Image.asset(
-                                      "lib/assets/img/${(item.type == "rank" || item.type == "receive") ? 'bbsmessage_icon_rank' : 'bbsmessage_icon_notice'}.png"),
+                                      "lib/assets/img/bbsmessage_icon_color_${(item.type == "rank" || item.type == "receive") ? 'rank' : 'notice'}.png",width: 44.0,height: 44.0,),
                                   SizedBox(
                                     width: 8.0,
                                   ),

+ 573 - 0
lib/pages/social/new_social_index_page.dart

@@ -0,0 +1,573 @@
+import 'dart:ui';
+
+import 'package:cached_network_image/cached_network_image.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_easyrefresh/easy_refresh.dart';
+import 'package:provider/provider.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+import 'package:sport/bean/forum.dart';
+import 'package:sport/bean/post.dart';
+import 'package:sport/pages/social/post_detail_page.dart';
+import 'package:sport/pages/social/post_page.dart';
+import 'package:sport/pages/social/post_widget.dart';
+import 'package:sport/pages/social/search_page.dart';
+import 'package:sport/provider/lib/provider_widget.dart';
+import 'package:sport/provider/lib/view_state.dart';
+import 'package:sport/provider/lib/view_state_lifecycle.dart';
+import 'package:sport/provider/social_detail_model.dart';
+import 'package:sport/provider/social_index_model.dart';
+import 'package:sport/router/navigator_util.dart';
+import 'package:sport/router/routes.dart';
+import 'package:sport/services/api/inject_api.dart';
+import 'package:sport/services/api/resp.dart';
+import 'package:sport/services/userid.dart';
+import 'package:sport/widgets/appbar.dart';
+import 'package:sport/widgets/error.dart';
+import 'package:sport/widgets/loading.dart';
+import 'package:sport/widgets/misc.dart';
+import 'package:sport/widgets/persistent_header.dart';
+import 'package:sport/widgets/space.dart';
+
+class NewSocialIndexPage extends StatefulWidget {
+  NewSocialIndexPage();
+
+  @override
+  State<StatefulWidget> createState() => _PageState();
+}
+
+class _PageState
+    extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailModel>
+    with TickerProviderStateMixin, UserId, InjectApi {
+  ScrollController _controller;
+  double _expandedHeight = 0;
+  int _brightness = 0;
+
+  TabController _tabController;
+  final List<String> _tabs = ['热门', '关注', '最新', '精华', '官方'];
+  Future<RespPage<Post>> _getPostListByOfficial;
+  final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+  @override
+  SocialDetailModel createModel() => SocialDetailModel(0);
+  SocialIndexModel indexModel = new SocialIndexModel();
+  // 右边draw中的 当前选择的索引...
+
+  ValueNotifier<int> drawOneIndex = ValueNotifier(0);
+  ValueNotifier<int> drawTwoIndex = ValueNotifier(0);
+
+  String forumId = "";
+  String isOfficial;
+
+  List buttonList = [];
+  List<Forum> buttonData = [
+    new Forum(
+      gameName: "全部",
+    ),
+    new Forum(
+      gameName: "用户发布",
+      forumId: "0",
+    ),
+    new Forum(gameName: "官方发布", forumId: "1"),
+  ];
+  ValueNotifier<bool> isShowSelect = ValueNotifier(false);
+
+  @override
+  void initState() {
+    super.initState();
+    _tabController = TabController(
+        length: _tabs.length, initialIndex: 0, vsync: this)
+      ..addListener(() {
+        if (_tabController.index.toDouble() == _tabController.animation.value) {
+          model?.setForumIdAndOrigin(_tabController.index, forumId, isOfficial);
+          _controller.animateTo(0,
+              duration: Duration(milliseconds: 100), curve: Curves.ease);
+        }
+      });
+    _controller = ScrollController()
+      ..addListener(() {
+        if (_controller.position.pixels >= _expandedHeight - 70) {
+          if (_brightness == 0) {
+            setState(() {
+              _brightness = 1;
+            });
+          }
+        } else {
+          if (_brightness == 1) {
+            setState(() {
+              _brightness = 0;
+            });
+          }
+        }
+      });
+    initButtonList();
+  }
+
+  @override
+  void dispose() {
+    super.dispose();
+    _controller?.dispose();
+    _tabController?.dispose();
+    PaintingBinding.instance.imageCache.clear();
+  }
+
+  Future<int> _getCount() async {
+    int count = 0;
+    try {
+      count += (await model.api.getNoticeCount("comment", "0")).data;
+    } catch (e) {
+      print(e);
+    }
+    if (count == 0) {
+      try {
+        count += (await model.api.getNoticeCount("like", "0")).data;
+      } catch (e) {
+        print(e);
+      }
+    }
+    return count;
+  }
+
+  Widget _buildSearchWidget() {
+    return GestureDetector(
+      onTap: () {
+        Navigator.push(
+            context, new MaterialPageRoute(builder: (context) => SearchPage()));
+      },
+      child: Container(
+//        margin: EdgeInsets.fromLTRB(12.0, 0, 12.0, 12.0),
+        width: MediaQuery.of(context).size.width * 0.8,
+        height: 35,
+        padding: EdgeInsets.fromLTRB(12.0, 0, 12.0, 0),
+        decoration: BoxDecoration(
+          color: Color(0xffF1F1F1),
+          shape: BoxShape.rectangle,
+          borderRadius: BorderRadius.all(Radius.circular(50)),
+        ),
+        child: Row(
+          children: <Widget>[
+            Image.asset("lib/assets/img/searchbar_icon_search.png"),
+            Space(
+              width: 4,
+            ),
+            Text(
+              "输入关键词",
+              strutStyle: StrutStyle(forceStrutHeight: true),
+              style: TextStyle(fontSize: 14, color: Color(0xff999999)),
+            ),
+          ],
+        ),
+      ),
+    );
+  }
+
+  //  @title       button 的title
+  //  @index       当前显示的下标
+  //  @targetIndex 目标下标
+  //  @type        origin / project
+  Widget _buildDrawerButtonItem(
+      Forum data, int index, ValueNotifier<int> targetIndex, String type) {
+    return InkWell(
+      child: Container(
+        decoration: BoxDecoration(
+            color: index == targetIndex.value
+                ? Theme.of(context).accentColor
+                : Colors.white,
+            borderRadius: BorderRadius.all(Radius.circular(20.0)),
+            border: Border.all(
+                color: index == targetIndex.value
+                    ? Colors.white
+                    : Color(0xff999999))),
+        padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 25.0),
+        child: Text(
+          data.gameName,
+          style: TextStyle(
+              fontSize: 14.0,
+              color: index == targetIndex.value
+                  ? Colors.white
+                  : Color(0xff999999)),
+        ),
+      ),
+      onTap: () {
+        targetIndex.value = index;
+        if (type == "project") {
+          forumId = data.forumId;
+        } else if (type == "origin") {
+          isOfficial = data.forumId;
+        }
+        if (drawOneIndex.value == 0 && drawTwoIndex.value == 0) {
+          isShowSelect.value = false;
+        } else {
+          isShowSelect.value = true;
+        }
+
+        model.setForumIdAndOrigin(_tabController.index, forumId, isOfficial);
+      },
+    );
+  }
+
+  Widget _buildDrawButtonContainer(Widget buttons, {String type = 'top'}) {
+    return Padding(
+      padding: EdgeInsets.only(left: 16.0),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: <Widget>[
+          type == 'top'
+              ? Space(
+                  height: 21.0,
+                )
+              : Container(),
+          type == 'bottom'
+              ? Space(
+                  height: 43.0,
+                )
+              : Container(),
+          Text("运动项目",
+              style: TextStyle(
+                  color: Color(0xff333333),
+                  fontSize: 16.0,
+                  fontWeight: FontWeight.bold)),
+          Space(
+            height: 16.0,
+          ),
+          buttons,
+          type == 'bottom'
+              ? Space(
+                  height: 21.0,
+                )
+              : Container(),
+        ],
+      ),
+    );
+  }
+
+  Widget _buildButtons(ValueNotifier<int> targetIndex, {List<dynamic> list}) {
+    return ValueListenableBuilder(
+      valueListenable: targetIndex,
+      builder: (BuildContext context, int value, Widget child) => Wrap(
+        alignment: WrapAlignment.start,
+        spacing: 8.0,
+        runSpacing: 16.0,
+        children: list != null
+            ? list
+                .asMap()
+                .entries
+                .map((e) => _buildDrawerButtonItem(
+                    e.value, e.key, targetIndex, "project"))
+                .toList()
+            : buttonData
+                .asMap()
+                .entries
+                .map((e) => _buildDrawerButtonItem(
+                    e.value, e.key, targetIndex, "origin"))
+                .toList(),
+      ),
+    );
+  }
+
+  Widget _buildEndrawer() {
+    return Container(
+        height: double.infinity,
+        width: MediaQuery.of(context).size.width * 0.65,
+        decoration: BoxDecoration(
+          color: Colors.white,
+          borderRadius: BorderRadius.only(
+            topLeft: Radius.circular(10.0),
+            bottomLeft: Radius.circular(10.0),
+          ),
+        ),
+        child: Column(
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: <Widget>[
+            _buildDrawButtonContainer(
+              _buildButtons(drawOneIndex, list: buttonList),
+              type: "bottom",
+            ),
+            Divider(),
+            _buildDrawButtonContainer(
+              _buildButtons(drawTwoIndex),
+              type: "top",
+            ),
+          ],
+        ));
+  }
+
+  Widget _buildFilterButton(
+      String name, ValueNotifier<int> index, String type) {
+    return InkWell(
+      child: Container(
+        padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
+        decoration: BoxDecoration(
+            border: Border.all(color: Theme.of(context).accentColor),
+            borderRadius: BorderRadius.all(Radius.circular(44.0))),
+        child: Row(
+          crossAxisAlignment: CrossAxisAlignment.center,
+          children: <Widget>[
+            Text(
+              "$name",
+              style: TextStyle(
+                  color: Theme.of(context).accentColor, fontSize: 12.0),
+            ),
+            Space(
+              width: 5.0,
+            ),
+            Image.asset(
+              "lib/assets/img/btn_close_yellow.png",
+              width: 7.0,
+              height: 7.0,
+            )
+          ],
+        ),
+      ),
+      onTap: () {
+        type == "one"
+            ? model.setForumIdAndOrigin(_tabController.index, "", isOfficial)
+            : model.setForumIdAndOrigin(_tabController.index, forumId, "");
+        index.value = 0;
+      },
+    );
+  }
+
+  initButtonList() async {
+    RespList<Forum> data = await api.getForumIndex();
+    setState(() {
+      buttonList = data.results;
+      if (data.results.length > 0) {
+        buttonList.insert(0, new Forum(gameName: "全部"));
+      }
+    });
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      key: _scaffoldKey,
+      backgroundColor: Colors.white,
+      endDrawer: _buildEndrawer(),
+      body: ProviderWidget2<SocialDetailModel, SocialIndexModel>(
+        model1: model,
+        model2: indexModel,
+        onModelReady: (model1, model2) => model.initData(),
+        builder: (_, model, model2, __) {
+          return EasyRefresh.builder(
+              controller: model.refreshController,
+              enableControlFinishRefresh: true,
+              enableControlFinishLoad: true,
+              onRefresh: () => model.refresh(),
+              onLoad: model.isIdle ? () => model.loadMore() : null,
+              header: buildClassicalHeader(),
+              footer: buildClassicalFooter(),
+              builder: (context, physics, header, footer) {
+                return AnnotatedRegion<SystemUiOverlayStyle>(
+                  value: SystemUiOverlayStyle.dark,
+                  child: Material(
+                    color: Colors.white,
+                    child: SafeArea(
+                      child: CustomScrollView(
+                        controller: _controller,
+                        physics: physics,
+                        slivers: <Widget>[
+                          buildSliverAppBar(context, "社区",
+                              canBack: false,
+                              pinned: false,
+                              actions: <Widget>[
+                                Selector<SocialIndexModel, ViewState>(
+                                    selector: (_, SocialIndexModel model) =>
+                                        model.viewState,
+                                    shouldRebuild: (_, v) =>
+                                        v == ViewState.idle,
+                                    builder: (BuildContext context,
+                                        ViewState value, Widget child) {
+                                      return IconButton(
+                                        icon: Stack(
+                                          alignment: Alignment.center,
+                                          children: <Widget>[
+                                            Image.asset(
+                                                "lib/assets/img/bbs_icon_news.png"),
+                                            FutureBuilder(
+                                                future: SharedPreferences
+                                                    .getInstance(),
+                                                builder: (BuildContext context,
+                                                    AsyncSnapshot<
+                                                            SharedPreferences>
+                                                        snapshot) {
+                                                  if (snapshot
+                                                          .connectionState ==
+                                                      ConnectionState.done) {
+                                                    if (snapshot.data.getBool(
+                                                            "message_setting") ??
+                                                        true == true) {
+                                                      return FutureBuilder(
+                                                          future: _getCount(),
+                                                          builder: (BuildContext
+                                                                  context,
+                                                              AsyncSnapshot<int>
+                                                                  snapshot) {
+                                                            if (snapshot.data !=
+                                                                    null &&
+                                                                snapshot.data >
+                                                                    0) {
+                                                              return Align(
+                                                                alignment:
+                                                                    Alignment
+                                                                        .topRight,
+                                                                child:
+                                                                    Container(
+                                                                  margin: const EdgeInsets
+                                                                          .only(
+                                                                      top: 6.0),
+                                                                  width: 10,
+                                                                  height: 10,
+                                                                  decoration: BoxDecoration(
+                                                                      shape: BoxShape
+                                                                          .circle,
+                                                                      color: Colors
+                                                                          .red),
+                                                                  child: Center(
+                                                                    child: Text(
+                                                                        ""),
+                                                                  ),
+                                                                ),
+                                                              );
+                                                            }
+                                                            return Container();
+                                                          });
+                                                    }
+                                                  }
+                                                  return Container();
+                                                }),
+                                          ],
+                                        ),
+                                        onPressed: () async {
+                                          await NavigatorUtil.go(
+                                              context, Routes.socialMessage);
+                                          setState(() {});
+                                        },
+                                      );
+                                    }),
+                              ],
+                              paddingLeading: false),
+                          header,
+                          SliverPersistentHeader(
+                            delegate: PersistentHeader(
+                                min: 34,
+                                max: 34,
+                                child: Container(
+                                  color: Colors.white,
+                                  padding: EdgeInsets.only(bottom: 5),
+                                  child: TabBar(
+                                    isScrollable: true,
+                                    indicatorPadding:
+                                        EdgeInsets.symmetric(horizontal: 8),
+                                    indicatorWeight: 3,
+                                    controller: _tabController,
+                                    tabs:
+                                        _tabs.map((e) => Tab(text: e)).toList(),
+                                  ),
+                                )),
+                            pinned: true,
+                          ),
+                          SliverToBoxAdapter(
+                            child: Padding(
+                              padding: EdgeInsets.symmetric(
+                                  vertical: 12.0, horizontal: 12.0),
+                              child: Row(
+                                children: <Widget>[
+                                  _buildSearchWidget(),
+                                  Space(
+                                    width: 15.0,
+                                  ),
+                                  ValueListenableBuilder(
+                                    valueListenable: isShowSelect,
+                                    builder: (context, flag, child) => InkWell(
+                                      child: flag
+                                          ? Image.asset(
+                                              "lib/assets/img/bbs_icon_choose_press.png",
+                                              width: 22,
+                                              height: 22,
+                                            )
+                                          : Image.asset(
+                                              "lib/assets/img/bbs_icon_choose_normal.png",
+                                              width: 22,
+                                              height: 22,
+                                            ),
+                                      onTap: () => _scaffoldKey.currentState
+                                          .openEndDrawer(),
+                                    ),
+                                  ),
+                                ],
+                              ),
+                            ),
+                          ),
+                          SliverToBoxAdapter(
+                            child: Padding(
+                              padding: EdgeInsets.only(left: 12.0),
+                              child: Row(
+                                children: <Widget>[
+                                  if (drawOneIndex.value != 0)
+                                    _buildFilterButton('${buttonList[drawOneIndex.value].gameName}',drawOneIndex,"one"),
+                                  Space(
+                                    width: 10.0,
+                                  ),
+                                  if (drawTwoIndex.value != 0)
+                                    _buildFilterButton('${buttonData[drawTwoIndex.value].gameName}',drawTwoIndex,"two"),
+                                ],
+                              ),
+                            ),
+                          ),
+                          if (model.isBusy)
+                            SliverToBoxAdapter(
+                              child: RequestLoadingWidget(),
+                            ),
+                          if (model.isEmpty)
+                            SliverFillRemaining(
+                              child: Center(
+                                child: RequestErrorWidget(
+                                  null,
+                                  msg: "暂无帖子~",
+                                  assets:
+                                      RequestErrorWidget.ASSETS_NO_INVITATION,
+                                ),
+                              ),
+                            ),
+                          if (model.isIdle)
+                            SliverList(
+                              delegate: SliverChildBuilderDelegate(
+                                (context, index) {
+                                  Post post = model.list[index];
+                                  return PostWidget(
+                                      post, model, selfId == post.userId);
+                                },
+                                childCount: model.list.length,
+                              ),
+                            ),
+                        ],
+                      ),
+                    ),
+                  ),
+                );
+              });
+        },
+      ),
+      floatingActionButton: Container(
+        width: 44.0,
+        height: 44.0,
+        color: Colors.white,
+        alignment: Alignment.center,
+        child: FloatingActionButton(
+          child: Image.asset("lib/assets/img/bbs_icon_edit.png"),
+          onPressed: () {
+//            print('FloatingActionButton');
+            NavigatorUtil.goPage(
+                context,
+                (context) => PostPage(
+                      "",
+                      forums: buttonList,
+                    ));
+          },
+        ),
+      ),
+    );
+  }
+}

+ 112 - 8
lib/pages/social/post_page.dart

@@ -22,18 +22,20 @@ import 'package:sport/widgets/appbar.dart';
 import 'package:sport/widgets/button_primary.dart';
 import 'package:sport/widgets/dialog/alert_dialog.dart';
 import 'package:sport/widgets/dialog/bindphone_dialog.dart';
+import 'package:sport/widgets/label.dart';
 import 'package:sport/widgets/space.dart';
 
 import 'chat_page.dart';
 
 class PostPage extends StatefulWidget {
-  final String id;
-  final Forum forum;
-  final Post post;
-  final String url;
-  final String hash;
-  final String image;
-  const PostPage(this.id, {this.post, this.forum,this.url,this.hash,this.image});
+  final String id;  // 论坛Id
+  final Forum forum; // 论坛实例
+  final Post post;   // 帖子 转发的情况下
+  final String url;  // url  转发的情况下
+  final String hash; //      转发的情况下
+  final String image; //     转发的情况下
+  final List<Forum> forums; // 主要是获取 forums 名字
+  const PostPage(this.id, {this.post, this.forum,this.url,this.hash,this.image,this.forums});
 
   @override
   State<StatefulWidget> createState() => _PageState();
@@ -44,6 +46,8 @@ class _PageState extends State<PostPage> {
   TextEditingController _controller;
   ValueNotifier<String> _valueNotifier = ValueNotifier("");
   FocusNode _focusNode;
+  ValueNotifier<int> labelIndex = ValueNotifier(0);
+  Forum selectLabel;
 
   @override
   void initState() {
@@ -109,7 +113,7 @@ class _PageState extends State<PostPage> {
                     barrierDismissible: false,
                     builder: (context) => SimpleDialog(
                           children: <Widget>[
-                            PostAction(widget.id, postValue, imageList, widget.post?.quoteSubjectId == '0' ? widget.post?.id : widget.post?.quoteSubjectId,widget.url,widget.hash,widget.image)
+                            PostAction(selectLabel.forumId, postValue, imageList, widget.post?.quoteSubjectId == '0' ? widget.post?.id : widget.post?.quoteSubjectId,widget.url,widget.hash,widget.image)
                           ],
                         ));
                 if (result == true) {
@@ -217,6 +221,9 @@ class _PageState extends State<PostPage> {
                       ),
 //                if(widget.url != null)
 //                  _postLink(),
+              Space(height: 21.0,),
+              Divider(),
+                _postGameLabel(),
               ],
             ),
           ),
@@ -409,6 +416,103 @@ class _PageState extends State<PostPage> {
       imageList = resultList;
     });
   }
+
+  Widget _labelItem(String title){
+    if(title == null) return Container();
+    return Container(
+      padding: EdgeInsets.symmetric(vertical: 8.0,horizontal: 16.0),
+      decoration: BoxDecoration(border: Border.all(color: Theme.of(context).accentColor), borderRadius: BorderRadius.all(Radius.circular(44.0))),
+      child: Row(
+        crossAxisAlignment: CrossAxisAlignment.center,
+        children: <Widget>[
+          Text(title,style: TextStyle(color: Theme.of(context).accentColor,fontSize: 12.0),),
+          Space(width: 5.0,),
+          Image.asset("lib/assets/img/btn_close_yellow.png",width: 7.0,height: 7.0,)
+        ],
+      ),
+    );
+  }
+
+  Widget _postGameLabel(){
+    return Row(
+      mainAxisAlignment: MainAxisAlignment.spaceBetween,
+      children: <Widget>[
+        InkWell(
+          child: selectLabel != null ? _labelItem(selectLabel.gameName) : Container(),
+          onTap: (){
+            selectLabel = new Forum();
+            setState(() {});
+          },
+        ),
+        InkWell(
+          child: Container(
+            height: 34.0,
+            child: Row(
+//            crossAxisAlignment: CrossAxisAlignment.center,
+              children: <Widget>[
+                Text("添加游戏标签",style: TextStyle(fontSize: 12.0,color: Color(0xff666666)),),
+                Space(
+                  width: 4.0,
+                ),
+                Image.asset("lib/assets/img/btn_arrow_bottom.png")
+              ],
+            ),
+          ),
+          onTap: () async {
+            bool flag = await showDialog(context: context,builder: (context) => CustomAlertDialog(title: "添加游戏标签",
+              ok: () => Navigator.of(context).pop(true),
+              child: ValueListenableBuilder(
+              valueListenable: labelIndex,
+              builder: (context,index,child) => Wrap(
+                  runSpacing: 12.0,
+                  spacing: 8.0,
+                  children: widget.forums.asMap()
+                      .entries
+                      .map((e) => _buildDrawerButtonItem(
+                      e.value, e.key, labelIndex))
+                      .toList()
+              ),
+            ),));
+//            print("${labelIndex}==========================================");
+            if(flag){
+              selectLabel = widget.forums[labelIndex.value];
+              print("${selectLabel.toJson()}-----------------------------------");
+              setState(() {});
+            }
+          },
+        ),
+      ],
+    );
+
+  }
+  Widget _buildDrawerButtonItem(
+      Forum data, int index, ValueNotifier<int> targetIndex) {
+    return InkWell(
+      child: Container(
+        decoration: BoxDecoration(
+            color: index == targetIndex.value
+                ? Theme.of(context).accentColor
+                : Colors.white,
+            borderRadius: BorderRadius.all(Radius.circular(20.0)),
+            border: Border.all(
+                color: index == targetIndex.value
+                    ? Colors.white
+                    : Color(0xff999999))),
+        padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 25.0),
+        child: Text(
+          data.gameName,
+          style: TextStyle(
+              fontSize: 14.0,
+              color: index == targetIndex.value
+                  ? Colors.white
+                  : Color(0xff999999)),
+        ),
+      ),
+      onTap: () {
+        labelIndex.value = index;
+      },
+    );
+  }
 }
 
 class PostAction extends StatefulWidget {

+ 13 - 1
lib/pages/social/post_widget.dart

@@ -102,7 +102,8 @@ class _PostWidgetState extends State<PostWidget> with InjectApi {
 
   Widget _postWidget(Post post) {
     double width = MediaQuery.of(context).size.width - 24 - 22;
-    if(post.quoteData != null) print("[post:]${post.toJson()}-------------------------");
+//    if(post.quoteData != null) print("[post:]${post.toJson()}-------------------------");
+    // print("[post:]${post.toJson()}----------------------------------------");
     return Column(
       crossAxisAlignment: CrossAxisAlignment.start,
       children: <Widget>[
@@ -188,6 +189,7 @@ class _PostWidgetState extends State<PostWidget> with InjectApi {
                   .toList()),
         if(post.quoteData != null)
           _postLink(post.quoteData,color: Colors.white),
+
       ],
     );
   }
@@ -687,6 +689,16 @@ class _PostWidgetState extends State<PostWidget> with InjectApi {
               ],
             ),
           ),
+        if(post.gameName != null)
+        Container(
+            padding: EdgeInsets.fromLTRB(8.0, 0, 8.0, 16.0),
+            alignment: Alignment.centerLeft,
+              child: Container(
+              padding: EdgeInsets.symmetric(vertical: 4.0,horizontal: 8.0),
+              decoration: BoxDecoration(border: Border.all(color: Theme.of(context).accentColor), borderRadius: BorderRadius.all(Radius.circular(10.0))),
+              child: Text(post.gameName,style: TextStyle(color: Theme.of(context).accentColor,fontSize: 12.0),),
+            ),
+          ),
         Divider(
           height: 1,
         ),

+ 1 - 1
lib/pages/social/search_page.dart

@@ -52,7 +52,7 @@ class _PageState extends State<SearchPage> with UserId, InjectApi {
     _model = SearchModel()
       ..getHistory()
       ..getHot();
-    _searchModel = SocialDetailModel("0", 100);
+    _searchModel = SocialDetailModel(100,);
     simpleModel = new SimpleModel((page) async {
       var list = (await api.userSearch(kw: _controller.text, page: page))
           .pageResult

+ 63 - 26
lib/pages/social/social_detail_page.dart

@@ -34,7 +34,8 @@ class SocialDetailPage extends StatefulWidget {
   State<StatefulWidget> createState() => _PageState();
 }
 
-class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel> with TickerProviderStateMixin, UserId {
+class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
+    with TickerProviderStateMixin, UserId {
   ScrollController _controller;
   double _expandedHeight = 0;
   int _brightness = 0;
@@ -44,17 +45,20 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
   Future<RespPage<Post>> _getPostListByOfficial;
 
   @override
-  SocialDetailModel createModel() => SocialDetailModel(widget.forum.forumId, widget.index ?? 0);
+  SocialDetailModel createModel() => SocialDetailModel(widget.index ?? 0);
 
   @override
   void initState() {
     super.initState();
-    _getPostListByOfficial = model.api.getPostListByOfficial(forumId: widget.forum.forumId, limit: 3);
-    _tabController = TabController(length: _tabs.length, initialIndex: widget.index ?? 0, vsync: this)
+    _getPostListByOfficial = model.api
+        .getPostListByOfficial(forumId: widget.forum.forumId, limit: 3);
+    _tabController = TabController(
+        length: _tabs.length, initialIndex: widget.index ?? 0, vsync: this)
       ..addListener(() {
         if (_tabController.index.toDouble() == _tabController.animation.value) {
           model?.swtichTab(_tabController.index);
-          _controller.animateTo(0, duration: Duration(milliseconds: 100), curve: Curves.ease);
+          _controller.animateTo(0,
+              duration: Duration(milliseconds: 100), curve: Curves.ease);
         }
       });
     _controller = ScrollController()
@@ -89,7 +93,8 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
         imageUrl: "${widget.forum.cover}",
         fit: BoxFit.cover,
         width: double.infinity,
-        height: MediaQuery.of(context).size.width * 154.0 / 375 + MediaQuery.of(context).padding.top,
+        height: MediaQuery.of(context).size.width * 154.0 / 375 +
+            MediaQuery.of(context).padding.top,
       ),
       BackdropFilter(
         filter: ImageFilter.blur(sigmaX: 30.0, sigmaY: 30.0),
@@ -109,7 +114,10 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
               child: Row(
                 mainAxisAlignment: MainAxisAlignment.start,
                 children: <Widget>[
-                  CircleAvatar(backgroundImage: CachedNetworkImageProvider("${widget.forum.cover}"), radius: 30.0),
+                  CircleAvatar(
+                      backgroundImage:
+                          CachedNetworkImageProvider("${widget.forum.cover}"),
+                      radius: 30.0),
                   Space(
                     width: 12,
                   ),
@@ -125,13 +133,17 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                       ),
                       Row(
                         children: <Widget>[
-                          Image.asset("lib/assets/img/bbs_icon_reportnumber.png"),
+                          Image.asset(
+                              "lib/assets/img/bbs_icon_reportnumber.png"),
                           Space(
                             width: 4,
                           ),
                           Text(
                             "帖子数:${widget.forum.subjectCount}",
-                            style: Theme.of(context).textTheme.subtitle2.copyWith(color: Colors.white),
+                            style: Theme.of(context)
+                                .textTheme
+                                .subtitle2
+                                .copyWith(color: Colors.white),
                           ),
                         ],
                       ),
@@ -149,7 +161,9 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
         bottom: -1,
         child: Container(
           height: 10,
-          decoration: BoxDecoration(borderRadius: BorderRadius.vertical(top: Radius.circular(10)), color: Colors.white),
+          decoration: BoxDecoration(
+              borderRadius: BorderRadius.vertical(top: Radius.circular(10)),
+              color: Colors.white),
         ),
       ),
     ]);
@@ -166,11 +180,15 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
 
   Widget _buildHeaderListWidget() {
     return Container(
-      decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.vertical(top: Radius.circular(10))),
+      decoration: BoxDecoration(
+          color: Colors.white,
+          borderRadius: BorderRadius.vertical(top: Radius.circular(10))),
       child: FutureBuilder<RespPage<Post>>(
         future: _getPostListByOfficial,
-        builder: (BuildContext context, AsyncSnapshot<RespPage<Post>> snapshot) {
-          if (snapshot.connectionState == ConnectionState.done && snapshot.data?.pageResult?.results?.isNotEmpty == true) {
+        builder:
+            (BuildContext context, AsyncSnapshot<RespPage<Post>> snapshot) {
+          if (snapshot.connectionState == ConnectionState.done &&
+              snapshot.data?.pageResult?.results?.isNotEmpty == true) {
             return Column(children: <Widget>[
               Space(
                 height: 5,
@@ -179,8 +197,10 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                 children: snapshot.data.pageResult.results
                     .map((e) => InkWell(
                         onTap: () {
-                          Navigator.push(context, MaterialPageRoute(builder: (context) {
-                            return PostDetailPage(e, false, snapshot.data?.pageResult?.results ?? []);
+                          Navigator.push(context,
+                              MaterialPageRoute(builder: (context) {
+                            return PostDetailPage(e, false,
+                                snapshot.data?.pageResult?.results ?? []);
                           }));
                         },
                         child: Row(
@@ -188,7 +208,8 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                             Container(
                                 decoration: BoxDecoration(
                                     color: Colors.white,
-                                    borderRadius: BorderRadius.all(Radius.circular(2)),
+                                    borderRadius:
+                                        BorderRadius.all(Radius.circular(2)),
                                     border: Border.all(
                                       color: getColor(e.tags?.first),
                                       width: .5,
@@ -198,11 +219,17 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                                 child: Text(
                                   "${e.tags.first}",
                                   strutStyle: fixedLine,
-                                  style: Theme.of(context).textTheme.subtitle2.copyWith(color: getColor(e.tags?.first)),
+                                  style: Theme.of(context)
+                                      .textTheme
+                                      .subtitle2
+                                      .copyWith(color: getColor(e.tags?.first)),
                                 )),
                             Expanded(
-                              child: Text("${e.title?.isNotEmpty == true ? e.title : e.content}",
-                                  maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.subtitle1),
+                              child: Text(
+                                  "${e.title?.isNotEmpty == true ? e.title : e.content}",
+                                  maxLines: 1,
+                                  overflow: TextOverflow.ellipsis,
+                                  style: Theme.of(context).textTheme.subtitle1),
                             )
                           ],
                         )))
@@ -248,8 +275,13 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                             expandedHeight: _expandedHeight,
                             pinned: true,
                             elevation: 0,
-                            iconTheme: IconThemeData(color: _brightness == 0 ? Colors.white : Colors.black),
-                            brightness: _brightness == 0 ? Brightness.dark : Brightness.light,
+                            iconTheme: IconThemeData(
+                                color: _brightness == 0
+                                    ? Colors.white
+                                    : Colors.black),
+                            brightness: _brightness == 0
+                                ? Brightness.dark
+                                : Brightness.light,
                             title: _brightness == 0
                                 ? Text("")
                                 : Text(
@@ -262,7 +294,8 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                               background: _buildHeaderWidget(),
                             ),
                             leading: IconButton(
-                              icon: Image.asset("lib/assets/img/topbar_return${_brightness == 0 ? "_white" : ""}.png"),
+                              icon: Image.asset(
+                                  "lib/assets/img/topbar_return${_brightness == 0 ? "_white" : ""}.png"),
                               onPressed: () {
                                 Navigator.of(context).pop();
                               },
@@ -281,10 +314,12 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                                   padding: EdgeInsets.only(bottom: 5),
                                   child: TabBar(
                                     isScrollable: true,
-                                    indicatorPadding: EdgeInsets.symmetric(horizontal: 8),
+                                    indicatorPadding:
+                                        EdgeInsets.symmetric(horizontal: 8),
                                     indicatorWeight: 3,
                                     controller: _tabController,
-                                    tabs: _tabs.map((e) => Tab(text: e)).toList(),
+                                    tabs:
+                                        _tabs.map((e) => Tab(text: e)).toList(),
                                   ),
                                 )),
                             pinned: true,
@@ -299,7 +334,8 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                                 child: RequestErrorWidget(
                                   null,
                                   msg: "暂无帖子~",
-                                  assets: RequestErrorWidget.ASSETS_NO_INVITATION,
+                                  assets:
+                                      RequestErrorWidget.ASSETS_NO_INVITATION,
                                 ),
                               ),
                             ),
@@ -308,7 +344,8 @@ class _PageState extends ViewStateLifecycle<SocialDetailPage, SocialDetailModel>
                               delegate: SliverChildBuilderDelegate(
                                 (context, index) {
                                   Post post = model.list[index];
-                                  return PostWidget(post, model, selfId == post.userId);
+                                  return PostWidget(
+                                      post, model, selfId == post.userId);
                                 },
                                 childCount: model.list.length,
                               ),

+ 331 - 163
lib/pages/social/user_friend_page.dart

@@ -1,6 +1,9 @@
+import 'package:azlistview/azlistview.dart';
+import 'package:cached_network_image/cached_network_image.dart';
 import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
 import 'package:flutter/material.dart' hide NestedScrollView;
 import 'package:flutter_easyrefresh/easy_refresh.dart';
+import 'package:sport/bean/login.dart';
 import 'package:sport/bean/post_user.dart';
 import 'package:sport/bean/user_friend.dart';
 import 'package:sport/pages/social/chat_page.dart';
@@ -13,12 +16,14 @@ import 'package:sport/router/navigator_util.dart';
 import 'package:sport/utils/DateFormat.dart';
 import 'package:sport/utils/toast.dart';
 import 'package:sport/widgets/appbar.dart';
+import 'package:sport/widgets/dialog/alert_dialog.dart';
 import 'package:sport/widgets/dialog/request_dialog.dart';
 import 'package:sport/widgets/error.dart';
 import 'package:sport/widgets/image.dart';
 import 'package:sport/widgets/loading.dart';
 import 'package:sport/widgets/misc.dart';
 import 'package:sport/widgets/persistent_header.dart';
+import 'package:sport/widgets/space.dart';
 
 class UserFriendPage extends StatefulWidget {
   @override
@@ -28,7 +33,7 @@ class UserFriendPage extends StatefulWidget {
 class _PageState extends State<UserFriendPage> {
   PageController _controller;
   bool _refresh = false;
-  int _page =0;
+  int _page = 0;
 
   @override
   void initState() {
@@ -66,25 +71,32 @@ class _PageState extends State<UserFriendPage> {
           },
           headerSliverBuilder: (context, innerBoxIsScrolled) {
             return <Widget>[
-              buildSliverAppBar(context, "好友列表", innerBoxIsScrolled: innerBoxIsScrolled, actions: <Widget>[
-                IconButton(
-                  icon:Image.asset("lib/assets/img/bbs_icon_addmore.png",width: 22.0,height: 22.0,),
+              buildSliverAppBar(context, "好友列表",
+                  innerBoxIsScrolled: innerBoxIsScrolled,
+                  actions: <Widget>[
+                    IconButton(
+                      icon: Image.asset(
+                        "lib/assets/img/bbs_icon_addmore.png",
+                        width: 22.0,
+                        height: 22.0,
+                      ),
 //                  icon: Text(
 //                    "添加",
 //                    style: TextStyle(fontSize: 15, color: Theme.of(context).accentColor),
 //                  ),
-                  onPressed: () async {
-                    await NavigatorUtil.goPage(context, (context) => UserFriendAddPage());
-                    setState(() {
-                      _refresh = true;
-                    });
-                    await Future.delayed(Duration(seconds: 1));
-                    setState(() {
-                      _refresh = false;
-                    });
-                  },
-                )
-              ]),
+                      onPressed: () async {
+                        await NavigatorUtil.goPage(
+                            context, (context) => UserFriendAddPage());
+                        setState(() {
+                          _refresh = true;
+                        });
+                        await Future.delayed(Duration(seconds: 1));
+                        setState(() {
+                          _refresh = false;
+                        });
+                      },
+                    )
+                  ]),
               SliverPersistentHeader(
                 delegate: PersistentHeader(
                     min: tabHeader,
@@ -99,10 +111,16 @@ class _PageState extends State<UserFriendPage> {
                                 height: 35,
                                 child: TabBar(
                                   isScrollable: true,
-                                  labelPadding: EdgeInsets.symmetric(horizontal: 32),
+                                  labelPadding:
+                                      EdgeInsets.symmetric(horizontal: 32),
                                   indicatorWeight: 3,
-                                  indicatorPadding: EdgeInsets.symmetric(horizontal: 6),
-                                  tabs: <Widget>[Tab(text: '好友'), Tab(text: '我关注'), Tab(text: '关注我')],
+                                  indicatorPadding:
+                                      EdgeInsets.symmetric(horizontal: 6),
+                                  tabs: <Widget>[
+                                    Tab(text: '好友'),
+                                    Tab(text: '我关注'),
+                                    Tab(text: '关注我')
+                                  ],
                                   onTap: (index) {
                                     _controller?.jumpToPage(index);
                                   },
@@ -117,13 +135,16 @@ class _PageState extends State<UserFriendPage> {
               ),
             ];
           },
-          body: _refresh? RequestLoadingWidget(): PageView.builder(
-              controller: _controller = PageController(initialPage: _page)..addListener(() {
-                _page = _controller.page.toInt();
-              }),
-              physics: NeverScrollableScrollPhysics(),
-              itemCount: 3,
-              itemBuilder: (_, index) => _PageDetailPage(index)),
+          body: _refresh
+              ? RequestLoadingWidget()
+              : PageView.builder(
+                  controller: _controller = PageController(initialPage: _page)
+                    ..addListener(() {
+                      _page = _controller.page.toInt();
+                    }),
+                  physics: NeverScrollableScrollPhysics(),
+                  itemCount: 3,
+                  itemBuilder: (_, index) => _PageDetailPage(index)),
         ),
       ),
     );
@@ -139,7 +160,8 @@ class _PageDetailPage extends StatefulWidget {
   State<StatefulWidget> createState() => _PageDetailState(type);
 }
 
-class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendModel>  {
+class _PageDetailState
+    extends ViewStateLifecycle<_PageDetailPage, UserFriendModel> {
   TextEditingController _controller;
   FocusNode _focusNode;
   ValueNotifier<String> _searchValue = ValueNotifier<String>("");
@@ -151,6 +173,7 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
     super.initState();
     _focusNode = FocusNode();
     _controller = new TextEditingController(text: '');
+
   }
 
   @override
@@ -166,7 +189,86 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
         model: model,
         onModelReady: (model) => model.initData(),
         builder: (_, model, __) {
-          return EasyRefresh.custom(
+          return widget.type == 0
+              ? Column(
+                children: <Widget>[
+                  _searchWidget(context),
+                  Space(height: 16.0,),
+                  Expanded(
+                    child: AzListView(
+                      data: model.items,
+                      susItemHeight:200,
+                      itemCount: model.items.length,
+                      indexBarData: model.items.map((e) => "${e.getSuspensionTag()}").toList(),
+                      itemBuilder: (BuildContext context, int index) {
+                        return ListTile(
+                          leading: Container(
+                            width: 44,
+                            height: 44,
+                            decoration: BoxDecoration(
+                              shape: BoxShape.rectangle,
+                              borderRadius: BorderRadius.circular(4.0),
+                              image: DecorationImage(
+                                  image: CachedNetworkImageProvider(model.items[index].user.avatar,)
+                              ),
+                            ),
+                          ),
+                          title: Text("${model.items[index].user.name}"),
+                          onTap: () {
+
+                          },
+                        );
+                      },
+                      physics: BouncingScrollPhysics(),
+                      padding: EdgeInsets.zero,
+                      susItemBuilder: (BuildContext context, int index) {
+                        return Column(
+                          children: <Widget>[
+                            Container(
+//                              height: 40,
+                              width: MediaQuery.of(context).size.width,
+                              padding: EdgeInsets.only(left: 16.0),
+//                              color: Color(0xFFF3F4F5),
+                              alignment: Alignment.centerLeft,
+                              child: Text(
+                                '${model.items[index].getSuspensionTag()}',
+                                softWrap: false,
+                                style: TextStyle(
+                                  fontSize: 14.0,
+                                  color: Color(0xff9999999),
+                                ),
+                              ),
+                            ),
+                            Divider(indent: 12.0,endIndent: 12.0,),
+                          ],
+                        );
+                      },
+                      indexBarOptions: IndexBarOptions(
+                        needRebuild: true,
+                        ignoreDragCancel: true,
+                        textStyle: TextStyle(color:Color(0xff999999),fontSize: 12.0),
+                        selectTextStyle: TextStyle(fontSize: 20, color: Theme.of(context).accentColor),
+//                        downTextStyle: TextStyle(fontSize: 12, color: Theme.of(context).accentColor),
+//                        selectItemDecoration: BoxDecoration(color: Colors.green),
+//                        downItemDecoration:
+//                        BoxDecoration(color: Colors.green),
+                        indexHintWidth: 33,
+                        indexHintHeight: 33,
+                            indexHintDecoration: BoxDecoration(
+                              image: DecorationImage(
+                                image: AssetImage("lib/assets/img/friendlist_bg_letter.png"),
+                                fit: BoxFit.contain,
+                              ),
+                            ),
+                        indexHintTextStyle:TextStyle(fontSize: 18.0,color:Colors.white),
+                        indexHintAlignment: Alignment.centerRight,
+                        indexHintChildAlignment: Alignment(-0.25, 0.0),
+                        indexHintOffset: Offset(0, 0),
+                      ),
+                    ),
+                  ),
+                ],
+              ) : EasyRefresh.custom(
             firstRefresh: false,
             onRefresh: () => model.refresh(),
             onLoad: () => model.loadMore(),
@@ -178,60 +280,27 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
               SliverToBoxAdapter(
                 child: _searchWidget(context),
               ),
-//              if (widget.type == 2)
-//                SliverToBoxAdapter(
-//                  child: Center(
-//                    child: Padding(
-//                      padding: const EdgeInsets.all(8.0),
-//                      child: Row(
-//                        children: <Widget>[
-//                          Image.asset("lib/assets/img/linkpop_icon_modify.png"),
-//                          SizedBox(
-//                            width: 6,
-//                          ),
-//                          Text(
-//                            "互相关注后可成为好友",
-//                            style: TextStyle(fontSize: 12, color: Color(0xffcecece)),
-//                          )
-//                        ],
-//                        mainAxisSize: MainAxisSize.min,
-//                      ),
-//                    ),
-//                  ),
-//                ),
               if (model.isBusy)
                 SliverToBoxAdapter(
                   child: RequestLoadingWidget(),
                 ),
-              if (model.isEmpty)
-                SliverFillRemaining(
-                  child:Container(
-                    alignment: Alignment.center,
-                    child: Center(
-                      child: RequestErrorWidget(
-                        null,
-                        msg: widget.type == 0 ? "暂无好友~" : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
-                        assets: "emptypage-image-nomotion.png",
+              SliverList(
+                        delegate: SliverChildBuilderDelegate(
+                          (context, index) {
+                            return _buildItem(model.list[index]);
+                          },
+                          childCount: model.list.length,
+                        ),
                       ),
-                    ),
-                  )
-                ),
-              if (model.isIdle)
-                SliverList(
-                  delegate: SliverChildBuilderDelegate(
-                    (context, index) {
-                      return _buildItem(model.list[index]);
-                    },
-                    childCount: model.list.length,
-                  ),
-                ),
               if (model.isError)
                 SliverToBoxAdapter(
                   child: RequestErrorWidget(
                     () {
                       model.initData();
                     },
-                    msg: widget.type == 0 ? "暂无好友~" : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
+                    msg: widget.type == 0
+                        ? "暂无好友~"
+                        : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
                     assets: "emptypage-image-nomotion.png",
                   ),
                 ),
@@ -259,15 +328,49 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
               children: <Widget>[
                 Text(
                   "${user?.socialInfo?.name}",
-                  style: Theme.of(context).textTheme.headline3.copyWith(fontWeight: FontWeight.normal),
+                  style: Theme.of(context)
+                      .textTheme
+                      .headline3
+                      .copyWith(fontWeight: FontWeight.normal),
                 ),
                 SizedBox(
                   height: 5,
                 ),
-                Text(
-                  "${DateFormat.formatCreateAt(user?.createdAt)}关注了你",
-                  style: Theme.of(context).textTheme.bodyText1,
+                RichText(
+                  text: TextSpan(
+                      style: Theme.of(context).textTheme.subtitle2,
+                      children: <InlineSpan>[
+                        TextSpan(
+                          text: '${DateFormat.formatCreateAt(user?.createdAt)}',
+                          style: Theme.of(context).textTheme.bodyText1,
+                        ),
+                        user.makeFrom == 'follow'
+                            ? TextSpan(
+                                text: '通过线上',
+                                style: Theme.of(context)
+                                    .textTheme
+                                    .bodyText1
+                                    .copyWith(
+                                        color: Theme.of(context).accentColor),
+                              )
+                            : TextSpan(
+                                text: '通过扫码',
+                                style: Theme.of(context)
+                                    .textTheme
+                                    .bodyText1
+                                    .copyWith(
+                                        color: Theme.of(context).accentColor),
+                              ),
+                        TextSpan(
+                          text: "关注了你",
+                          style: Theme.of(context).textTheme.bodyText1,
+                        )
+                      ]),
                 ),
+//                TextSpan(
+//                  "${DateFormat.formatCreateAt(user?.createdAt)}通过${user.makeFrom}关注了你",
+//
+//                ),
               ],
             ),
           ),
@@ -280,7 +383,7 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                       alignment: Alignment.center,
                       margin: _padding,
                       child: Text(
-                        "忽略",
+                        "关注",
                         strutStyle: fixedLine,
                         style: Theme.of(context).textTheme.bodyText2,
                       ),
@@ -294,7 +397,9 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                     ),
                     onTap: () async {
                       await request(context, () async {
-                        var resp = await model.api.userIgnoreFollow(uid: user?.socialInfo?.id).catchError((onError) {});
+                        var resp = await model.api
+                            .userIgnoreFollow(uid: user?.socialInfo?.id)
+                            .catchError((onError) {});
                         if (resp?.code == 0) {
                           setState(() {
                             user.isIgnore = 1;
@@ -304,16 +409,16 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                     },
                   )
                 : Container(
-              width: 64,
-              height: 30,
-              margin: _padding,
-              alignment: Alignment.center,
-              child: Text(
-                "已忽略",
-                strutStyle: fixedLine,
-                style: Theme.of(context).textTheme.bodyText2,
-              ),
-            ),
+                    width: 64,
+                    height: 30,
+                    margin: _padding,
+                    alignment: Alignment.center,
+                    child: Text(
+                      "已忽略",
+                      strutStyle: fixedLine,
+                      style: Theme.of(context).textTheme.bodyText2,
+                    ),
+                  ),
           if (user?.isIgnore == 0)
             user.isFriends == "1"
                 ? Container(
@@ -324,7 +429,10 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                     child: Text(
                       "已关注",
                       strutStyle: fixedLine,
-                      style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor),
+                      style: Theme.of(context)
+                          .textTheme
+                          .bodyText2
+                          .copyWith(color: Theme.of(context).accentColor),
                     ),
                   )
                 : GestureDetector(
@@ -336,7 +444,10 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                       child: Text(
                         "关注",
                         strutStyle: fixedLine,
-                        style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor),
+                        style: Theme.of(context)
+                            .textTheme
+                            .bodyText2
+                            .copyWith(color: Theme.of(context).accentColor),
                       ),
                       decoration: BoxDecoration(
                         borderRadius: BorderRadius.circular(20),
@@ -349,7 +460,9 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                     onTap: () async {
                       if (user.isFriends == "1") return;
                       await request(context, () async {
-                        var resp = await model.api.userFollow(uid: user?.socialInfo?.id).catchError((onError) {});
+                        var resp = await model.api
+                            .userFollow(uid: user?.socialInfo?.id)
+                            .catchError((onError) {});
                         if (resp?.code == 0) {
                           ToastUtil.show("关注成功");
                           setState(() {
@@ -374,95 +487,151 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
           Expanded(
             child: Text(
               "${user?.socialInfo?.name}",
-              style: Theme.of(context).textTheme.headline3.copyWith(fontWeight: FontWeight.normal),
+              style: Theme.of(context)
+                  .textTheme
+                  .headline3
+                  .copyWith(fontWeight: FontWeight.normal),
             ),
           ),
           GestureDetector(
-            child: Container(
-              width: 82,
-              height: 30,
-              alignment: Alignment.center,
-              child: Text(
-                "取消关注",
-                strutStyle: fixedLine,
-                style: Theme.of(context).textTheme.bodyText2,
-              ),
-              decoration: BoxDecoration(
-                borderRadius: BorderRadius.circular(20),
-                border: Border.all(
-                  color: Color(0xffDCDCDC),
-                  width: .5,
-                ),
-              ),
-            ),
+            child: user.isFriends == "1"
+                ? Row(
+                    children: <Widget>[
+                      Text("互关好友",
+                          style: TextStyle(
+                              fontSize: 14.0, color: Color(0xff999999)))
+                    ],
+                  )
+                : Text("已关注",
+                    style: TextStyle(fontSize: 14.0, color: Color(0xff999999))),
+//            Container(
+//              width: 82,
+//              height: 30,
+//              alignment: Alignment.center,
+//              child:
+//              decoration: BoxDecoration(
+//                borderRadius: BorderRadius.circular(20),
+//                border: Border.all(
+//                  color: Color(0xffDCDCDC),
+//                  width: .5,
+//                ),
+//              ),
+//            ),
             onTap: () async {
-              await request(context, () async {
-                var resp = await model.api.userUnFollow(uid: user?.socialInfo?.id).catchError((onError) {});
-                if (resp?.code == 0) {
-                  ToastUtil.show("取关成功");
-                  setState(() {
-                    model.list?.remove(user);
-                    if(model.list?.isEmpty == true){
-                      model.initData();
-                    }
-                  });
-                }
-              });
+              bool flag;
+              if (user.isFriends == "1") {
+                flag = await showDialog(
+                    context: context,
+                    builder: (context) => CustomAlertDialog(
+                          title: '是否取消关注,解除好友关系',
+                          ok: () {
+                            Navigator.of(context).pop(true);
+                          },
+                        ));
+              } else {
+                flag = true;
+              }
+              if (flag) {
+                await request(context, () async {
+                  var resp = await model.api
+                      .userUnFollow(uid: user?.socialInfo?.id)
+                      .catchError((onError) {});
+                  if (resp?.code == 0) {
+                    ToastUtil.show("取关成功");
+                    setState(() {
+                      model.list?.remove(user);
+                      if (model.list?.isEmpty == true) {
+                        model.initData();
+                      }
+                    });
+                  }
+                });
+              }
             },
           )
         ],
       );
     } else {
-      child = Row(
-        children: <Widget>[
-          CircleAvatar(
-            backgroundImage: userAvatarProvider(user?.socialInfo?.avatar),
-            radius: 22,
-          ),
-          SizedBox(
-            width: 8,
-          ),
-          Expanded(
-            child: Column(
-              crossAxisAlignment: CrossAxisAlignment.start,
-              children: <Widget>[
-                Text(
-                  "${user?.socialInfo?.name}",
-                  style: Theme.of(context).textTheme.headline3.copyWith(fontWeight: FontWeight.normal),
-                ),
-                SizedBox(
-                  height: 5,
-                ),
-                Text(
-                  "${DateFormat.formatCreateAt(user?.updatedAt)}在线",
-                  style: Theme.of(context).textTheme.bodyText1,
-                ),
-              ],
-            ),
-          ),
-        ],
-      );
+//      child = Row(
+//        children: <Widget>[
+//          CircleAvatar(
+//            backgroundImage: userAvatarProvider(user?.socialInfo?.avatar),
+//            radius: 22,
+//          ),
+//          SizedBox(
+//            width: 8,
+//          ),
+//          Expanded(
+//            child: Column(
+//              crossAxisAlignment: CrossAxisAlignment.start,
+//              children: <Widget>[
+//                Text(
+//                  "${user?.socialInfo?.name}",
+//                  style: Theme.of(context)
+//                      .textTheme
+//                      .headline3
+//                      .copyWith(fontWeight: FontWeight.normal),
+//                ),
+//                SizedBox(
+//                  height: 5,
+//                ),
+//                Text(
+//                  "${DateFormat.formatCreateAt(user?.updatedAt)}在线",
+//                  style: Theme.of(context).textTheme.bodyText1,
+//                ),
+//              ],
+//            ),
+//          ),
+//        ],
+//      );
     }
+//    return Column(
+//      children: <Widget>[
+//        Padding(
+//          padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0),
+//          child: InkWell(
+//              onTap: () async {
+////                if(widget.type == 0)  await NavigatorUtil.goPage(context, (context) => ChatPage(user?.socialInfo));
+////                else
+//                await NavigatorUtil.goPage(
+//                    context,
+//                    (context) => UserDetailPage(
+//                        PostUser(
+//                            id: "${user?.socialInfo?.id}",
+//                            name: user?.socialInfo?.name,
+//                            avatar: user?.socialInfo?.avatar),
+//                        userFriends: model.list));
+//                setState(() {});
+//              },
+//              child: child),
+//        ),
+//        Divider(
+//          indent: 12.0,
+//          height: 1,
+//          endIndent: 12.0,
+//        )
+//      ],
+//    );
     return Column(
       children: <Widget>[
         Padding(
-          padding: const EdgeInsets.symmetric(horizontal: 12.0,vertical: 12.0),
+          padding: const EdgeInsets.all(12.0),
           child: InkWell(
               onTap: () async {
-//                if(widget.type == 0)  await NavigatorUtil.goPage(context, (context) => ChatPage(user?.socialInfo));
-//                else
                 await NavigatorUtil.goPage(
                     context,
-                        (context) => UserDetailPage(PostUser(id: "${user?.socialInfo?.id}", name: user?.socialInfo?.name, avatar: user?.socialInfo?.avatar),
+                    (context) => UserDetailPage(
+                        PostUser(
+                            id: "${user?.socialInfo?.id}",
+                            name: user?.socialInfo?.name,
+                            avatar: user?.socialInfo?.avatar),
                         userFriends: model.list));
                 setState(() {});
               },
               child: child),
         ),
         Divider(
-          indent: 12.0,
           height: 1,
-          endIndent: 12.0,
         )
       ],
     );
@@ -498,9 +667,10 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                 hintText: '输入账号/用户昵称',
                 border: InputBorder.none,
                 contentPadding: EdgeInsets.symmetric(
-                    vertical: 11.5,),
-                hintStyle:  TextStyle(
-                  color:Color(0xff999999),
+                  vertical: 11.5,
+                ),
+                hintStyle: TextStyle(
+                  color: Color(0xff999999),
                 ),
               ),
               onChanged: (value) {
@@ -512,9 +682,9 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
                 // _searchModel.setKeyword(value);
                 // Provider.of<SearchModel>(context, listen: false).queryValue(value);
               },
-                style: TextStyle(
-                  color:Color(0xff333333),
-                ),
+              style: TextStyle(
+                color: Color(0xff333333),
+              ),
             ),
           ),
           Visibility(
@@ -534,8 +704,6 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
     );
   }
 
-
   @override
   UserFriendModel createModel() => UserFriendModel(widget.type);
-
 }

+ 1 - 1
lib/provider/message_model.dart

@@ -39,7 +39,7 @@ class MessageModel extends ChangeNotifier with InjectApi {
 //      print("[list]:$list--------------------------");
 
       var userList = await MessageDB().findAllUser();
-      print("[list]:$userList--------------------------");
+//      print("[list]:$userList--------------------------");
 //      MessageDB().deleteTable(); //
       // 这里本来是做了去重操作的 现在不用了 ...
 //      if (_messages.length > 0) {

+ 36 - 9
lib/provider/social_detail_model.dart

@@ -6,10 +6,11 @@ import 'package:sport/services/api/inject_api.dart';
 
 class SocialDetailModel extends ViewStateRefreshListModel with InjectApi {
   int _type = 0;
-  String forumId;
+  String _forumId;
   String _kw;
+  String _isOfficial;
 
-  SocialDetailModel(this.forumId, this._type);
+  SocialDetailModel(this._type);
 
   void swtichTab(int type) async {
     this._type = type;
@@ -22,29 +23,55 @@ class SocialDetailModel extends ViewStateRefreshListModel with InjectApi {
     initData();
   }
 
+  void setForumId(String forumId) async {
+    this._type = 100;
+    this._forumId = forumId;
+    initData();
+  }
+
+  void setForumIdAndOrigin(int type, String forumId, String isOfficial) {
+    this._forumId = forumId;
+    this._isOfficial = isOfficial;
+    this._type = type;
+    initData();
+  }
+
   @override
   Future<List> loadData({int pageNum = 1}) async {
     List results = [];
     switch (_type) {
       case 100:
-        results = handlePage(await api.getPostList(kw: _kw, page: max(1, pageNum)));
+        results =
+            handlePage(await api.getPostList(kw: _kw, page: max(1, pageNum),forumId: _forumId,isOfficial: _isOfficial));
         break;
+      // 第四个变成公共了...
       case 4:
-        SharedPreferences prefs = await SharedPreferences.getInstance();
-        results = handlePage(await api.getPostListByUser(prefs.getInt("id").toString(), forumId: forumId, page: max(1, pageNum)));
+        results =
+            handlePage(await api.getPostListByOfficial(page: max(1, pageNum),forumId: _forumId,isOfficial: _isOfficial));
         break;
+//      case 4:
+//        SharedPreferences prefs = await SharedPreferences.getInstance();
+//        results = handlePage(await api.getPostListByUser(
+//            prefs.getInt("id").toString(),
+//            forumId: _forumId,
+//            page: max(1, pageNum)));
+//        break;
       case 3:
-        results = handlePage(await api.getPostList(forumId: forumId, isGood: 1, page: max(1, pageNum)));
+        results =
+            handlePage(await api.getPostList(isGood: 1, page: max(1, pageNum),forumId: _forumId,isOfficial: _isOfficial));
         break;
       case 2:
-        results = handlePage(await api.getPostList(forumId: forumId, page: max(1, pageNum)));
+        results = handlePage(await api.getPostList(page: max(1, pageNum),forumId: _forumId,isOfficial: _isOfficial));
         break;
       case 1:
         SharedPreferences prefs = await SharedPreferences.getInstance();
-        results = handlePage(await api.getPostListByFollow(prefs.getInt("id").toString(), forumId, page: max(1, pageNum)),);
+        results = handlePage(
+          await api.getPostListByFollow(prefs.getInt("id").toString(),
+              page: max(1, pageNum),forumId: _forumId,isOfficial: _isOfficial),
+        );
         break;
       default:
-        results = handlePage(await api.getPostListByHot(forumId, page: max(1, pageNum)));
+        results = handlePage(await api.getPostListByHot(page: max(1, pageNum),forumId: _forumId,isOfficial: _isOfficial));
         break;
     }
     return results;

+ 4 - 3
lib/provider/user_detail_model.dart

@@ -12,7 +12,7 @@ class UserDetailModel extends SocialDetailModel with InjectApi {
   Forum forum;
   String _sortBy = "created_at";
 
-  UserDetailModel(this.id) : super('', 0);
+  UserDetailModel(this.id) : super(0);
 
   @override
   Future<List> loadData({int pageNum = 1}) async {
@@ -24,7 +24,8 @@ class UserDetailModel extends SocialDetailModel with InjectApi {
         items.addAll(top.results);
       }
     }
-    var page = handlePage(await api.getPostListByUser(id, page: max(pageNum, 1), forumId: forumId, sortBy: _sortBy, removeTop: 1));
+    // 这里修改了下 论坛...
+    var page = handlePage(await api.getPostListByUser(id, page: max(pageNum, 1), sortBy: _sortBy, removeTop: 1));
     if (page?.isNotEmpty == true) {
       items.addAll(page);
     }
@@ -33,7 +34,7 @@ class UserDetailModel extends SocialDetailModel with InjectApi {
 
   forumBy(Forum forum) {
     this.forum = forum;
-    forumId = forum?.forumId;
+//    forumId = forum?.forumId;
     initData();
   }
 

+ 72 - 5
lib/provider/user_friend_model.dart

@@ -1,13 +1,18 @@
+import 'dart:convert';
 import 'dart:math';
 
+import 'package:azlistview/azlistview.dart';
 import 'package:sport/bean/user_friend.dart';
 import 'package:sport/provider/lib/view_state_refresh_list_model.dart';
 import 'package:sport/services/api/inject_api.dart';
+import 'package:sport/services/api/resp.dart';
 
-class UserFriendModel extends ViewStateRefreshListModel<UserFriend> with InjectApi {
+class UserFriendModel extends ViewStateRefreshListModel<UserFriend>
+    with InjectApi {
   int type;
   String kw;
-
+//  Map map;
+  List<SuspensionBean> items = [];
   UserFriendModel(this.type);
 
   @override
@@ -15,13 +20,31 @@ class UserFriendModel extends ViewStateRefreshListModel<UserFriend> with InjectA
     List<UserFriend> results = [];
     switch (type) {
       case 2:
-        results = (await api.userFansList(kw: kw, page: max(1, pageNum))).results;
+        results =
+            (await api.userFansList(kw: kw, page: max(1, pageNum))).results;
         break;
       case 1:
-        results = (await api.userFollowList(kw: kw, page: max(1, pageNum))).results;
+        results =
+            (await api.userFollowList(kw: kw, page: max(1, pageNum))).results;
         break;
       default:
-        results = (await api.userFriends(kw: kw, page: max(1, pageNum))).results;
+        ResultsTest<UserFriend> data = (await api.userFriendsTest(
+                kw: kw, page: max(1, pageNum), test: "1"))
+            .results;
+//        map = data.map;
+//        items = data.map.keys.map((e) => SuspensionBean(e.toString(), data.map[e] as List)).toList();
+        items = [];
+        data.map.forEach((key, value) {
+          value.forEach((element) {
+            items.add(SuspensionBean(key, UserFriend.fromJson(element)));
+          });
+        });
+        items.forEach((element) {
+          print(element.toJson());
+        });
+        SuspensionUtil.setShowSuspensionStatus(items);
+        SuspensionUtil.sortListBySuspensionTag(items);
+//        print("$items----------------${items.length}");
         break;
     }
     return results;
@@ -32,3 +55,47 @@ class UserFriendModel extends ViewStateRefreshListModel<UserFriend> with InjectA
     refresh(init: true);
   }
 }
+
+class SuspensionBean extends ISuspensionBean {
+  final String tag;
+  final UserFriend user;
+
+  SuspensionBean(this.tag, this.user);
+
+  @override
+  String getSuspensionTag() => tag;
+
+  Map<String, dynamic> toJson() {
+    final Map<String, dynamic> data = new Map<String, dynamic>();
+    data['tag'] = this.tag;
+    data['user'] = this.user.toJson();
+    return data;
+  }
+}
+
+class UserFriendListModel extends ISuspensionBean {
+  String name;
+  String tagIndex;
+  String namePinyin;
+
+  UserFriendListModel({
+    this.name,
+    this.tagIndex,
+    this.namePinyin,
+  });
+
+  UserFriendListModel.fromJson(Map<String, dynamic> json) : name = json['name'];
+
+  Map<String, dynamic> toJson() => {
+        'name': name,
+//        'tagIndex': tagIndex,
+//        'namePinyin': namePinyin,
+//        'isShowSuspension': isShowSuspension
+      };
+
+  @override
+  String getSuspensionTag() => tagIndex;
+
+  @override
+  String toString() => json.encode(this);
+}

+ 32 - 2
lib/services/api/resp.dart

@@ -19,7 +19,8 @@ class RespData<T> extends Resp {
   RespData(code, msg, this.data) : super(code, msg);
 
   factory RespData.fromJson(Map<String, dynamic> json) {
-    return RespData(json['code'], json['msg'], json['data'] != null ? Converter.fromJson<T>(json['data']) : null);
+    return RespData(json['code'], json['msg'],
+        json['data'] != null ? Converter.fromJson<T>(json['data']) : null);
   }
 }
 
@@ -61,7 +62,7 @@ class RespPage<T> extends Resp {
           results.add(Converter.fromJson<T>(element));
         });
         pageResult.results = results;
-      }else if (data['data'] != null) {
+      } else if (data['data'] != null) {
         (data['data'] as List).forEach((element) {
           results.add(Converter.fromJson<T>(element));
         });
@@ -76,3 +77,32 @@ class RespPage<T> extends Resp {
     return RespPage(json['code'], json['msg'], pageResult);
   }
 }
+
+class ResultsTest<T> {
+  List<T> list;
+  Map map;
+}
+
+class RespListTest<T> extends Resp {
+  ResultsTest<T> results;
+
+  RespListTest(code, msg, this.results) : super(code, msg);
+
+  factory RespListTest.fromJson(Map<String, dynamic> json) {
+    ResultsTest<T> results = ResultsTest<T>();
+    Map<String, List<int>> _map = new Map();
+
+    if (json['data'] != null) {
+      results.list = [];
+      (json['data']["list"] as List).forEach((element) {
+        results.list.add(Converter.fromJson<T>(element));
+      });
+
+      if (json['data']["map"] != null) {
+        results.map  = json['data']["map"];
+      }
+    }
+    print("[results]:${results.map}--------------------------");
+    return RespListTest(json['code'], json['msg'], results);
+  }
+}

+ 9 - 6
lib/services/api/rest_client.dart

@@ -110,20 +110,20 @@ abstract class RestClient {
   Future<RespList<Forum>> getForumIndex();
 
   @GET("/forum/list")
-  Future<RespPage<Post>> getPostList({@Query("forumId") String forumId, @Query("p") int page, @Query("isGood") int isGood, @Query("kw") String kw});
+  Future<RespPage<Post>> getPostList({@Query("forumId") String forumId, @Query("p") int page, @Query("isGood") int isGood, @Query("kw") String kw ,@Query("isOfficial") String isOfficial,});
 
   @GET("/forum/listByOfficial")
-  Future<RespPage<Post>> getPostListByOfficial({@Query("forumId") String forumId, @Query("p") int page, @Query("limit") int limit = 3,  @Query("sortBy") String sortBy});
+  Future<RespPage<Post>> getPostListByOfficial({@Query("forumId") String forumId, @Query("p") int page, @Query("limit") int limit = 3,  @Query("sortBy") String sortBy,@Query("isOfficial") String isOfficial});
 
   @GET("/forum/listByHot")
-  Future<RespPage<Post>> getPostListByHot(@Query("forumId") String forumId, {@Query("p") int page, @DioOptions() Options options});
+  Future<RespPage<Post>> getPostListByHot({@Query("forumId") String forumId,@Query("p") int page,@Query("isOfficial") String isOfficial, @DioOptions() Options options});
 
   @GET("/forum/listByUser")
   Future<RespPage<Post>> getPostListByUser(@Query("uid") String uid,
-      {@Query("forumId") String forumId, @Query("p") int page, @Query("sortBy") String sortBy, @Query("removeTop") int removeTop});
+      {@Query("forumId") String forumId, @Query("p") int page, @Query("sortBy") String sortBy, @Query("removeTop") int removeTop,@Query("isOfficial") String isOfficial});
 
   @GET("/forum/listByFollow")
-  Future<RespPage<Post>> getPostListByFollow(@Query("uid") String uid, @Query("forumId") String forumId, {@Query("p") int page, @Query("limit") int limit, @Query("testuid") int testuid, @Query("sortBy") String sortBy, @DioOptions() Options options});
+  Future<RespPage<Post>> getPostListByFollow(@Query("uid") String uid,  {@Query("forumId") String forumId,@Query("p") int page, @Query("limit") int limit, @Query("testuid") int testuid, @Query("sortBy") String sortBy,@Query("isOfficial") String isOfficial,@DioOptions() Options options});
 
   @GET("/forum/subjectDetail")
   Future<RespData<Post>> getPostDetail(@Query("subjectId") String subjectId);
@@ -205,7 +205,10 @@ abstract class RestClient {
   Future<RespList<UserFriend>> userFansList({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50});
 
   @GET("/forum/friends")
-  Future<RespList<UserFriend>> userFriends({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50});
+  Future<RespList<UserFriend>> userFriends({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50 ,@Query("test") String test,});
+
+  @GET("/forum/friends")
+  Future<RespListTest<UserFriend>> userFriendsTest({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50 ,@Query("test") String test,});
 
   @GET("/user/search")
   Future<RespPage<UserInfo>> userSearch({@Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 20});

+ 47 - 15
lib/services/api/rest_client.g.dart

@@ -467,13 +467,14 @@ class _RestClient implements RestClient {
   }
 
   @override
-  getPostList({forumId, page, isGood, kw}) async {
+  getPostList({forumId, page, isGood, kw, isOfficial}) async {
     const _extra = <String, dynamic>{};
     final queryParameters = <String, dynamic>{
       r'forumId': forumId,
       r'p': page,
       r'isGood': isGood,
-      r'kw': kw
+      r'kw': kw,
+      r'isOfficial': isOfficial
     };
     queryParameters.removeWhere((k, v) => v == null);
     final _data = <String, dynamic>{};
@@ -491,13 +492,14 @@ class _RestClient implements RestClient {
   }
 
   @override
-  getPostListByOfficial({forumId, page, limit = 3, sortBy}) async {
+  getPostListByOfficial({forumId, page, limit = 3, sortBy, isOfficial}) async {
     const _extra = <String, dynamic>{};
     final queryParameters = <String, dynamic>{
       r'forumId': forumId,
       r'p': page,
       r'limit': limit,
-      r'sortBy': sortBy
+      r'sortBy': sortBy,
+      r'isOfficial': isOfficial
     };
     queryParameters.removeWhere((k, v) => v == null);
     final _data = <String, dynamic>{};
@@ -515,10 +517,13 @@ class _RestClient implements RestClient {
   }
 
   @override
-  getPostListByHot(forumId, {page, options}) async {
-    ArgumentError.checkNotNull(forumId, 'forumId');
+  getPostListByHot({forumId, page, isOfficial, options}) async {
     const _extra = <String, dynamic>{};
-    final queryParameters = <String, dynamic>{r'forumId': forumId, r'p': page};
+    final queryParameters = <String, dynamic>{
+      r'forumId': forumId,
+      r'p': page,
+      r'isOfficial': isOfficial
+    };
     queryParameters.removeWhere((k, v) => v == null);
     final _data = <String, dynamic>{};
     final newOptions = newRequestOptions(options);
@@ -534,7 +539,7 @@ class _RestClient implements RestClient {
   }
 
   @override
-  getPostListByUser(uid, {forumId, page, sortBy, removeTop}) async {
+  getPostListByUser(uid, {forumId, page, sortBy, removeTop, isOfficial}) async {
     ArgumentError.checkNotNull(uid, 'uid');
     const _extra = <String, dynamic>{};
     final queryParameters = <String, dynamic>{
@@ -542,7 +547,8 @@ class _RestClient implements RestClient {
       r'forumId': forumId,
       r'p': page,
       r'sortBy': sortBy,
-      r'removeTop': removeTop
+      r'removeTop': removeTop,
+      r'isOfficial': isOfficial
     };
     queryParameters.removeWhere((k, v) => v == null);
     final _data = <String, dynamic>{};
@@ -560,10 +566,9 @@ class _RestClient implements RestClient {
   }
 
   @override
-  getPostListByFollow(uid, forumId,
-      {page, limit, testuid, sortBy, options}) async {
+  getPostListByFollow(uid,
+      {forumId, page, limit, testuid, sortBy, isOfficial, options}) async {
     ArgumentError.checkNotNull(uid, 'uid');
-    ArgumentError.checkNotNull(forumId, 'forumId');
     const _extra = <String, dynamic>{};
     final queryParameters = <String, dynamic>{
       r'uid': uid,
@@ -571,7 +576,8 @@ class _RestClient implements RestClient {
       r'p': page,
       r'limit': limit,
       r'testuid': testuid,
-      r'sortBy': sortBy
+      r'sortBy': sortBy,
+      r'isOfficial': isOfficial
     };
     queryParameters.removeWhere((k, v) => v == null);
     final _data = <String, dynamic>{};
@@ -1111,13 +1117,14 @@ class _RestClient implements RestClient {
   }
 
   @override
-  userFriends({groupId, kw, page, limit = 50}) async {
+  userFriends({groupId, kw, page, limit = 50, test}) async {
     const _extra = <String, dynamic>{};
     final queryParameters = <String, dynamic>{
       r'groupId': groupId,
       r'kw': kw,
       r'p': page,
-      r'limit': limit
+      r'limit': limit,
+      r'test': test
     };
     queryParameters.removeWhere((k, v) => v == null);
     final _data = <String, dynamic>{};
@@ -1135,6 +1142,31 @@ class _RestClient implements RestClient {
   }
 
   @override
+  userFriendsTest({groupId, kw, page, limit = 50, test}) async {
+    const _extra = <String, dynamic>{};
+    final queryParameters = <String, dynamic>{
+      r'groupId': groupId,
+      r'kw': kw,
+      r'p': page,
+      r'limit': limit,
+      r'test': test
+    };
+    queryParameters.removeWhere((k, v) => v == null);
+    final _data = <String, dynamic>{};
+    final Response<Map<String, dynamic>> _result = await _dio.request(
+        '/forum/friends',
+        queryParameters: queryParameters,
+        options: RequestOptions(
+            method: 'GET',
+            headers: <String, dynamic>{},
+            extra: _extra,
+            baseUrl: baseUrl),
+        data: _data);
+    final value = RespListTest<UserFriend>.fromJson(_result.data);
+    return value;
+  }
+
+  @override
   userSearch({kw, page, limit = 20}) async {
     const _extra = <String, dynamic>{};
     final queryParameters = <String, dynamic>{

+ 44 - 12
lib/widgets/appbar.dart

@@ -1,12 +1,26 @@
+import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:sport/widgets/image.dart';
 
-const titleStyle = TextStyle(fontWeight: FontWeight.w600,fontSize: 18.0, color: Color(0xff333333));
+const titleStyle = TextStyle(
+    fontWeight: FontWeight.w600, fontSize: 18.0, color: Color(0xff333333));
 
 Widget buildSliverAppBar(BuildContext context, String title,
-    {List<Widget> actions, backgroundColor = Colors.white, paddingLeading = true, useClose = false, canBack = true, innerBoxIsScrolled = false, height = 110.0}) {
+    {List<Widget> actions,
+      backgroundColor = Colors.white,
+      paddingLeading = true,
+      useClose = false,
+      canBack = true,
+      innerBoxIsScrolled = false,
+      height = 110.0,
+      brightness = 0,
+      textStyle = titleStyle,
+      whiteBackButton = false,
+      pinned = true
+    }) {
   return SliverAppBar(
-      pinned: true,
+      pinned: pinned,
+      brightness: brightness == 1 ? Brightness.dark : Brightness.light,
       expandedHeight: height,
       backgroundColor: backgroundColor,
       forceElevated: innerBoxIsScrolled,
@@ -26,38 +40,56 @@ Widget buildSliverAppBar(BuildContext context, String title,
                     Navigator.of(context).pop();
                   },
                 )
-              : Container(),
+              : whiteBackButton
+                  ? IconButton(
+                      icon:
+                          Image.asset("lib/assets/img/topbar_return_white.png"),
+                      onPressed: () {
+                        Navigator.of(context).pop();
+                      },
+                    )
+                  : Container(),
       actions: actions,
-      flexibleSpace: buildFlexibleSpace(title, paddingLeading: paddingLeading));
+      flexibleSpace: buildFlexibleSpace(title,
+          paddingLeading: paddingLeading, textStyle: textStyle));
 }
 
-Widget buildFlexibleSpace(String title, {paddingLeading = true}) {
+Widget buildFlexibleSpace(
+  String title, {
+  paddingLeading = true,
+  textStyle = titleStyle,
+}) {
   return LayoutBuilder(builder: (context, box) {
-    final FlexibleSpaceBarSettings settings = context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
+    final FlexibleSpaceBarSettings settings =
+        context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
     return FlexibleSpaceBar(
       centerTitle: false,
       titlePadding: EdgeInsets.fromLTRB(12.0, 0, 0, 15.0),
       title: paddingLeading
           ? Padding(
-              padding: EdgeInsets.only(left: (settings.maxExtent - box.biggest.height) / 3 * 2),
+              padding: EdgeInsets.only(
+                  left: (settings.maxExtent - box.biggest.height) / 3 * 2),
               child: Text(
                 title,
-                style: titleStyle,
+                style: textStyle,
               ),
             )
           : Text(
               title,
-              style: titleStyle,
+              style: textStyle,
             ),
     );
   });
 }
 
-Widget buildActionButton(String title, VoidCallback onPressed,{Color textColor}) {
+Widget buildActionButton(String title, VoidCallback onPressed,
+    {Color textColor}) {
   return IconButton(
     icon: Text(
       title,
-      style: textColor != null ? TextStyle(fontSize: 16.0,color: textColor) :TextStyle(fontSize: 16),
+      style: textColor != null
+          ? TextStyle(fontSize: 16.0, color: textColor)
+          : TextStyle(fontSize: 16),
     ),
     onPressed: onPressed,
   );

+ 17 - 9
lib/widgets/menu_share_bottom.dart

@@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
 import 'package:image_gallery_saver/image_gallery_saver.dart';
 import 'package:provider/provider.dart';
 import 'package:sport/bean/post.dart';
+import 'package:sport/pages/social/post_page.dart';
 import 'package:sport/pages/social/post_share_page.dart';
 import 'package:sport/provider/user_model.dart';
 import 'package:sport/router/navigator_util.dart';
@@ -104,11 +105,17 @@ class _MenuShareBottomContentState extends State<MenuShareBottomContent>
         "callBack": () async {
           if (widget.shareType == "social") {
             await NavigatorUtil.goPage(
-                context, (context) => PostSharePage(post: widget.post));
+                context,
+                (contxt) => PostPage(
+                      "",
+                      post: widget.post,
+                    ));
           } else if (widget.shareType == "Link") {
             await NavigatorUtil.goPage(
                 context,
-                (context) => PostSharePage(
+                (contxt) => PostPage(
+                      "",
+                      post: widget.post,
                       url: "http://shoes-web.hiyd.com/share",
                       hash: widget.hash,
                     ));
@@ -117,7 +124,7 @@ class _MenuShareBottomContentState extends State<MenuShareBottomContent>
             print("$path---------------------------------");
             Future.delayed(new Duration(milliseconds: 200));
             await NavigatorUtil.goPage(
-                context, (context) => PostSharePage(image: path));
+                context, (context) => PostPage("",image: path));
           }
           Navigator.pop(context, true);
         }
@@ -191,13 +198,12 @@ class _MenuShareBottomContentState extends State<MenuShareBottomContent>
       Directory(sTempDir).create();
     }
     // QQ分享需要一个确实存在的图片
-    File file = await File(
-            sTempDir + "/poster-temp-${DateTime.now().millisecondsSinceEpoch}.png")
+    File file = await File(sTempDir +
+            "/poster-temp-${DateTime.now().millisecondsSinceEpoch}.png")
         .writeAsBytes(pngBytes);
 
-
-
-    print("[file]:${file.readAsBytesSync().length}---------------${pngBytes.length}----------------");
+    print(
+        "[file]:${file.readAsBytesSync().length}---------------${pngBytes.length}----------------");
     return file.path;
   }
 
@@ -273,7 +279,9 @@ class _MenuShareBottomContentState extends State<MenuShareBottomContent>
                                 width: 44.0,
                                 height: 44.0,
                               ),
-                              Space(height: 6.0,),
+                              Space(
+                                height: 6.0,
+                              ),
                               Text(
                                 "${e["value"]}",
                                 style: Theme.of(context).textTheme.subtitle2,

+ 49 - 20
lib/widgets/misc.dart

@@ -1,6 +1,7 @@
 import 'dart:math';
 
 import 'package:cached_network_image/cached_network_image.dart';
+import 'package:dartin/dartin.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_easyrefresh/easy_refresh.dart';
 import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
@@ -8,8 +9,11 @@ import 'package:provider/provider.dart';
 import 'package:sport/bean/post_user.dart';
 import 'package:sport/bean/user.dart';
 import 'package:sport/constant/ui.dart';
+import 'package:sport/pages/my/achievement_detail_page.dart';
 import 'package:sport/provider/user_model.dart';
 import 'package:sport/router/navigator_util.dart';
+import 'package:sport/services/api/inject_api.dart';
+import 'package:sport/services/api/login_api.dart';
 import 'package:sport/widgets/dialog/popupmenu.dart' as menu;
 import 'package:sport/widgets/image.dart';
 import 'package:sport/widgets/refresh_header.dart' as header;
@@ -80,33 +84,58 @@ Widget achievementGroupWidget(List<Achievement> achievements) {
         );
 }
 
-Widget achievementWidget(BuildContext context, Achievement item, {double w = 70, bool replace = false, bool isRadius = false, bool jump = true}) => InkWell(
-    onTap: () {
+Widget achievementWidget(BuildContext context, Achievement item, {double w = 70, bool replace = false, bool isRadius = false, bool jump = true,showCount=false}) => InkWell(
+    onTap: () async {
+      // 不能看别人的成就...
       if(item.userId != null && Provider.of<UserModel>(context, listen: false).user.id != item.userId)
         return;
-      if (jump == true) NavigatorUtil.goAchievementDetails(context, id: item.id, userId: item.userId ?? 0, replace: replace);
+//      if (jump == true) NavigatorUtil.goAchievementDetails(context, id: item.id, userId: item.userId ?? 0, replace: replace);
+        if(jump == true) {
+          List<Achievement> relateAchievements = (await inject<LoginApi>().getAchieveDetailInfo(item.id)).data.relateAchievements;
+          showSharePopup(context,relateAchievements,item.id);
+        }
+
     },
-    child: Column(
+    child: Stack(
       children: <Widget>[
-        isRadius
-            ? CircleAvatar(backgroundImage: CachedNetworkImageProvider(item.logo ?? ""), radius: w / 2)
-            : item?.createdAt == ""
+        Column(
+          children: <Widget>[
+            isRadius
+                ? CircleAvatar(backgroundImage: CachedNetworkImageProvider(item.logo ?? ""), radius: w / 2)
+                : item?.createdAt == ""
                 ? ColorFiltered(
-                    colorFilter: ColorFilter.mode(Color(0xffF1F1F1), BlendMode.color),
-                    child: CachedNetworkImage(width: w, height: w, imageUrl: item.logo ?? ""),
-                  )
+              colorFilter: ColorFilter.mode(Color(0xffF1F1F1), BlendMode.color),
+              child: CachedNetworkImage(width: w, height: w, imageUrl: item.logo ?? ""),
+            )
                 : Container(
-                    width: w,
-                    height: w,
-                    child: CachedNetworkImage(imageUrl: item.logo ?? ""),
-                  ),
-        Space(
-          height: 5,
+              width: w,
+              height: w,
+              child: CachedNetworkImage(imageUrl: item.logo ?? ""),
+            ),
+            Space(
+              height: 5,
+            ),
+            Text(
+              item.seriesName  != null ? item.seriesName : item.name,
+              style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: w < 80 ? 12 : 14),
+            )
+          ],
         ),
-        Text(
-          item.name,
-          style: Theme.of(context).textTheme.subtitle1.copyWith(fontSize: w < 80 ? 12 : 14),
-        )
+        showCount ? Positioned(
+          top: 0,
+          right: 10.0,
+          child: Container(
+            alignment: Alignment.center,
+            width: 32.0,height: 21.0,
+            decoration: BoxDecoration(
+              image: DecorationImage(
+                image: AssetImage("lib/assets/img/bg_achievement_number.png"),
+                fit: BoxFit.cover,
+              )
+            ),
+            child: Text("${item.seriesCount}枚",style:TextStyle(fontSize: 12.0,color:Colors.white),strutStyle: StrutStyle(forceStrutHeight: true, height: 0.8),),
+          )
+        ):Container()
       ],
     ));
 

+ 1 - 0
pubspec.yaml

@@ -78,6 +78,7 @@ dependencies:
   # The following adds the Cupertino Icons font to your application.
   # Use with the CupertinoIcons class for iOS style icons.
   cupertino_icons: ^0.1.3
+  azlistview: ^1.1.0 # 列表搜索
 
 dev_dependencies:
   flutter_test: