Browse Source

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

master
fmk 3 years ago
parent
commit
cf56007586
  1. 12
      lib/community/community_child_page.dart
  2. 11
      lib/community/community_details.dart
  3. 10
      lib/community/community_page.dart
  4. 2
      lib/community/community_view/community_comment.dart
  5. 95
      lib/community/community_view/community_dynamic.dart
  6. 1
      lib/community/release_dynamic.dart
  7. 34
      lib/mine/mine_view/community_follow.dart
  8. 10
      lib/mine/release_page.dart

12
lib/community/community_child_page.dart

@ -24,19 +24,18 @@ class CommunityChildPage extends StatefulWidget {
class _CommunityChildPage extends State<CommunityChildPage> {
RefreshController refreshController = RefreshController();
ApiService apiService;
int pageNum = 1;
int pageNum = 0;
List<ComunityComment> comments = [];
@override
void initState() {
super.initState();
_onRefresh();
}
_onRefresh() async {
pageNum = 1;
pageNum = 0;
setState(() {});
}
@ -50,7 +49,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
token: value.getString("token"),
);
}
pageNum += 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"onlyFollow": widget.typeStr == "关注" ? true:false,
"onlyMe": false,
@ -69,6 +68,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
comments.clear();
}
comments.addAll(baseData.data.list);
// comments.sort((a,b)=>b.createTime.compareTo(a.createTime));
print("comments: ${comments.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
refreshController.loadNoData();
@ -100,7 +100,9 @@ class _CommunityChildPage extends State<CommunityChildPage> {
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(comments[position],0),
child: CommunityDynamic(comments[position],0,exitFull: (){setState(() {
});},),
onTap: () {
Navigator.of(context).pushNamed(
'/router/community_details',

11
lib/community/community_details.dart

@ -16,7 +16,6 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/comment_menu.dart';
import 'package:huixiang/view_widget/login_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:shared_preferences/shared_preferences.dart';
@ -143,14 +142,16 @@ class _CommunityDetails extends State<CommunityDetails>
),
color: Colors.white,
child: CommunityDynamic(
comunity,0,
comunity,0,exitFull: (){setState(() {
});},
itemCount: 3,
isDetails: true,
heightFun: (height) {
this.height = height +
MediaQuery.of(context).padding.top +
kToolbarHeight +
68;
24;
setState(() {});
},
),
@ -199,8 +200,7 @@ class _CommunityDetails extends State<CommunityDetails>
body: Container(
height: MediaQuery.of(context).size.height -
MediaQuery.of(context).padding.top +
kToolbarHeight -
68,
kToolbarHeight - 68,
margin: EdgeInsets.only(top: 50 + kToolbarHeight),
child: Column(
children: [
@ -231,6 +231,7 @@ class _CommunityDetails extends State<CommunityDetails>
Container(
width: double.infinity,
alignment: Alignment.topCenter,
margin: EdgeInsets.only(top:40),
padding: EdgeInsets.all(22.h),
child: Text(
S.of(context).zanwupinglun,

10
lib/community/community_page.dart

@ -36,10 +36,14 @@ class _CommunityPage extends State<CommunityPage>
}
_toRelease() async {
int tmpIndex = tabcontroller.index;
setState(() {
tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1;
});
var result = await Navigator.of(context).pushNamed('/router/release_dynamic');
if (result != null && result) {
setState(() {});
}
setState(() {
tabcontroller.index = tmpIndex;
});
}
@override

2
lib/community/community_view/community_comment.dart

@ -206,7 +206,7 @@ class _CommunityComment extends State<CommunityComment> {
],
),
alignment: Alignment.topCenter,
padding: EdgeInsets.only(top: 22.h),
padding: EdgeInsets.only(top: 22.h,bottom: 22),
child: Text(
S.of(context).yixiansquanbupinglun,
style: TextStyle(

95
lib/community/community_view/community_dynamic.dart

@ -1,8 +1,10 @@
import 'package:chewie/chewie.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.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:chewie/src/chewie_progress_colors.dart' as chewie;
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
@ -11,6 +13,7 @@ import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:video_player/video_player.dart';
class CommunityDynamic extends StatefulWidget {
final int itemCount;
@ -18,6 +21,7 @@ class CommunityDynamic extends StatefulWidget {
final bool isDetails;
final int commentType;
final Function removalDynamic;
final Function exitFull;
final ComunityComment comment;
@ -29,6 +33,7 @@ class CommunityDynamic extends StatefulWidget {
this.heightFun,
this.isDetails = false,
this.removalDynamic,
this.exitFull
}) : super(key: key);
@override
@ -106,9 +111,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: Row(
children: [
MImage(
widget.comment != null
? widget.comment.memberInfo.avatar
: "",
widget?.comment?.memberInfo?.avatar??"",
width: 44,
height: 44,
isCircle: true,
@ -124,9 +127,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.comment != null
? widget.comment.memberInfo.nickname
: "",
widget?.comment?.memberInfo?.nickname??"",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
@ -134,9 +135,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
),
Text(
widget.comment != null
? widget.comment.createTime
: "",
widget?.comment?.createTime??"",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
@ -199,7 +198,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
Text(
widget.comment.subject ?? "",
// maxLines: 5,
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF1A1A1A),
@ -221,7 +220,6 @@ class _CommunityDynamic extends State<CommunityDynamic> {
(widget.comment != null)
? "${widget.comment.viewers}"
: "",
// "${widget.comment.viewers ?? 0}",
space: 4.w,
leftImage: "assets/svg/liulanliang.svg",
iconSize: 16,
@ -264,7 +262,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
subjectInfo.images[0],
fit: BoxFit.cover,
width: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.width /1,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
@ -286,7 +284,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
itemBuilder: (context, position) {
return Container(
child: MImage(
subjectInfo.images[0],
subjectInfo.images[position],
fit: BoxFit.cover,
aspectRatio: 1,
errorSrc: "assets/image/default_2_1.png",
@ -298,13 +296,11 @@ class _CommunityDynamic extends State<CommunityDynamic> {
);
}
} else if (subjectInfo.type == "video" &&
subjectInfo.video != null &&
subjectInfo.video != "") {
widget = Container(
width: MediaQuery.of(context).size.width - 32,
height: MediaQuery.of(context).size.width / 2,
color: Colors.blue.withAlpha(123),
);
subjectInfo.video.isNotEmpty) {
widget = videoWidget(
MediaQuery.of(context).size.width - 32,
MediaQuery.of(context).size.width /2,
subjectInfo.video);
}
return Column(
@ -320,6 +316,65 @@ class _CommunityDynamic extends State<CommunityDynamic> {
);
}
VideoPlayerController videoPlayerController;
ChewieController chewieAudioController;
Chewie chewies;
Widget videoWidget(double width, double height, src) {
print("src : $src");
chewieAudioController = ChewieController(
videoPlayerController: videoPlayerController =
VideoPlayerController.network(
src,
),
aspectRatio: width / height,
//
autoPlay: false,
//
looping: false,
//
allowFullScreen: true,
// systemOverlaysAfterFullScreen: [],
// systemOverlaysOnEnterFullScreen: [],
// deviceOrientationsAfterFullScreen: [],
// deviceOrientationsOnEnterFullScreen: [],
//
materialProgressColors: chewie.ChewieProgressColors(
playedColor: Colors.white,
handleColor: Colors.white,
backgroundColor: Colors.grey,
bufferedColor: Colors.transparent,
),
autoInitialize: true,
);
chewieAudioController.addListener(_fullScreenListener);
return MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: 0.9,
),
child: Container(
width: MediaQuery.of(context).size.width - 17,
height: (MediaQuery.of(context).size.width) / (width / height),
child: chewies = Chewie(
controller: chewieAudioController,
),
),
);
}
Future<void> _fullScreenListener() async {
print("object: isPlaying: ${videoPlayerController.value.isPlaying}");
print("object: isFullScreen: ${chewieAudioController.isFullScreen}");
if (!chewieAudioController.isFullScreen) {
Future.delayed(Duration(seconds: 1), () {
widget.exitFull();
});
}
}
///
showDeleteDialog() {
showDialog(

1
lib/community/release_dynamic.dart

@ -155,6 +155,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
if (baseData.isSuccess) {
SmartDialog.showToast("发布成功!");
Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop(true);
});
}

34
lib/mine/mine_view/community_follow.dart

@ -1,10 +1,16 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/mine/follow_page.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/social_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_tab.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../fans_page.dart';
@ -18,14 +24,34 @@ class CommunityFollow extends StatefulWidget {
class _CommunityFollow extends State<CommunityFollow>
with SingleTickerProviderStateMixin {
ApiService apiService;
SocialInfo infoNumber;
@override
void initState() {
super.initState();
querySocialInfo();
}
///(/)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
showLoading: false,
);
BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
infoNumber = baseData.data;
});
}
EasyLoading.dismiss();
}
@override
Widget build(BuildContext context) {
@ -56,8 +82,8 @@ class _CommunityFollow extends State<CommunityFollow>
indicatorSize: TabBarIndicatorSize.label,
//
tabs: <Widget>[
MyTab(text:"关注(0)",),
MyTab(text: "粉丝(0)"),
MyTab(text:"关注(${infoNumber?.follow??"0"})",),
MyTab(text: "粉丝(${infoNumber?.fans??"0"})"),
],
),
),

10
lib/mine/release_page.dart

@ -23,7 +23,7 @@ class ReleasePage extends StatefulWidget {
class _ReleasePage extends State<ReleasePage> {
RefreshController refreshController = RefreshController();
ApiService apiService;
int pageNum = 1;
int pageNum = 0;
List<ComunityComment> comments = [];
@ -35,7 +35,7 @@ class _ReleasePage extends State<ReleasePage> {
}
_onRefresh() async {
pageNum = 1;
pageNum = 0;
setState(() {});
}
@ -48,7 +48,7 @@ class _ReleasePage extends State<ReleasePage> {
token: value.getString("token"),
);
}
pageNum += 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"onlyFollow": false,
"onlyMe": true,
@ -108,7 +108,9 @@ class _ReleasePage extends State<ReleasePage> {
return InkWell(
child: CommunityDynamic(
comments[position],
1,
1,exitFull: (){setState(() {
});},
removalDynamic: () {
_onRefresh();
},

Loading…
Cancel
Save