Release Lunaris 2.0.1 polish update

This commit is contained in:
2026-05-26 18:47:07 +03:00
parent f65efe7cf7
commit af62ddf0da
37 changed files with 2607 additions and 143 deletions
@@ -8,6 +8,9 @@ class PostActionBar extends StatelessWidget {
required this.onCopy,
required this.isFavorite,
this.onDownload,
this.onDeleteLocalFile,
this.downloaded = false,
this.labels,
this.onSimilar,
this.onHide,
super.key,
@@ -19,11 +22,15 @@ class PostActionBar extends StatelessWidget {
final VoidCallback onCopy;
final bool isFavorite;
final VoidCallback? onDownload;
final VoidCallback? onDeleteLocalFile;
final VoidCallback? onSimilar;
final VoidCallback? onHide;
final bool downloaded;
final PostActionLabels? labels;
@override
Widget build(BuildContext context) {
final text = labels ?? const PostActionLabels();
return Wrap(
spacing: 8,
runSpacing: 8,
@@ -33,38 +40,46 @@ class PostActionBar extends StatelessWidget {
icon: Icon(
isFavorite ? Icons.favorite_rounded : Icons.favorite_border_rounded,
),
label: Text(isFavorite ? 'Unfavorite' : 'Favorite'),
label: Text(isFavorite ? text.unfavorite : text.favorite),
),
FilledButton.tonalIcon(
onPressed: onCollection,
icon: const Icon(Icons.add_rounded),
label: const Text('Collection'),
label: Text(text.collection),
),
if (onSimilar != null)
FilledButton.tonalIcon(
onPressed: onSimilar,
icon: const Icon(Icons.auto_awesome_rounded),
label: const Text('Similar'),
label: Text(text.similar),
),
IconButton.filledTonal(
tooltip: 'Open original',
tooltip: text.openOriginal,
onPressed: onOpen,
icon: const Icon(Icons.open_in_new_rounded),
),
IconButton.filledTonal(
tooltip: 'Copy link',
tooltip: text.copyLink,
onPressed: onCopy,
icon: const Icon(Icons.copy_rounded),
),
if (onDownload != null)
IconButton.filledTonal(
tooltip: 'Download',
tooltip: text.download,
onPressed: onDownload,
icon: const Icon(Icons.download_rounded),
icon: Icon(
downloaded ? Icons.download_done_rounded : Icons.download_rounded,
),
),
if (downloaded && onDeleteLocalFile != null)
IconButton.filledTonal(
tooltip: text.deleteLocalFile,
onPressed: onDeleteLocalFile,
icon: const Icon(Icons.delete_sweep_rounded),
),
if (onHide != null)
IconButton.filledTonal(
tooltip: 'Hide post locally',
tooltip: text.hidePost,
onPressed: onHide,
icon: const Icon(Icons.visibility_off_rounded),
),
@@ -72,3 +87,27 @@ class PostActionBar extends StatelessWidget {
);
}
}
class PostActionLabels {
const PostActionLabels({
this.favorite = 'Favorite',
this.unfavorite = 'Unfavorite',
this.collection = 'Collection',
this.similar = 'Similar',
this.openOriginal = 'Open original',
this.copyLink = 'Copy link',
this.download = 'Download',
this.deleteLocalFile = 'Delete local file',
this.hidePost = 'Hide post locally',
});
final String favorite;
final String unfavorite;
final String collection;
final String similar;
final String openOriginal;
final String copyLink;
final String download;
final String deleteLocalFile;
final String hidePost;
}
@@ -229,7 +229,7 @@ class _PostMediaViewerState extends State<PostMediaViewer>
},
);
final allowPinchZoom = MediaQuery.sizeOf(context).width < 700;
return allowPinchZoom ? InteractiveViewer(child: image) : image;
return allowPinchZoom ? _ZoomableImage(child: image) : image;
}
void _initializeVideo() {
@@ -348,7 +348,7 @@ class _PostMediaViewerState extends State<PostMediaViewer>
Map<String, String> _headersFor(Post post) {
return {
'User-Agent': 'Lunaris/2.0 Flutter local booru browser',
'User-Agent': 'Lunaris/2.0.1 Flutter local booru browser',
'Accept': '*/*',
if (post.providerName.toLowerCase().contains('gelbooru') ||
post.fileUrl.contains('gelbooru.com') ||
@@ -1170,6 +1170,61 @@ class VideoErrorOverlay extends StatelessWidget {
}
}
class _ZoomableImage extends StatefulWidget {
const _ZoomableImage({required this.child});
final Widget child;
@override
State<_ZoomableImage> createState() => _ZoomableImageState();
}
class _ZoomableImageState extends State<_ZoomableImage> {
final _controller = TransformationController();
TapDownDetails? _doubleTapDetails;
bool _zoomed = false;
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onDoubleTapDown: (details) => _doubleTapDetails = details,
onDoubleTap: _toggleZoom,
child: InteractiveViewer(
transformationController: _controller,
minScale: 1,
maxScale: 5,
panEnabled: _zoomed,
scaleEnabled: true,
clipBehavior: Clip.none,
onInteractionEnd: (_) {
final scale = _controller.value.getMaxScaleOnAxis();
if (mounted) setState(() => _zoomed = scale > 1.03);
},
child: widget.child,
),
);
}
void _toggleZoom() {
final tap = _doubleTapDetails?.localPosition ?? Offset.zero;
if (_zoomed) {
_controller.value = Matrix4.identity();
setState(() => _zoomed = false);
return;
}
_controller.value = Matrix4.identity()
..translateByDouble(-tap.dx * 1.3, -tap.dy * 1.3, 0, 1)
..scaleByDouble(2.3, 2.3, 1, 1);
setState(() => _zoomed = true);
}
}
class _RoundControlButton extends StatelessWidget {
const _RoundControlButton({
required this.tooltip,