@@ -8,7 +8,8 @@ class _Window extends Window {
88
99 int dragCount = 0 ;
1010 final edges = < ResizeEdge > [];
11- bool maximized = false ;
11+ int doubleClickCount = 0 ;
12+ bool doubleClickAccepted = true ;
1213 final systemMenuPositions = < Point > [];
1314
1415 @override
@@ -24,13 +25,17 @@ class _Window extends Window {
2425 void startResizing (ResizeEdge edge) => edges.add (edge);
2526
2627 @override
27- bool get isMaximized => maximized;
28+ bool performTitleBarDoubleClick () {
29+ doubleClickCount++ ;
30+ return doubleClickAccepted;
31+ }
2832
2933 @override
30- void maximize () => maximized = true ;
34+ void maximize () => throw StateError ( 'must delegate the platform preference' ) ;
3135
3236 @override
33- void unmaximize () => maximized = false ;
37+ void unmaximize () =>
38+ throw StateError ('must delegate the platform preference' );
3439}
3540
3641Widget _host (Widget child) => Directionality (
@@ -78,29 +83,33 @@ void main() {
7883 expect (window.systemMenuPositions, hasLength (1 ));
7984 },
8085 );
81- testWidgets ('move area drags and toggles maximization on double tap' , (
82- tester,
83- ) async {
84- final window = _Window ();
85- await tester.pumpWidget (
86- _host (
87- DragToMoveArea (
88- window: window,
89- child: const SizedBox (width: 200 , height: 100 ),
86+ testWidgets (
87+ 'move area drags and delegates each double tap without a fallback' ,
88+ (tester) async {
89+ final window = _Window ();
90+ await tester.pumpWidget (
91+ _host (
92+ DragToMoveArea (
93+ window: window,
94+ child: const SizedBox (width: 200 , height: 100 ),
95+ ),
9096 ),
91- ),
92- );
93- final center = tester.getCenter (find.byType (DragToMoveArea ));
94- await _drag (tester, center);
95- expect (window.dragCount, 1 );
96- for (final expected in [true , false ]) {
97- await tester.tapAt (center);
98- await tester.pump (const Duration (milliseconds: 50 ));
99- await tester.tapAt (center);
100- await tester.pumpAndSettle ();
101- expect (window.maximized, expected);
102- }
103- });
97+ );
98+ final center = tester.getCenter (find.byType (DragToMoveArea ));
99+ await _drag (tester, center);
100+ expect (window.dragCount, 1 );
101+ for (final accepted in [true , false ]) {
102+ window.doubleClickAccepted = accepted;
103+ final previous = window.doubleClickCount;
104+ await tester.tapAt (center);
105+ await tester.pump (const Duration (milliseconds: 50 ));
106+ await tester.tapAt (center);
107+ await tester.pumpAndSettle ();
108+ expect (window.doubleClickCount, previous + 1 );
109+ expect (tester.takeException (), isNull);
110+ }
111+ },
112+ );
104113
105114 testWidgets ('all eight handles send the correct native resize edge' , (
106115 tester,
0 commit comments