flutter/examples/api/lib/widgets
auto-submit[bot] 14d88ee0c8
Reverts "Native ios context menu (#143002)" (#148237)
Reverts: flutter/flutter#143002
Initiated by: cbracken
Reason for reverting: unresolved docs links. See failure here: https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20docs_test/16540/overview

```
dartdoc:stdout: Generating docs for package flutter...
dartdoc:stderr:   error: unresolved doc reference [TextInput.showSystemContextMenu]
dartdoc:stderr:     from widgets.MediaQueryData.supportsShowingSystemContextMenu: (file:///b/s/w/ir/x/w/flutter/packages/flutt
Original PR Author: justinmc

Reviewed By: {Renzo-Olivares, hellohuanlin}

This change reverts the following previous change:
In order to work around the fact that iOS 15 shows a notification on pressing Flutter's paste button (https://github.com/flutter/flutter/issues/103163), this PR allows showing the iOS system context menu in text fields.

<img width="385" alt="Screenshot 2024-02-06 at 11 52 25 AM" src="https://github.com/flutter/flutter/assets/389558/d82e18ee-b8a3-4082-9225-cf47fa7f3674">

It is currently opt-in, which a user would typically do like this (also in example system_context_menu.0.dart):

```dart
      contextMenuBuilder: (BuildContext context, EditableTextState editableTextState) {
        // If supported, show the system context menu.
        if (SystemContextMenu.isSupported(context)) {
          return SystemContextMenu.editableText(
            editableTextState: editableTextState,
          );
        }
        // Otherwise, show the flutter-rendered context menu for the current
        // platform.
        return AdaptiveTextSelectionToolbar.editableText(
          editableTextState: editableTextState,
        );
      },
```

Requires engine PR https://github.com/flutter/engine/pull/50095.

## API changes

### SystemContextMenu
A widget that shows the system context menu when built, and removes it when disposed. The main high-level way that most users would use this PR. Only works on later versions of iOS.

### SystemContextMenuController
Used under the hood to hide and show a system context menu. There can only be one visible at a time.

### MediaQuery.supportsShowingSystemContextMenu
Sent by the iOS embedder to tell the framework whether or not the platform supports showing the system context menu. That way the framework, or Flutter developers, can decide to show a different menu.

### `flutter/platform ContextMenu.showSystemContextMenu`
Sent by the framework to show the menu at a given `targetRect`, which is the current selection rect.

### `flutter/platform ContextMenu.hideSystemContextMenu`
Sent by the framework to hide the menu. Typically not needed, because the platform will hide the menu when the user taps outside of it and after the user presses a button, but it handles edge cases where the user programmatically rebuilds the context menu, for example.

### `flutter/platform System.onDismissSystemContextMenu`
Sent by the iOS embedder to indicate that the system context menu has been hidden by the system, such as when the user taps outside of the menu.  This is useful when there are multiple instances of SystemContextMenu, such as with multiple text fields.
2024-05-13 17:43:36 +00:00
..
actions Move examples to ListenableBuilder (#130671) 2023-07-17 21:06:15 +00:00
animated_grid Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
animated_list Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
animated_size Add test for animated_size.0.dart API example. (#147828) 2024-05-10 21:55:51 +00:00
animated_switcher Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
app Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
app_lifecycle_listener Update misc tests for Material3 (#128712) 2023-06-13 08:57:27 -07:00
async Add tests for stream_builder.0.dart API example. (#147832) 2024-05-10 21:48:35 +00:00
autocomplete Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
autofill Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
basic Update collection-fors to prefer final (as per updated prefer_final_in_for_each) (#127511) 2023-05-26 23:34:36 +00:00
binding Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
color_filter Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
dismissible Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
drag_target Deprecates onWillAccept and onAccept callbacks in DragTarget. (#133691) 2023-11-10 22:47:22 +00:00
draggable_scrollable_sheet Reland "Reland - Introduce tone-based surfaces and accent color add-ons - Part 2" (#144273) 2024-02-28 13:55:50 -08:00
editable_text Add more documentation for TextEditingController default constructor (#143452) 2024-02-14 20:10:18 +00:00
focus_manager Turning if chains into shorter switch statements (#144977) 2024-03-13 17:16:17 +00:00
focus_scope improve focus example (#147464) 2024-05-07 20:07:49 +00:00
focus_traversal Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
form Reapply new PopScope API (#147607) 2024-05-07 09:04:49 -07:00
framework Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
gesture_detector Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
hardware_keyboard cleanup now-irrelevant ignores for deprecated_member_use (#143403) 2024-02-14 21:08:25 +00:00
heroes Dev, examples/api, etc updated for Material 3 by default (#129683) 2023-06-28 09:41:58 -07:00
image Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
implicit_animations Add test for animated_fractionally_sized_box.0.dart API example. (#146721) 2024-05-01 16:03:12 +00:00
inherited_model Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
inherited_notifier Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
inherited_theme Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
interactive_viewer Update links and surrounding text for new main-api docs (#138602) 2023-11-17 22:27:53 +00:00
layout_builder Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
magnifier Remove dead code (#126266) 2023-05-09 15:47:16 +00:00
media_query Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
navigator Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
navigator_pop_handler Reland root predictive back (#132249) 2023-08-17 23:55:05 +00:00
nested_scroll_view Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
notification_listener Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
overflow_bar Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
overlay Dispose overlay entries (#132826) 2023-08-25 14:35:49 +02:00
overscroll_indicator Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
page_storage Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
page_view Reland "Reland - Introduce tone-based surfaces and accent color add-ons - Part 2" (#144273) 2024-02-28 13:55:50 -08:00
pop_scope Reapply new PopScope API (#147607) 2024-05-07 09:04:49 -07:00
preferred_size Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
restoration Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
restoration_properties Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
routes Update RouteObserver example and fix an error thrown (#141166) 2024-01-09 20:48:56 +00:00
scroll_notification_observer Add ScrollNotificationObserver sample (#127023) 2023-05-25 15:58:52 +00:00
scroll_position Add ScrollController.onAttach & onDetach, samples/docs on listening/getting scrolling info (#124823) 2023-05-15 21:01:06 +00:00
scroll_view Add findChildIndexCallback examples (#133469) 2023-10-18 00:26:17 +00:00
scrollbar Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
shared_app_data Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
shortcuts Add tests for single_activator.0.dart API example. (#147426) 2024-05-01 14:52:57 +00:00
single_child_scroll_view Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
sliver DecoratedSliver (#127823) 2023-06-20 23:35:42 +00:00
sliver_fill Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
slotted_render_object_widget Replace RenderBox.compute* with RenderBox.get* and add @visibleForOverriding (#145503) 2024-03-22 02:44:55 +00:00
table Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
tap_region Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
text Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
text_magnifier Updated TextMagnifierExampleApp to M3 (#129381) 2023-06-26 10:44:11 -07:00
transitions Fixed a lot of typos (#141431) 2024-01-12 22:10:25 +00:00
tween_animation_builder Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
undo_history Rename Sample classes (#124080) 2023-04-04 20:34:29 +00:00
value_listenable_builder Remove deprecated TextTheme members (#139255) 2024-03-28 01:20:55 +00:00