diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 479b5e9e..d5ca3dbc 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -24,7 +24,7 @@ class CommunityChildPage extends StatefulWidget { class _CommunityChildPage extends State { RefreshController refreshController = RefreshController(); ApiService apiService; - int pageNum = 1; + int pageNum = 0; List comments = []; @@ -36,7 +36,7 @@ class _CommunityChildPage extends State { } _onRefresh() async { - pageNum = 1; + pageNum = 0; setState(() {}); } @@ -50,7 +50,7 @@ class _CommunityChildPage extends State { token: value.getString("token"), ); } - + pageNum += 1; BaseData> baseData = await apiService.trendList({ "onlyFollow": widget.typeStr == "关注" ? true:false, "onlyMe": false, diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index 467ef9b0..c2c69020 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -199,8 +199,7 @@ class _CommunityDetails extends State body: Container( height: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top + - kToolbarHeight - - 68, + kToolbarHeight - 68, margin: EdgeInsets.only(top: 50 + kToolbarHeight), child: Column( children: [ @@ -231,6 +230,7 @@ class _CommunityDetails extends State Container( width: double.infinity, alignment: Alignment.topCenter, + margin: EdgeInsets.only(top: 20), padding: EdgeInsets.all(22.h), child: Text( S.of(context).zanwupinglun, diff --git a/lib/community/community_view/community_comment.dart b/lib/community/community_view/community_comment.dart index 123a9c3c..1ea7bc0c 100644 --- a/lib/community/community_view/community_comment.dart +++ b/lib/community/community_view/community_comment.dart @@ -206,7 +206,7 @@ class _CommunityComment extends State { ], ), alignment: Alignment.topCenter, - padding: EdgeInsets.only(top: 22.h), + padding: EdgeInsets.only(top: 22.h,bottom: 22), child: Text( S.of(context).yixiansquanbupinglun, style: TextStyle( diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 87742550..e320dd8c 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -106,9 +106,7 @@ class _CommunityDynamic extends State { child: Row( children: [ MImage( - widget.comment != null - ? widget.comment.memberInfo.avatar - : "", + widget?.comment?.memberInfo?.avatar??"", width: 44, height: 44, isCircle: true, @@ -124,9 +122,7 @@ class _CommunityDynamic extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - widget.comment != null - ? widget.comment.memberInfo.nickname - : "", + widget?.comment?.memberInfo?.nickname??"", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.medium, @@ -134,9 +130,7 @@ class _CommunityDynamic extends State { ), ), Text( - widget.comment != null - ? widget.comment.createTime - : "", + widget?.comment?.createTime??"", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -199,7 +193,7 @@ class _CommunityDynamic extends State { ), Text( widget.comment.subject ?? "", - // maxLines: 5, + maxLines: 5, overflow: TextOverflow.ellipsis, style: TextStyle( color: Color(0xFF1A1A1A), @@ -221,7 +215,6 @@ class _CommunityDynamic extends State { (widget.comment != null) ? "${widget.comment.viewers}" : "", - // "${widget.comment.viewers ?? 0}", space: 4.w, leftImage: "assets/svg/liulanliang.svg", iconSize: 16, diff --git a/lib/mine/mine_view/community_follow.dart b/lib/mine/mine_view/community_follow.dart index 94a2718c..1eed9d6e 100644 --- a/lib/mine/mine_view/community_follow.dart +++ b/lib/mine/mine_view/community_follow.dart @@ -1,10 +1,16 @@ +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/mine/follow_page.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/social_info.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_tab.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import '../fans_page.dart'; @@ -18,14 +24,34 @@ class CommunityFollow extends StatefulWidget { class _CommunityFollow extends State with SingleTickerProviderStateMixin { - + ApiService apiService; + SocialInfo infoNumber; @override void initState() { super.initState(); - + querySocialInfo(); } + ///个人社交信息(粉丝/关注数量) + querySocialInfo() async { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: false, + ); + + BaseData baseData = + await apiService.socialInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + infoNumber = baseData.data; + }); + } + EasyLoading.dismiss(); + } @override Widget build(BuildContext context) { @@ -56,8 +82,8 @@ class _CommunityFollow extends State indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽 tabs: [ - MyTab(text:"关注(0)",), - MyTab(text: "粉丝(0)"), + MyTab(text:"关注(${infoNumber?.follow??"0"})",), + MyTab(text: "粉丝(${infoNumber?.fans??"0"})"), ], ), ), diff --git a/lib/mine/release_page.dart b/lib/mine/release_page.dart index 01c7dff0..2923e642 100644 --- a/lib/mine/release_page.dart +++ b/lib/mine/release_page.dart @@ -23,7 +23,7 @@ class ReleasePage extends StatefulWidget { class _ReleasePage extends State { RefreshController refreshController = RefreshController(); ApiService apiService; - int pageNum = 1; + int pageNum = 0; List comments = []; @@ -35,7 +35,7 @@ class _ReleasePage extends State { } _onRefresh() async { - pageNum = 1; + pageNum = 0; setState(() {}); } @@ -48,7 +48,7 @@ class _ReleasePage extends State { token: value.getString("token"), ); } - + pageNum += 1; BaseData> baseData = await apiService.trendList({ "onlyFollow": false, "onlyMe": true,