Skip to content

Commit a1026b6

Browse files
wcb33bitsdojo
andauthored
#79 fix Allow custom the double tap process for MoveWindow. (#80)
* #79 fix Allow custom the double tap process for MoveWindow. * Fixed to work when no child specified Co-authored-by: Bits Dojo <bitsdojo@gmail.com>
1 parent 5d228de commit a1026b6

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

bitsdojo_window/lib/src/widgets/window_caption.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,30 @@ import '../app_window.dart';
33
import 'package:flutter/foundation.dart' show kIsWeb;
44

55
class _MoveWindow extends StatelessWidget {
6-
_MoveWindow({Key? key, this.child}) : super(key: key);
6+
_MoveWindow({Key? key, this.child, this.onDoubleTap}) : super(key: key);
77
final Widget? child;
8+
final VoidCallback? onDoubleTap;
89
@override
910
Widget build(BuildContext context) {
1011
return GestureDetector(
1112
behavior: HitTestBehavior.translucent,
1213
onPanStart: (details) {
1314
appWindow.startDragging();
1415
},
15-
onDoubleTap: () => appWindow.maximizeOrRestore(),
16+
onDoubleTap: this.onDoubleTap ?? () => appWindow.maximizeOrRestore(),
1617
child: this.child ?? Container());
1718
}
1819
}
1920

2021
class MoveWindow extends StatelessWidget {
2122
final Widget? child;
22-
MoveWindow({Key? key, this.child}) : super(key: key);
23+
final VoidCallback? onDoubleTap;
24+
MoveWindow({Key? key, this.child, this.onDoubleTap}) : super(key: key);
2325
@override
2426
Widget build(BuildContext context) {
25-
if (child == null) return _MoveWindow();
27+
if (child == null) return _MoveWindow(onDoubleTap: this.onDoubleTap);
2628
return _MoveWindow(
29+
onDoubleTap: this.onDoubleTap,
2730
child: Column(
2831
crossAxisAlignment: CrossAxisAlignment.start,
2932
children: [Expanded(child: this.child!)]),

0 commit comments

Comments
 (0)