fix: ok tuşları + buton hover/siyah border + çift tıklama cover
Build Windows / build-windows (push) Has been cancelled
Build Windows / build-windows (push) Has been cancelled
This commit is contained in:
1 parent
86a63e0bb6
commit
35ac949f4e
6 files changed
+109
-65
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -11,48 +11,50 @@ class AppShortcuts extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CallbackShortcuts(
|
return Focus(
|
||||||
bindings: {
|
autofocus: true,
|
||||||
// Navigate images
|
onKeyEvent: (node, event) {
|
||||||
const SingleActivator(LogicalKeyboardKey.arrowLeft): () {
|
if (event is KeyDownEvent) {
|
||||||
ImageManager.instance.previousImage();
|
switch (event.logicalKey) {
|
||||||
},
|
case LogicalKeyboardKey.arrowLeft:
|
||||||
const SingleActivator(LogicalKeyboardKey.arrowRight): () {
|
ImageManager.instance.previousImage();
|
||||||
ImageManager.instance.nextImage();
|
return KeyEventResult.handled;
|
||||||
},
|
case LogicalKeyboardKey.arrowRight:
|
||||||
|
ImageManager.instance.nextImage();
|
||||||
// Open file dialog
|
return KeyEventResult.handled;
|
||||||
const SingleActivator(
|
case LogicalKeyboardKey.escape:
|
||||||
LogicalKeyboardKey.keyO,
|
windowManager.isFullScreen().then((isFullscreen) {
|
||||||
control: true,
|
if (isFullscreen) windowManager.setFullScreen(false);
|
||||||
): () {
|
});
|
||||||
FileHandler.openFileDialog();
|
return KeyEventResult.handled;
|
||||||
},
|
|
||||||
|
|
||||||
// Fullscreen toggle
|
|
||||||
const SingleActivator(LogicalKeyboardKey.f11): () async {
|
|
||||||
final isFullscreen = await windowManager.isFullScreen();
|
|
||||||
await windowManager.setFullScreen(!isFullscreen);
|
|
||||||
},
|
|
||||||
|
|
||||||
// Exit fullscreen
|
|
||||||
const SingleActivator(LogicalKeyboardKey.escape): () async {
|
|
||||||
final isFullscreen = await windowManager.isFullScreen();
|
|
||||||
if (isFullscreen) {
|
|
||||||
await windowManager.setFullScreen(false);
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
return KeyEventResult.ignored;
|
||||||
// Quit
|
|
||||||
const SingleActivator(
|
|
||||||
LogicalKeyboardKey.keyQ,
|
|
||||||
control: true,
|
|
||||||
): () {
|
|
||||||
windowManager.close();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
child: Focus(
|
child: CallbackShortcuts(
|
||||||
autofocus: true,
|
bindings: {
|
||||||
|
// Open file dialog
|
||||||
|
const SingleActivator(
|
||||||
|
LogicalKeyboardKey.keyO,
|
||||||
|
control: true,
|
||||||
|
): () {
|
||||||
|
FileHandler.openFileDialog();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Fullscreen toggle
|
||||||
|
const SingleActivator(LogicalKeyboardKey.f11): () async {
|
||||||
|
final isFullscreen = await windowManager.isFullScreen();
|
||||||
|
await windowManager.setFullScreen(!isFullscreen);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Quit
|
||||||
|
const SingleActivator(
|
||||||
|
LogicalKeyboardKey.keyQ,
|
||||||
|
control: true,
|
||||||
|
): () {
|
||||||
|
windowManager.close();
|
||||||
|
},
|
||||||
|
},
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -41,22 +41,45 @@ class CustomTitleBar extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BarButton extends StatelessWidget {
|
class _BarButton extends StatefulWidget {
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
|
||||||
const _BarButton({required this.icon, required this.onTap});
|
const _BarButton({required this.icon, required this.onTap});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_BarButton> createState() => _BarButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BarButtonState extends State<_BarButton> {
|
||||||
|
bool _hovered = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: onTap,
|
onTap: widget.onTap,
|
||||||
child: MouseRegion(
|
child: MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: SizedBox(
|
onEnter: (_) => setState(() => _hovered = true),
|
||||||
|
onExit: (_) => setState(() => _hovered = false),
|
||||||
|
child: Container(
|
||||||
width: 36,
|
width: 36,
|
||||||
height: 28,
|
height: 28,
|
||||||
child: Icon(icon, color: Colors.white54, size: 16),
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.black54,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
color: _hovered ? Colors.red.withValues(alpha: 0.7) : Colors.transparent,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topRight: Radius.circular(4),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
widget.icon,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 14,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -112,28 +112,47 @@ class _ImageCanvasState extends State<ImageCanvas> {
|
|||||||
maxScale: 10.0,
|
maxScale: 10.0,
|
||||||
panEnabled: true,
|
panEnabled: true,
|
||||||
scaleEnabled: false,
|
scaleEnabled: false,
|
||||||
child: Center(
|
child: _isFilled
|
||||||
child: Image.file(
|
? SizedBox.expand(
|
||||||
File(widget.filePath),
|
child: Image.file(
|
||||||
fit: _isFilled ? BoxFit.cover : BoxFit.contain,
|
File(widget.filePath),
|
||||||
filterQuality: FilterQuality.high,
|
fit: BoxFit.cover,
|
||||||
errorBuilder: (context, error, stackTrace) {
|
filterQuality: FilterQuality.high,
|
||||||
return const Center(
|
errorBuilder: (context, error, stackTrace) {
|
||||||
child: Column(
|
return const Center(
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
Icon(Icons.broken_image, size: 48, color: Colors.white38),
|
children: [
|
||||||
SizedBox(height: 8),
|
Icon(Icons.broken_image, size: 48, color: Colors.white38),
|
||||||
Text(
|
SizedBox(height: 8),
|
||||||
'Resim yüklenemedi',
|
Text('Resim yüklenemedi',
|
||||||
style: TextStyle(color: Colors.white38),
|
style: TextStyle(color: Colors.white38)),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
},
|
: Center(
|
||||||
),
|
child: Image.file(
|
||||||
),
|
File(widget.filePath),
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
filterQuality: FilterQuality.high,
|
||||||
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
return const Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.broken_image, size: 48, color: Colors.white38),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Text('Resim yüklenemedi',
|
||||||
|
style: TextStyle(color: Colors.white38)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user