feat: gezinme oklari (hover), ayarlar penceresi (zaman/isme gore siralama), yazdirma (printing paketi), title hover saydamligi; .deb guncellendi

This commit is contained in:
Alhan
2026-08-06 03:43:48 +03:00
parent 185653f34e
commit f3a5aeb604
12 changed files with 431 additions and 38 deletions

Binary file not shown.

View File

@@ -2,6 +2,7 @@
| Tarih | Dosya | Konu |
|---|---|---|
| 2026-08-06 | [rapor-gezinme-ayarlar-print.md](rapor-gezinme-ayarlar-print.md) | **Rapor** — gezinme okları (hover), ayarlar/gear (sıralama), yazdırma (printing paketi) |
| 2026-08-06 | [rapor-sag-tik-donma-analizi.md](rapor-sag-tik-donma-analizi.md) | **Rapor** — sağ tuş efektlerinde donma analizi + slider UI değerlendirmesi |
| 2026-08-03 | [zoom-clamp-mekanizmasi.md](zoom-clamp-mekanizmasi.md) | **Düzeltme**`_vpSize` sıfırlama bug'ı: çift tıklama sonrası zoom ölümü/pan serbestliği |
| 2026-08-03 | [performance_llvmpipe_issue.md](performance_llvmpipe_issue.md) | **Rapor** — llvmpipe donma analizi, kare hızı throttle, ölçüm sonuçları |

View File

@@ -0,0 +1,80 @@
# Rapor — Gezinme Okları, Ayarlar (Sıralama) ve Yazdırma
Tarih: 2026-08-06
Durum: Uygulandı
## Amaç
Klavyede zaten çalışan sol/sağ ok tuşu gezinmesine görsel karşılık eklemek;
ayarlar (gear) penceresiyle klasör sıralamasını kullanıcıya bırakmak; resmi
yazıcıya göndermek.
## Yapılan Değişiklikler
### 1. Gezinme okları (görsel arayüz)
- Sol/sağ alt köşeye sade yuvarlak ok butonları eklendi (`_NavButton`,
`lib/screens/viewer_screen.dart`).
- Normalde görünmez; mouse görüntü alanına girince belirir
(`MouseRegion``_controlsVisible`).
- Hover'da kırmızı arka plan (kapatma butonuyla aynı stil).
- Tooltip yok (kullanıcı istemedi).
- `ImageManager.instance.previousImage()/nextImage()` çağırır — klavye
kısayoluyla aynı yolu kullanır.
### 2. PITFALL — MouseRegion flicker döngüsü (çözüldü)
İlk uygulamada MouseRegion yalnızca resim alanını sarıyordu, butonlar
Stack'te üstte ayrı duruyordu. Mouse butonun üzerine gelince hit-test
butona gidiyor → MouseRegion `onExit` → butonlar kayboluyor → mouse tekrar
resim alanına düşüyor → `onEnter` → sonsuz yanıp sönme ve tıklanamama.
Çözüm: `MouseRegion`'ı **tüm Stack'in** üzerine taşı (DropTarget'ın
çocuğu). Butonlar da Stack içinde kaldığı için onların üzerindeyken
bölgeden çıkılmaz; `onExit` yalnızca pencere alanı terk edilince tetiklenir.
### 3. Gear (Ayarlar) butonu
- İlk olarak görüntü alanının sol üstüne kondu; kullanıcı "title yüzünden
aşağıda çıkıyor" deyince **title bar'ın soluna** taşındı
(`CustomTitleBar(onSettings: ...)`, `lib/widgets/custom_title_bar.dart`).
- Title bar `visible` parametresiyle `_controlsVisible`'a bağlandı: mouse
resmin dışındayken title (gear dahil) saydam (AnimatedOpacity 0), mouse
girince görünür.
- Hover arka planı kırmızı (`_BarButton` varsayılanı).
### 4. Ayarlar penceresi (`_showSettings`)
Gear'a tıklayınca açılan AlertDialog:
- **Sıralama**: Zamana göre / İsme göre (RadioListTile).
`ImageManager.sortByName``setGalleryFromPaths` içinde sıralama
karşılaştırıcısı buna göre değişir; isim sıralaması `toLowerCase`
karşılaştırma ile (büyük/küçük harf duyarsız). Mod değişince mevcut
galeri `setGalleryFromPaths([_images[_currentIndex]])` ile yeniden
kurulur (açık resim korunur).
- Uygulamanın amacı (kısa paragraf).
- Kısayollar listesi (F11 satırı kaldırıldı — tam ekran özelliği yok).
### 5. Yazdırma (`_printImage`)
- Yeni bağımlılıklar: `printing: ^5.13.4`, `pdf: ^3.11.1` (Linux dahil
masaüstü destekli).
- Buton ayarlar penceresinin actions kısmında ("Yazdır"); ayrı köşe butonu
değil (kullanıcı istediği yerleşim).
- Akış: `File.readAsBytes``pw.MemoryImage``pw.Document` A4 sayfa,
`BoxFit.contain``Printing.layoutPdf` (sistem yazıcı dialogu).
### 6. `_BarButton.hoverColor` kaldırıldı
Gear title'a taşınıp tek hover rengi (kırmızı) kaldığı için opsiyonel
parametre gereksizleşti; analyze uyarısı (unused_element_parameter)
temizlendi.
## Doğrulama
- `flutter analyze`: 21 info (pre-existing baseline; yeni hata yok).
- `flutter build linux --release`: ✓ Built.
- `./install.sh` (debug bundle silinip release kuruldu): exit 0.
- `bash dist/rebuild-deb.sh`: `dist/imajviewer_1.0.1_amd64.deb` (11M) üretildi.
- Görsel davranış kullanıcı tarafından manuel test edildi (oklar,
gear/title saydamlığı, hover renkleri, sıralama, print dialogu).

View File

@@ -1,7 +1,11 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:window_manager/window_manager.dart';
import 'package:desktop_drop/desktop_drop.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
import '../services/image_manager.dart';
import '../services/file_handler.dart';
import '../widgets/custom_title_bar.dart';
@@ -20,6 +24,7 @@ class ViewerScreen extends StatefulWidget {
class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
bool _hasImages = false;
bool _isDragging = false;
bool _controlsVisible = false;
Timer? _saveDebounce;
Rect _lastBounds = Rect.zero;
@@ -84,6 +89,112 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
}
}
void _showSettings() {
showDialog(
context: context,
builder: (context) => StatefulBuilder(
builder: (context, setDialogState) => AlertDialog(
backgroundColor: const Color(0xFF2a2a2a),
title: const Text('Ayarlar',
style: TextStyle(color: Colors.white, fontSize: 18)),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Sıralama',
style: TextStyle(color: Colors.white70, fontSize: 13)),
RadioListTile<bool>(
value: false,
groupValue: ImageManager.instance.sortByName,
dense: true,
activeColor: Colors.blueAccent,
title: const Text('Zamana göre',
style: TextStyle(color: Colors.white, fontSize: 14)),
onChanged: (v) {
ImageManager.instance.setSortByName(v!);
setDialogState(() {});
},
),
RadioListTile<bool>(
value: true,
groupValue: ImageManager.instance.sortByName,
dense: true,
activeColor: Colors.blueAccent,
title: const Text('İsme göre',
style: TextStyle(color: Colors.white, fontSize: 14)),
onChanged: (v) {
ImageManager.instance.setSortByName(v!);
setDialogState(() {});
},
),
const Divider(color: Colors.white24, height: 24),
const Text('imajViewer', style: TextStyle(color: Colors.white, fontSize: 15)),
const SizedBox(height: 4),
const Text(
'Ultra hafif ve hızlı resim görüntüleyici. '
'Görselleri açın, gezinti için okları veya klavye tuşlarını kullanın.',
style: TextStyle(color: Colors.white70, fontSize: 13, height: 1.5),
),
const SizedBox(height: 12),
const Text('Kısayollar',
style: TextStyle(color: Colors.white70, fontSize: 13)),
const SizedBox(height: 4),
const Text(
'• Sol/Sağ ok — önceki/sonraki resim\n'
'• Ctrl+O — dosya aç\n'
'• Ctrl+Q — pencereyi kapat\n'
'• Çift tık — doldur/sığdır geçişi\n'
'• Sağ tık sürükle — kontrast\n'
'• Shift+sağ tık — döndür\n'
'• Ctrl+sağ tık — doygunluk\n'
'• Ctrl+Shift+sağ tık — parlaklık',
style: TextStyle(color: Colors.white70, fontSize: 13, height: 1.6),
),
],
),
),
actions: [
TextButton.icon(
onPressed: () {
Navigator.pop(context);
_printImage();
},
icon: const Icon(Icons.print, color: Colors.white70, size: 18),
label: const Text('Yazdır',
style: TextStyle(color: Colors.white70)),
),
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Kapat', style: TextStyle(color: Colors.white70)),
),
],
),
),
);
}
Future<void> _printImage() async {
final path = ImageManager.instance.currentImagePath;
if (path.isEmpty) return;
final bytes = await File(path).readAsBytes();
final image = pw.MemoryImage(bytes);
await Printing.layoutPdf(
onLayout: (format) async {
final doc = pw.Document();
doc.addPage(
pw.Page(
pageFormat: PdfPageFormat.a4,
build: (context) => pw.Center(
child: pw.Image(image, fit: pw.BoxFit.contain),
),
),
);
return doc.save();
},
);
}
@override
Widget build(BuildContext context) {
return AppShortcuts(
@@ -98,41 +209,65 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
FileHandler.loadImagesFromPaths(
details.files.map((f) => f.path).toList());
},
child: Stack(
children: [
Positioned(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: Container(color: const Color(0xFF1a1a1a)),
),
Positioned(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: Container(
color: Colors.transparent,
child: _hasImages
? ImageCanvas(
filePath: ImageManager.instance.currentImagePath,
)
: const Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.image, size: 64, color: Colors.white24),
SizedBox(height: 16),
Text('Resimleri buraya sürükleyin\nveya Ctrl+O ile açın',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white38, fontSize: 16)),
],
),
),
child: MouseRegion(
onEnter: (_) => setState(() => _controlsVisible = true),
onExit: (_) => setState(() => _controlsVisible = false),
child: Stack(
children: [
Positioned(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: Container(color: const Color(0xFF1a1a1a)),
),
),
const CustomTitleBar(),
Positioned(
top: 0,
left: 0,
right: 0,
bottom: 0,
child: Container(
color: Colors.transparent,
child: _hasImages
? ImageCanvas(
filePath: ImageManager.instance.currentImagePath,
)
: const Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.image, size: 64, color: Colors.white24),
SizedBox(height: 16),
Text('Resimleri buraya sürükleyin\nveya Ctrl+O ile açın',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white38, fontSize: 16)),
],
),
),
),
),
CustomTitleBar(
onSettings: _showSettings,
visible: _controlsVisible,
),
if (_hasImages && _controlsVisible) ...[
Positioned(
left: 8,
bottom: 8,
child: _NavButton(
icon: Icons.chevron_left,
onTap: () => ImageManager.instance.previousImage(),
),
),
Positioned(
right: 8,
bottom: 8,
child: _NavButton(
icon: Icons.chevron_right,
onTap: () => ImageManager.instance.nextImage(),
),
),
],
if (_isDragging)
Positioned.fill(
child: Container(
@@ -152,6 +287,7 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
),
),
],
),
),
),
),
@@ -159,3 +295,40 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
);
}
}
class _NavButton extends StatefulWidget {
final IconData icon;
final VoidCallback onTap;
const _NavButton({required this.icon, required this.onTap});
@override
State<_NavButton> createState() => _NavButtonState();
}
class _NavButtonState extends State<_NavButton> {
bool _hovered = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: widget.onTap,
child: MouseRegion(
cursor: SystemMouseCursors.click,
onEnter: (_) => setState(() => _hovered = true),
onExit: (_) => setState(() => _hovered = false),
child: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: _hovered
? Colors.red.withValues(alpha: 0.8)
: Colors.black.withValues(alpha: 0.35),
shape: BoxShape.circle,
),
child: Icon(widget.icon, color: Colors.white, size: 22),
),
),
);
}
}

View File

@@ -12,10 +12,12 @@ class ImageManager extends ChangeNotifier {
final List<String> _images = [];
int _currentIndex = 0;
bool _sortByName = false;
List<String> get images => List.unmodifiable(_images);
int get currentIndex => _currentIndex;
int get imageCount => _images.length;
bool get sortByName => _sortByName;
String get currentImagePath {
if (_images.isEmpty) return '';
@@ -48,6 +50,9 @@ class ImageManager extends ChangeNotifier {
} catch (_) {}
}
entries.sort((a, b) {
if (_sortByName) {
return a.$1.toLowerCase().compareTo(b.$1.toLowerCase());
}
final byDate = b.$2.compareTo(a.$2);
return byDate != 0 ? byDate : a.$1.compareTo(b.$1);
});
@@ -69,6 +74,16 @@ class ImageManager extends ChangeNotifier {
notifyListeners();
}
void setSortByName(bool value) {
if (_sortByName == value) return;
_sortByName = value;
if (_images.isNotEmpty) {
setGalleryFromPaths([_images[_currentIndex]]);
} else {
notifyListeners();
}
}
void setCurrentIndex(int index) {
if (index < 0 || index >= _images.length) return;
_currentIndex = index;

View File

@@ -2,7 +2,10 @@ import 'package:flutter/material.dart';
import 'package:window_manager/window_manager.dart';
class CustomTitleBar extends StatelessWidget {
const CustomTitleBar({super.key});
final VoidCallback? onSettings;
final bool visible;
const CustomTitleBar({super.key, this.onSettings, this.visible = true});
@override
Widget build(BuildContext context) {
@@ -10,11 +13,29 @@ class CustomTitleBar extends StatelessWidget {
top: 0,
left: 0,
right: 0,
child: DragToMoveArea(
child: AnimatedOpacity(
opacity: visible ? 1.0 : 0.0,
duration: const Duration(milliseconds: 150),
child: DragToMoveArea(
child: SizedBox(
height: 24,
child: Stack(
children: [
if (onSettings != null)
Positioned(
left: 0,
top: 0,
bottom: 0,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
_BarButton(
icon: Icons.settings,
onTap: onSettings!,
),
],
),
),
Positioned(
right: 0,
top: 0,
@@ -36,6 +57,7 @@ class CustomTitleBar extends StatelessWidget {
],
),
),
),
),
);
}
@@ -45,7 +67,10 @@ class _BarButton extends StatefulWidget {
final IconData icon;
final VoidCallback onTap;
const _BarButton({required this.icon, required this.onTap});
const _BarButton({
required this.icon,
required this.onTap,
});
@override
State<_BarButton> createState() => _BarButtonState();

View File

@@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h"
#include <desktop_drop/desktop_drop_plugin.h>
#include <printing/printing_plugin.h>
#include <screen_retriever_linux/screen_retriever_linux_plugin.h>
#include <window_manager/window_manager_plugin.h>
@@ -14,6 +15,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) desktop_drop_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin");
desktop_drop_plugin_register_with_registrar(desktop_drop_registrar);
g_autoptr(FlPluginRegistrar) printing_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin");
printing_plugin_register_with_registrar(printing_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin");
screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar);

View File

@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
printing
screen_retriever_linux
window_manager
)

View File

@@ -25,6 +25,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.13.1"
barcode:
dependency: transitive
description:
name: barcode
sha256: "7b6729c37e3b7f34233e2318d866e8c48ddb46c1f7ad01ff7bb2a8de1da2b9f4"
url: "https://pub.dev"
source: hosted
version: "2.2.9"
bidi:
dependency: transitive
description:
name: bidi
sha256: "77f475165e94b261745cf1032c751e2032b8ed92ccb2bf5716036db79320637d"
url: "https://pub.dev"
source: hosted
version: "2.0.13"
boolean_selector:
dependency: transitive
description:
@@ -81,6 +97,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.5+4"
crypto:
dependency: transitive
description:
name: crypto
sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf
url: "https://pub.dev"
source: hosted
version: "3.0.7"
desktop_drop:
dependency: "direct main"
description:
@@ -152,6 +176,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "9.2.1"
http:
dependency: transitive
description:
name: http
sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"
url: "https://pub.dev"
source: hosted
version: "1.6.0"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
url: "https://pub.dev"
source: hosted
version: "4.1.2"
image:
dependency: transitive
description:
@@ -248,6 +288,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
pdf:
dependency: "direct main"
description:
name: pdf
sha256: "517df47af468734a23c8b513c0c6a8a62357403ab1b8ab7fad1606576a9dbdd0"
url: "https://pub.dev"
source: hosted
version: "3.13.0"
pdf_widget_wrapper:
dependency: transitive
description:
name: pdf_widget_wrapper
sha256: c930860d987213a3d58c7ec3b7ecf8085c3897f773e8dc23da9cae60a5d6d0f5
url: "https://pub.dev"
source: hosted
version: "1.0.4"
petitparser:
dependency: transitive
description:
@@ -272,6 +336,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.5.2"
printing:
dependency: "direct main"
description:
name: printing
sha256: f6cd14c768c1352dd37a958a3ee351aa9ce305b398218d3acd86389d5f7ecad1
url: "https://pub.dev"
source: hosted
version: "5.15.0"
pub_semver:
dependency: transitive
description:
@@ -280,6 +352,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.0"
qr:
dependency: transitive
description:
name: qr
sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
screen_retriever:
dependency: "direct main"
description:
@@ -373,6 +453,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.11"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
url: "https://pub.dev"
source: hosted
version: "1.4.0"
universal_platform:
dependency: transitive
description:
@@ -439,4 +527,4 @@ packages:
version: "3.1.3"
sdks:
dart: ">=3.12.2 <4.0.0"
flutter: ">=3.38.0"
flutter: ">=3.41.0"

View File

@@ -23,6 +23,8 @@ dependencies:
path: ^1.9.0
desktop_drop: ^0.7.1
msix: ^3.18.0
printing: ^5.13.4
pdf: ^3.11.1
dev_dependencies:
flutter_test:

View File

@@ -7,12 +7,15 @@
#include "generated_plugin_registrant.h"
#include <desktop_drop/desktop_drop_plugin.h>
#include <printing/printing_plugin.h>
#include <screen_retriever_windows/screen_retriever_windows_plugin_c_api.h>
#include <window_manager/window_manager_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
DesktopDropPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
PrintingPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PrintingPlugin"));
ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi"));
WindowManagerPluginRegisterWithRegistrar(

View File

@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
printing
screen_retriever_windows
window_manager
)