@@ -1503,6 +1503,54 @@ void main() {
15031503 expect (find.text ('Paste' ), findsNothing);
15041504 });
15051505
1506+ testWidgets ('toolbar hidden on mobile when orientation changes' , (WidgetTester tester) async {
1507+ addTearDown (tester.binding.window.clearPhysicalSizeTestValue);
1508+
1509+ await tester.pumpWidget (
1510+ MaterialApp (
1511+ home: EditableText (
1512+ backgroundCursorColor: Colors .grey,
1513+ controller: controller,
1514+ focusNode: focusNode,
1515+ style: textStyle,
1516+ cursorColor: cursorColor,
1517+ selectionControls: materialTextSelectionControls,
1518+ ),
1519+ ),
1520+ );
1521+
1522+ final EditableTextState state =
1523+ tester.state <EditableTextState >(find.byType (EditableText ));
1524+
1525+ // Show the toolbar
1526+ state.renderEditable.selectWordsInRange (
1527+ from: Offset .zero,
1528+ cause: SelectionChangedCause .tap,
1529+ );
1530+ await tester.pump ();
1531+
1532+ expect (state.showToolbar (), true );
1533+ await tester.pumpAndSettle ();
1534+ expect (find.text ('Paste' ), findsOneWidget);
1535+
1536+ // Hide the menu by changing orientation.
1537+ tester.binding.window.physicalSizeTestValue = const Size (1800.0 , 2400.0 );
1538+ await tester.pumpAndSettle ();
1539+ expect (find.text ('Paste' ), findsNothing);
1540+
1541+ // Handles should be hidden as well on Android
1542+ expect (
1543+ find.descendant (
1544+ of: find.byType (CompositedTransformFollower ),
1545+ matching: find.byType (Padding ),
1546+ ),
1547+ defaultTargetPlatform == TargetPlatform .android ? findsNothing : findsOneWidget,
1548+ );
1549+
1550+ // On web, we don't show the Flutter toolbar and instead rely on the browser
1551+ // toolbar. Until we change that, this test should remain skipped.
1552+ }, skip: kIsWeb, variant: const TargetPlatformVariant (< TargetPlatform > { TargetPlatform .iOS, TargetPlatform .android })); // [intended]
1553+
15061554 testWidgets ('Paste is shown only when there is something to paste' , (WidgetTester tester) async {
15071555 await tester.pumpWidget (
15081556 MaterialApp (
0 commit comments