mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +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();
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
24
pubspec.lock
24
pubspec.lock
@@ -42,10 +42,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: app_links
|
||||
sha256: "50437e5916e6f56c1ca53e967cbfd6d53b3451465b41eef05ba1533bf1e1c5ea"
|
||||
sha256: "7e058edbc78bd40b6a8227941b955f38320a4e799bc0983c8146bda41593a491"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
version: "6.3.1"
|
||||
app_links_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -243,10 +243,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: catcher_2
|
||||
sha256: a15deaec342d7b10c44d71443a5ed66adda8cd70ae00dd2adfadb8958f7c5441
|
||||
sha256: "9e5b5f0f1c06d48a83cbedb15d7b5fc0d785c6f3b835c5d7b1cc61b839d901ea"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0-alpha.2"
|
||||
version: "2.0.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -411,10 +411,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0"
|
||||
sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.6.0"
|
||||
version: "5.7.0"
|
||||
dio_cookie_manager:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -653,10 +653,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_smart_dialog
|
||||
sha256: "3d376ba47f64391cc657f706815b32dd6ff2e0f80553a5c9f33b812ba7c59462"
|
||||
sha256: "6b5fd32cd2900745df30c1d95ef597ea0ee1ee8cfa557eab62010e3db1d3d717"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.8"
|
||||
version: "4.9.8+1"
|
||||
flutter_svg:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1409,10 +1409,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sentry
|
||||
sha256: "0f787e27ff617e4f88f7074977240406a9c5509444bac64a4dfa5b3200fb5632"
|
||||
sha256: "1af8308298977259430d118ab25be8e1dda626cdefa1e6ce869073d530d39271"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.7.0"
|
||||
version: "8.8.0"
|
||||
share_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1774,10 +1774,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
|
||||
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.4"
|
||||
version: "14.2.5"
|
||||
volume_controller:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user