ソースを参照

Merge branch 'd-dev' of http://svn.ouj.com:3000/ouj/flutter-sport into k-dev-20210122

kidd3166 3 年 前
コミット
c8286388a5

BIN
lib/assets/img/bbs_icon_friend.png


BIN
lib/assets/img/bbs_icon_official.png


+ 200 - 167
lib/pages/my/achievement_detail_page.dart

@@ -278,40 +278,46 @@ Future<bool> showSharePopup(
 //                              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(
+        return Material(
+          color: Colors.transparent,
+          child: Column(
+//            mainAxisSize: MainAxisSize.max,
+            children: <Widget>[
+              Space(
+                height: MediaQuery.of(context).padding.top + 31,
+              ),
+              Column(
+                mainAxisSize: MainAxisSize.max,
+                mainAxisAlignment: MainAxisAlignment.start,
+                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,
+                  ),
+                  Stack(
+//                    fit: StackFit.expand,
+                    alignment: Alignment.topCenter,
+                    overflow: Overflow.visible,
                     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(
+//                          itemWidth: MediaQuery.of(context).size.width,
                           loop: false,
                           index: startIndex,
                           itemBuilder: (BuildContext context, int index) {
@@ -319,39 +325,43 @@ Future<bool> showSharePopup(
                               children: <Widget>[
                                 relateAchievements[index].createdAt != ""
                                     ? CachedNetworkImage(
-                                  imageUrl: relateAchievements[index].logo,
-                                  width: 180,
-                                  height: 180,
-                                )
+                                        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(
+                                        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)
+                                            imageUrl:
+                                                relateAchievements[index]
+                                                    .logo),
+                                      ),
+                                if (index == currentIndex)
                                   Column(
                                     children: <Widget>[
                                       Space(
@@ -359,15 +369,13 @@ Future<bool> showSharePopup(
                                       ),
                                       Text(
                                         "${relateAchievements[index].name}",
-                                        style:
-                                        TextStyle(fontSize: 18.0, color: Colors.white),
+                                        style: TextStyle(
+                                            fontSize: 18.0,
+                                            color: Colors.white),
                                       ),
                                       Space(
                                         height: 5.0,
                                       ),
-                                      Text("${relateAchievements[index].conditionDetail}",
-                                          style: TextStyle(
-                                              fontSize: 14.0, color: Color(0xff999999))),
                                     ],
                                   )
                               ],
@@ -381,118 +389,143 @@ Future<bool> showSharePopup(
                               builder: DotSwiperPaginationBuilder(
                                   size: 6,
                                   activeSize: 6,
-                                  activeColor: Theme.of(context).accentColor)),
+                                  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,
+                      Positioned(
+//                          top: 120.0,
+                        top: 180,
+                        child: Container(
+                          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,
+                                            ),
+                                            Container(
+                                              alignment: Alignment.center,
+                                              child: Text(
+                                                  "${relateAchievements[value].conditionDetail}",
+                                                  style: TextStyle(
+                                                      fontSize: 14.0,
+                                                      color:
+                                                          Color(0xff999999))),
+                                            ),
+                                            Space(
+                                              height: 50.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,
+                                              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),
+                                              ),
                                             ),
-                                            child: Container(
-                                              height: 8,
+                                          ],
+                                        )
+                                      : Column(
+                                          children: <Widget>[
+                                            Space(
+                                              height: 57.0,
                                             ),
-                                          ),
-                                        ),
-                                      ),
-                                    ),
-                                    Space(
-                                      height: 5.0,
-                                    ),
-                                    Text(
-                                        "${relateAchievements[value].conditionProgress} / ${relateAchievements[value].conditionCount}")
-                                  ],
-                                );
-                              } else {
-                                return Container();
-                              }
-                            }),
-                      )],
-                  ),
-                )
-              ],
-            ),
+                                            Text(
+                                              "成就条件: ${relateAchievements[value].conditionDetail}",
+                                              style: TextStyle(
+                                                  fontSize: 14.0,
+                                                  color: Color(0xff999999)),
+                                            ),
+                                            Space(
+                                              height: 50.0,
+                                            ),
+                                            Text("未获得"),
+                                            Space(
+                                              height: 22.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();
+                                }
+                              }),
+                        ),
+                      ),
+                    ],
+                  )
+                ],
+              ),
+            ],
           ),
         );
       });

+ 35 - 16
lib/pages/social/post_widget.dart

@@ -313,19 +313,38 @@ class _PostWidgetState extends State<PostWidget> with InjectApi {
                                           ),
                                     if (post?.followStatus == "friends")
                                       Container(
+                                        margin: EdgeInsets.only(left: 4.0),
+                                        width: 27.0,
+                                        height: 14.0,
                                           decoration: BoxDecoration(
-                                              color: Colors.white,
-                                              borderRadius: BorderRadius.all(Radius.circular(2)),
-                                              border: Border.all(
-                                                color: Theme.of(context).accentColor,
-                                                width: .5,
-                                              )),
-                                          padding: EdgeInsets.fromLTRB(4, 0, 4, 2),
-                                          margin: EdgeInsets.fromLTRB(6.0, 0, 6, 0),
-                                          child: Text(
-                                            "好友",
-                                            style: Theme.of(context).textTheme.subtitle2.copyWith(color: Theme.of(context).accentColor, fontSize: 11),
-                                          ))
+//                                              color: Colors.white,
+//                                              borderRadius: BorderRadius.all(Radius.circular(2)),
+//                                              border: Border.all(
+//                                                color: Theme.of(context).accentColor,
+//                                                width: .5,
+//                                              )
+                                            image: DecorationImage(
+                                              image: AssetImage("lib/assets/img/bbs_icon_friend.png")
+                                            ),
+                                          ),
+//                                          padding: EdgeInsets.fromLTRB(4, 0, 4, 2),
+//                                          margin: EdgeInsets.fromLTRB(6.0, 0, 6, 0),
+//                                          child: Text(
+//                                            "好友",
+//                                            style: Theme.of(context).textTheme.subtitle2.copyWith(color: Theme.of(context).accentColor, fontSize: 11),
+//                                          )
+                                      ),
+                                    if(post?.isOfficial == "1")
+                                      Container(
+                                        margin: EdgeInsets.only(left: 4.0),
+                                        width: 27.0,
+                                        height: 14.0,
+                                        decoration: BoxDecoration(
+                                          image: DecorationImage(
+                                              image: AssetImage("lib/assets/img/bbs_icon_official.png")
+                                          ),
+                                        ),
+                                      ),
                                   ],
                                 ),
                                 Space(
@@ -691,12 +710,12 @@ class _PostWidgetState extends State<PostWidget> with InjectApi {
           ),
         if(post.gameName != null && post.gameName != "" )
         Container(
-            padding: EdgeInsets.fromLTRB(8.0, 0, 8.0, 16.0),
+            padding: EdgeInsets.fromLTRB(12.0, 0, 12.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),),
+              padding: EdgeInsets.symmetric(vertical: 4.0,horizontal: 12.0),
+              decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(12.0)),color: Color(0xffF1F1F1)),
+              child: Text(post.gameName,style: TextStyle(color: Color(0xff999999),fontSize: 12.0),),
             ),
           ),
         Divider(

+ 181 - 162
lib/pages/social/share_achievement.dart

@@ -32,93 +32,94 @@ class ShareAchievementPage extends StatelessWidget {
             alignment: Alignment.centerLeft,
           ),
           leading: buildBackButton(context),
-          actions: <Widget>[
-            IconButton(
-              icon: Image.asset("lib/assets/img/bbs_icon_share.png"),
-              onPressed: () async {
-                await menuShareBottom(context, "Img",
-                    poster: poster, hasDownload: true);
-              },
-            )
-          ],
+//          actions: <Widget>[
+//            IconButton(
+//              icon: Image.asset("lib/assets/img/bbs_icon_share.png"),
+//              onPressed: () async {
+//                await menuShareBottom(context, "Img",
+//                    poster: poster, hasDownload: true);
+//              },
+//            )
+//          ],
         ),
-        body: Container(
-            color: Color(0xff999999),
-            width: MediaQuery.of(context).size.width * 1,
-            child: Column(
-              children: <Widget>[
-                Expanded(
-                    child: Column(
-                        mainAxisAlignment: MainAxisAlignment.start,
-                        children: <Widget>[
-                      Space(
-                        height: 40.0,
-                      ),
-                      RepaintBoundary(
-                        key: poster,
-                        child: Container(
-                          width: MediaQuery.of(context).size.width * 0.65,
-                          decoration: BoxDecoration(
-                            borderRadius:
-                                BorderRadius.all(Radius.circular(10.0)),
-                            color: Colors.white,
-                          ),
-                          child: Column(
-                            crossAxisAlignment: CrossAxisAlignment.center,
-                            children: <Widget>[
-                              Space(
-                                height: 35.0,
-                              ),
-                              Text(
-                                "恭喜您达到新成就",
-                                style: Theme.of(context).textTheme.headline3,
-                              ),
-                              Space(
-                                height: 5.0,
-                              ),
-                              Text(
-                                "您是第${achievement.userCount}位获得者",
-                                style: Theme.of(context).textTheme.bodyText1,
-                              ),
-                              Space(
-                                height: 16.0,
-                              ),
-                              Container(
-                                width: double.infinity,
-                                decoration: BoxDecoration(
-                                    image: DecorationImage(
-                                        image: AssetImage("lib/assets/img/bg_pop_achievement.png")
-                                    )
+        body: Stack(children: [
+          Container(
+              color: Color(0xff999999),
+              width: MediaQuery.of(context).size.width * 1,
+              child: Column(
+                children: <Widget>[
+                  Expanded(
+                      child: Column(
+                          mainAxisAlignment: MainAxisAlignment.start,
+                          children: <Widget>[
+                        Space(
+                          height: 40.0,
+                        ),
+                        RepaintBoundary(
+                          key: poster,
+                          child: Container(
+                            width: MediaQuery.of(context).size.width * 0.65,
+                            decoration: BoxDecoration(
+                              borderRadius:
+                                  BorderRadius.all(Radius.circular(10.0)),
+                              color: Colors.white,
+                            ),
+                            child: Column(
+                              crossAxisAlignment: CrossAxisAlignment.center,
+                              children: <Widget>[
+                                Space(
+                                  height: 35.0,
+                                ),
+                                Text(
+                                  "恭喜您达到新成就",
+                                  style: Theme.of(context).textTheme.headline3,
+                                ),
+                                Space(
+                                  height: 5.0,
                                 ),
-                                child: CachedNetworkImage(
-                                  imageUrl: achievement.logo,
-                                  width: 120.0,
-                                  height: 120.0,
+                                Text(
+                                  "您是第${achievement.userCount}位获得者",
+                                  style: Theme.of(context).textTheme.bodyText1,
+                                ),
+                                Space(
+                                  height: 16.0,
+                                ),
+                                Container(
+                                  width: double.infinity,
+                                  decoration: BoxDecoration(
+                                      image: DecorationImage(
+                                          image: AssetImage(
+                                              "lib/assets/img/bg_pop_achievement.png"))),
+                                  child: CachedNetworkImage(
+                                    imageUrl: achievement.logo,
+                                    width: 120.0,
+                                    height: 120.0,
+                                  ),
                                 ),
-                              ),
-                              Space(
-                                height: 8.0,
-                              ),
-                              Text(
-                                "${achievement.name}",
-                                style: Theme.of(context).textTheme.headline1,
-                              ),
-                              Space(
-                                height: 12.0,
-                              ),
-                              Text(
-                                "使用智能鞋运动${achievement.conditionDetail}",
-                                style: Theme.of(context).textTheme.bodyText1,
-                              ),
-                              Space(
-                                height: 5.0,
-                              ),
-                              Container(
-                                height: 25.0,
-                                width: MediaQuery.of(context).size.width * 0.6,
+                                Space(
+                                  height: 8.0,
+                                ),
+                                Text(
+                                  "${achievement.name}",
+                                  style: Theme.of(context).textTheme.headline1,
+                                ),
+                                Space(
+                                  height: 12.0,
+                                ),
+                                Text(
+                                  "使用智能鞋运动${achievement.conditionDetail}",
+                                  style: Theme.of(context).textTheme.bodyText1,
+                                ),
+                                Space(
+                                  height: 5.0,
+                                ),
+                                Container(
+                                  height: 25.0,
+                                  width:
+                                      MediaQuery.of(context).size.width * 0.6,
 //                                color: Color(0xffFFC400).withOpacity(0.3),
-                                alignment: Alignment.center,
-                                decoration: BoxDecoration(
+                                  alignment: Alignment.center,
+                                  decoration: BoxDecoration(
 //                                  gradient: new RadialGradient(
 //                                      radius: 4,
 //                                      colors: [
@@ -126,93 +127,111 @@ class ShareAchievementPage extends StatelessWidget {
 //                                        Color(0x00ffffff),
 //                                      ]),
                                       image: DecorationImage(
-                                        image: AssetImage("lib/assets/img/bg1_pop_achievement.png")
-                                      )
+                                          image: AssetImage(
+                                              "lib/assets/img/bg1_pop_achievement.png"))),
+                                  child: Text(
+                                    "经验值+${achievement.rewardExp}  积分+${achievement.rewardScore}",
+                                    style: Theme.of(context)
+                                        .textTheme
+                                        .subtitle2
+                                        .copyWith(
+                                            color:
+                                                Theme.of(context).accentColor),
+                                  ),
                                 ),
-                                child: Text(
-                                  "经验值+${achievement.rewardExp}  积分+${achievement.rewardScore}",
-                                  style: Theme.of(context)
-                                      .textTheme
-                                      .subtitle2
-                                      .copyWith(
-                                          color: Theme.of(context).accentColor),
+                                Space(
+                                  height: 14.0,
                                 ),
-                              ),
-                              Space(
-                                height: 14.0,
-                              ),
-                              Row(
-                                mainAxisAlignment: MainAxisAlignment.center,
-                                children: <Widget>[
-                                  Expanded(
-                                    child: Divider(
-                                      indent: 50.0,
-                                      endIndent: 10.0,
-                                    ),
-                                  ),
-                                  Text(
-                                    "${achievement.createdAt}",
-                                    style:
-                                        Theme.of(context).textTheme.bodyText1,
-                                  ),
-                                  Expanded(
-                                    child: Divider(
-                                      indent: 10.0,
-                                      endIndent: 50.0,
-                                    ),
-                                  ),
-                                ],
-                              ),
-                              Container(
-                                margin: EdgeInsets.only(top: 8.0),
-                                width: MediaQuery.of(context).size.width * 1,
-                                padding: EdgeInsets.fromLTRB(12, 9,12, 9),
-//                                color: Colors.black,
-                                decoration: BoxDecoration(
-                                    color: Colors.black,
-                                    borderRadius: BorderRadius.only(
-                                        bottomLeft: Radius.circular(10),
-                                        bottomRight: Radius.circular(10))),
-                                child: Row(
-                                  mainAxisAlignment:
-                                      MainAxisAlignment.spaceBetween,
+                                Row(
+                                  mainAxisAlignment: MainAxisAlignment.center,
                                   children: <Widget>[
-                                    Column(
-                                      crossAxisAlignment:
-                                          CrossAxisAlignment.start,
-                                      children: <Widget>[
-                                        Container(
-                                            width: 36,
-                                            height: 36,
-                                            color: Color(0xFFFFC400)),
-                                        Space(
-                                          height: 4.0,
-                                        ),
-                                        Text(
-                                          "这是一段产品sloagn",
-                                          style: Theme.of(context)
-                                              .textTheme
-                                              .bodyText1,
-                                        )
-                                      ],
+                                    Expanded(
+                                      child: Divider(
+                                        indent: 50.0,
+                                        endIndent: 10.0,
+                                      ),
                                     ),
-                                    Container(
-                                      width: 60.0,
-                                      height: 60.0,
-                                      child: Center(
-                                        child: Text("二维码"),
+                                    Text(
+                                      "${achievement.createdAt}",
+                                      style:
+                                          Theme.of(context).textTheme.bodyText1,
+                                    ),
+                                    Expanded(
+                                      child: Divider(
+                                        indent: 10.0,
+                                        endIndent: 50.0,
                                       ),
-                                      color: Colors.white,
                                     ),
                                   ],
                                 ),
-                              )
-                            ],
+                                Container(
+                                  margin: EdgeInsets.only(top: 8.0),
+                                  width: MediaQuery.of(context).size.width * 1,
+                                  padding: EdgeInsets.fromLTRB(12, 9, 12, 9),
+//                                color: Colors.black,
+                                  decoration: BoxDecoration(
+                                      color: Colors.black,
+                                      borderRadius: BorderRadius.only(
+                                          bottomLeft: Radius.circular(10),
+                                          bottomRight: Radius.circular(10))),
+                                  child: Row(
+                                    mainAxisAlignment:
+                                        MainAxisAlignment.spaceBetween,
+                                    children: <Widget>[
+                                      Column(
+                                        crossAxisAlignment:
+                                            CrossAxisAlignment.start,
+                                        children: <Widget>[
+                                          Container(
+                                              width: 36,
+                                              height: 36,
+                                              color: Color(0xFFFFC400)),
+                                          Space(
+                                            height: 4.0,
+                                          ),
+                                          Text(
+                                            "这是一段产品sloagn",
+                                            style: Theme.of(context)
+                                                .textTheme
+                                                .bodyText1,
+                                          )
+                                        ],
+                                      ),
+                                      Container(
+                                        width: 60.0,
+                                        height: 60.0,
+                                        child: Center(
+                                          child: Text("二维码"),
+                                        ),
+                                        color: Colors.white,
+                                      ),
+                                    ],
+                                  ),
+                                )
+                              ],
+                            ),
                           ),
-                        ),
-                      )
-                    ])),
-              ],
-            )));
+                        )
+                      ])),
+                ],
+              )),
+          Positioned(
+              bottom: 0,
+              child: Container(
+//                height: 300,
+//              color: Colors.white,
+                decoration: BoxDecoration(
+                    borderRadius: BorderRadius.only(
+                        topLeft: Radius.circular(10),
+                        topRight: Radius.circular(10)),
+                    color: Colors.white),
+                width: MediaQuery.of(context).size.width,
+                child: MenuShareBottomContent(
+                  "Img",
+                  hasDownload: true,
+                  poster: poster,
+                ),
+              )),
+        ]));
   }
 }

+ 231 - 135
lib/pages/social/user_friend_page.dart

@@ -6,6 +6,7 @@ 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/bean/user_info.dart';
 import 'package:sport/pages/social/chat_page.dart';
 import 'package:sport/pages/social/user_detail_page.dart';
 import 'package:sport/pages/social/user_friend_add_page.dart';
@@ -161,18 +162,46 @@ class _PageDetailPage extends StatefulWidget {
 }
 
 class _PageDetailState
-    extends ViewStateLifecycle<_PageDetailPage, UserFriendModel> {
+    extends ViewStateLifecycle<_PageDetailPage, UserFriendModel>
+    with ChangeNotifier {
   TextEditingController _controller;
   FocusNode _focusNode;
   ValueNotifier<String> _searchValue = ValueNotifier<String>("");
-
+  bool isSeach = false;
   _PageDetailState(int type);
-
   @override
   void initState() {
     super.initState();
     _focusNode = FocusNode();
     _controller = new TextEditingController(text: '');
+    // 监听 ...
+    _controller.addListener(() {
+      if (_controller.value.text != "") {
+        if (widget.type == 0) {
+          model.items = model.originItems
+              .where(
+                  (element) => element.user.name.indexOf(_controller.text) > -1)
+              .toList();
+          setState(() {
+            isSeach = true;
+          });
+        } else {
+          model.list = model.originList
+              .where((element) => element.name.indexOf(_controller.text) > -1)
+              .toList();
+        }
+        notifyListeners();
+      } else {
+        if (widget.type == 0) {
+          setState(() {
+            isSeach = false;
+          });
+        }
+        model.items = model.originItems;
+        model.list = model.originList;
+        notifyListeners();
+      }
+    });
   }
 
   @override
@@ -195,88 +224,150 @@ class _PageDetailState
                     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),
+                    isSeach
+                        ? model.items.length > 0
+                            ? Expanded(
+                                child: ListView.builder(
+                                  itemBuilder: (context, index) => ListTile(
+                                    leading: InkWell(
+                                      child: Container(
+                                        width: 44,
+                                        height: 44,
+                                        decoration: BoxDecoration(
+                                          shape: BoxShape.rectangle,
+                                          borderRadius:
+                                              BorderRadius.circular(4.0),
+                                          image: DecorationImage(
+                                              image: CachedNetworkImageProvider(
+                                            model.items[index].user.avatar,
+                                          )),
+                                        ),
+                                      ),
+                                      onTap: () {
+                                        NavigatorUtil.goPage(
+                                            context,
+                                            (context) => UserDetailPage(
+                                                    PostUser.fromJson({
+                                                  "id":
+                                                      "${model.items[index].user.uid}"
+                                                })));
+                                      },
+                                    ),
+                                    title:
+                                        Text("${model.items[index].user.name}"),
+                                    onTap: () {
+                                      NavigatorUtil.goPage(
+                                          context,
+                                          (context) => ChatPage(
+                                              UserInfo.fromJson(model
+                                                  .items[index].user
+                                                  .toJson())));
+                                    },
                                   ),
+                                  itemCount: model.items.length,
                                 ),
-                              ),
-                              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),
+                              )
+                            : _searchNothings()
+                        : Expanded(
+                            child: AzListView(
+                              data: model.items,
+                              susItemHeight: 200,
+                              itemCount: model.items.length,
+                              indexBarData:
+                                  model.tags.map((e) => "$e").toList(),
+                              itemBuilder: (BuildContext context, int index) {
+                                return ListTile(
+                                  leading: InkWell(
+                                    child: Container(
+                                      width: 44,
+                                      height: 44,
+                                      decoration: BoxDecoration(
+                                        shape: BoxShape.rectangle,
+                                        borderRadius:
+                                            BorderRadius.circular(4.0),
+                                        image: DecorationImage(
+                                            image: CachedNetworkImageProvider(
+                                          model.items[index].user.avatar,
+                                        )),
+                                      ),
+                                    ),
+                                    onTap: () {
+                                      NavigatorUtil.goPage(
+                                          context,
+                                          (context) => UserDetailPage(
+                                                  PostUser.fromJson({
+                                                "id":
+                                                    "${model.items[index].user.uid}"
+                                              })));
+                                    },
+                                  ),
+                                  title:
+                                      Text("${model.items[index].user.name}"),
+                                  onTap: () {
+                                    NavigatorUtil.goPage(
+                                        context,
+                                        (context) => ChatPage(UserInfo.fromJson(
+                                            model.items[index].user.toJson())));
+                                  },
+                                );
+                              },
+                              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,
+                                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),
+                              ),
                             ),
                           ),
-                          indexHintTextStyle:
-                              TextStyle(fontSize: 18.0, color: Colors.white),
-                          indexHintAlignment: Alignment.centerRight,
-                          indexHintChildAlignment: Alignment(-0.25, 0.0),
-                          indexHintOffset: Offset(0, 0),
-                        ),
-                      ),
-                    ),
                   ],
                 )
               : EasyRefresh.custom(
@@ -295,14 +386,19 @@ class _PageDetailState
                       SliverToBoxAdapter(
                         child: RequestLoadingWidget(),
                       ),
-                    SliverList(
-                      delegate: SliverChildBuilderDelegate(
-                        (context, index) {
-                          return _buildItem(model.list[index]);
-                        },
-                        childCount: model.list.length,
+                    if (model.list.length > 0)
+                      SliverList(
+                        delegate: SliverChildBuilderDelegate(
+                          (context, index) {
+                            return _buildItem(model.list[index]);
+                          },
+                          childCount: model.list.length,
+                        ),
+                      ),
+                    if (model.list.length <= 0)
+                      SliverToBoxAdapter(
+                        child: _searchNothings(),
                       ),
-                    ),
                     if (model.isError)
                       SliverToBoxAdapter(
                         child: RequestErrorWidget(
@@ -366,11 +462,7 @@ class _PageDetailState
                               )
                             : TextSpan(
                                 text: '通过扫码',
-                                style: Theme.of(context)
-                                    .textTheme
-                                    .bodyText1
-                                    .copyWith(
-                                        color: Theme.of(context).accentColor),
+                                style: Theme.of(context).textTheme.bodyText1,
                               ),
                         TextSpan(
                           text: "关注了你",
@@ -435,16 +527,11 @@ class _PageDetailState
                 ? Container(
                     width: 64,
                     height: 30,
-                    margin: _padding,
+//                    margin: _padding,
                     alignment: Alignment.center,
-                    child: Text(
-                      "已关注",
-                      strutStyle: fixedLine,
-                      style: Theme.of(context)
-                          .textTheme
-                          .bodyText2
-                          .copyWith(color: Theme.of(context).accentColor),
-                    ),
+                    child: Text("已关注",
+                        strutStyle: fixedLine,
+                        style: Theme.of(context).textTheme.bodyText2),
                   )
                 : GestureDetector(
                     child: Container(
@@ -517,9 +604,27 @@ class _PageDetailState
                     ? Text("已关注",
                         style:
                             TextStyle(fontSize: 14.0, color: Color(0xff999999)))
-                    : Text("关注",
-                        style: TextStyle(
-                            fontSize: 14.0, color: Color(0xff999999))),
+                    : Container(
+                        width: 64,
+                        height: 30,
+                        margin: _padding,
+                        alignment: Alignment.center,
+                        child: Text(
+                          "关注",
+                          strutStyle: fixedLine,
+                          style: Theme.of(context)
+                              .textTheme
+                              .bodyText2
+                              .copyWith(color: Theme.of(context).accentColor),
+                        ),
+                        decoration: BoxDecoration(
+                          borderRadius: BorderRadius.circular(20),
+                          border: Border.all(
+                            color: Theme.of(context).accentColor,
+                            width: .5,
+                          ),
+                        ),
+                      ),
 //            Container(
 //              width: 82,
 //              height: 30,
@@ -566,7 +671,7 @@ class _PageDetailState
 //                    });
 //                  }
                 });
-              } else {
+              } else if (flag == null) {
                 await request(context, () async {
                   var resp = await model.api
                       .userFollow(uid: user?.socialInfo?.id)
@@ -583,39 +688,8 @@ class _PageDetailState
           )
         ],
       );
-    } 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,
-//                ),
-//              ],
-//            ),
-//          ),
-//        ],
-//      );
+    } else if (widget.type == 4) {
+//        child = ListView.separated(itemBuilder: ()=>, itemCount: );
     }
 //    return Column(
 //      children: <Widget>[
@@ -736,6 +810,28 @@ class _PageDetailState
     );
   }
 
+  Widget _searchNothings() {
+    return Column(
+      mainAxisSize: MainAxisSize.min,
+      children: <Widget>[
+        Padding(
+          padding: const EdgeInsets.fromLTRB(0, 50, 0, 0),
+          child: Image.asset("lib/assets/img/emptypage-image-nonetwork.png"),
+        ),
+        Padding(
+          padding: const EdgeInsets.fromLTRB(0, 12, 0, 12),
+          child: Text(
+            "搜索无果",
+            style: Theme.of(context).textTheme.bodyText2,
+          ),
+        ),
+        SizedBox(
+          height: 100,
+        )
+      ],
+    );
+  }
+
   @override
   UserFriendModel createModel() => UserFriendModel(widget.type);
 }

+ 12 - 3
lib/provider/user_friend_model.dart

@@ -13,6 +13,10 @@ class UserFriendModel extends ViewStateRefreshListModel<UserFriend>
   String kw;
 //  Map map;
   List<SuspensionBean> items = [];
+  List<SuspensionBean> originItems = [];
+
+  List originList = [];
+  List<String> tags = [];
   UserFriendModel(this.type);
 
   @override
@@ -22,24 +26,29 @@ class UserFriendModel extends ViewStateRefreshListModel<UserFriend>
       case 2:
         results =
             (await api.userFansList(kw: kw, page: max(1, pageNum))).results.list;
+        originList = results;
+
         break;
       case 1:
         results =
             (await api.userFollowList(kw: kw, page: max(1, pageNum))).results.list;
+        originList = results;
         break;
       default:
         ResultsTest<UserFriend> data = (await api.userFriendsTest(
                 kw: kw, page: max(1, pageNum), test: "1"))
             .results;
         items = [];
+        tags = data.map.keys.toList();
         data.map.forEach((key, value) {
           value.forEach((element) {
             items.add(SuspensionBean(key, UserFriend.fromJson(element)));
           });
         });
-        items.forEach((element) {
-          print(element.toJson());
-        });
+//        items.forEach((element) {
+//          print(element.toJson());
+//        });
+        originItems = items;
         SuspensionUtil.setShowSuspensionStatus(items);
         SuspensionUtil.sortListBySuspensionTag(items);
         break;