Compare commits

...
2 Commits
Author SHA1 Message Date
Siyi Guo 70f87c73fc optimize the use exciress 2023-04-13 19:18:32 +08:00
Siyi Guo ba642e21d0 add ExcludeFocus to avoid slider get the focus 2023-04-13 19:13:19 +08:00
2 changed files with 12 additions and 3 deletions

No files matched your search

+6 -3
View File
@@ -31,12 +31,12 @@ class _DraggableAreaState extends State<DraggableArea> {
bool isPressShift = false; bool isPressShift = false;
Axis? get axis { Axis? get axis {
if (isPressCommand) {
return Axis.vertical;
}
if (isPressShift) { if (isPressShift) {
return Axis.horizontal; return Axis.horizontal;
} }
if (isPressCommand) {
return Axis.vertical;
}
return null; return null;
} }
@@ -101,8 +101,11 @@ class _DraggableAreaState extends State<DraggableArea> {
setState(() {}); setState(() {});
} }
if (value is KeyUpEvent && isShift(value)) { if (value is KeyUpEvent && isShift(value)) {
Future.delayed(const Duration(milliseconds: 500)).then((value) {
isPressShift = false; isPressShift = false;
if (!mounted) return;
setState(() {}); setState(() {});
});
} }
if (value is! KeyDownEvent && value is! KeyRepeatEvent) { if (value is! KeyDownEvent && value is! KeyRepeatEvent) {
return KeyEventResult.ignored; return KeyEventResult.ignored;
+6
View File
@@ -59,6 +59,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
child: 'Window Opacity'.toText(size: 12.dp), child: 'Window Opacity'.toText(size: 12.dp),
), ),
Expanded( Expanded(
child: ExcludeFocus(
child: Slider( child: Slider(
value: opacityWindow, value: opacityWindow,
onChanged: (v) { onChanged: (v) {
@@ -68,6 +69,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
}, },
), ),
), ),
),
], ],
), ),
getSelectedButton(), getSelectedButton(),
@@ -175,6 +177,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
), ),
SizedBox( SizedBox(
width: 80.dp, width: 80.dp,
child: ExcludeFocus(
child: Slider( child: Slider(
value: opacity1, value: opacity1,
onChanged: (v) { onChanged: (v) {
@@ -183,6 +186,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
}, },
), ),
), ),
),
const Spacer(), const Spacer(),
SizedBox( SizedBox(
width: 20.dp, width: 20.dp,
@@ -201,6 +205,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
), ),
SizedBox( SizedBox(
width: 80.dp, width: 80.dp,
child: ExcludeFocus(
child: Slider( child: Slider(
value: opacity2, value: opacity2,
onChanged: (v) { onChanged: (v) {
@@ -208,6 +213,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
setState(() {}); setState(() {});
}, },
), ),
),
) )
], ],
), ),