mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: show listsheet item cover
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import 'package:PiliPalaX/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPalaX/models/bangumi/info.dart' as bangumi;
|
||||
import 'package:PiliPalaX/models/video_detail_res.dart' as video;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
@@ -117,18 +120,46 @@ class _ListSheetContentState extends State<ListSheetContent> {
|
||||
}
|
||||
},
|
||||
dense: false,
|
||||
leading: isCurrentIndex
|
||||
? Image.asset(
|
||||
'assets/images/live.png',
|
||||
color: primary,
|
||||
height: 12,
|
||||
semanticLabel: "正在播放:",
|
||||
leading: (episode is video.EpisodeItem && episode.arc?.pic != null) ||
|
||||
(episode is video.Part && episode.firstFrame != null) ||
|
||||
(episode is bangumi.EpisodeItem && episode.cover != null)
|
||||
? Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 6),
|
||||
decoration: isCurrentIndex
|
||||
? BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border.all(
|
||||
width: 1.8,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
child: LayoutBuilder(
|
||||
builder: (_, constraints) => NetworkImgLayer(
|
||||
radius: 6,
|
||||
src: episode is video.EpisodeItem
|
||||
? episode.arc?.pic
|
||||
: episode is bangumi.EpisodeItem
|
||||
? episode.cover
|
||||
: episode.firstFrame,
|
||||
width: constraints.maxHeight * 16 / 9,
|
||||
height: constraints.maxHeight,
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
: isCurrentIndex
|
||||
? Image.asset(
|
||||
'assets/images/live.png',
|
||||
color: primary,
|
||||
height: 12,
|
||||
semanticLabel: "正在播放:",
|
||||
)
|
||||
: null,
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: isCurrentIndex ? FontWeight.bold : null,
|
||||
color: isCurrentIndex
|
||||
? primary
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
@@ -191,6 +222,15 @@ class _ListSheetContentState extends State<ListSheetContent> {
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.my_location),
|
||||
onPressed: () {
|
||||
itemScrollController.scrollTo(
|
||||
index: currentIndex,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
);
|
||||
},
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
tooltip: '反序',
|
||||
|
||||
@@ -23,6 +23,7 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
this.origAspectRatio,
|
||||
this.semanticsLabel,
|
||||
this.ignoreHeight,
|
||||
this.radius,
|
||||
});
|
||||
|
||||
final String? src;
|
||||
@@ -35,6 +36,7 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
final double? origAspectRatio;
|
||||
final String? semanticsLabel;
|
||||
final bool? ignoreHeight;
|
||||
final double? radius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -57,11 +59,13 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
? ClipRRect(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
borderRadius: BorderRadius.circular(
|
||||
type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x,
|
||||
radius != null
|
||||
? radius!
|
||||
: type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x,
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
|
||||
@@ -597,6 +597,18 @@ class UgcSeason {
|
||||
}
|
||||
}
|
||||
|
||||
class Arc {
|
||||
Arc({
|
||||
this.pic,
|
||||
});
|
||||
|
||||
String? pic;
|
||||
|
||||
Arc.fromJson(Map<String, dynamic> json) {
|
||||
pic = json['pic'] as String?;
|
||||
}
|
||||
}
|
||||
|
||||
class SectionItem {
|
||||
SectionItem({
|
||||
this.seasonId,
|
||||
@@ -636,6 +648,7 @@ class EpisodeItem {
|
||||
this.page,
|
||||
this.bvid,
|
||||
this.badge,
|
||||
this.arc,
|
||||
});
|
||||
int? seasonId;
|
||||
int? sectionId;
|
||||
@@ -648,6 +661,7 @@ class EpisodeItem {
|
||||
Part? page;
|
||||
String? bvid;
|
||||
String? badge;
|
||||
Arc? arc;
|
||||
|
||||
EpisodeItem.fromJson(Map<String, dynamic> json) {
|
||||
seasonId = json['season_id'];
|
||||
@@ -661,5 +675,8 @@ class EpisodeItem {
|
||||
page = Part.fromJson(json['page']);
|
||||
bvid = json['bvid'];
|
||||
badge = json['badge'];
|
||||
arc = json['arc'] == null
|
||||
? null
|
||||
: Arc.fromJson(json['arc'] as Map<String, dynamic>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
fabAnimationCtr.dispose();
|
||||
_videoReplyController.scrollController.removeListener(() {});
|
||||
fabAnimationCtr.dispose();
|
||||
// _videoReplyController.scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -92,9 +92,13 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
final ScrollDirection direction =
|
||||
_videoReplyController.scrollController.position.userScrollDirection;
|
||||
if (direction == ScrollDirection.forward) {
|
||||
_showFab();
|
||||
if (mounted) {
|
||||
_showFab();
|
||||
}
|
||||
} else if (direction == ScrollDirection.reverse) {
|
||||
_hideFab();
|
||||
if (mounted) {
|
||||
_hideFab();
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user