mod: 相关推荐视频开发、页面跳转Hero、一些字段修改
This commit is contained in:
@ -2,6 +2,7 @@ import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/video_detail_res.dart';
|
||||
import 'package:pilipala/pages/video/detail/controller.dart';
|
||||
|
||||
class VideoIntroController extends GetxController {
|
||||
// 视频aid
|
||||
@ -41,6 +42,10 @@ class VideoIntroController extends GetxController {
|
||||
});
|
||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||
videoDetail.value = result.data!;
|
||||
Get.find<VideoDetailController>().tabs.value = [
|
||||
'简介',
|
||||
'评论 ${result.data!.stat!.reply}'
|
||||
];
|
||||
// await Future.delayed(const Duration(seconds: 3));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
library video_detail_introduction;
|
||||
library video_intro_panel;
|
||||
|
||||
export './controller.dart';
|
||||
export './view.dart';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
@ -17,11 +16,16 @@ class VideoIntroPanel extends StatefulWidget {
|
||||
State<VideoIntroPanel> createState() => _VideoIntroPanelState();
|
||||
}
|
||||
|
||||
class _VideoIntroPanelState extends State<VideoIntroPanel> {
|
||||
class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
final VideoIntroController videoIntroController =
|
||||
Get.put(VideoIntroController());
|
||||
VideoDetailData? videoDetail;
|
||||
|
||||
// 添加页面缓存
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -42,10 +46,10 @@ class _VideoIntroPanelState extends State<VideoIntroPanel> {
|
||||
future: videoIntroController.queryVideoDetail(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
print(snapshot.data);
|
||||
if (snapshot.data) {
|
||||
// 请求成功
|
||||
return _buildView(context, false, videoDetail);
|
||||
// return _buildView(context, false, videoDetail);
|
||||
return VideoInfo(loadingStatus: false, videoDetail: videoDetail);
|
||||
} else {
|
||||
// 请求错误
|
||||
return Center(
|
||||
@ -58,7 +62,8 @@ class _VideoIntroPanelState extends State<VideoIntroPanel> {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return _buildView(context, true, videoDetail);
|
||||
// return _buildView(context, true, videoDetail);
|
||||
return VideoInfo(loadingStatus: true, videoDetail: videoDetail);
|
||||
}
|
||||
},
|
||||
);
|
||||
@ -320,7 +325,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
),
|
||||
),
|
||||
_actionGrid(context),
|
||||
const SizedBox(height: 5),
|
||||
// const SizedBox(height: 5),
|
||||
],
|
||||
)
|
||||
: const Center(child: CircularProgressIndicator()),
|
||||
|
||||
Reference in New Issue
Block a user