opt: bangumi intro

This commit is contained in:
bggRGjQaUbCoE
2024-09-19 10:29:22 +08:00
parent 7e83856615
commit 1d50eb0724
5 changed files with 34 additions and 15 deletions

View File

@@ -19,18 +19,19 @@ import 'package:PiliPalaX/utils/feed_back.dart';
import '../../../utils/utils.dart';
import 'controller.dart';
import 'widgets/intro_detail.dart';
class BangumiIntroPanel extends StatefulWidget {
final int? cid;
final String heroTag;
final Function showEpisodes;
final Function showIntroDetail;
const BangumiIntroPanel({
Key? key,
this.cid,
required this.heroTag,
required this.showEpisodes,
required this.showIntroDetail,
}) : super(key: key);
@override
@@ -76,6 +77,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
bangumiDetail: loadingState.response,
cid: cid,
showEpisodes: widget.showEpisodes,
showIntroDetail: widget.showIntroDetail,
)
: loadingState is Error
? HttpError(
@@ -87,6 +89,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
bangumiDetail: null,
cid: cid,
showEpisodes: widget.showEpisodes,
showIntroDetail: widget.showIntroDetail,
);
}
}
@@ -98,12 +101,14 @@ class BangumiInfo extends StatefulWidget {
this.bangumiDetail,
this.cid,
required this.showEpisodes,
required this.showIntroDetail,
});
final bool loadingStatus;
final BangumiInfoModel? bangumiDetail;
final int? cid;
final Function showEpisodes;
final Function showIntroDetail;
@override
State<BangumiInfo> createState() => _BangumiInfoState();
@@ -143,7 +148,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
// 收藏
showFavBottomSheet() {
if (bangumiIntroController.userInfo.mid == null) {
if (bangumiIntroController.userInfo == null) {
SmartDialog.showToast('账号未登录');
return;
}
@@ -160,13 +165,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
// 视频介绍
showIntroDetail() {
feedBack();
showBottomSheet(
context: context,
enableDrag: true,
builder: (BuildContext context) {
return IntroDetail(bangumiDetail: widget.bangumiDetail!);
},
);
widget.showIntroDetail(widget.bangumiDetail);
}
@override

View File

@@ -29,6 +29,7 @@ class ActionItem extends StatelessWidget {
child: Semantics(
label: (text ?? "") + (selectStatus ? "" : "") + semanticsLabel,
child: InkWell(
borderRadius: BorderRadius.circular(6),
onTap: () => {
feedBack(),
onTap!(),

View File

@@ -26,7 +26,7 @@ class _FavPanelState extends State<FavPanel> {
Widget build(BuildContext context) {
return Container(
height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
child: Column(
children: [
AppBar(

View File

@@ -75,7 +75,7 @@ class IntroDetail extends StatelessWidget {
),
],
),
const SizedBox(height: 20),
const SizedBox(height: 10),
SizedBox(
width: double.infinity,
child: SelectableRegion(
@@ -86,9 +86,12 @@ class IntroDetail extends StatelessWidget {
children: <Widget>[
Text(
videoDetail!.bvid!,
style: const TextStyle(fontSize: 13),
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.primary,
),
),
const SizedBox(height: 4),
const SizedBox(height: 10),
Text.rich(
style: const TextStyle(
height: 1.4,

View File

@@ -5,8 +5,12 @@ import 'dart:math';
import 'package:PiliPalaX/common/constants.dart';
import 'package:PiliPalaX/common/widgets/list_sheet.dart';
import 'package:PiliPalaX/http/loading_state.dart';
import 'package:PiliPalaX/models/bangumi/info.dart';
import 'package:PiliPalaX/models/common/reply_type.dart';
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/intro_detail.dart';
import 'package:PiliPalaX/pages/bangumi/introduction/widgets/intro_detail.dart'
as bangumi;
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/intro_detail.dart'
as video;
import 'package:PiliPalaX/pages/video/detail/reply_reply/view.dart';
import 'package:PiliPalaX/pages/video/detail/widgets/ai_detail.dart';
import 'package:PiliPalaX/utils/extension.dart';
@@ -423,6 +427,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
String introText = '简介',
bool isSingle = false,
]) {
if (videoDetailController.tabCtr.length != (isSingle ? 1 : 2)) {
videoDetailController.tabCtr =
TabController(length: isSingle ? 1 : 2, vsync: this);
}
return Container(
width: double.infinity,
height: 45,
@@ -735,6 +743,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
cid:
videoDetailController.cid.value,
showEpisodes: showEpisodes,
showIntroDetail: showIntroDetail,
)),
],
SliverToBoxAdapter(
@@ -855,6 +864,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
heroTag: heroTag,
cid: videoDetailController.cid.value,
showEpisodes: showEpisodes,
showIntroDetail: showIntroDetail,
)),
],
SliverToBoxAdapter(
@@ -970,6 +980,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
heroTag: heroTag,
cid: videoDetailController.cid.value,
showEpisodes: showEpisodes,
showIntroDetail: showIntroDetail,
)),
]
],
@@ -1013,6 +1024,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
heroTag: heroTag,
cid: videoDetailController.cid.value,
showEpisodes: showEpisodes,
showIntroDetail: showIntroDetail,
)),
]
],
@@ -1200,6 +1212,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
heroTag: heroTag,
cid: videoDetailController.cid.value,
showEpisodes: showEpisodes,
showIntroDetail: showIntroDetail,
)),
]
],
@@ -1442,7 +1455,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
showIntroDetail(videoDetail) {
scaffoldKey.currentState?.showBottomSheet(
enableDrag: true, (context) => IntroDetail(videoDetail: videoDetail));
enableDrag: true,
(context) => videoDetail is BangumiInfoModel
? bangumi.IntroDetail(bangumiDetail: videoDetail)
: video.IntroDetail(videoDetail: videoDetail));
}
showEpisodes(episodes, bvid, aid, cid) {