Reland Native ios context menu (#143002) (#148238) (#148265)

Reverting https://github.com/flutter/flutter/pull/148238 which was relanded in https://github.com/flutter/flutter/pull/148237 which was originally from https://github.com/flutter/flutter/pull/143002.

This time post-submit I saw a failure of a wasm version of a test added by this PR.
This commit is contained in:
Justin McCandless
2024-05-15 11:37:05 -07:00
committed by GitHub
parent 95f0c0d8f9
commit 8e35cf5125
13 changed files with 1397 additions and 49 deletions

View File

@@ -0,0 +1,41 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
/// Flutter code sample for [SystemContextMenu].
void main() => runApp(const SystemContextMenuExampleApp());
class SystemContextMenuExampleApp extends StatelessWidget {
const SystemContextMenuExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('SystemContextMenu Basic Example'),
),
body: Center(
child: TextField(
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,
);
},
),
),
),
);
}
}