fix: ok tuslari HardwareKeyboard, topbar 16px, border kaldirildi
Some checks failed
Build Windows / build-windows (push) Has been cancelled
Some checks failed
Build Windows / build-windows (push) Has been cancelled
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:desktop_drop/desktop_drop.dart';
|
||||
import '../services/image_manager.dart';
|
||||
@@ -24,11 +25,26 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
Timer? _pollTimer;
|
||||
Rect _lastBounds = Rect.zero;
|
||||
|
||||
bool _handleKeyEvent(KeyEvent event) {
|
||||
if (event is KeyDownEvent) {
|
||||
switch (event.logicalKey) {
|
||||
case LogicalKeyboardKey.arrowLeft:
|
||||
ImageManager.instance.previousImage();
|
||||
return true;
|
||||
case LogicalKeyboardKey.arrowRight:
|
||||
ImageManager.instance.nextImage();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
windowManager.addListener(this);
|
||||
ImageManager.instance.addListener(_onImageManagerChanged);
|
||||
HardwareKeyboard.instance.addHandler(_handleKeyEvent);
|
||||
|
||||
if (widget.initialFiles.isNotEmpty) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -62,6 +78,7 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
HardwareKeyboard.instance.removeHandler(_handleKeyEvent);
|
||||
windowManager.removeListener(this);
|
||||
ImageManager.instance.removeListener(_onImageManagerChanged);
|
||||
_saveDebounce?.cancel();
|
||||
@@ -119,7 +136,7 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 28,
|
||||
top: 16,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
|
||||
@@ -12,7 +12,7 @@ class CustomTitleBar extends StatelessWidget {
|
||||
right: 0,
|
||||
child: DragToMoveArea(
|
||||
child: SizedBox(
|
||||
height: 28,
|
||||
height: 16,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
@@ -63,22 +63,13 @@ class _BarButtonState extends State<_BarButton> {
|
||||
onEnter: (_) => setState(() => _hovered = true),
|
||||
onExit: (_) => setState(() => _hovered = false),
|
||||
child: Container(
|
||||
width: 36,
|
||||
height: 28,
|
||||
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),
|
||||
),
|
||||
),
|
||||
width: 24,
|
||||
height: 16,
|
||||
color: _hovered ? Colors.red.withValues(alpha: 0.8) : Colors.transparent,
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
color: Colors.white,
|
||||
size: 14,
|
||||
size: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user