|
|
@ -1,8 +1,10 @@ |
|
|
|
|
|
|
|
import 'package:chewie/chewie.dart'; |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.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:chewie/src/chewie_progress_colors.dart' as chewie; |
|
|
|
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/border_text.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: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'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
import 'package:video_player/video_player.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class CommunityDynamic extends StatefulWidget { |
|
|
|
class CommunityDynamic extends StatefulWidget { |
|
|
|
final int itemCount; |
|
|
|
final int itemCount; |
|
|
@ -18,6 +21,7 @@ class CommunityDynamic extends StatefulWidget { |
|
|
|
final bool isDetails; |
|
|
|
final bool isDetails; |
|
|
|
final int commentType; |
|
|
|
final int commentType; |
|
|
|
final Function removalDynamic; |
|
|
|
final Function removalDynamic; |
|
|
|
|
|
|
|
final Function exitFull; |
|
|
|
|
|
|
|
|
|
|
|
final ComunityComment comment; |
|
|
|
final ComunityComment comment; |
|
|
|
|
|
|
|
|
|
|
@ -29,6 +33,7 @@ class CommunityDynamic extends StatefulWidget { |
|
|
|
this.heightFun, |
|
|
|
this.heightFun, |
|
|
|
this.isDetails = false, |
|
|
|
this.isDetails = false, |
|
|
|
this.removalDynamic, |
|
|
|
this.removalDynamic, |
|
|
|
|
|
|
|
this.exitFull |
|
|
|
}) : super(key: key); |
|
|
|
}) : super(key: key); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -291,13 +296,11 @@ class _CommunityDynamic extends State<CommunityDynamic> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (subjectInfo.type == "video" && |
|
|
|
} else if (subjectInfo.type == "video" && |
|
|
|
subjectInfo.video != null && |
|
|
|
subjectInfo.video.isNotEmpty) { |
|
|
|
subjectInfo.video != "") { |
|
|
|
widget = videoWidget( |
|
|
|
widget = Container( |
|
|
|
MediaQuery.of(context).size.width - 32, |
|
|
|
width: MediaQuery.of(context).size.width - 32, |
|
|
|
MediaQuery.of(context).size.width /2, |
|
|
|
height: MediaQuery.of(context).size.width /2, |
|
|
|
subjectInfo.video); |
|
|
|
color: Colors.blue.withAlpha(123), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Column( |
|
|
|
return Column( |
|
|
@ -313,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() { |
|
|
|
showDeleteDialog() { |
|
|
|
showDialog( |
|
|
|
showDialog( |
|
|
|