import 'dart:io';
|
import 'dart:ui';
|
|
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/material.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import '../../api/video_api.dart';
|
import '../../model/video/video_attention_model.dart';
|
import '../../model/video/video_model.dart';
|
import '../../model/video/video_play_url_model.dart';
|
import '../../ui/mine/email_login.dart';
|
import '../../ui/video/video_player_browser.dart';
|
import '../../ui/widget/button.dart';
|
import '../../ui/widget/refresh_listview.dart';
|
import '../../ui/widget/video_item.dart';
|
import '../../utils/ad_util.dart';
|
import '../../utils/db_manager.dart';
|
import '../../utils/pageutils.dart';
|
import '../../utils/share_preference.dart';
|
import '../../utils/string_util.dart';
|
import '../../utils/ui_constant.dart';
|
import '../../utils/ui_utils.dart';
|
import '../../utils/user_util.dart';
|
import 'package:share_plus/share_plus.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
import '../../ui/widget/nav.dart';
|
|
class VideoDetailPage extends StatefulWidget {
|
VideoDetailPage(
|
{Key? key, this.videoId, this.videoInfo, required this.position})
|
: super(key: key);
|
final String? videoId;
|
final VideoInfoModel? videoInfo;
|
final int position;
|
|
@override
|
_VideoDetailPageState createState() => _VideoDetailPageState();
|
}
|
|
class _VideoDetailPageState extends State<VideoDetailPage>
|
with SingleTickerProviderStateMixin {
|
TabController? _tabController;
|
List tabs = [" 剧集 ", " 简介 "];
|
int _playPosition = 0;
|
VideoDetailStatus _status = VideoDetailStatus.going;
|
|
VideoResource? _selectedVideoResource;
|
|
VideoInfoModel? _videoInfoModel;
|
|
VideoInfoModel? _simpleVideo;
|
|
List<VideoInfoModel> relativeVideoList = [];
|
|
VideoAttentionModel? videoAttention;
|
|
//是否已经收藏
|
bool collected = false;
|
|
//是否展开剧集
|
bool episodeExpand = false;
|
|
bool adShown = false;
|
|
final MyRefreshController _refreshController =
|
MyRefreshController(initialRefresh: false);
|
final ScrollController _scrollController = ScrollController();
|
|
int episodePage = 1;
|
bool episodeHasMore = true;
|
|
String applink = "";
|
|
@override
|
void initState() {
|
super.initState();
|
if (Platform.isAndroid) {
|
WebView.platform = SurfaceAndroidWebView();
|
}
|
_playPosition = widget.position;
|
_simpleVideo = widget.videoInfo;
|
_tabController = TabController(length: tabs.length, vsync: this);
|
if (Platform.isIOS) {
|
MySharedPreferences.getInstance().getString("appLink").then((value) {
|
setState(() {
|
applink = value!;
|
});
|
});
|
}
|
|
getVideoDetail(_simpleVideo!.id);
|
}
|
|
void getVideoDetail(videoId) async {
|
setState(() {
|
_status = VideoDetailStatus.going;
|
//初始化状态
|
episodePage = 1;
|
episodeHasMore = true;
|
episodeExpand = false;
|
});
|
|
Map<String, dynamic>? result = await VideoApiUtil.getVideoDetail(
|
context,
|
videoId,
|
_selectedVideoResource == null ? null : _selectedVideoResource!.id);
|
|
if (result == null) {
|
setState(() {
|
_status = VideoDetailStatus.fail;
|
});
|
return;
|
}
|
|
if (result["IsPost"] == "true") {
|
VideoInfoModel temp = VideoInfoModel.fromJson(result["Data"]["Video"]);
|
if (temp.videoDetailList!.length <= _playPosition) {
|
setState(() {
|
_playPosition = 0;
|
});
|
}
|
|
setState(() {
|
_videoInfoModel = temp;
|
_status = VideoDetailStatus.success;
|
});
|
_videoInfoModel!.resourceList!.forEach((element) {
|
if (element.checked!) {
|
setState(() {
|
_selectedVideoResource = element;
|
});
|
}
|
});
|
if (_selectedVideoResource == null) {
|
setState(() {
|
_selectedVideoResource = _videoInfoModel!.resourceList![0];
|
});
|
}
|
//解析追剧数据
|
if (result["Data"]["Attention"] != null) {
|
VideoAttentionModel temp =
|
VideoAttentionModel.fromJson(result["Data"]["Attention"]);
|
setState(() {
|
videoAttention = temp;
|
});
|
} else {
|
setState(() {
|
videoAttention = null;
|
});
|
}
|
|
if (result["Data"]["AdInfo"] != null) {
|
if (result["Data"]["AdInfo"]["FullVideo"] && !adShown) {
|
AdUtil.loadFullScreenAd(
|
AdType.csj, CSJADConstant.PID_VIDEO_DETAIL_FULLSCREEN);
|
adShown = true;
|
}
|
}
|
|
getRelativeVideos(videoId);
|
_isCollectedVideo();
|
} else {
|
ToastUtil.toast(result["Error"], context);
|
popPage(context);
|
}
|
}
|
|
void getEpisodeList(videoId, _page) async {
|
episodePage = _page;
|
Map<String, dynamic>? result = await VideoApiUtil.getVideoEpisodeList(
|
context,
|
videoId,
|
_selectedVideoResource == null ? null : _selectedVideoResource!.id,
|
_page);
|
if (result == null || result["IsPost"] != "true") {
|
//回退页码
|
if (episodePage > 1) {
|
episodePage--;
|
}
|
return;
|
}
|
List<dynamic> list = result["Data"]["list"];
|
episodeHasMore = result["Data"]["hasMore"];
|
List<VideoDetailInfo> tempList = [];
|
list.forEach((element) {
|
tempList.add(VideoDetailInfo.fromJson(element));
|
});
|
setState(() {
|
_videoInfoModel!.videoDetailList!.addAll(tempList);
|
});
|
|
if (!episodeHasMore) {
|
_refreshController.loadNoData();
|
} else {
|
_refreshController.loadComplete();
|
}
|
}
|
|
void getRelativeVideos(videoId) async {
|
Map<String, dynamic>? result =
|
await VideoApiUtil.getRelativeVideos(context, videoId);
|
if (result == null) {
|
return;
|
}
|
|
if (result["IsPost"] == "true") {
|
List<dynamic> list = result["Data"]["data"];
|
|
List<VideoInfoModel> tempList = [];
|
|
list.forEach((element) {
|
tempList.add(VideoInfoModel.fromJson(element));
|
});
|
setState(() {
|
relativeVideoList = tempList;
|
});
|
}
|
}
|
|
void getPlayUrl(position) async {
|
setState(() {
|
_playPosition = position;
|
});
|
Map<String, dynamic>? result = await VideoApiUtil.getPlayUrl(
|
context,
|
_videoInfoModel!.id!,
|
_videoInfoModel!.videoDetailList![position].id!,
|
_selectedVideoResource!.id!);
|
|
if (result == null) {
|
return;
|
}
|
if (result["IsPost"] == "true") {
|
//添加观看记录
|
_videoInfoModel!.tag = _simpleVideo!.tag;
|
DBManager.addWatchRecord(_videoInfoModel!,
|
_videoInfoModel!.videoDetailList![_playPosition], _playPosition);
|
|
VideoPlayUrlModel temp = VideoPlayUrlModel.fromJson(result["Data"]);
|
if (temp.playType == 1) {
|
NavigatorUtil.navigateToNextPage(
|
context,
|
VideoPlayerWebPage(
|
title: _videoInfoModel!.videoDetailList![_playPosition].name!,
|
url: temp.url!),
|
(data) {});
|
}
|
}
|
}
|
|
String getPosterImg() {
|
if (_videoInfoModel == null) {
|
if (!StringUtil.isNullOrEmpty(widget.videoInfo!.hpicture)) {
|
return widget.videoInfo!.hpicture!;
|
} else {
|
return widget.videoInfo!.picture!;
|
}
|
} else {
|
if (!StringUtil.isNullOrEmpty(_videoInfoModel!.playPicture)) {
|
return _videoInfoModel!.playPicture!;
|
}
|
if (!StringUtil.isNullOrEmpty(_videoInfoModel!.hpicture)) {
|
return _videoInfoModel!.hpicture!;
|
}
|
return _videoInfoModel!.picture!;
|
}
|
}
|
|
@override
|
Widget build(BuildContext context) {
|
return Scaffold(
|
backgroundColor: Colors.white,
|
body: Column(
|
children: [
|
Container(
|
height: MediaQuery.of(context).viewPadding.top,
|
),
|
//封面
|
AspectRatio(
|
aspectRatio: 1.7778,
|
child: Stack(
|
alignment: Alignment.center,
|
children: [
|
Positioned(
|
left: 0,
|
right: 0,
|
top: 0,
|
bottom: 0,
|
child: VideoImage(getPosterImg()),
|
),
|
// Positioned(
|
// left: 0,
|
// right: 0,
|
// top: 0,
|
// bottom: 0,
|
// child: _getPlayer(),
|
// ),
|
Positioned(
|
top: 10,
|
left: 10,
|
child: InkWell(
|
onTap: () {
|
popPage(context);
|
},
|
child: Image.asset(
|
"assets/imgs/video/ic_play_back.png",
|
width: 29,
|
height: 29,
|
))),
|
Positioned(
|
width: 60,
|
height: 60,
|
child: InkWell(
|
onTap: () {
|
getPlayUrl(_playPosition);
|
},
|
child:
|
Image.asset("assets/imgs/video/ic_play.png")))
|
],
|
)),
|
|
_status == VideoDetailStatus.success
|
? Expanded(
|
child: Stack(children: [
|
Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
Stack(alignment: Alignment.bottomLeft, children: [
|
Container(
|
color: const Color(0xFFEEEEEE),
|
height: 2,
|
),
|
Container(
|
margin: const EdgeInsets.only(left: 34),
|
alignment: Alignment.topLeft,
|
child: TabBar(
|
isScrollable: true,
|
labelPadding:
|
const EdgeInsets.fromLTRB(10, 10, 10, 10),
|
indicatorColor: const Color(0xFFFF558D),
|
labelColor: const Color(0xFFFF558D),
|
labelStyle: const TextStyle(fontSize: 15),
|
unselectedLabelColor:
|
const Color(0xFFF999999),
|
indicatorWeight: 4,
|
indicatorSize: TabBarIndicatorSize.label,
|
controller: _tabController,
|
tabs: tabs.map((e) => Text(e)).toList(),
|
))
|
]),
|
Expanded(
|
child: TabBarView(
|
controller: _tabController,
|
children: [
|
SingleChildScrollView(
|
child: _getVideoEpisodeView(),
|
),
|
_getVideoDescView()
|
]))
|
]),
|
//选集浮层
|
_videoInfoModel != null && episodeExpand
|
? Container(
|
color: Colors.white,
|
child: Stack(children: [
|
RefreshListView(
|
enablePullDown: false,
|
refreshController: _refreshController,
|
loadMore: () {
|
getEpisodeList(
|
_simpleVideo!.id, episodePage + 1);
|
},
|
content: GridView.builder(
|
padding: const EdgeInsets.only(
|
top: 45, left: 10, right: 10, bottom: 10),
|
itemCount:
|
_videoInfoModel!.videoDetailList!.length,
|
itemBuilder:
|
(BuildContext context, int index) {
|
return _getEpisodeItem(
|
_videoInfoModel!
|
.videoDetailList![index],
|
index);
|
},
|
gridDelegate:
|
SliverGridDelegateWithFixedCrossAxisCount(
|
//横轴元素个数
|
crossAxisCount:
|
_videoInfoModel!.showType == 2
|
? 5
|
: 2,
|
//纵轴间距
|
mainAxisSpacing: 10.0,
|
//横轴间距
|
crossAxisSpacing: 10.0,
|
//子组件宽高长度比例
|
childAspectRatio:
|
_videoInfoModel!.showType == 2
|
? 1.6
|
: 2),
|
),
|
),
|
Positioned(
|
right: 0,
|
top: 0,
|
left: 0,
|
child: Container(
|
height: 40,
|
color: Colors.white,
|
child: Stack(
|
alignment: Alignment.center,
|
children: [
|
Text(
|
"选集",
|
style: TextStyle(fontSize: 16),
|
),
|
Positioned(
|
right: 0,
|
child: InkWell(
|
onTap: () {
|
setState(() {
|
episodeExpand = false;
|
});
|
},
|
child: const Icon(
|
Icons.close,
|
color: Colors.black54,
|
)))
|
])))
|
]),
|
)
|
: Container()
|
]))
|
: Expanded(child: getStatusView())
|
],
|
));
|
}
|
|
Widget getStatusView() {
|
if (_status == VideoDetailStatus.going) {
|
return const SpinKitCircle(
|
color: ColorConstant.theme,
|
size: 60.0,
|
);
|
} else if (_status == VideoDetailStatus.fail) {
|
return InkWell(
|
onTap: () {
|
getVideoDetail(_simpleVideo!.id);
|
},
|
child: Container(
|
alignment: Alignment.center,
|
child: const Text(
|
"加载失败,点击重试",
|
textAlign: TextAlign.center,
|
style: TextStyle(color: Colors.grey, fontSize: 18),
|
)));
|
}
|
return Container();
|
}
|
|
void _collectVideo(bool collect) async {
|
if (!await UserUtil.isLogin()) {
|
NavigatorUtil.navigateToNextPage(
|
context, EmailLoginPage(title: ""), (data) {});
|
return;
|
}
|
|
Map<String, dynamic>? result =
|
await VideoApiUtil.collelctVideo(context, _simpleVideo!.id!, collect);
|
if (result == null) {
|
return;
|
}
|
if (result["IsPost"] == "true") {
|
ToastUtil.toast(collect ? "收藏成功" : "取消收藏成功", context);
|
}
|
setState(() {
|
collected = collect;
|
});
|
}
|
|
void _isCollectedVideo() async {
|
if (!await UserUtil.isLogin()) {
|
return;
|
}
|
|
Map<String, dynamic>? result =
|
await VideoApiUtil.isCollelctedVideo(context, _simpleVideo!.id!);
|
if (result == null) {
|
return;
|
}
|
if (result["IsPost"] == "true") {
|
setState(() {
|
collected = true;
|
});
|
} else {
|
collected = false;
|
}
|
}
|
|
void attentionClick() async {
|
bool login = await UserUtil.isLogin();
|
if (!login) {
|
NavigatorUtil.navigateToNextPage(
|
context, EmailLoginPage(title: ""), (data) {});
|
return;
|
}
|
|
if (videoAttention!.attention!) {
|
//取消关注
|
Map<String, dynamic>? result =
|
await VideoApiUtil.cancelAttentionVideo(context, _simpleVideo!.id!);
|
if (result == null) {
|
return;
|
}
|
if (result["IsPost"] == "true") {
|
ToastUtil.toast("取消追剧成功", context);
|
setState(() {
|
videoAttention!.attention = false;
|
});
|
} else {
|
ToastUtil.toast(result["Error"], context);
|
}
|
} else {
|
//关注
|
Map<String, dynamic>? result =
|
await VideoApiUtil.addAttentionVideo(context, _simpleVideo!.id!);
|
if (result == null) {
|
return;
|
}
|
if (result["IsPost"] == "true") {
|
ToastUtil.toast("追剧成功", context);
|
setState(() {
|
videoAttention!.attention = true;
|
});
|
} else {
|
ToastUtil.toast(result["Error"], context);
|
}
|
}
|
}
|
|
|
|
Widget _getPlayer() {
|
return WebView(
|
//http://192.168.3.122:8848/test/JsTest.html
|
initialUrl: "https://jx.parwix.com:4433/player/?url=https://v.youku.com/v_show/id_XNTg0ODEyODc0NA==.html",
|
navigationDelegate: (NavigationRequest request) {
|
if (!request.url.startsWith("http")) {
|
return NavigationDecision.prevent;
|
}
|
return NavigationDecision.navigate;
|
},
|
);
|
}
|
|
//剧集
|
Widget _getVideoEpisodeView() {
|
return Column(
|
children: [
|
Container(
|
padding: const EdgeInsets.fromLTRB(12, 20, 12, 10),
|
child:
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
Expanded(
|
child: Text(
|
_videoInfoModel!.name!,
|
style: const TextStyle(color: Colors.black, fontSize: 18),
|
)),
|
Container(
|
width: 10,
|
),
|
_selectedVideoResource != null
|
? InkWell(
|
onTap: () {
|
if (_videoInfoModel == null) {
|
return;
|
}
|
|
DialogUtil.showDialogBottom(
|
context,
|
//资源选择弹框
|
_getResourceListDialog(),
|
borderRadius: const BorderRadius.only(
|
topRight: Radius.circular(10),
|
topLeft: Radius.circular(10)));
|
},
|
child: Container(
|
padding:
|
const EdgeInsets.fromLTRB(9.5, 10, 8.5, 10),
|
decoration: BoxDecoration(
|
borderRadius: BorderRadius.circular(10),
|
border: Border.all(
|
color: Color(0xFFBBBBBB),
|
width: DimenUtil.getOnePixel(context))),
|
child: Row(children: [
|
Text.rich(
|
TextSpan(
|
text: "来源:",
|
style: const TextStyle(
|
color: Color(0xFF999999), fontSize: 9),
|
children: [
|
TextSpan(
|
text: _selectedVideoResource!.name,
|
style: const TextStyle(
|
color: Color(0xFF666666),
|
fontSize: 11))
|
]),
|
),
|
const Icon(
|
Icons.keyboard_arrow_down,
|
color: Color(0xFFE0E0E0),
|
),
|
]),
|
))
|
: Container()
|
],
|
),
|
_videoInfoModel!.score != null &&
|
_videoInfoModel!.score!.isNotEmpty
|
? Text.rich(
|
TextSpan(
|
text: "评分:",
|
style: const TextStyle(
|
color: Color(0xFF999999), fontSize: 14),
|
children: [
|
TextSpan(
|
text: _videoInfoModel!.score!,
|
style: const TextStyle(
|
color: Color(0xFFFB9F00),
|
fontSize: 14,
|
fontWeight: FontWeight.bold),
|
)
|
]),
|
)
|
: Container(),
|
Container(
|
height: 30,
|
),
|
Row(
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
children: [
|
InkWell(
|
onTap: () {
|
_collectVideo(!collected);
|
},
|
child: Column(children: [
|
Image.asset(
|
collected
|
? "assets/imgs/video/icon_collected.png"
|
: "assets/imgs/video/icon_uncollected.png",
|
width: 22,
|
),
|
Container(
|
height: 5,
|
),
|
const Text(
|
"收藏",
|
style:
|
TextStyle(color: Color(0xFF9D9D9D), fontSize: 10),
|
)
|
])),
|
InkWell(
|
onTap: () {
|
ToastUtil.toast("暂不支持下载", context);
|
},
|
child: Column(children: [
|
Image.asset(
|
"assets/imgs/video/icon_download.png",
|
width: 21,
|
),
|
Container(
|
height: 5,
|
),
|
const Text(
|
"下载",
|
style:
|
TextStyle(color: Color(0xFF9D9D9D), fontSize: 10),
|
)
|
])),
|
InkWell(
|
onTap: () {
|
Share.share(
|
"我正在看《${_simpleVideo!.name!}》,APP链接地址为:$applink");
|
},
|
child: Column(children: [
|
Image.asset(
|
"assets/imgs/video/icon_share.png",
|
width: 21,
|
),
|
Container(
|
height: 5,
|
),
|
const Text(
|
"分享",
|
style:
|
TextStyle(color: Color(0xFF9D9D9D), fontSize: 10),
|
)
|
])),
|
],
|
),
|
])),
|
//追剧
|
videoAttention != null
|
? Container(
|
height: 60,
|
margin: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
padding: const EdgeInsets.fromLTRB(5, 10, 5, 10),
|
decoration: BoxDecoration(
|
border: Border.all(
|
color: const Color(0xFF999999),
|
width: DimenUtil.getOnePixel(context)),
|
borderRadius: BorderRadius.circular(8)),
|
child: Row(
|
children: [
|
ClipRRect(
|
borderRadius: BorderRadius.circular(20),
|
child: CommonImage(
|
videoAttention!.picture!,
|
width: 40,
|
height: 40,
|
)),
|
const SizedBox(
|
width: 5,
|
),
|
Expanded(
|
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
Text(
|
videoAttention!.name!,
|
maxLines: 1,
|
overflow: TextOverflow.ellipsis,
|
style: const TextStyle(fontSize: 14),
|
),
|
Expanded(child: Container()),
|
Text(
|
videoAttention!.updateInfo!,
|
style: const TextStyle(
|
fontSize: 10, color: Color(0xFF9D9D9D)),
|
)
|
],
|
)),
|
const SizedBox(
|
width: 5,
|
),
|
MyFillButton(
|
videoAttention!.attention! ? "取消追剧" : "追剧",
|
6,
|
width: 60,
|
color: ColorConstant.theme,
|
onClick: () {
|
attentionClick();
|
},
|
)
|
],
|
),
|
)
|
: Container(),
|
|
Container(
|
padding: const EdgeInsets.fromLTRB(12, 16, 12, 0),
|
child: Row(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
const Text(
|
"选集",
|
style: TextStyle(color: Color(0xFF999999)),
|
),
|
InkWell(
|
onTap: () {
|
setState(() {
|
episodeExpand = true;
|
});
|
},
|
child: Row(children: [
|
Text(
|
_videoInfoModel!.tag ?? "",
|
style: const TextStyle(color: Color(0xFF999999)),
|
),
|
const Icon(
|
Icons.arrow_forward_ios,
|
color: Color(0xFF999999),
|
size: 15,
|
)
|
]))
|
])),
|
Container(
|
margin: const EdgeInsets.only(top: 12),
|
alignment: Alignment.topLeft,
|
height: _videoInfoModel!.showType == 2 ? 40 : 90,
|
child: ListView.separated(
|
padding: const EdgeInsets.only(left: 12, right: 12),
|
scrollDirection: Axis.horizontal,
|
controller: _scrollController,
|
shrinkWrap: true,
|
itemCount: _videoInfoModel!.videoDetailList!.length,
|
itemBuilder: (BuildContext context, int index) {
|
VideoDetailInfo detailInfo =
|
_videoInfoModel!.videoDetailList![index];
|
return _getEpisodeItem(detailInfo, index);
|
},
|
separatorBuilder: (BuildContext context, int index) {
|
return Container(
|
width: 8.5,
|
);
|
},
|
)),
|
relativeVideoList.isNotEmpty
|
? Container(
|
margin: const EdgeInsets.fromLTRB(12, 30, 12, 20),
|
alignment: Alignment.topLeft,
|
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
const Text(
|
"相关推荐",
|
style: TextStyle(color: Colors.black, fontSize: 16.41),
|
),
|
ListView.separated(
|
physics: const NeverScrollableScrollPhysics(),
|
shrinkWrap: true,
|
itemBuilder: (BuildContext context, int index) {
|
return InkWell(
|
onTap: () {
|
setState(() {
|
_playPosition = 0;
|
_selectedVideoResource = null;
|
_simpleVideo = relativeVideoList[index];
|
});
|
getVideoDetail(_simpleVideo!.id);
|
},
|
child: VideoListUIUtil.getRecommendVideo(
|
context, relativeVideoList[index]));
|
},
|
separatorBuilder: (BuildContext context, int index) {
|
return Container(
|
height: 14,
|
);
|
},
|
itemCount: relativeVideoList.length)
|
]),
|
)
|
: Container()
|
],
|
);
|
}
|
|
Widget _getEpisodeItem(VideoDetailInfo detailInfo, int index) {
|
//滑到指定位置
|
|
if (_videoInfoModel!.showType == 2) {
|
return VideoListUIUtil.getTVEpisodeItem(detailInfo.tag, 60, 30, context,
|
checked: _playPosition == index, onClick: () {
|
_scrollController.animateTo(60.0 * index + 8.5 * index,
|
duration: const Duration(milliseconds: 200), curve: Curves.ease);
|
setState(() {
|
_playPosition = index;
|
episodeExpand = false;
|
});
|
getPlayUrl(_playPosition);
|
});
|
} else {
|
return VideoListUIUtil.getShowEpisodeItem(detailInfo.tag, context,
|
checked: _playPosition == index, onClick: () {
|
_scrollController.animateTo(200.0 * index + 8.5 * index,
|
duration: const Duration(milliseconds: 200), curve: Curves.ease);
|
setState(() {
|
_playPosition = index;
|
episodeExpand = false;
|
});
|
getPlayUrl(_playPosition);
|
});
|
}
|
}
|
|
Widget _getVideoDescView() {
|
return Container(
|
alignment: Alignment.topLeft,
|
padding: const EdgeInsets.all(10),
|
child: SingleChildScrollView(
|
child: Text(
|
_videoInfoModel!.introduction ?? "",
|
style: const TextStyle(fontSize: 16),
|
)));
|
}
|
|
Widget _getResourceListDialog() {
|
return Container(
|
margin: const EdgeInsets.all(10),
|
alignment: Alignment.bottomCenter,
|
child: Stack(alignment: Alignment.bottomCenter, children: [
|
Container(
|
margin: const EdgeInsets.only(bottom: 50),
|
decoration: BoxDecoration(
|
color: Colors.white, borderRadius: BorderRadius.circular(10)),
|
child: GridView.count(
|
childAspectRatio: 3,
|
shrinkWrap: true,
|
crossAxisCount: 2,
|
children: _videoInfoModel!.resourceList!.map((e) {
|
return InkWell(
|
onTap: () {
|
setState(() {
|
_selectedVideoResource = e;
|
});
|
popPage(context);
|
getVideoDetail(_simpleVideo!.id);
|
},
|
child: Container(
|
alignment: Alignment.center,
|
child: Text(
|
e.name!,
|
style: TextStyle(fontSize: 18),
|
)));
|
}).toList(),
|
)),
|
MyFillButton(
|
"取消",
|
20,
|
height: 40,
|
color: Colors.grey,
|
fontSize: 14,
|
onClick: () {
|
popPage(context);
|
},
|
)
|
]));
|
}
|
}
|
|
enum VideoDetailStatus { success, fail, going }
|