|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
|
|
import 'dart:io'; |
|
|
|
import 'dart:ui'; |
|
|
|
import 'dart:ui'; |
|
|
|
|
|
|
|
|
|
|
|
import 'package:chewie/chewie.dart'; |
|
|
|
import 'package:chewie/chewie.dart'; |
|
|
@ -14,8 +15,10 @@ 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:path_provider/path_provider.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:video_player/video_player.dart'; |
|
|
|
import 'package:video_player/video_player.dart'; |
|
|
|
|
|
|
|
import 'package:thumbnails/thumbnails.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class CommunityDynamic extends StatefulWidget { |
|
|
|
class CommunityDynamic extends StatefulWidget { |
|
|
|
final int itemCount; |
|
|
|
final int itemCount; |
|
|
@ -24,7 +27,7 @@ class CommunityDynamic extends StatefulWidget { |
|
|
|
final int commentType; |
|
|
|
final int commentType; |
|
|
|
final Function removalDynamic; |
|
|
|
final Function removalDynamic; |
|
|
|
final Function exitFull; |
|
|
|
final Function exitFull; |
|
|
|
|
|
|
|
final bool isList; |
|
|
|
final ComunityComment comment; |
|
|
|
final ComunityComment comment; |
|
|
|
|
|
|
|
|
|
|
|
CommunityDynamic( |
|
|
|
CommunityDynamic( |
|
|
@ -36,6 +39,7 @@ class CommunityDynamic extends StatefulWidget { |
|
|
|
this.isDetails = false, |
|
|
|
this.isDetails = false, |
|
|
|
this.removalDynamic, |
|
|
|
this.removalDynamic, |
|
|
|
this.exitFull, |
|
|
|
this.exitFull, |
|
|
|
|
|
|
|
this.isList = false, |
|
|
|
}) : super(key: key); |
|
|
|
}) : super(key: key); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -65,9 +69,19 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
), |
|
|
|
), |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
initVideo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String filePath; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initVideo() async { |
|
|
|
if (widget.comment.subjectInfo.type == "video" && |
|
|
|
if (widget.comment.subjectInfo.type == "video" && |
|
|
|
widget.comment.subjectInfo.video.isNotEmpty) { |
|
|
|
widget.comment.subjectInfo.video.isNotEmpty) { |
|
|
|
|
|
|
|
if (widget.isList) { |
|
|
|
|
|
|
|
videoPlayerController = VideoPlayerController.network( |
|
|
|
|
|
|
|
widget.comment.subjectInfo.video, |
|
|
|
|
|
|
|
)..initialize().then((value) {}); |
|
|
|
|
|
|
|
} else { |
|
|
|
videoPlayerController = VideoPlayerController.network( |
|
|
|
videoPlayerController = VideoPlayerController.network( |
|
|
|
widget.comment.subjectInfo.video, |
|
|
|
widget.comment.subjectInfo.video, |
|
|
|
)..initialize().then((value) { |
|
|
|
)..initialize().then((value) { |
|
|
@ -94,6 +108,7 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
///关注/取关会员 |
|
|
|
///关注/取关会员 |
|
|
|
_vipFollow(followId) async { |
|
|
|
_vipFollow(followId) async { |
|
|
@ -292,10 +307,10 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
if (subjectInfo == null) { |
|
|
|
if (subjectInfo == null) { |
|
|
|
return Container(); |
|
|
|
return Container(); |
|
|
|
} |
|
|
|
} |
|
|
|
Widget widget = Container(); |
|
|
|
Widget itemWidget = Container(); |
|
|
|
if (subjectInfo.type == "image" && subjectInfo.images.length > 0) { |
|
|
|
if (subjectInfo.type == "image" && subjectInfo.images.length > 0) { |
|
|
|
if (subjectInfo.images.length == 1) { |
|
|
|
if (subjectInfo.images.length == 1) { |
|
|
|
widget = Container( |
|
|
|
itemWidget = Container( |
|
|
|
child: MImage( |
|
|
|
child: MImage( |
|
|
|
subjectInfo.images[0], |
|
|
|
subjectInfo.images[0], |
|
|
|
fit: BoxFit.cover, |
|
|
|
fit: BoxFit.cover, |
|
|
@ -306,7 +321,7 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
widget = GridView.builder( |
|
|
|
itemWidget = GridView.builder( |
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
|
|
|
crossAxisCount: (subjectInfo.images.length == 2 || |
|
|
|
crossAxisCount: (subjectInfo.images.length == 2 || |
|
|
|
subjectInfo.images.length == 4) |
|
|
|
subjectInfo.images.length == 4) |
|
|
@ -334,15 +349,15 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) { |
|
|
|
} else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) { |
|
|
|
widget = videoWidget( |
|
|
|
itemWidget = videoWidget( |
|
|
|
MediaQuery.of(context).size.width - 32, |
|
|
|
MediaQuery.of(context).size.width - 32, |
|
|
|
videoPlayerController != null |
|
|
|
videoPlayerController != null |
|
|
|
? (MediaQuery.of(context).size.width - 32) / |
|
|
|
? (MediaQuery.of(context).size.width - 32) / |
|
|
|
videoPlayerController.value.aspectRatio |
|
|
|
videoPlayerController.value.aspectRatio |
|
|
|
: MediaQuery.of(context).size.width / 2, |
|
|
|
: MediaQuery.of(context).size.width / 2, |
|
|
|
subjectInfo.video); |
|
|
|
!widget.isList ? subjectInfo.video : widget.comment.coverImg, |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Column( |
|
|
|
return Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
@ -351,7 +366,7 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
SizedBox( |
|
|
|
SizedBox( |
|
|
|
height: 16.h, |
|
|
|
height: 16.h, |
|
|
|
), |
|
|
|
), |
|
|
|
widget, |
|
|
|
itemWidget, |
|
|
|
], |
|
|
|
], |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -378,7 +393,8 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
data: MediaQuery.of(context).copyWith( |
|
|
|
data: MediaQuery.of(context).copyWith( |
|
|
|
textScaleFactor: 0.9, |
|
|
|
textScaleFactor: 0.9, |
|
|
|
), |
|
|
|
), |
|
|
|
child: chewieAudioController != null |
|
|
|
child: !widget.isList |
|
|
|
|
|
|
|
? (chewieAudioController != null |
|
|
|
? Container( |
|
|
|
? Container( |
|
|
|
width: width, |
|
|
|
width: width, |
|
|
|
height: height, |
|
|
|
height: height, |
|
|
@ -389,6 +405,29 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
: Container( |
|
|
|
: Container( |
|
|
|
width: width, |
|
|
|
width: width, |
|
|
|
height: height, |
|
|
|
height: height, |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
: Container( |
|
|
|
|
|
|
|
width: width, |
|
|
|
|
|
|
|
height: width / 3 * 2, |
|
|
|
|
|
|
|
child: Stack( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
MImage( |
|
|
|
|
|
|
|
src, |
|
|
|
|
|
|
|
width: width, |
|
|
|
|
|
|
|
height: width / 3 * 2, |
|
|
|
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
|
|
errorSrc: "assets/image/default_2_1.png", |
|
|
|
|
|
|
|
fadeSrc: "assets/image/default_2_1.png", |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Center( |
|
|
|
|
|
|
|
child: Icon( |
|
|
|
|
|
|
|
Icons.play_circle_outline, |
|
|
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
|
|
size: 60, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|