Browse Source

社群更改

master
w-R 3 years ago
parent
commit
5df3f1bbe0
  1. 4
      lib/community/community_child_page.dart
  2. 4
      lib/community/community_details.dart
  3. 76
      lib/community/community_view/community_dynamic.dart
  4. 4
      lib/mine/release_page.dart

4
lib/community/community_child_page.dart

@ -100,7 +100,9 @@ class _CommunityChildPage extends State<CommunityChildPage> {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return InkWell( return InkWell(
child: CommunityDynamic(comments[position],0), child: CommunityDynamic(comments[position],0,exitFull: (){setState(() {
});},),
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/community_details', '/router/community_details',

4
lib/community/community_details.dart

@ -142,7 +142,9 @@ class _CommunityDetails extends State<CommunityDetails>
), ),
color: Colors.white, color: Colors.white,
child: CommunityDynamic( child: CommunityDynamic(
comunity,0, comunity,0,exitFull: (){setState(() {
});},
itemCount: 3, itemCount: 3,
isDetails: true, isDetails: true,
heightFun: (height) { heightFun: (height) {

76
lib/community/community_view/community_dynamic.dart

@ -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(

4
lib/mine/release_page.dart

@ -108,7 +108,9 @@ class _ReleasePage extends State<ReleasePage> {
return InkWell( return InkWell(
child: CommunityDynamic( child: CommunityDynamic(
comments[position], comments[position],
1, 1,exitFull: (){setState(() {
});},
removalDynamic: () { removalDynamic: () {
_onRefresh(); _onRefresh();
}, },

Loading…
Cancel
Save