Browse Source

视频详情bug更改;

订单详情数据异常更改
dart3
wurong 5 months ago
parent
commit
8dd7ee55c3
  1. 13
      lib/community/community_course.dart
  2. 32
      lib/community/community_view/class_details_video.dart
  3. 2
      lib/order/order_detail_page.dart

13
lib/community/community_course.dart

@ -55,9 +55,16 @@ class _CommunityCourse extends State<CommunityCourse>
setState(() {}); setState(() {});
} }
}); });
queryCourseBanner(); if (apiService == null) {
classListAsync(); SharedPreferences.getInstance().then((value) {
collectionList(); apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
_onRefresh();
});
}
} }
///banner ///banner

32
lib/community/community_view/class_details_video.dart

@ -31,9 +31,9 @@ class ClassDetailsVideo extends StatefulWidget {
} }
class ClassDetailsVideoState extends State<ClassDetailsVideo> { class ClassDetailsVideoState extends State<ClassDetailsVideo> {
late VideoPlayerController videoPlayerController; VideoPlayerController? videoPlayerController;
late ChewieController chewieAudioController; ChewieController? chewieAudioController;
late Chewie chewies; Chewie? chewies;
GlobalKey globalKey = GlobalKey(); GlobalKey globalKey = GlobalKey();
double height = 0; double height = 0;
@ -60,14 +60,14 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
} }
initVideo(videoUrl) async { initVideo(videoUrl) async {
videoPlayerController.pause(); videoPlayerController?.pause();
videoPlayerController.dispose(); videoPlayerController?.dispose();
videoPlayerController = VideoPlayerController.networkUrl( videoPlayerController = VideoPlayerController.networkUrl(
Uri.parse(videoUrl), Uri.parse(videoUrl),
)..initialize().then((value) { )..initialize().then((value) {
chewieAudioController = ChewieController( chewieAudioController = ChewieController(
videoPlayerController: videoPlayerController, videoPlayerController: videoPlayerController!,
aspectRatio: videoPlayerController.value.aspectRatio, aspectRatio: videoPlayerController?.value.aspectRatio,
// aspectRatio: 1.44, // aspectRatio: 1.44,
// //
autoPlay: false, autoPlay: false,
@ -87,7 +87,7 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
// //
autoInitialize: true, autoInitialize: true,
); );
chewieAudioController.addListener(_fullScreenListener); chewieAudioController?.addListener(_fullScreenListener);
if (mounted) setState(() {}); if (mounted) setState(() {});
}); });
} }
@ -101,7 +101,7 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
), ),
color: Colors.black, color: Colors.black,
key: globalKey, key: globalKey,
child: (videoPlayerController.value.isInitialized ?? false) child: (videoPlayerController?.value.isInitialized ?? false)
? videoWidget( ? videoWidget(
MediaQuery.of(context).size.height, MediaQuery.of(context).size.height,
(MediaQuery.of(context).size.height / 1.44) - 43, (MediaQuery.of(context).size.height / 1.44) - 43,
@ -115,11 +115,11 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
void dispose() { void dispose() {
super.dispose(); super.dispose();
chewieAudioController.pause(); chewieAudioController?.pause();
chewieAudioController.dispose(); chewieAudioController?.dispose();
videoPlayerController.pause(); videoPlayerController?.pause();
videoPlayerController.dispose(); videoPlayerController?.dispose();
} }
Widget videoWidget(double width, double height, src) { Widget videoWidget(double width, double height, src) {
@ -137,7 +137,7 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
height: MediaQuery.of(context).size.width / 1.5, height: MediaQuery.of(context).size.width / 1.5,
// margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), // margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
child: chewies = Chewie( child: chewies = Chewie(
controller: chewieAudioController, controller: chewieAudioController!,
), ),
) )
: Container( : Container(
@ -150,7 +150,7 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
onTap: () { onTap: () {
setState(() { setState(() {
widget.changeShowImg?.call(false); widget.changeShowImg?.call(false);
chewieAudioController.play(); chewieAudioController?.play();
}); });
}, },
child: Container( child: Container(
@ -189,7 +189,7 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
} }
Future<void> _fullScreenListener() async { Future<void> _fullScreenListener() async {
if (!chewieAudioController.isFullScreen) { if (!(chewieAudioController?.isFullScreen ?? false)) {
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {
widget.exitFull?.call(); widget.exitFull?.call();
}); });

2
lib/order/order_detail_page.dart

@ -113,7 +113,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
refreshController.loadFailed(); refreshController.loadFailed();
}); });
if (baseData?.isSuccess ?? false) { if (baseData?.isSuccess ?? false) {
orderInfo = baseData!.data; orderInfo = baseData?.data;
payStatus = orderInfo?.payStatus ?? 0; payStatus = orderInfo?.payStatus ?? 0;
orderStatus = orderInfo?.orderStatus ?? 0; orderStatus = orderInfo?.orderStatus ?? 0;
sendStatus = orderInfo?.sendStatus ?? 0; sendStatus = orderInfo?.sendStatus ?? 0;

Loading…
Cancel
Save