1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Flutter counterpart: `widgets/platform_selectable_region_context_menu.dart` and its
//! `_platform_selectable_region_context_menu_io.dart` stub.
//!
//! A widget that provides the web's native selection context menu for its child subtree. The
//! non-web implementation is a stub: every member throws, and nothing names it yet, since the
//! web implementation is deferred (`## Deferred` in `PORTING.md`).
use crate::framework::{BuildContext, KeyRef, StatelessWidget, WidgetRef};
use crate::widgets::selection_container::AnySelectionContainerDelegate;
use waft_foundation::App;
/// Function signature for `ui_web.platformViewRegistry.registerViewFactory`.
pub type RegisterViewFactory = fn(String, Box<dyn Fn(i32) -> Box<dyn std::any::Any>>, bool);
/// A widget that provides native selection context menu for its child subtree.
///
/// This widget currently only supports Flutter web. Using this widget on non-web platforms
/// throws [`UnimplementedError`](std::unimplemented).
pub struct PlatformSelectableRegionContextMenu {
pub key: Option<KeyRef>,
/// The widget below this widget in the tree.
pub child: WidgetRef,
}
impl PlatformSelectableRegionContextMenu {
/// Creates a [`PlatformSelectableRegionContextMenu`].
#[cfg_attr(debug_assertions, track_caller)]
pub fn new<K>(child: impl crate::framework::IntoWidget<K>) -> Self {
PlatformSelectableRegionContextMenu {
key: None,
child: child.into_widget(),
}
}
/// Attaches the client to the platform-appropriate context menus.
pub fn attach(_client: AnySelectionContainerDelegate) {
unimplemented!()
}
/// Detaches the client from the platform-appropriate selection context menus.
pub fn detach(_client: AnySelectionContainerDelegate) {
unimplemented!()
}
/// The client currently attached to the platform context menu.
pub fn debug_active_client() -> Option<AnySelectionContainerDelegate> {
unimplemented!()
}
/// Resets the view factory registration to its initial state.
pub fn debug_reset_registry() {
unimplemented!()
}
}
impl std::fmt::Debug for PlatformSelectableRegionContextMenu {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("PlatformSelectableRegionContextMenu")
.finish_non_exhaustive()
}
}
impl StatelessWidget for PlatformSelectableRegionContextMenu {
fn key(&self) -> Option<&KeyRef> {
self.key.as_ref()
}
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef {
unimplemented!()
}
}