|
|
|
@ -4,6 +4,7 @@ import 'package:chewie/chewie.dart';
|
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
@ -395,9 +396,23 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool tempDelayedFlag = false; |
|
|
|
|
|
|
|
|
|
Future<void> _fullScreenListener() async { |
|
|
|
|
if (!chewieAudioController.isFullScreen) { |
|
|
|
|
Future.delayed(Duration(seconds: 1), () {}); |
|
|
|
|
if (!chewieAudioController.isFullScreen && !tempDelayedFlag) { |
|
|
|
|
tempDelayedFlag = true; |
|
|
|
|
SystemChrome.setPreferredOrientations( |
|
|
|
|
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); |
|
|
|
|
setState(() {}); |
|
|
|
|
SystemChrome.setPreferredOrientations( |
|
|
|
|
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]); |
|
|
|
|
Future.delayed(Duration(seconds: 1), () { |
|
|
|
|
SystemChrome.setPreferredOrientations( |
|
|
|
|
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); |
|
|
|
|
setState(() { |
|
|
|
|
tempDelayedFlag = false; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -410,52 +425,50 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
|
|
|
|
|
child: Stack(children: [ |
|
|
|
|
(chewieAudioController != null |
|
|
|
|
? Container( |
|
|
|
|
width: width, |
|
|
|
|
height: height, |
|
|
|
|
child: chewies = Chewie( |
|
|
|
|
controller: chewieAudioController, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
width: width, |
|
|
|
|
height: height, |
|
|
|
|
child: chewies = Chewie( |
|
|
|
|
controller: chewieAudioController, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
: Container( |
|
|
|
|
width: width, |
|
|
|
|
height: height, |
|
|
|
|
)), |
|
|
|
|
if(isShowImg) |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
isShowImg = false; |
|
|
|
|
if(chewieAudioController != null) |
|
|
|
|
chewieAudioController.play(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
width: width, |
|
|
|
|
height: height, |
|
|
|
|
color: Colors.black, |
|
|
|
|
child: Stack( |
|
|
|
|
children: [ |
|
|
|
|
Center( |
|
|
|
|
child: MImage( |
|
|
|
|
src, |
|
|
|
|
width:width, |
|
|
|
|
height: height, |
|
|
|
|
fit: BoxFit.fill, |
|
|
|
|
errorSrc: "assets/image/default_2_1.png", |
|
|
|
|
fadeSrc: "assets/image/default_2_1.png", |
|
|
|
|
width: width, |
|
|
|
|
height: height, |
|
|
|
|
)), |
|
|
|
|
if (isShowImg) |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
isShowImg = false; |
|
|
|
|
if (chewieAudioController != null) |
|
|
|
|
chewieAudioController.play(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
width: width, |
|
|
|
|
height: width / 7 * 6, |
|
|
|
|
color: Colors.black, |
|
|
|
|
child: Stack( |
|
|
|
|
children: [ |
|
|
|
|
Center( |
|
|
|
|
child: MImage( |
|
|
|
|
src, |
|
|
|
|
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, |
|
|
|
|
Center( |
|
|
|
|
child: Icon( |
|
|
|
|
Icons.play_circle_outline, |
|
|
|
|
color: Colors.white, |
|
|
|
|
size: 60, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -501,7 +514,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
|
|
|
|
|
setState(() { |
|
|
|
|
chapterIndex = position; |
|
|
|
|
isShowImg = true; |
|
|
|
|
if(chewieAudioController != null) |
|
|
|
|
if (chewieAudioController != null) |
|
|
|
|
chewieAudioController.pause(); |
|
|
|
|
initVideo(chapterList[position].content.fileUrl); |
|
|
|
|
}); |
|
|
|
|