fix: ok tuslari HardwareKeyboard, topbar 16px, border kaldirildi
Build Windows / build-windows (push) Has been cancelled
Build Windows / build-windows (push) Has been cancelled
This commit is contained in:
1 parent
35ac949f4e
commit
5be314e857
5 files changed
+23
-15
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
import 'package:desktop_drop/desktop_drop.dart';
|
import 'package:desktop_drop/desktop_drop.dart';
|
||||||
import '../services/image_manager.dart';
|
import '../services/image_manager.dart';
|
||||||
@@ -24,11 +25,26 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
|||||||
Timer? _pollTimer;
|
Timer? _pollTimer;
|
||||||
Rect _lastBounds = Rect.zero;
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
windowManager.addListener(this);
|
windowManager.addListener(this);
|
||||||
ImageManager.instance.addListener(_onImageManagerChanged);
|
ImageManager.instance.addListener(_onImageManagerChanged);
|
||||||
|
HardwareKeyboard.instance.addHandler(_handleKeyEvent);
|
||||||
|
|
||||||
if (widget.initialFiles.isNotEmpty) {
|
if (widget.initialFiles.isNotEmpty) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
@@ -62,6 +78,7 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
HardwareKeyboard.instance.removeHandler(_handleKeyEvent);
|
||||||
windowManager.removeListener(this);
|
windowManager.removeListener(this);
|
||||||
ImageManager.instance.removeListener(_onImageManagerChanged);
|
ImageManager.instance.removeListener(_onImageManagerChanged);
|
||||||
_saveDebounce?.cancel();
|
_saveDebounce?.cancel();
|
||||||
@@ -119,7 +136,7 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 28,
|
top: 16,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class CustomTitleBar extends StatelessWidget {
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: DragToMoveArea(
|
child: DragToMoveArea(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 28,
|
height: 16,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
@@ -63,22 +63,13 @@ class _BarButtonState extends State<_BarButton> {
|
|||||||
onEnter: (_) => setState(() => _hovered = true),
|
onEnter: (_) => setState(() => _hovered = true),
|
||||||
onExit: (_) => setState(() => _hovered = false),
|
onExit: (_) => setState(() => _hovered = false),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 36,
|
width: 24,
|
||||||
height: 28,
|
height: 16,
|
||||||
decoration: BoxDecoration(
|
color: _hovered ? Colors.red.withValues(alpha: 0.8) : Colors.transparent,
|
||||||
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(
|
child: Icon(
|
||||||
widget.icon,
|
widget.icon,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 14,
|
size: 12,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user