@@ -129,4 +129,53 @@ void main() {
129129 expect (content, isNotNull);
130130 expect (content! .plainText, 'How' );
131131 });
132+
133+ testWidgets ('stopping drag of end handle will show the toolbar' , (WidgetTester tester) async {
134+ // Regression test for https://github.com/flutter/flutter/issues/119314
135+ await tester.pumpWidget (
136+ MaterialApp (
137+ home: Scaffold (
138+ body: Padding (
139+ padding: const EdgeInsets .only (top: 64 ),
140+ child: Column (
141+ children: < Widget > [
142+ const Text ('How are you?' ),
143+ SelectionArea (
144+ focusNode: FocusNode (),
145+ child: const Text ('Good, and you?' ),
146+ ),
147+ const Text ('Fine, thank you.' ),
148+ ],
149+ ),
150+ ),
151+ ),
152+ ),
153+ );
154+ final RenderParagraph paragraph2 = tester.renderObject <RenderParagraph >(find.descendant (of: find.text ('Good, and you?' ), matching: find.byType (RichText )));
155+ final TestGesture gesture = await tester.startGesture (textOffsetToPosition (paragraph2, 7 )); // at the 'a'
156+ addTearDown (gesture.removePointer);
157+ await tester.pump (const Duration (milliseconds: 500 ));
158+ await gesture.up ();
159+ final List <TextBox > boxes = paragraph2.getBoxesForSelection (paragraph2.selections[0 ]);
160+ expect (boxes.length, 1 );
161+ // There is a selection now.
162+ // We check the presence of the copy button to make sure the selection toolbar
163+ // is showing.
164+ expect (find.text ('Copy' ), findsOneWidget);
165+
166+ // This is the position of the selection handle displayed at the end.
167+ final Offset handlePos = paragraph2.localToGlobal (boxes[0 ].toRect ().bottomRight);
168+ await gesture.down (handlePos);
169+ await gesture.moveTo (textOffsetToPosition (paragraph2, 11 ) + Offset (0 , paragraph2.size.height / 2 ));
170+ await tester.pump ();
171+
172+ await gesture.up ();
173+ await tester.pump ();
174+
175+ // After lifting the finger up, the selection toolbar should be showing again.
176+ expect (find.text ('Copy' ), findsOneWidget);
177+ },
178+ variant: TargetPlatformVariant .all (),
179+ skip: kIsWeb, // [intended]
180+ );
132181}
0 commit comments