opt: image view

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-12 20:23:21 +08:00
parent 7905f51067
commit be371e002a
3 changed files with 38 additions and 38 deletions

View File

@@ -232,6 +232,8 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
itemCount: widget.sources.length, itemCount: widget.sources.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: Get.back,
onDoubleTapDown: (TapDownDetails details) { onDoubleTapDown: (TapDownDetails details) {
_doubleTapLocalPosition = details.localPosition; _doubleTapLocalPosition = details.localPosition;
}, },
@@ -351,36 +353,31 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
} }
Widget _itemBuilder(sources, index) { Widget _itemBuilder(sources, index) {
return GestureDetector( return Center(
behavior: HitTestBehavior.opaque, child: Hero(
onTap: () { tag: sources[index],
Get.back(); child: CachedNetworkImage(
}, fadeInDuration: const Duration(milliseconds: 0),
child: Center( fadeOutDuration: const Duration(milliseconds: 0),
child: Hero( imageUrl: _thumbList[index] && _quality != 100
tag: sources[index], ? '${sources[index]}@${_quality}q.webp'
child: CachedNetworkImage( : sources[index],
fadeInDuration: const Duration(milliseconds: 0), fit: BoxFit.contain,
fadeOutDuration: const Duration(milliseconds: 0), progressIndicatorBuilder: (context, url, progress) {
imageUrl: _thumbList[index] && _quality != 100 return Center(
? '${sources[index]}@${_quality}q.webp' child: SizedBox(
: sources[index],
fit: BoxFit.contain,
progressIndicatorBuilder: (context, url, progress) {
return Container(
width: 150.0, width: 150.0,
alignment: Alignment.center,
child: LinearProgressIndicator(value: progress.progress ?? 0), child: LinearProgressIndicator(value: progress.progress ?? 0),
); ),
}, );
errorListener: (value) { },
WidgetsBinding.instance.addPostFrameCallback((_) { errorListener: (value) {
setState(() { WidgetsBinding.instance.addPostFrameCallback((_) {
_thumbList[index] = false; setState(() {
}); _thumbList[index] = false;
}); });
}, });
), },
), ),
), ),
); );

View File

@@ -102,9 +102,10 @@ class _ActionPanelState extends State<ActionPanel> {
), ),
); );
}, },
icon: const Icon( icon: Icon(
FontAwesomeIcons.shareFromSquare, FontAwesomeIcons.shareFromSquare,
size: 16, size: 16,
color: color,
semanticLabel: "转发", semanticLabel: "转发",
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(
@@ -119,9 +120,10 @@ class _ActionPanelState extends State<ActionPanel> {
child: TextButton.icon( child: TextButton.icon(
onPressed: () => _dynamicsController.pushDetail(widget.item, 1, onPressed: () => _dynamicsController.pushDetail(widget.item, 1,
action: 'comment'), action: 'comment'),
icon: const Icon( icon: Icon(
FontAwesomeIcons.comment, FontAwesomeIcons.comment,
size: 16, size: 16,
color: color,
semanticLabel: "评论", semanticLabel: "评论",
), ),
style: TextButton.styleFrom( style: TextButton.styleFrom(

View File

@@ -82,16 +82,17 @@ Widget videoSeasonWidget(item, context, type, {floor = 1}) {
double width = box.maxWidth; double width = box.maxWidth;
return Stack( return Stack(
children: [ children: [
Hero( // Hero(
tag: content.bvid, // tag: content.bvid,
child: NetworkImgLayer( // child:
type: null, NetworkImgLayer(
width: width, type: null,
height: width / StyleString.aspectRatio, width: width,
src: content.cover, height: width / StyleString.aspectRatio,
semanticsLabel: content.title, src: content.cover,
), semanticsLabel: content.title,
), ),
// ),
if (content.badge != null && type == 'pgc') if (content.badge != null && type == 'pgc')
PBadge( PBadge(
text: content.badge['text'], text: content.badge['text'],