mod: 番剧样式修改
This commit is contained in:
@ -36,7 +36,6 @@ class BangumiIntroController extends GetxController {
|
|||||||
RxBool isLoading = false.obs;
|
RxBool isLoading = false.obs;
|
||||||
|
|
||||||
// 视频详情 请求返回
|
// 视频详情 请求返回
|
||||||
Rx<VideoDetailData> videoDetail = VideoDetailData().obs;
|
|
||||||
Rx<BangumiInfoModel> bangumiDetail = BangumiInfoModel().obs;
|
Rx<BangumiInfoModel> bangumiDetail = BangumiInfoModel().obs;
|
||||||
|
|
||||||
// 请求返回的信息
|
// 请求返回的信息
|
||||||
@ -89,11 +88,6 @@ class BangumiIntroController extends GetxController {
|
|||||||
|
|
||||||
// 获取番剧简介&选集
|
// 获取番剧简介&选集
|
||||||
Future queryBangumiIntro() async {
|
Future queryBangumiIntro() async {
|
||||||
var result = await SearchHttp.bangumiInfo(seasonId: seasonId, epId: epId);
|
|
||||||
if (result['status']) {
|
|
||||||
bangumiDetail.value = result['data'];
|
|
||||||
epId = bangumiDetail.value.episodes!.first.id;
|
|
||||||
}
|
|
||||||
if (userLogin) {
|
if (userLogin) {
|
||||||
// 获取点赞状态
|
// 获取点赞状态
|
||||||
queryHasLikeVideo();
|
queryHasLikeVideo();
|
||||||
@ -102,6 +96,11 @@ class BangumiIntroController extends GetxController {
|
|||||||
// 获取收藏状态
|
// 获取收藏状态
|
||||||
queryHasFavVideo();
|
queryHasFavVideo();
|
||||||
}
|
}
|
||||||
|
var result = await SearchHttp.bangumiInfo(seasonId: seasonId, epId: epId);
|
||||||
|
if (result['status']) {
|
||||||
|
bangumiDetail.value = result['data'];
|
||||||
|
epId = bangumiDetail.value.episodes!.first.id;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,15 +131,10 @@ class BangumiIntroController extends GetxController {
|
|||||||
Future actionLikeVideo() async {
|
Future actionLikeVideo() async {
|
||||||
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
if (!hasLike.value) {
|
SmartDialog.showToast(!hasLike.value ? '点赞成功 👍' : '取消赞');
|
||||||
SmartDialog.showToast('点赞成功 👍');
|
hasLike.value = !hasLike.value;
|
||||||
hasLike.value = true;
|
bangumiDetail.value.stat!['likes'] =
|
||||||
videoDetail.value.stat!.like = videoDetail.value.stat!.like! + 1;
|
bangumiDetail.value.stat!['likes'] + (!hasLike.value ? 1 : -1);
|
||||||
} else if (hasLike.value) {
|
|
||||||
SmartDialog.showToast('取消赞');
|
|
||||||
hasLike.value = false;
|
|
||||||
videoDetail.value.stat!.like = videoDetail.value.stat!.like! - 1;
|
|
||||||
}
|
|
||||||
hasLike.refresh();
|
hasLike.refresh();
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
@ -193,8 +187,8 @@ class BangumiIntroController extends GetxController {
|
|||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('投币成功 👏');
|
SmartDialog.showToast('投币成功 👏');
|
||||||
hasCoin.value = true;
|
hasCoin.value = true;
|
||||||
videoDetail.value.stat!.coin =
|
bangumiDetail.value.stat!['coins'] =
|
||||||
videoDetail.value.stat!.coin! + _tempThemeValue;
|
bangumiDetail.value.stat!['coins'] + _tempThemeValue;
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
@ -287,4 +281,13 @@ class BangumiIntroController extends GetxController {
|
|||||||
await VideoHttp.bangumiDel(seasonId: bangumiDetail.value.seasonId);
|
await VideoHttp.bangumiDel(seasonId: bangumiDetail.value.seasonId);
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future queryVideoInFolder() async {
|
||||||
|
var result = await VideoHttp.videoInFolder(
|
||||||
|
mid: user.get(UserBoxKey.userMid), rid: IdUtils.bv2av(bvid));
|
||||||
|
if (result['status']) {
|
||||||
|
favFolderData.value = result['data'];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
|||||||
final BangumiIntroController bangumiIntroController =
|
final BangumiIntroController bangumiIntroController =
|
||||||
Get.put(BangumiIntroController(), tag: Get.arguments['heroTag']);
|
Get.put(BangumiIntroController(), tag: Get.arguments['heroTag']);
|
||||||
BangumiInfoModel? bangumiDetail;
|
BangumiInfoModel? bangumiDetail;
|
||||||
|
late Future _futureBuilderFuture;
|
||||||
|
|
||||||
// 添加页面缓存
|
// 添加页面缓存
|
||||||
@override
|
@override
|
||||||
@ -44,13 +45,14 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
|||||||
bangumiIntroController.bangumiDetail.listen((value) {
|
bangumiIntroController.bangumiDetail.listen((value) {
|
||||||
bangumiDetail = value;
|
bangumiDetail = value;
|
||||||
});
|
});
|
||||||
|
_futureBuilderFuture = bangumiIntroController.queryBangumiIntro();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: bangumiIntroController.queryBangumiIntro(),
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if (snapshot.data['status']) {
|
if (snapshot.data['status']) {
|
||||||
@ -356,10 +358,10 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
||||||
onTap: () => bangumiIntroController.actionLikeVideo(),
|
onTap: () => bangumiIntroController.actionLikeVideo(),
|
||||||
selectStatus: bangumiIntroController.hasLike.value,
|
selectStatus: bangumiIntroController.hasLike.value,
|
||||||
loadingStatus: widget.loadingStatus,
|
loadingStatus: false,
|
||||||
text: !widget.loadingStatus
|
text: !widget.loadingStatus
|
||||||
? widget.bangumiDetail!.stat!['likes']!.toString()
|
? widget.bangumiDetail!.stat!['likes']!.toString()
|
||||||
: '-'),
|
: bangumiItem!.stat!['likes']!.toString()),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
@ -367,10 +369,10 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
selectIcon: const Icon(FontAwesomeIcons.b),
|
selectIcon: const Icon(FontAwesomeIcons.b),
|
||||||
onTap: () => bangumiIntroController.actionCoinVideo(),
|
onTap: () => bangumiIntroController.actionCoinVideo(),
|
||||||
selectStatus: bangumiIntroController.hasCoin.value,
|
selectStatus: bangumiIntroController.hasCoin.value,
|
||||||
loadingStatus: widget.loadingStatus,
|
loadingStatus: false,
|
||||||
text: !widget.loadingStatus
|
text: !widget.loadingStatus
|
||||||
? widget.bangumiDetail!.stat!['coins']!.toString()
|
? widget.bangumiDetail!.stat!['coins']!.toString()
|
||||||
: '-'),
|
: bangumiItem!.stat!['coins']!.toString()),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
@ -378,29 +380,29 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
selectIcon: const Icon(FontAwesomeIcons.solidStar),
|
||||||
onTap: () => showFavBottomSheet(),
|
onTap: () => showFavBottomSheet(),
|
||||||
selectStatus: bangumiIntroController.hasFav.value,
|
selectStatus: bangumiIntroController.hasFav.value,
|
||||||
loadingStatus: widget.loadingStatus,
|
loadingStatus: false,
|
||||||
text: !widget.loadingStatus
|
text: !widget.loadingStatus
|
||||||
? widget.bangumiDetail!.stat!['favorite']!.toString()
|
? widget.bangumiDetail!.stat!['favorite']!.toString()
|
||||||
: '-'),
|
: bangumiItem!.stat!['favorite']!.toString()),
|
||||||
),
|
),
|
||||||
ActionItem(
|
ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.comment),
|
icon: const Icon(FontAwesomeIcons.comment),
|
||||||
selectIcon: const Icon(FontAwesomeIcons.reply),
|
selectIcon: const Icon(FontAwesomeIcons.reply),
|
||||||
onTap: () => videoDetailCtr!.tabCtr!.animateTo(1),
|
onTap: () => videoDetailCtr.tabCtr!.animateTo(1),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
loadingStatus: widget.loadingStatus,
|
loadingStatus: false,
|
||||||
text: !widget.loadingStatus
|
text: !widget.loadingStatus
|
||||||
? widget.bangumiDetail!.stat!['reply']!.toString()
|
? widget.bangumiDetail!.stat!['reply']!.toString()
|
||||||
: '-',
|
: bangumiItem!.stat!['reply']!.toString(),
|
||||||
),
|
),
|
||||||
ActionItem(
|
ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||||
onTap: () => bangumiIntroController.actionShareVideo(),
|
onTap: () => bangumiIntroController.actionShareVideo(),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
loadingStatus: widget.loadingStatus,
|
loadingStatus: false,
|
||||||
text: !widget.loadingStatus
|
text: !widget.loadingStatus
|
||||||
? widget.bangumiDetail!.stat!['share']!.toString()
|
? widget.bangumiDetail!.stat!['share']!.toString()
|
||||||
: '-'),
|
: bangumiItem!.stat!['share']!.toString()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -464,9 +466,6 @@ class _BangumiInfoState extends State<BangumiInfo> {
|
|||||||
onTap: () => videoIntroController.actionShareVideo(),
|
onTap: () => videoIntroController.actionShareVideo(),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
loadingStatus: widget.loadingStatus,
|
loadingStatus: widget.loadingStatus,
|
||||||
// text: !widget.loadingStatus
|
|
||||||
// ? widget.videoDetail!.stat!.share!.toString()
|
|
||||||
// : '-',
|
|
||||||
text: '转发'),
|
text: '转发'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -65,121 +65,119 @@ class _BangumiPageState extends State<BangumiPage>
|
|||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(StyleString.imgRadius),
|
borderRadius: BorderRadius.all(StyleString.imgRadius),
|
||||||
),
|
),
|
||||||
child: Expanded(
|
child: RefreshIndicator(
|
||||||
child: RefreshIndicator(
|
onRefresh: () async {
|
||||||
onRefresh: () async {
|
await _bangumidController.queryBangumiListFeed(type: 'init');
|
||||||
await _bangumidController.queryBangumiListFeed(type: 'init');
|
return _bangumidController.queryBangumiFollow();
|
||||||
return _bangumidController.queryBangumiFollow();
|
},
|
||||||
},
|
child: CustomScrollView(
|
||||||
child: CustomScrollView(
|
controller: _bangumidController.scrollController,
|
||||||
controller: _bangumidController.scrollController,
|
slivers: [
|
||||||
slivers: [
|
SliverToBoxAdapter(
|
||||||
SliverToBoxAdapter(
|
child: Obx(
|
||||||
child: Obx(
|
() => Visibility(
|
||||||
() => Visibility(
|
visible: _bangumidController.userLogin.value,
|
||||||
visible: _bangumidController.userLogin.value,
|
child: Column(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
Padding(
|
||||||
Padding(
|
padding:
|
||||||
padding: const EdgeInsets.only(
|
const EdgeInsets.only(top: 10, bottom: 10, left: 6),
|
||||||
top: 10, bottom: 10, left: 6),
|
child: Row(
|
||||||
child: Row(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
children: [
|
Text(
|
||||||
Text(
|
'最近追番',
|
||||||
'最近追番',
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
),
|
||||||
),
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
height: 254,
|
SizedBox(
|
||||||
child: FutureBuilder(
|
height: 254,
|
||||||
future: _bangumidController.queryBangumiFollow(),
|
child: FutureBuilder(
|
||||||
builder: (context, snapshot) {
|
future: _bangumidController.queryBangumiFollow(),
|
||||||
if (snapshot.connectionState ==
|
builder: (context, snapshot) {
|
||||||
ConnectionState.done) {
|
if (snapshot.connectionState ==
|
||||||
Map data = snapshot.data as Map;
|
ConnectionState.done) {
|
||||||
if (data['status']) {
|
Map data = snapshot.data as Map;
|
||||||
return Obx(
|
if (data['status']) {
|
||||||
() => ListView.builder(
|
return Obx(
|
||||||
scrollDirection: Axis.horizontal,
|
() => ListView.builder(
|
||||||
itemCount: _bangumidController
|
scrollDirection: Axis.horizontal,
|
||||||
.bangumiFollowList.length,
|
itemCount: _bangumidController
|
||||||
itemBuilder: (context, index) {
|
.bangumiFollowList.length,
|
||||||
return Container(
|
itemBuilder: (context, index) {
|
||||||
width: Get.size.width / 3,
|
return Container(
|
||||||
height: 254,
|
width: Get.size.width / 3,
|
||||||
margin: EdgeInsets.only(
|
height: 254,
|
||||||
right: index <
|
margin: EdgeInsets.only(
|
||||||
_bangumidController
|
right: index <
|
||||||
.bangumiFollowList
|
_bangumidController
|
||||||
.length -
|
.bangumiFollowList
|
||||||
1
|
.length -
|
||||||
? StyleString.safeSpace
|
1
|
||||||
: 0),
|
? StyleString.safeSpace
|
||||||
child: BangumiCardV(
|
: 0),
|
||||||
bangumiItem: _bangumidController
|
child: BangumiCardV(
|
||||||
.bangumiFollowList[index],
|
bangumiItem: _bangumidController
|
||||||
),
|
.bangumiFollowList[index],
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
);
|
),
|
||||||
} else {
|
);
|
||||||
return SizedBox();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return SizedBox();
|
return SizedBox();
|
||||||
}
|
}
|
||||||
},
|
} else {
|
||||||
),
|
return SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 10, bottom: 10, left: 6),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'推荐',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPadding(
|
),
|
||||||
padding: EdgeInsets.zero,
|
SliverToBoxAdapter(
|
||||||
sliver: FutureBuilder(
|
child: Padding(
|
||||||
future: _futureBuilderFuture,
|
padding: const EdgeInsets.only(top: 10, bottom: 10, left: 6),
|
||||||
builder: (context, snapshot) {
|
child: Row(
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
Map data = snapshot.data as Map;
|
children: [
|
||||||
if (data['status']) {
|
Text(
|
||||||
return Obx(() => contentGrid(_bangumidController,
|
'推荐',
|
||||||
_bangumidController.bangumiList));
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
} else {
|
),
|
||||||
return HttpError(
|
],
|
||||||
errMsg: data['msg'],
|
|
||||||
fn: () => {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return contentGrid(_bangumidController, []);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const LoadingMore()
|
),
|
||||||
],
|
SliverPadding(
|
||||||
),
|
padding: EdgeInsets.zero,
|
||||||
|
sliver: FutureBuilder(
|
||||||
|
future: _futureBuilderFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
Map data = snapshot.data as Map;
|
||||||
|
if (data['status']) {
|
||||||
|
return Obx(() => contentGrid(_bangumidController,
|
||||||
|
_bangumidController.bangumiList));
|
||||||
|
} else {
|
||||||
|
return HttpError(
|
||||||
|
errMsg: data['msg'],
|
||||||
|
fn: () => {},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return contentGrid(_bangumidController, []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const LoadingMore()
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -37,10 +37,10 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
AppBar(
|
||||||
height: 45,
|
toolbarHeight: 45,
|
||||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
automaticallyImplyLeading: false,
|
||||||
child: Row(
|
title: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -53,10 +53,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
titleSpacing: 10,
|
||||||
Divider(
|
|
||||||
height: 1,
|
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
@ -66,8 +63,15 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () => changeFucCall(widget.pages[index], index),
|
onTap: () => changeFucCall(widget.pages[index], index),
|
||||||
dense: false,
|
dense: false,
|
||||||
|
leading: index == currentIndex
|
||||||
|
? Image.asset(
|
||||||
|
'assets/images/live.gif',
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
height: 12,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
title: Text(
|
title: Text(
|
||||||
widget.pages[index].longTitle!,
|
'第${index + 1}话 ${widget.pages[index].longTitle!}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: index == currentIndex
|
color: index == currentIndex
|
||||||
@ -148,6 +152,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length,
|
||||||
|
itemExtent: 150,
|
||||||
itemBuilder: ((context, i) {
|
itemBuilder: ((context, i) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 150,
|
width: 150,
|
||||||
|
Reference in New Issue
Block a user