Browse Source

Merge branches 'dev' and 'master' of https://git.lotus-wallet.com/fmk/huixiang_app

 Conflicts:
	lib/community/community_child_page.dart
	lib/mine/mine_page.dart
	lib/retrofit/min_api.dart
master
fmk 3 years ago
parent
commit
5bae27a6e5
  1. BIN
      assets/image/2x/dynamic.png
  2. BIN
      assets/image/3x/dynamic.png
  3. BIN
      assets/image/dynamic.png
  4. 7
      lib/article/hot_article_item.dart
  5. 68
      lib/community/community_child_page.dart
  6. 171
      lib/community/community_details.dart
  7. 3
      lib/community/community_page.dart
  8. 33
      lib/community/community_view/community_comment.dart
  9. 212
      lib/community/community_view/community_dynamic.dart
  10. 6
      lib/community/release_dynamic.dart
  11. 3
      lib/generated/intl/messages_en.dart
  12. 3
      lib/generated/intl/messages_zh_CN.dart
  13. 3
      lib/generated/intl/messages_zh_Hans_CN.dart
  14. 3
      lib/generated/intl/messages_zh_Hant_CN.dart
  15. 3
      lib/generated/intl/messages_zh_TW.dart
  16. 30
      lib/generated/l10n.dart
  17. 3
      lib/l10n/intl_en.arb
  18. 3
      lib/l10n/intl_zh_CN.arb
  19. 3
      lib/l10n/intl_zh_Hans_CN.arb
  20. 3
      lib/l10n/intl_zh_Hant_CN.arb
  21. 3
      lib/l10n/intl_zh_TW.arb
  22. 58
      lib/mine/fans_page.dart
  23. 64
      lib/mine/follow_page.dart
  24. 1
      lib/mine/manage_address_page.dart
  25. 60
      lib/mine/mine_page.dart
  26. 21
      lib/mine/mine_view/community_follow.dart
  27. 17
      lib/mine/mine_view/mine_item.dart
  28. 326
      lib/mine/release_page.dart
  29. 13
      lib/retrofit/data/article.dart
  30. 1
      lib/retrofit/data/comunity_comment.dart
  31. 159
      lib/retrofit/data/follow_list.dart
  32. 2
      lib/retrofit/data/page.dart
  33. 37
      lib/retrofit/data/social_info.dart
  34. 18
      lib/retrofit/retrofit_api.dart
  35. 92
      lib/retrofit/retrofit_api.g.dart
  36. 1
      lib/view_widget/coupon_widget.dart
  37. 194
      lib/view_widget/hot_item.dart
  38. 7
      lib/web/web_page.dart
  39. 4
      lib/web/web_view/comment_list.dart
  40. 8
      lib/web/web_view/input_comment.dart

BIN
assets/image/2x/dynamic.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/image/3x/dynamic.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
assets/image/dynamic.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

7
lib/article/hot_article_item.dart

@ -108,11 +108,12 @@ class _HotArticlePage extends State<HotArticlePage> {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return AspectRatio( return AspectRatio(
aspectRatio: position == 0 ? 1.38 : 3.56, aspectRatio: position == 0 ? 1.38 : 2.56,
child: Container( child: Container(
height: position == 0 ? 247.h : 96.h, height: position == 0 ? 247.h : 96.h,
margin: EdgeInsets.symmetric(vertical: 6.h, horizontal: 16.w), margin: EdgeInsets.symmetric(vertical:6.h, horizontal: 16.w),
child: HotArticleItem(article: articles[position], isHot: position == 0), child:
HotArticleItem(article: articles[position], isHot: position == 0),
), ),
); );
}, },

68
lib/community/community_child_page.dart

@ -11,6 +11,10 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class CommunityChildPage extends StatefulWidget { class CommunityChildPage extends StatefulWidget {
final String typeStr;
CommunityChildPage(this.typeStr);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _CommunityChildPage(); return _CommunityChildPage();
@ -36,6 +40,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
setState(() {}); setState(() {});
} }
///
queryCommunity() async { queryCommunity() async {
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
@ -47,7 +52,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
} }
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({ BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"onlyFollow": false, "onlyFollow": widget.typeStr == "关注" ? true:false,
"onlyMe": false, "onlyMe": false,
"pageNum": pageNum, "pageNum": pageNum,
"pageSize": 10, "pageSize": 10,
@ -77,38 +82,37 @@ class _CommunityChildPage extends State<CommunityChildPage> {
future: queryCommunity(), future: queryCommunity(),
builder: (context, position) { builder: (context, position) {
return SmartRefresher( return SmartRefresher(
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: true, enablePullUp: true,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
header: MyHeader(), header: MyHeader(),
footer: CustomFooter( footer: CustomFooter(
builder: (context, mode) { builder: (context, mode) {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
onRefresh: _onRefresh, onRefresh: _onRefresh,
onLoading: () { onLoading: () {
setState(() {}); setState(() {});
},
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(comments[position]),
onTap: () {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"comment": comments[position],
},
);
},
);
}, },
itemCount: comments.length, child: ListView.builder(
), physics: NeverScrollableScrollPhysics(),
); itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(comments[position],0),
onTap: () {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"comment": comments[position],
},
);
},
);
},
itemCount: comments.length,
));
}, },
); );
} }

171
lib/community/community_details.dart

@ -5,34 +5,40 @@ import 'package:huixiang/community/community_view/community_comment.dart';
import 'package:huixiang/community/community_view/community_dynamic.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/member_comment_list.dart'; import 'package:huixiang/retrofit/data/member_comment_list.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/comment_menu.dart'; import 'package:huixiang/view_widget/comment_menu.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:huixiang/view_widget/tips_dialog.dart'; import 'package:huixiang/view_widget/tips_dialog.dart';
import 'package:huixiang/web/web_view/comment_list.dart';
import 'package:huixiang/web/web_view/input_comment.dart'; import 'package:huixiang/web/web_view/input_comment.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class CommunityDetails extends StatefulWidget { class CommunityDetails extends StatefulWidget {
// final ComunityComment arguments;
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
CommunityDetails({this.arguments}); CommunityDetails({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _CommunityDetails(); return _CommunityDetails();
} }
} }
class _CommunityDetails extends State<CommunityDetails> { class _CommunityDetails extends State<CommunityDetails>
with WidgetsBindingObserver {
double height = 0; double height = 0;
double commentHeight = 60.h; double commentHeight = 60.h;
ComunityComment comunity;
String parenId = "0";
final GlobalKey commentKey = GlobalKey();
final ScrollController scrollController = ScrollController();
List<MemberCommentList> memberList = []; List<MemberCommentList> memberList = [];
ApiService apiService; ApiService apiService;
@ -40,10 +46,14 @@ class _CommunityDetails extends State<CommunityDetails> {
String hintText = S.current.liuxianinjingcaidepinglunba; String hintText = S.current.liuxianinjingcaidepinglunba;
bool isKeyBoardShow = false; bool isKeyBoardShow = false;
int commentTotal = 0;
Article article;
@override @override
void didChangeMetrics() { void didChangeMetrics() {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
if (MediaQuery.of(context).viewInsets.bottom == 0) { if (MediaQuery.of(context).viewInsets.bottom == 0) {
if (isKeyBoardShow) { if (isKeyBoardShow) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
@ -63,26 +73,39 @@ class _CommunityDetails extends State<CommunityDetails> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
comunity = widget.arguments["comment"];
WidgetsBinding.instance.addObserver(this);
SharedPreferences.getInstance().then((value) { _queryMemberCommentList();
apiService = ApiService( queryDetails();
Dio(), }
context: context,
token: value.getString("token"), ///
); queryDetails() async {
}); SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
BaseData<Article> baseData = await apiService
.informationInfo(comunity.id)
.catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Scaffold(
body: Container(
child: Column(
children: [ children: [
Expanded( Expanded(
child: NestedScrollView( child: NestedScrollView(
headerSliverBuilder: (context, position) { headerSliverBuilder: (context, position) {
return [ return [
SliverOverlapAbsorber( SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar( sliver: SliverAppBar(
expandedHeight: (height == 0) ? 614 : height, expandedHeight: (height == 0) ? 614 : height,
pinned: true, pinned: true,
@ -120,7 +143,7 @@ class _CommunityDetails extends State<CommunityDetails> {
), ),
color: Colors.white, color: Colors.white,
child: CommunityDynamic( child: CommunityDynamic(
widget.arguments["comment"], comunity,0,
itemCount: 3, itemCount: 3,
isDetails: true, isDetails: true,
heightFun: (height) { heightFun: (height) {
@ -146,7 +169,7 @@ class _CommunityDetails extends State<CommunityDetails> {
child: Row( child: Row(
children: [ children: [
Text( Text(
S.of(context).pinglun_("1"), S.of(context).pinglun_(commentTotal.toString()),
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -157,7 +180,8 @@ class _CommunityDetails extends State<CommunityDetails> {
width: 16.w, width: 16.w,
), ),
Text( Text(
S.of(context).xihuan_("0"), S.of(context).xihuan_(
"${comunity?.likes ?? comunity?.likes ?? "0"}"),
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -177,11 +201,11 @@ class _CommunityDetails extends State<CommunityDetails> {
MediaQuery.of(context).padding.top + MediaQuery.of(context).padding.top +
kToolbarHeight - kToolbarHeight -
68, 68,
margin: EdgeInsets.only(top: 68 + 50 + kToolbarHeight), margin: EdgeInsets.only(top: 50 + kToolbarHeight),
child: Column( child: Column(
children: [ children: [
if (memberList != null && memberList.length > 0) if (memberList != null && memberList.length > 0)
ListView.builder( Expanded(child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: memberList != null ? memberList.length : 0, itemCount: memberList != null ? memberList.length : 0,
@ -197,35 +221,12 @@ class _CommunityDetails extends State<CommunityDetails> {
child: CommunityComment( child: CommunityComment(
memberList[position], memberList[position],
_queryCommentLike, _queryCommentLike,
(memberList.length-1 == position)?1:0
), ),
), ),
); );
}, },
), )),
if (memberList != null && memberList.length > 0)
Container(
height: commentHeight,
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 2),
blurRadius: 14,
spreadRadius: 0,
),
],
),
alignment: Alignment.topCenter,
padding: EdgeInsets.only(top: 22.h),
child: Text(
S.of(context).yixiansquanbupinglun,
style: TextStyle(
fontSize: 12,
color: Color(0xff353535),
),
),
),
if (memberList == null || memberList.length == 0) if (memberList == null || memberList.length == 0)
Container( Container(
width: double.infinity, width: double.infinity,
@ -257,46 +258,55 @@ class _CommunityDetails extends State<CommunityDetails> {
_toComment, _toComment,
_queryMemberComment, _queryMemberComment,
_queryInformationLikes, _queryInformationLikes,
isLike: comunity.selfLike,
), ),
], ],
); )));
} }
/// ////
_queryInformationLikes() async { _queryInformationLikes() async {
BaseData baseData = await apiService.informationLikes(""); BaseData baseData = await apiService.informationLikes(comunity.id);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
// commentKey.currentState.setState(() {}); // commentKey.currentState.setState(() {});
setState(() {
if(comunity.selfLike??false)
comunity.likes -= 1;
else comunity.likes += 1;
comunity.selfLike = !comunity.selfLike??false;
});
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
} }
// ///
_queryMemberComment(String content) async { _queryMemberComment(String content) async {
// BaseData baseData = await apiService.memberComment({ BaseData baseData = await apiService.memberComment({
// "content": content, "content": content,
// "parentId": parenId, "parentId": parenId,
// "relationalId": "relationalId": comunity.id,
// widget.arguments["activityId"] ?? widget.arguments["articleId"], "relationalType": 1
// "relationalType": 1 }).catchError((error) {});
// }).catchError((error) {}); if (baseData != null && baseData.isSuccess) {
// if (baseData != null && baseData.isSuccess) { // commentKey.currentState.initState();
// commentKey.currentState.initState(); commentTextController.text = "";
// commentTextController.text = ""; FocusScope.of(context).unfocus();
// _toComment(); _queryMemberCommentList();
// } }
} }
/// ///
_toComment() { _toComment() {
// if (commentKey.currentContext == null) return; if (commentKey.currentContext == null) return;
// RenderBox firstRenderBox = commentKey.currentContext.findRenderObject(); RenderBox firstRenderBox = commentKey.currentContext.findRenderObject();
// Offset first = firstRenderBox.localToGlobal(Offset.zero); Offset first = firstRenderBox.localToGlobal(Offset.zero);
// scrollController.animateTo(first.dy + scrollController.offset - scrollController.animateTo(
// (kToolbarHeight + MediaQuery.of(context).padding.top), first.dy +
// duration: Duration(milliseconds: 300), scrollController.offset -
// curve: Curves.easeIn); (kToolbarHeight + MediaQuery.of(context).padding.top),
duration: Duration(milliseconds: 300),
curve: Curves.easeIn);
} }
final GlobalKey inputKey = GlobalKey(); final GlobalKey inputKey = GlobalKey();
@ -355,11 +365,11 @@ class _CommunityDetails extends State<CommunityDetails> {
/// ///
_reply(memberComment) { _reply(memberComment) {
FocusScope.of(context).requestFocus(commentFocus); FocusScope.of(context).requestFocus(commentFocus);
// parenId = memberComment.id; parenId = memberComment.id;
hintText = S.of(context).huifu_("${memberComment.username}"); hintText = S.of(context).huifu_("${memberComment.username}");
} }
// ///
_queryCommentLike(String id) async { _queryCommentLike(String id) async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
String token = sharedPreferences.getString("token"); String token = sharedPreferences.getString("token");
@ -382,4 +392,29 @@ class _CommunityDetails extends State<CommunityDetails> {
}); });
} }
} }
///
_queryMemberCommentList() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: sharedPreferences.getString("token"),
showLoading: false,
);
BaseData<PageInfo<MemberCommentList>> baseData =
await apiService.memberCommentList({
"pageNum": 1,
"pageSize": 100,
"relationalId": comunity.id,
"relationalType": 1,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
commentTotal = baseData.data.size;
memberList = baseData.data.list;
contentHeight();
setState(() {});
}
}
} }

3
lib/community/community_page.dart

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/article/hot_article_item.dart'; import 'package:huixiang/article/hot_article_item.dart';
import 'package:huixiang/community/community_child_page.dart'; import 'package:huixiang/community/community_child_page.dart';
import 'package:huixiang/home/home_view/hot_article.dart';
import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/home/huixiang_brand_page.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -94,7 +93,7 @@ class _CommunityPage extends State<CommunityPage>
}else if(e == "头条"){ }else if(e == "头条"){
return HotArticlePage(); return HotArticlePage();
} else { } else {
return CommunityChildPage(); return CommunityChildPage(e);
} }
}).toList(), }).toList(),
controller: tabcontroller, controller: tabcontroller,

33
lib/community/community_view/community_comment.dart

@ -1,19 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/member_comment_list.dart'; import 'package:huixiang/retrofit/data/member_comment_list.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:like_button/like_button.dart'; import 'package:like_button/like_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
class CommunityComment extends StatefulWidget { class CommunityComment extends StatefulWidget {
MemberCommentList memberList; final MemberCommentList memberList;
Function(String id) queryCommentLike; final Function(String id) queryCommentLike;
CommunityComment(this.memberList, this.queryCommentLike); final int footType;
CommunityComment(this.memberList, this.queryCommentLike,this.footType);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -194,6 +192,29 @@ class _CommunityComment extends State<CommunityComment> {
), ),
), ),
), ),
if (widget.footType == 1)
Container(
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 2),
blurRadius: 14,
spreadRadius: 0,
),
],
),
alignment: Alignment.topCenter,
padding: EdgeInsets.only(top: 22.h),
child: Text(
S.of(context).yixiansquanbupinglun,
style: TextStyle(
fontSize: 12,
color: Color(0xff353535),
),
),
),
], ],
), ),
); );

212
lib/community/community_view/community_dynamic.dart

@ -1,25 +1,34 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class CommunityDynamic extends StatefulWidget { class CommunityDynamic extends StatefulWidget {
final int itemCount; final int itemCount;
final Function(double height) heightFun; final Function(double height) heightFun;
final bool isDetails; final bool isDetails;
final int commentType;
final Function removalDynamic;
final ComunityComment comment; final ComunityComment comment;
CommunityDynamic( CommunityDynamic(
this.comment, { this.comment,
this.commentType, {
Key key, Key key,
this.itemCount = 9, this.itemCount = 9,
this.heightFun, this.heightFun,
this.isDetails = false, this.isDetails = false,
this.removalDynamic,
}) : super(key: key); }) : super(key: key);
@override @override
@ -31,12 +40,44 @@ class CommunityDynamic extends StatefulWidget {
class _CommunityDynamic extends State<CommunityDynamic> { class _CommunityDynamic extends State<CommunityDynamic> {
GlobalKey globalKey = GlobalKey(); GlobalKey globalKey = GlobalKey();
double height = 0; double height = 0;
ApiService apiService;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(),
context: context, token: value.getString('token')),
});
}
////
_vipFollow(followId) async {
BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("关注成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
///
_deleteDynamic(id) async {
BaseData baseData = await apiService.deleteTrend(id);
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("删除成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 2),
key: globalKey, key: globalKey,
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
@ -64,13 +105,16 @@ class _CommunityDynamic extends State<CommunityDynamic> {
height: 44, height: 44,
child: Row( child: Row(
children: [ children: [
ClipRRect( MImage(
child: Image.asset( widget.comment != null
"assets/image/default_user.png", ? widget.comment.memberInfo.avatar
width: 44, : "",
height: 44, width: 44,
), height: 44,
borderRadius: BorderRadius.circular(22), isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
), ),
SizedBox( SizedBox(
width: 8, width: 8,
@ -80,7 +124,9 @@ class _CommunityDynamic extends State<CommunityDynamic> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"百花谷", widget.comment != null
? widget.comment.memberInfo.nickname
: "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
@ -88,7 +134,9 @@ class _CommunityDynamic extends State<CommunityDynamic> {
), ),
), ),
Text( Text(
"2021.04.12", widget.comment != null
? widget.comment.createTime
: "",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -100,22 +148,49 @@ class _CommunityDynamic extends State<CommunityDynamic> {
], ],
), ),
), ),
RoundButton( GestureDetector(
padding: EdgeInsets.symmetric( onTap: () {
horizontal: 8, setState(() {
vertical: 3, if (widget.commentType == 0) {
), widget.comment.selfFollow =
backgroup: Color(0xFF32A060), !(widget.comment.selfFollow ?? false);
textColor: Colors.white, _vipFollow(widget.comment.memberInfo.mid);
text: "关注", } else {
radius: 20, showDeleteDialog();
icons: SvgPicture.asset( }
"assets/svg/shequ_fabu.svg", });
fit: BoxFit.contain, },
color: Colors.white, child: (widget.commentType == 0)
width: 14, ? RoundButton(
height: 14, padding: EdgeInsets.symmetric(
), horizontal: 8,
vertical: 3,
),
backgroup: (widget.comment.selfFollow ?? false)
? Color(0xFFE6E6E6)
: Color(0xFF32A060),
textColor: (widget.comment.selfFollow ?? false)
? Color(0xFF808080)
: Colors.white,
text: (widget.comment.selfFollow ?? false)
? "已关注"
: "关注",
radius: 20,
icons: Icon(
(widget.comment.selfFollow ?? false)
? Icons.check
: Icons.add,
color: (widget.comment.selfFollow ?? false)
? Color(0xFF808080)
: Colors.white,
size: 14,
),
)
: Icon(
Icons.close,
color: Colors.black,
size: 16,
),
), ),
], ],
), ),
@ -124,7 +199,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
), ),
Text( Text(
widget.comment.subject ?? "", widget.comment.subject ?? "",
maxLines: 5, // maxLines: 5,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Color(0xFF1A1A1A), color: Color(0xFF1A1A1A),
@ -143,7 +218,10 @@ class _CommunityDynamic extends State<CommunityDynamic> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
IconText( IconText(
"${widget.comment.viewers ?? 0}", (widget.comment != null)
? "${widget.comment.viewers}"
: "",
// "${widget.comment.viewers ?? 0}",
space: 4.w, space: 4.w,
leftImage: "assets/svg/liulanliang.svg", leftImage: "assets/svg/liulanliang.svg",
iconSize: 16, iconSize: 16,
@ -173,6 +251,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
); );
} }
///
Widget buildMedia(SubjectInfo subjectInfo) { Widget buildMedia(SubjectInfo subjectInfo) {
if (subjectInfo == null) { if (subjectInfo == null) {
return Container(); return Container();
@ -241,6 +320,81 @@ class _CommunityDynamic extends State<CommunityDynamic> {
); );
} }
///
showDeleteDialog() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 110.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"确定要删除这条动态?",
style: TextStyle(
fontSize: 17.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(
height: 30.h,
),
Row(
children: [
Expanded(
child: InkWell(
child: BorderText(
text: "取消",
textColor: Color(0xFF32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
borderColor: Color(0xFF32A060),
radius: 4,
padding: EdgeInsets.all(12),
borderWidth: 1,
),
onTap: () {
Navigator.of(context).pop();
},
),
flex: 1,
),
SizedBox(
width: 16.w,
),
Expanded(
child: InkWell(
child: RoundButton(
text: "确定",
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
_deleteDynamic(widget.comment.id);
Navigator.of(context).pop();
},
),
flex: 1,
),
],
)
],
),
),
);
},
);
}
@override @override
void didChangeDependencies() { void didChangeDependencies() {
if (widget.heightFun != null) if (widget.heightFun != null)

6
lib/community/release_dynamic.dart

@ -30,6 +30,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
TextEditingController textEditingController = TextEditingController(); TextEditingController textEditingController = TextEditingController();
ApiService apiService; ApiService apiService;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -118,7 +119,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
releaseDynamic() async { releaseDynamic() async {
String dynamicText = textEditingController.text; String dynamicText = textEditingController.text;
if (dynamicText == null || dynamicText == "") { if (dynamicText == null || dynamicText == "") {
SmartDialog.showToast("请输入您此刻的想法!"); SmartDialog.showToast("请输入您此刻的想法!");
return; return;
} }
EasyLoading.show(status: S.of(context).zhengzaijiazai); EasyLoading.show(status: S.of(context).zhengzaijiazai);
@ -152,7 +153,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
EasyLoading.dismiss(); EasyLoading.dismiss();
}); });
if (baseData.isSuccess) { if (baseData.isSuccess) {
SmartDialog.showToast("发布成功!"); SmartDialog.showToast("发布成功!");
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}); });
@ -367,6 +368,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
), ),
child: TextField( child: TextField(
controller: textEditingController, controller: textEditingController,
maxLines:5,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,

3
lib/generated/intl/messages_en.dart

@ -200,6 +200,7 @@ class MessageLookup extends MessageLookupByLibrary {
"faxingshijian" : m4, "faxingshijian" : m4,
"feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非实物兑换吗"), "feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非实物兑换吗"),
"feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非实物商品兑换后领取到卡包即可使用!"), "feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非实物商品兑换后领取到卡包即可使用!"),
"fensi" : MessageLookupByLibrary.simpleMessage("粉丝"),
"fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"), "fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"),
"fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接点击右上方的分享给到你想要邀请的人。"), "fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接点击右上方的分享给到你想要邀请的人。"),
"fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"), "fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"),
@ -218,6 +219,7 @@ class MessageLookup extends MessageLookupByLibrary {
"guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"), "guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"),
"guanyu" : MessageLookupByLibrary.simpleMessage("关于"), "guanyu" : MessageLookupByLibrary.simpleMessage("关于"),
"guanyuchuangshiren" : MessageLookupByLibrary.simpleMessage("关于创始人"), "guanyuchuangshiren" : MessageLookupByLibrary.simpleMessage("关于创始人"),
"guanzhu" : MessageLookupByLibrary.simpleMessage("关注"),
"guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"),
"haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"),
"haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"), "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"),
@ -491,6 +493,7 @@ class MessageLookup extends MessageLookupByLibrary {
"wenzhang" : MessageLookupByLibrary.simpleMessage("文章"), "wenzhang" : MessageLookupByLibrary.simpleMessage("文章"),
"wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章详情"), "wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章详情"),
"weulingqu" : MessageLookupByLibrary.simpleMessage("未领取"), "weulingqu" : MessageLookupByLibrary.simpleMessage("未领取"),
"wodedongtai" : MessageLookupByLibrary.simpleMessage("我的动态"),
"wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"),
"wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"),
"wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"),

3
lib/generated/intl/messages_zh_CN.dart

@ -200,6 +200,7 @@ class MessageLookup extends MessageLookupByLibrary {
"faxingshijian" : m4, "faxingshijian" : m4,
"feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非实物兑换吗"), "feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非实物兑换吗"),
"feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非实物商品兑换后领取到卡包即可使用!"), "feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非实物商品兑换后领取到卡包即可使用!"),
"fensi" : MessageLookupByLibrary.simpleMessage("粉丝"),
"fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"), "fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"),
"fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接点击右上方的分享给到你想要邀请的人。"), "fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接点击右上方的分享给到你想要邀请的人。"),
"fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"), "fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"),
@ -217,6 +218,7 @@ class MessageLookup extends MessageLookupByLibrary {
"gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("请勾选同意隐私服务和一心回乡服务协议"), "gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("请勾选同意隐私服务和一心回乡服务协议"),
"guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"), "guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"),
"guanyu" : MessageLookupByLibrary.simpleMessage("关于"), "guanyu" : MessageLookupByLibrary.simpleMessage("关于"),
"guanzhu" : MessageLookupByLibrary.simpleMessage("关注"),
"guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"),
"haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"),
"haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"), "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"),
@ -490,6 +492,7 @@ class MessageLookup extends MessageLookupByLibrary {
"wenzhang" : MessageLookupByLibrary.simpleMessage("文章"), "wenzhang" : MessageLookupByLibrary.simpleMessage("文章"),
"wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章详情"), "wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章详情"),
"weulingqu" : MessageLookupByLibrary.simpleMessage("未领取"), "weulingqu" : MessageLookupByLibrary.simpleMessage("未领取"),
"wodedongtai" : MessageLookupByLibrary.simpleMessage("我的动态"),
"wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"),
"wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"),
"wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"),

3
lib/generated/intl/messages_zh_Hans_CN.dart

@ -200,6 +200,7 @@ class MessageLookup extends MessageLookupByLibrary {
"faxingshijian" : m4, "faxingshijian" : m4,
"feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非实物兑换吗"), "feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非实物兑换吗"),
"feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非实物商品兑换后领取到卡包即可使用!"), "feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非实物商品兑换后领取到卡包即可使用!"),
"fensi" : MessageLookupByLibrary.simpleMessage("粉丝"),
"fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"), "fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"),
"fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接点击右上方的分享给到你想要邀请的人。"), "fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接点击右上方的分享给到你想要邀请的人。"),
"fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"), "fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"),
@ -217,6 +218,7 @@ class MessageLookup extends MessageLookupByLibrary {
"gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("请勾选同意隐私服务和一心回乡服务协议"), "gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("请勾选同意隐私服务和一心回乡服务协议"),
"guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"), "guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"),
"guanyu" : MessageLookupByLibrary.simpleMessage("关于"), "guanyu" : MessageLookupByLibrary.simpleMessage("关于"),
"guanzhu" : MessageLookupByLibrary.simpleMessage("关注"),
"guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"),
"haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"),
"haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"), "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"),
@ -490,6 +492,7 @@ class MessageLookup extends MessageLookupByLibrary {
"wenzhang" : MessageLookupByLibrary.simpleMessage("文章"), "wenzhang" : MessageLookupByLibrary.simpleMessage("文章"),
"wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章详情"), "wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章详情"),
"weulingqu" : MessageLookupByLibrary.simpleMessage("未领取"), "weulingqu" : MessageLookupByLibrary.simpleMessage("未领取"),
"wodedongtai" : MessageLookupByLibrary.simpleMessage("我的动态"),
"wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"),
"wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"),
"wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"),

3
lib/generated/intl/messages_zh_Hant_CN.dart

@ -200,6 +200,7 @@ class MessageLookup extends MessageLookupByLibrary {
"faxingshijian" : m4, "faxingshijian" : m4,
"feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非實物兌換碼"), "feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非實物兌換碼"),
"feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非實物商品!"), "feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非實物商品!"),
"fensi" : MessageLookupByLibrary.simpleMessage("粉絲"),
"fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"), "fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"),
"fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接點擊右上方的分享給到你想要邀請的人。"), "fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接點擊右上方的分享給到你想要邀請的人。"),
"fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"), "fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"),
@ -217,6 +218,7 @@ class MessageLookup extends MessageLookupByLibrary {
"gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("請勾選同意隱私服務和一心回鄉服務協定"), "gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("請勾選同意隱私服務和一心回鄉服務協定"),
"guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"), "guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"),
"guanyu" : MessageLookupByLibrary.simpleMessage("關於"), "guanyu" : MessageLookupByLibrary.simpleMessage("關於"),
"guanzhu" : MessageLookupByLibrary.simpleMessage("關注"),
"guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("過健康有機生活"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("過健康有機生活"),
"haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("還沒有消息~"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("還沒有消息~"),
"haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("還沒有優惠券可以領取~"), "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("還沒有優惠券可以領取~"),
@ -490,6 +492,7 @@ class MessageLookup extends MessageLookupByLibrary {
"wenzhang" : MessageLookupByLibrary.simpleMessage("文章"), "wenzhang" : MessageLookupByLibrary.simpleMessage("文章"),
"wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章詳情"), "wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章詳情"),
"weulingqu" : MessageLookupByLibrary.simpleMessage("未領取"), "weulingqu" : MessageLookupByLibrary.simpleMessage("未領取"),
"wodedongtai" : MessageLookupByLibrary.simpleMessage("我的動態"),
"wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"),
"wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的會員等級"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的會員等級"),
"wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的積分值"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的積分值"),

3
lib/generated/intl/messages_zh_TW.dart

@ -200,6 +200,7 @@ class MessageLookup extends MessageLookupByLibrary {
"faxingshijian" : m4, "faxingshijian" : m4,
"feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非實物兌換碼"), "feishiwuduihuanma" : MessageLookupByLibrary.simpleMessage("非實物兌換碼"),
"feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非實物商品!"), "feishiwushangpin" : MessageLookupByLibrary.simpleMessage("非實物商品!"),
"fensi" : MessageLookupByLibrary.simpleMessage("粉絲"),
"fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"), "fenxiangdao" : MessageLookupByLibrary.simpleMessage("分享到"),
"fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接點擊右上方的分享給到你想要邀請的人。"), "fenxiangyaoqing" : MessageLookupByLibrary.simpleMessage("也可以直接點擊右上方的分享給到你想要邀請的人。"),
"fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"), "fenxiangzhiweixin" : MessageLookupByLibrary.simpleMessage("分享至微信"),
@ -217,6 +218,7 @@ class MessageLookup extends MessageLookupByLibrary {
"gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("請勾選同意隱私服務和一心回鄉服務協定"), "gouxuanxieyi" : MessageLookupByLibrary.simpleMessage("請勾選同意隱私服務和一心回鄉服務協定"),
"guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"), "guanlidizhi" : MessageLookupByLibrary.simpleMessage("管理地址"),
"guanyu" : MessageLookupByLibrary.simpleMessage("關於"), "guanyu" : MessageLookupByLibrary.simpleMessage("關於"),
"guanzhu" : MessageLookupByLibrary.simpleMessage("關注"),
"guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("過健康有機生活"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("過健康有機生活"),
"haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("還沒有消息~"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("還沒有消息~"),
"haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("還沒有優惠券可以領取~"), "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("還沒有優惠券可以領取~"),
@ -490,6 +492,7 @@ class MessageLookup extends MessageLookupByLibrary {
"wenzhang" : MessageLookupByLibrary.simpleMessage("文章"), "wenzhang" : MessageLookupByLibrary.simpleMessage("文章"),
"wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章詳情"), "wenzhangxiangqing" : MessageLookupByLibrary.simpleMessage("文章詳情"),
"weulingqu" : MessageLookupByLibrary.simpleMessage("未領取"), "weulingqu" : MessageLookupByLibrary.simpleMessage("未領取"),
"wodedongtai" : MessageLookupByLibrary.simpleMessage("我的動態"),
"wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"),
"wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的會員等級"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的會員等級"),
"wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的積分值"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的積分值"),

30
lib/generated/l10n.dart

@ -5145,6 +5145,36 @@ class S {
); );
} }
/// ``
String get fensi {
return Intl.message(
'粉丝',
name: 'fensi',
desc: '',
args: [],
);
}
/// ``
String get guanzhu {
return Intl.message(
'关注',
name: 'guanzhu',
desc: '',
args: [],
);
}
/// ``
String get wodedongtai {
return Intl.message(
'我的动态',
name: 'wodedongtai',
desc: '',
args: [],
);
}
/// `使` /// `使`
String get privacy_policy4 { String get privacy_policy4 {
return Intl.message( return Intl.message(

3
lib/l10n/intl_en.arb

@ -534,6 +534,9 @@
"yuanjia": "原价", "yuanjia": "原价",
"xuanguige": "选规格", "xuanguige": "选规格",
"chaojiyouhuiquan": "超值优惠券", "chaojiyouhuiquan": "超值优惠券",
"fensi": "粉丝",
"guanzhu": "关注",
"wodedongtai": "我的动态",

3
lib/l10n/intl_zh_CN.arb

@ -534,6 +534,9 @@
"yuanjia": "原价", "yuanjia": "原价",
"xuanguige": "选规格", "xuanguige": "选规格",
"chaojiyouhuiquan": "超值优惠券", "chaojiyouhuiquan": "超值优惠券",
"fensi": "粉丝",
"guanzhu": "关注",
"wodedongtai": "我的动态",

3
lib/l10n/intl_zh_Hans_CN.arb

@ -534,6 +534,9 @@
"yuanjia": "原价", "yuanjia": "原价",
"xuanguige": "选规格", "xuanguige": "选规格",
"chaojiyouhuiquan": "超值优惠券", "chaojiyouhuiquan": "超值优惠券",
"fensi": "粉丝",
"guanzhu": "关注",
"wodedongtai": "我的动态",

3
lib/l10n/intl_zh_Hant_CN.arb

@ -529,6 +529,9 @@
"yuanjia": "原價", "yuanjia": "原價",
"xuanguige": "選規格", "xuanguige": "選規格",
"chaojiyouhuiquan": "超值优惠券", "chaojiyouhuiquan": "超值优惠券",
"fensi": "粉絲",
"guanzhu": "關注",
"wodedongtai": "我的動態",

3
lib/l10n/intl_zh_TW.arb

@ -528,6 +528,9 @@
"yuanjia": "原價", "yuanjia": "原價",
"xuanguige": "選規格", "xuanguige": "選規格",
"chaojiyouhuiquan": "超值优惠券", "chaojiyouhuiquan": "超值优惠券",
"fensi": "粉絲",
"guanzhu": "關注",
"wodedongtai": "我的動態",

58
lib/mine/fans_page.dart

@ -1,15 +1,14 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/data/follow_list.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
import 'package:huixiang/view_widget/no_data_view.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -23,7 +22,8 @@ class FansPage extends StatefulWidget {
class _FansPage extends State<FansPage> { class _FansPage extends State<FansPage> {
RefreshController _refreshController; RefreshController _refreshController;
int pageNum = 1;
List<ListData> list = [];
ApiService apiService; ApiService apiService;
@override @override
@ -34,16 +34,50 @@ class _FansPage extends State<FansPage> {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = apiService =
ApiService(Dio(), context: context, token: value.getString("token")); ApiService(Dio(), context: context, token: value.getString("token"));
_queryFollowList();
}); });
} }
///
_queryFollowList() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: sharedPreferences.getString("token"),
showLoading: false,
);
BaseData<PageInfo<ListData>> baseData = await apiService.followList({
"isMyFans": true,
"pageNum": 1,
"pageSize": 100,
}).catchError((error) {
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
_refreshController.refreshCompleted();
_refreshController.loadComplete();
if (baseData != null && baseData.isSuccess) {
if (pageNum == 1) {
list.clear();
}
list.addAll(baseData.data.list);
print("list: ${list.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
_refreshController.loadNoData();
}
setState(() {});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
margin: EdgeInsets.only(top: 2),
color:Colors.white,
child: SmartRefresher( child: SmartRefresher(
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
@ -57,16 +91,18 @@ class _FansPage extends State<FansPage> {
// onRefresh: , // onRefresh: ,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: ListView.builder( child: ListView.builder(
itemCount: list == null ? 0 : list.length,
padding: EdgeInsets.symmetric(vertical: 8.h), padding: EdgeInsets.symmetric(vertical: 8.h),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
}, },
child: fansItem(), child: fansItem(list[position]),
); );
}, },
itemCount:5,
) )
// NoDataView( // NoDataView(
// isShowBtn: false, // isShowBtn: false,
@ -80,7 +116,7 @@ class _FansPage extends State<FansPage> {
} }
Widget fansItem() { Widget fansItem(ListData list) {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
child:Row( child:Row(
@ -88,7 +124,7 @@ class _FansPage extends State<FansPage> {
crossAxisAlignment:CrossAxisAlignment.center, crossAxisAlignment:CrossAxisAlignment.center,
children: [ children: [
MImage( MImage(
"assets/image/default_1.png", list != null ? (list.avatar ?? "") : "",
width: 44, width: 44,
height: 44, height: 44,
isCircle: true, isCircle: true,
@ -100,7 +136,7 @@ class _FansPage extends State<FansPage> {
width:8, width:8,
), ),
Expanded(child:Text( Expanded(child:Text(
"百花谷", list != null ? (list.nickname ?? "") : "",
style: TextStyle( style: TextStyle(
color: Color(0xFF1A1A1A), color: Color(0xFF1A1A1A),
fontSize: 14.sp, fontSize: 14.sp,

64
lib/mine/follow_page.dart

@ -3,6 +3,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/follow_list.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/data/vip_card.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
@ -23,8 +25,9 @@ class FollowPage extends StatefulWidget {
class _FollowPage extends State<FollowPage> { class _FollowPage extends State<FollowPage> {
RefreshController _refreshController; RefreshController _refreshController;
ApiService apiService; ApiService apiService;
int pageNum = 1;
List<ListData> list = [];
@override @override
void initState() { void initState() {
@ -34,16 +37,50 @@ class _FollowPage extends State<FollowPage> {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = apiService =
ApiService(Dio(), context: context, token: value.getString("token")); ApiService(Dio(), context: context, token: value.getString("token"));
_queryFollowList();
}); });
} }
///
_queryFollowList() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: sharedPreferences.getString("token"),
showLoading: false,
);
BaseData<PageInfo<ListData>> baseData = await apiService.followList({
"isMyFans": false,
"pageNum": 1,
"pageSize": 100,
}).catchError((error) {
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
_refreshController.refreshCompleted();
_refreshController.loadComplete();
if (baseData != null && baseData.isSuccess) {
if (pageNum == 1) {
list.clear();
}
list.addAll(baseData.data.list);
print("list: ${list.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
_refreshController.loadNoData();
}
setState(() {});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
margin: EdgeInsets.only(top: 2),
color:Colors.white,
child: SmartRefresher( child: SmartRefresher(
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
@ -56,18 +93,18 @@ class _FollowPage extends State<FollowPage> {
controller: _refreshController, controller: _refreshController,
// onRefresh: , // onRefresh: ,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: ListView.builder( child: ListView.builder(
itemCount: list == null ? 0 : list.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
padding: EdgeInsets.symmetric(vertical: 8.h), padding: EdgeInsets.symmetric(vertical: 8.h),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return Container(
onTap: () { child: followItem(list[position]),
},
child: followItem(),
); );
}, },
itemCount:5, ),
)
// NoDataView( // NoDataView(
// isShowBtn: false, // isShowBtn: false,
// text: "共关注0人", // text: "共关注0人",
@ -75,12 +112,13 @@ class _FollowPage extends State<FollowPage> {
// margin: EdgeInsets.only(top: 120.h), // margin: EdgeInsets.only(top: 120.h),
// ), // ),
), ),
), ),
); );
} }
Widget followItem() { Widget followItem(ListData list) {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
child:Row( child:Row(
@ -88,7 +126,7 @@ class _FollowPage extends State<FollowPage> {
crossAxisAlignment:CrossAxisAlignment.center, crossAxisAlignment:CrossAxisAlignment.center,
children: [ children: [
MImage( MImage(
"assets/image/default_1.png", list != null ? (list.avatar ?? "") : "",
width: 44, width: 44,
height: 44, height: 44,
isCircle: true, isCircle: true,
@ -100,7 +138,7 @@ class _FollowPage extends State<FollowPage> {
width:8, width:8,
), ),
Expanded(child:Text( Expanded(child:Text(
"百花谷", list != null ? (list.nickname ?? "") : "",
style: TextStyle( style: TextStyle(
color: Color(0xFF1A1A1A), color: Color(0xFF1A1A1A),
fontSize: 14.sp, fontSize: 14.sp,

1
lib/mine/manage_address_page.dart

@ -261,6 +261,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
); );
} }
///
showDeleteDialog(position) { showDeleteDialog(position) {
showDialog( showDialog(
context: context, context: context,

60
lib/mine/mine_page.dart

@ -8,6 +8,8 @@ import 'package:huixiang/main.dart';
import 'package:huixiang/mine/mine_view/mine_order.dart'; import 'package:huixiang/mine/mine_view/mine_order.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/rank.dart'; import 'package:huixiang/retrofit/data/rank.dart';
import 'package:huixiang/retrofit/data/sign_info.dart';
import 'package:huixiang/retrofit/data/social_info.dart';
import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/event_type.dart';
@ -35,6 +37,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
UserInfo userInfo; UserInfo userInfo;
List<Rank> ranks = []; List<Rank> ranks = [];
SocialInfo infoNumber;
final RefreshController _refreshController = RefreshController(); final RefreshController _refreshController = RefreshController();
_toUserInfo() async { _toUserInfo() async {
@ -57,6 +60,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
querySocialInfo();
eventBus.on<EventType>().listen((event) { eventBus.on<EventType>().listen((event) {
print("EventType: ${event.type}"); print("EventType: ${event.type}");
@ -113,6 +117,24 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
///(/)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
showLoading: false,
);
BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
infoNumber = baseData.data;
}
EasyLoading.dismiss();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
@ -283,44 +305,24 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
} }
///// /////
Widget attention() { Widget attention(){
return Container( return Container(
margin: EdgeInsets.only(left: 16, right: 17, top: 10), margin: EdgeInsets.only(left: 16,top: 10),
child: GestureDetector( child:GestureDetector(
onTap: () { onTap:(){
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/communityFollow', '/router/communityFollow',
arguments: {}, arguments: {},
); );
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
Text( Text(
"关注", S.of(context).guanzhu,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
Text(
"45",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
],
),
Row(
children: [
Text(
"粉丝",
style: TextStyle( style: TextStyle(
color: Color(0xFF000000), color: Color(0xFF000000),
fontSize: 14.sp, fontSize: 14.sp,
@ -328,7 +330,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
), ),
), ),
Text( Text(
"666", "(" + (infoNumber != null ?infoNumber.follow.toString() :"()") +")",
style: TextStyle( style: TextStyle(
color: Color(0xFF000000), color: Color(0xFF000000),
fontSize: 15.sp, fontSize: 15.sp,
@ -340,7 +342,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
Row( Row(
children: [ children: [
Text( Text(
"发布", S.of(context).fensi,
style: TextStyle( style: TextStyle(
color: Color(0xFF000000), color: Color(0xFF000000),
fontSize: 14.sp, fontSize: 14.sp,
@ -348,7 +350,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
), ),
), ),
Text( Text(
"666", "(" + (infoNumber != null ?infoNumber.fans.toString() :"()") +")",
style: TextStyle( style: TextStyle(
color: Color(0xFF000000), color: Color(0xFF000000),
fontSize: 15.sp, fontSize: 15.sp,

21
lib/mine/mine_view/community_follow.dart

@ -1,9 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/mine/follow_page.dart'; import 'package:huixiang/mine/follow_page.dart';
import 'package:huixiang/mine/release_page.dart';
import 'package:huixiang/mine/vip_card_page.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -21,10 +18,19 @@ class CommunityFollow extends StatefulWidget {
class _CommunityFollow extends State<CommunityFollow> class _CommunityFollow extends State<CommunityFollow>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
@override
void initState() {
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultTabController( return DefaultTabController(
length: 3, length: 2,
child: Scaffold( child: Scaffold(
appBar: MyAppBar( appBar: MyAppBar(
title: "", title: "",
@ -50,14 +56,13 @@ class _CommunityFollow extends State<CommunityFollow>
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
// //
tabs: <Widget>[ tabs: <Widget>[
MyTab(text:"关注(23)"), MyTab(text:"关注(0)",),
MyTab(text: "粉丝(55)"), MyTab(text: "粉丝(0)"),
MyTab(text: "发布(26)"),
], ],
), ),
), ),
body: TabBarView( body: TabBarView(
children: [FollowPage(),FansPage(),ReleasePage()], children: [FollowPage(),FansPage()],
), ),
), ),
); );

17
lib/mine/mine_view/mine_item.dart

@ -60,6 +60,23 @@ class _MineItem extends State<MineItem> {
), ),
), ),
), ),
InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context)
.pushNamed('/router/releasePage');
});
},
child: mineItem(
S.of(context).wodedongtai,
"assets/image/dynamic.png",
),
),
InkWell( InkWell(
onTap: () { onTap: () {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {

326
lib/mine/release_page.dart

@ -1,18 +1,17 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
import 'package:huixiang/view_widget/no_data_view.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ReleasePage extends StatefulWidget { class ReleasePage extends StatefulWidget {
@override @override
@ -22,251 +21,112 @@ class ReleasePage extends StatefulWidget {
} }
class _ReleasePage extends State<ReleasePage> { class _ReleasePage extends State<ReleasePage> {
RefreshController _refreshController; RefreshController refreshController = RefreshController();
var isShowShrink = false;
ApiService apiService; ApiService apiService;
int pageNum = 1;
List<ComunityComment> comments = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_refreshController = RefreshController();
SharedPreferences.getInstance().then((value) { _onRefresh();
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
});
} }
_onRefresh() async {
pageNum = 1;
setState(() {});
}
queryCommunity() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
@override BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
Widget build(BuildContext context) { "onlyFollow": false,
return Scaffold( "onlyMe": true,
body: Container( "pageNum": pageNum,
child: SmartRefresher( "pageSize": 10,
enablePullDown: true, "searchKey": ""
enablePullUp: false, }).catchError((error) {
header: MyHeader(), refreshController.refreshFailed();
footer: CustomFooter( refreshController.loadFailed();
builder: (context, mode) { });
return MyFooter(mode);
},
),
controller: _refreshController,
// onRefresh: ,
physics: BouncingScrollPhysics(),
child: ListView.builder(
padding: EdgeInsets.symmetric(vertical: 8.h),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
}, refreshController.refreshCompleted();
child: releaseItem(), refreshController.loadComplete();
); if (baseData.isSuccess) {
}, if (pageNum == 1) {
itemCount:5, comments.clear();
) }
// NoDataView( comments.addAll(baseData.data.list);
// isShowBtn: false, print("comments: ${comments.length}");
// text: "共关注0人", if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
// fontSize: 16.sp, refreshController.loadNoData();
// margin: EdgeInsets.only(top: 120.h), }
// ), }
),
),
);
} }
@override
Widget releaseItem() { Widget build(BuildContext context) {
return Container( return FutureBuilder(
color: Colors.white, future: queryCommunity(),
padding: EdgeInsets.symmetric(horizontal: 16.w), builder: (context, position) {
margin: EdgeInsets.symmetric(vertical: 16.w), return Scaffold(
child:Column( appBar: MyAppBar(
mainAxisAlignment: MainAxisAlignment.spaceAround, background: Color(0xFFFFFFFF),
crossAxisAlignment:CrossAxisAlignment.start, leadingColor: Colors.black,
children: [ title: "动态",
Row( titleColor: Colors.black,
children: [ titleSize: 18.sp,
ClipOval(
child: Image.network(
"https://t7.baidu.com/it/u=2841334870,333581502&fm=193&f=GIF",
fit: BoxFit.cover,
width: 44.w,
height: 44.h,
),
clipBehavior: Clip.hardEdge,
),
SizedBox(
width: 8.w,
),
Expanded(
child: Container(
height: 60.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(child: Text(
"百花谷",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xff808080),
),
), ),
InkWell(
onTap: () {
},
child: Icon(
Icons.close,
color: Colors.black,
size: 16,
),
),
],
),
Text(
"2021.04.12 12:12",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 12.sp,
color: Color(0xff808080),
),
),
],
),
),
flex: 1,
),
],
),
SizedBox(height: 12),
Text(
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Message)的一个句子或多个句子的组合。"
"一个文本可以是一个句子(Sentence)、一个段落(Paragraph)或者一个篇章(Discourse)。广义“文本”:"
"任何由书写所固定下来的任何话语。(利科尔) 狭义“文本”:由语言文字组成的文学实体,代指“作品”,相对于作者、世界构成一个独立、自足的系统。",
overflow: isShowShrink
? TextOverflow.visible
: TextOverflow.ellipsis,
maxLines: isShowShrink ? 10 :5,
style: TextStyle(
fontSize: 14.sp,
color:Color(0xFF1A1A1A),
fontWeight: MyFontWeight.regular,
),
),
SizedBox(height: 4.h),
GestureDetector(
onTap: () {
setState(() {
isShowShrink = !isShowShrink;
});
},
child: Row(
// mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Text(
(isShowShrink != null && !isShowShrink)
?"查看全文":"收起",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF32A060),
fontWeight: MyFontWeight.medium,
),
),
],
),
),
SizedBox(height:16.h),
Image.asset(
"assets/image/laoban.png",
height: 310.h,
), ),
SizedBox(height: 17.h), body: SmartRefresher(
Padding(padding: EdgeInsets.only(bottom: 16), controller: refreshController,
child:Row( enablePullDown: true,
mainAxisAlignment: MainAxisAlignment.spaceBetween, enablePullUp: true,
crossAxisAlignment: CrossAxisAlignment.start, physics: BouncingScrollPhysics(),
children: [ header: MyHeader(),
Row( footer: CustomFooter(
children: [ builder: (context, mode) {
InkWell( return MyFooter(mode);
onTap: () { },
},
child: Image.asset(
"assets/image/browse.png",
height: 16.h,
width: 16.w,
),
),
SizedBox(width:4),
Text(
"15",
style: TextStyle(
fontSize: 12.sp,
color:Color(0xFF1A1A1A),
fontWeight: MyFontWeight.regular,
),
),
],
), ),
Row( onRefresh: _onRefresh,
children: [ onLoading: () {
InkWell( setState(() {});
onTap: () { },
}, child: ListView.builder(
child: Image.asset( physics: NeverScrollableScrollPhysics(),
"assets/image/leaving_message.png", itemBuilder: (context, position) {
height: 16.h, return InkWell(
width: 16.w, child: CommunityDynamic(
), comments[position],
), 1,
SizedBox(width:4), removalDynamic: () {
Text( _onRefresh();
"52", },
style: TextStyle(
fontSize: 12.sp,
color:Color(0xFF1A1A1A),
fontWeight: MyFontWeight.regular,
), ),
),
],
),
Row(
children: [
InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"comment": comments[position],
},
);
}, },
child: Image.asset( );
"assets/image/follow.png", },
height: 16.h, itemCount: comments.length,
width: 16.w, )),
), );
), },
SizedBox(width:4),
Text(
"25",
style: TextStyle(
fontSize: 12.sp,
color:Color(0xFF1A1A1A),
fontWeight: MyFontWeight.regular,
),
),
],
),
],
),),
],
),
); );
} }
} }

13
lib/retrofit/data/article.dart

@ -24,6 +24,8 @@ class Article {
bool _isHot; bool _isHot;
bool _liked; bool _liked;
int _viewers; int _viewers;
int _comments;
bool isFollow;
dynamic _storeName; dynamic _storeName;
String get id => _id; String get id => _id;
@ -46,6 +48,7 @@ class Article {
bool get isHot => _isHot; bool get isHot => _isHot;
bool get liked => _liked; bool get liked => _liked;
int get viewers => _viewers; int get viewers => _viewers;
int get comments => _comments;
dynamic get storeName => _storeName; dynamic get storeName => _storeName;
set likes(int value) { set likes(int value) {
@ -60,6 +63,10 @@ class Article {
_viewers = value; _viewers = value;
} }
set comments(int value) {
_comments = value;
}
Article({ Article({
String id, String id,
String createTime, String createTime,
@ -71,7 +78,7 @@ class Article {
dynamic viceTitle, dynamic viceTitle,
String content, String content,
String coverImg, String coverImg,
Author author, Author author,
int type, int type,
String startTime, String startTime,
String endTime, String endTime,
@ -80,6 +87,7 @@ class Article {
int likes, int likes,
bool isHot, bool isHot,
int viewers, int viewers,
int comments,
dynamic storeName}){ dynamic storeName}){
_id = id; _id = id;
_createTime = createTime; _createTime = createTime;
@ -101,6 +109,7 @@ class Article {
_isHot = isHot; _isHot = isHot;
_liked = liked; _liked = liked;
_viewers = viewers; _viewers = viewers;
_comments = comments;
_storeName = storeName; _storeName = storeName;
} }
@ -125,6 +134,7 @@ class Article {
_isHot = json["isHot"]; _isHot = json["isHot"];
_liked = json["liked"]; _liked = json["liked"];
_viewers = json["viewers"]; _viewers = json["viewers"];
_comments = json["comments"];
_storeName = json["storeName"]; _storeName = json["storeName"];
} }
@ -150,6 +160,7 @@ class Article {
map["isHot"] = _isHot; map["isHot"] = _isHot;
map["liked"] = _liked; map["liked"] = _liked;
map["viewers"] = _viewers; map["viewers"] = _viewers;
map["comments"] = _comments;
map["storeName"] = _storeName; map["storeName"] = _storeName;
return map; return map;
} }

1
lib/retrofit/data/comunity_comment.dart

@ -10,7 +10,6 @@
/// createTime : "2021-10-19 09:55:16" /// createTime : "2021-10-19 09:55:16"
class ComunityComment { class ComunityComment {
ComunityComment({ ComunityComment({
String id, String id,
String subject, String subject,

159
lib/retrofit/data/follow_list.dart

@ -0,0 +1,159 @@
/// pageNum : 1
/// pageSize : 100
/// size : 1
/// pages : 1
/// hasPreviousPage : false
/// hasNextPage : false
/// total : "1"
/// list : [{"mid":"1406879717390286848","nickname":"flutter无敌","avatar":"https://pos.upload.gznl.top/admin/2021/10/fb4dadec-a836-49bd-a4c9-c35fc9fd5008.jpeg"}]
class FollowList {
FollowList({
int pageNum,
int pageSize,
int size,
int pages,
bool hasPreviousPage,
bool hasNextPage,
String total,
List<ListData> list,}){
_pageNum = pageNum;
_pageSize = pageSize;
_size = size;
_pages = pages;
_hasPreviousPage = hasPreviousPage;
_hasNextPage = hasNextPage;
_total = total;
_list = list;
}
FollowList.fromJson(dynamic json) {
_pageNum = json['pageNum'];
_pageSize = json['pageSize'];
_size = json['size'];
_pages = json['pages'];
_hasPreviousPage = json['hasPreviousPage'];
_hasNextPage = json['hasNextPage'];
_total = json['total'];
if (json['list'] != null) {
_list = [];
json['list'].forEach((v) {
_list.add(ListData.fromJson(v));
});
}
}
int _pageNum;
int _pageSize;
int _size;
int _pages;
bool _hasPreviousPage;
bool _hasNextPage;
String _total;
List<ListData> _list;
int get pageNum => _pageNum;
int get pageSize => _pageSize;
int get size => _size;
int get pages => _pages;
bool get hasPreviousPage => _hasPreviousPage;
bool get hasNextPage => _hasNextPage;
String get total => _total;
List<ListData> get list => _list;
set pageNum(int value) {
_pageNum = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['pageNum'] = _pageNum;
map['pageSize'] = _pageSize;
map['size'] = _size;
map['pages'] = _pages;
map['hasPreviousPage'] = _hasPreviousPage;
map['hasNextPage'] = _hasNextPage;
map['total'] = _total;
if (_list != null) {
map['list'] = _list.map((v) => v.toJson()).toList();
}
return map;
}
set pageSize(int value) {
_pageSize = value;
}
set size(int value) {
_size = value;
}
set pages(int value) {
_pages = value;
}
set hasPreviousPage(bool value) {
_hasPreviousPage = value;
}
set hasNextPage(bool value) {
_hasNextPage = value;
}
set total(String value) {
_total = value;
}
set list(List<ListData> value) {
_list = value;
}
}
/// mid : "1406879717390286848"
/// nickname : "flutter无敌"
/// avatar : "https://pos.upload.gznl.top/admin/2021/10/fb4dadec-a836-49bd-a4c9-c35fc9fd5008.jpeg"
class ListData {
ListData({
String mid,
String nickname,
String avatar,}){
_mid = mid;
_nickname = nickname;
_avatar = avatar;
}
ListData.fromJson(dynamic json) {
_mid = json['mid'];
_nickname = json['nickname'];
_avatar = json['avatar'];
}
String _mid;
String _nickname;
String _avatar;
String get mid => _mid;
String get nickname => _nickname;
String get avatar => _avatar;
set mid(String value) {
_mid = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['mid'] = _mid;
map['nickname'] = _nickname;
map['avatar'] = _avatar;
return map;
}
set nickname(String value) {
_nickname = value;
}
set avatar(String value) {
_avatar = value;
}
}

2
lib/retrofit/data/page.dart

@ -22,7 +22,7 @@ class PageInfo<D> {
List<D> list; List<D> list;
List<D> records; List<D> records;
factory PageInfo.fromJson(Map<String, dynamic> json, D Function(dynamic d) fromJsonD) => _$PageInfoFromJson(json, fromJsonD); factory PageInfo.fromJson(Map<String, dynamic> json, D Function(dynamic d) fromJsonD) => _$PageInfoFromJson(json, fromJsonD);
Map<String, dynamic> toJson(Object Function(D value) toJsonD) => _$PageInfoToJson(this, toJsonD); Map<String, dynamic> toJson(Object Function(D value) toJsonD) => _$PageInfoToJson(this, toJsonD);
} }

37
lib/retrofit/data/social_info.dart

@ -0,0 +1,37 @@
/// fans : 0
/// follow : 0
class SocialInfo {
SocialInfo({
int fans,
int follow,}){
_fans = fans;
_follow = follow;
}
SocialInfo.fromJson(dynamic json) {
_fans = json['fans'];
_follow = json['follow'];
}
int _fans;
int _follow;
int get fans => _fans;
int get follow => _follow;
set fans(int value) {
_fans = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['fans'] = _fans;
map['follow'] = _follow;
return map;
}
set follow(int value) {
_follow = value;
}
}

18
lib/retrofit/retrofit_api.dart

@ -21,6 +21,7 @@ import 'data/address.dart';
import 'data/banner.dart'; import 'data/banner.dart';
import 'data/brand_data.dart'; import 'data/brand_data.dart';
import 'data/exchange_order.dart'; import 'data/exchange_order.dart';
import 'data/follow_list.dart';
import 'data/goods.dart'; import 'data/goods.dart';
import 'data/goods_category.dart'; import 'data/goods_category.dart';
import 'data/logistics.dart'; import 'data/logistics.dart';
@ -29,6 +30,7 @@ import 'data/message.dart';
import 'data/page.dart'; import 'data/page.dart';
import 'data/rank.dart'; import 'data/rank.dart';
import 'data/sign_info.dart'; import 'data/sign_info.dart';
import 'data/social_info.dart';
import 'data/store.dart'; import 'data/store.dart';
import 'data/upload_result.dart'; import 'data/upload_result.dart';
import 'data/user_bill.dart'; import 'data/user_bill.dart';
@ -370,5 +372,21 @@ abstract class ApiService {
@POST("/information/trend-list") @POST("/information/trend-list")
Future<BaseData<PageInfo<ComunityComment>>> trendList(@Body() Map<String, dynamic> map); Future<BaseData<PageInfo<ComunityComment>>> trendList(@Body() Map<String, dynamic> map);
/// /
@POST("/member/follow/list")
Future<BaseData<PageInfo<ListData>>> followList(@Body() Map<String, dynamic> map);
////
@PUT("/member/follow/{followId}")
Future<BaseData> follow(@Path("followId") String followId);
///
@DELETE("/information/trend/{id}")
Future<BaseData> deleteTrend(@Path("id") String id);
///(/)
@GET("/member/socialInfo")
Future<BaseData<SocialInfo>> socialInfo();
} }

92
lib/retrofit/retrofit_api.g.dart

@ -1254,4 +1254,96 @@ class _ApiService implements ApiService {
); );
return value; return value;
} }
@override
Future<BaseData<PageInfo<ListData>>> followList(map) async {
ArgumentError.checkNotNull(map, 'map');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(map ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'/member/follow/list',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<PageInfo<ListData>>.fromJson(
_result.data,
(json) => PageInfo<ListData>.fromJson(
json,
(json) => ListData.fromJson(json),
),
);
return value;
}
@override
Future<BaseData<dynamic>> follow(followId) async {
ArgumentError.checkNotNull(followId, 'followId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/member/follow/$followId',
queryParameters: queryParameters,
options: RequestOptions(
method: 'PUT',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<dynamic>> deleteTrend(id) async {
ArgumentError.checkNotNull(id, 'id');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/information/trend/$id',
queryParameters: queryParameters,
options: RequestOptions(
method: 'DELETE',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<SocialInfo>> socialInfo() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/member/socialInfo',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<SocialInfo>.fromJson(
_result.data,
(json) => SocialInfo.fromJson(json),
);
return value;
}
} }

1
lib/view_widget/coupon_widget.dart

@ -80,7 +80,6 @@ class CouponWidget extends StatelessWidget {
: coupon.couponImg, : coupon.couponImg,
) )
// Image.network( // Image.network(
// width: 60, // width: 60,
// height: 60, // height: 60,
// fit: BoxFit.cover, // fit: BoxFit.cover,

194
lib/view_widget/hot_item.dart

@ -1,19 +1,23 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
class HotArticleItem extends StatefulWidget { class HotArticleItem extends StatefulWidget {
final Article article; final Article article;
final bool isHot; final bool isHot;
HotArticleItem({this.article, this.isHot}); HotArticleItem({this.article, this.isHot});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _HotArticleItem(); return _HotArticleItem();
@ -21,7 +25,24 @@ class HotArticleItem extends StatefulWidget {
} }
class _HotArticleItem extends State<HotArticleItem> { class _HotArticleItem extends State<HotArticleItem> {
ApiService apiService;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), context: context, token: value.getString("token")),
});
}
////
_vipFollow(followId) async {
BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("关注成功");
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -40,6 +61,7 @@ class _HotArticleItem extends State<HotArticleItem> {
setState(() {}); setState(() {});
} }
Widget hotItem(BuildContext context) { Widget hotItem(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.all((widget.isHot == null || !widget.isHot) ? 4 : 0), padding: EdgeInsets.all((widget.isHot == null || !widget.isHot) ? 4 : 0),
@ -58,88 +80,95 @@ class _HotArticleItem extends State<HotArticleItem> {
child: (widget.isHot == null || !widget.isHot) child: (widget.isHot == null || !widget.isHot)
? Column( ? Column(
children: [ children: [
Row( // Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
Container( // Container(
height: 44, // margin: EdgeInsets.only(left: 5),
child: Row( // child: Row(
children: [ // children: [
MImage( // MImage(
(widget.article != null && // (widget.article != null &&
widget.article.author != null) // widget.article.author != null)
? widget.article.author.avatar // ? widget.article.author.avatar
: "", // : "",
width: 44, // width: 44,
height: 44, // height: 44,
isCircle: true, // isCircle: true,
fit: BoxFit.cover, // fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png", // errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png", // fadeSrc: "assets/image/default_1.png",
), // ),
SizedBox( // SizedBox(
width: 8, // width: 8,
), // ),
Column( // Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
Text( // Text(
(widget.article != null && // (widget.article != null &&
widget.article.author != null) // widget.article.author != null)
? widget.article.author.name // ? widget.article.author.name
: "", // : "",
style: TextStyle( // style: TextStyle(
fontSize: 14.sp, // fontSize: 14.sp,
fontWeight: MyFontWeight.medium, // fontWeight: MyFontWeight.medium,
color: Color(0xFF1A1A1A), // color: Color(0xFF1A1A1A),
), // ),
), // ),
Text( // Text(
widget.article != null // widget.article != null
? (widget.article.createTime.split(" ")[0]) // ? (widget.article.createTime.split(" ")[0])
: "", // : "",
style: TextStyle( // style: TextStyle(
fontSize: 12.sp, // fontSize: 12.sp,
fontWeight: MyFontWeight.regular, // fontWeight: MyFontWeight.regular,
color: Color(0xFF808080), // color: Color(0xFF808080),
), // ),
), // ),
], // ],
), // ),
], // ],
), // ),
), // ),
GestureDetector( // GestureDetector(
onTap: (){ // onTap: (){
}, // setState(() {
child: RoundButton( // widget.article.isFollow = !(widget.article.isFollow??false);
padding: EdgeInsets.symmetric( // _vipFollow(widget.article.updateUser);
horizontal: 8, // });
vertical: 3, // },
), // child: RoundButton(
backgroup: Color(0xFF32A060), // padding: EdgeInsets.symmetric(
textColor: Colors.white , // horizontal: 8,
text: "关注", // vertical: 3,
radius: 20, // ),
icons: Icon( // backgroup: (widget.article.isFollow??false) ? Color(0xFFE6E6E6) : Color(0xFF32A060),
Icons.check, // textColor: (widget.article.isFollow??false) ? Color(0xFF808080):Colors.white ,
color: Color(0xFF808080), // text:(widget.article.isFollow??false) ? "已关注":"关注",
size: 14, // radius: 20,
), // icons: Icon(
), // (widget.article.isFollow??false) ? Icons.check: Icons.add,
), // color:(widget.article.isFollow??false) ? Color(0xFF808080):Colors.white ,
], // size: 14,
), // ),
// ),
// ),
// ],
// ),
Expanded(child:Row( Expanded(child:Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
SizedBox(height: 5.h),
Expanded( Expanded(
child: Container( child: Container(
margin: EdgeInsets.only(left: 12.w), margin: EdgeInsets.only(left: 12.w),
child: articleTextTow(context), child: articleTextTow(context),
), ),
), ),
SizedBox(width: 12.w,),
Visibility( Visibility(
visible: widget.article != null && visible: widget.article != null &&
widget.article.coverImg != null && widget.article.coverImg != null &&
@ -147,13 +176,10 @@ class _HotArticleItem extends State<HotArticleItem> {
child:Stack( child:Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
MImage( Image.network(
widget.article != null ? widget.article.coverImg : "", widget.article != null ? widget.article.coverImg : "",
fit: BoxFit.cover, fit: BoxFit.fill,
radius: BorderRadius.circular(2), height: double.infinity,
aspectRatio: 1,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
), ),
Visibility( Visibility(
visible: (widget.article != null && visible: (widget.article != null &&
@ -168,8 +194,10 @@ class _HotArticleItem extends State<HotArticleItem> {
], ],
), ),
), ),
SizedBox(width:5.w,),
], ],
)), )),
SizedBox(height: 10.h,)
], ],
) )
: Column( : Column(
@ -302,7 +330,7 @@ class _HotArticleItem extends State<HotArticleItem> {
), ),
Text( Text(
(widget.article != null) (widget.article != null)
? "${widget.article.viewers}" ? "${widget.article.comments}"
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
@ -469,7 +497,7 @@ class _HotArticleItem extends State<HotArticleItem> {
), ),
Text( Text(
(widget.article != null) (widget.article != null)
? "${widget.article.viewers}" ? "${widget.article.comments}"
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,

7
lib/web/web_page.dart

@ -123,8 +123,10 @@ class _WebPage extends State<WebPage> with WidgetsBindingObserver {
"relationalType": 1 "relationalType": 1
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
commentKey.currentState.initState(); CommentListState _commentList = commentKey.currentState;
_commentList.queryMemberCommentList();
commentTextController.text = ""; commentTextController.text = "";
FocusScope.of(context).unfocus();
_toComment(); _toComment();
} }
} }
@ -310,7 +312,8 @@ class _WebPage extends State<WebPage> with WidgetsBindingObserver {
BaseData baseData = await apiService.delComment( BaseData baseData = await apiService.delComment(
widget.arguments["activityId"] ?? widget.arguments["articleId"]); widget.arguments["activityId"] ?? widget.arguments["articleId"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
commentKey.currentState.initState(); CommentListState _commentList = commentKey.currentState;
_commentList.queryMemberCommentList();
} }
} }

4
lib/web/web_view/comment_list.dart

@ -30,11 +30,11 @@ class CommentList extends StatefulWidget {
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _CommentList(); return CommentListState();
} }
} }
class _CommentList extends State<CommentList> { class CommentListState extends State<CommentList> {
int commentTotal = 0; int commentTotal = 0;
List<MemberCommentList> memberList = []; List<MemberCommentList> memberList = [];
ApiService apiService; ApiService apiService;

8
lib/web/web_view/input_comment.dart

@ -15,6 +15,7 @@ class InputComment extends StatefulWidget {
final Function(String text) queryMemberComment; final Function(String text) queryMemberComment;
final Function() queryInformationLikes; final Function() queryInformationLikes;
final TextEditingController commentTextController; final TextEditingController commentTextController;
final bool isLike;
InputComment( InputComment(
Key key, Key key,
@ -26,9 +27,10 @@ class InputComment extends StatefulWidget {
this.queryMemberComment, this.queryMemberComment,
this.queryInformationLikes, this.queryInformationLikes,
{ {
this.activity, this.activity,
this.article, this.article,
this.isLike
} }
) : super(key: key); ) : super(key: key);
@ -156,14 +158,14 @@ class _InputComment extends State<InputComment> {
? widget.activity.liked ? widget.activity.liked
: widget.article != null : widget.article != null
? widget.article.liked ? widget.article.liked
: false), : widget.isLike??false),
onTap: (isLiked) async { onTap: (isLiked) async {
await widget.queryInformationLikes(); await widget.queryInformationLikes();
return (widget.activity != null return (widget.activity != null
? widget.activity.liked ? widget.activity.liked
: widget.article != null : widget.article != null
? widget.article.liked ? widget.article.liked
: false); : widget.isLike??false);
}, },
countBuilder: (int count, bool isLiked, String text) { countBuilder: (int count, bool isLiked, String text) {
return Text( return Text(

Loading…
Cancel
Save