pub struct AdaptiveTextSelectionToolbar {
pub key: Option<KeyRef>,
pub button_items: Option<Vec<ContextMenuButtonItem>>,
pub children: Option<Vec<WidgetRef>>,
pub anchors: TextSelectionToolbarAnchors,
}Expand description
The default context menu for text selection for the current platform.
Typically, this widget would be passed to contextMenuBuilder in a
supported parent widget, such as:
EditableText.contextMenuBuilderTextField.contextMenuBuilderCupertinoTextField.contextMenuBuilderSelectionArea.contextMenuBuilderSelectableText.contextMenuBuilder
See also:
EditableText::get_editable_button_items, which returns the defaultContextMenuButtonItems forEditableTexton the platform.AdaptiveTextSelectionToolbar::get_adaptive_buttons, which builds the button Widgets for the current platform givenContextMenuButtonItems.CupertinoAdaptiveTextSelectionToolbar, which does the same thing as this widget but only for Cupertino context menus.TextSelectionToolbar, the default toolbar for Android.DesktopTextSelectionToolbar, the default toolbar for desktop platforms other than MacOS.CupertinoTextSelectionToolbar, the default toolbar for iOS.CupertinoDesktopTextSelectionToolbar, the default toolbar for MacOS.
Fields§
§key: Option<KeyRef>The ContextMenuButtonItems that will be turned into the correct button
widgets for the current platform.
children: Option<Vec<WidgetRef>>The children of the toolbar, typically buttons.
anchors: TextSelectionToolbarAnchorsThe location on which to anchor the menu.
Implementations§
Source§impl AdaptiveTextSelectionToolbar
impl AdaptiveTextSelectionToolbar
Sourcepub fn new(
children: Option<Vec<WidgetRef>>,
anchors: TextSelectionToolbarAnchors,
) -> AdaptiveTextSelectionToolbar
pub fn new( children: Option<Vec<WidgetRef>>, anchors: TextSelectionToolbarAnchors, ) -> AdaptiveTextSelectionToolbar
Create an instance of AdaptiveTextSelectionToolbar with the
given children.
See also:
AdaptiveTextSelectionToolbar::button_items, which takes a list ofContextMenuButtonItems instead ofchildrenwidgets.AdaptiveTextSelectionToolbar::editable, which builds the default children for an editable field.AdaptiveTextSelectionToolbar::editable_text, which builds the default children for anEditableText.
Sourcepub fn key(self, key: KeyRef) -> AdaptiveTextSelectionToolbar
pub fn key(self, key: KeyRef) -> AdaptiveTextSelectionToolbar
Dart AdaptiveTextSelectionToolbar(key:).
Create an instance of AdaptiveTextSelectionToolbar whose children will
be built from the given button_items.
See also:
AdaptiveTextSelectionToolbar::new, which takes the children directly as a list of widgets.AdaptiveTextSelectionToolbar::editable, which builds the default children for an editable field.AdaptiveTextSelectionToolbar::editable_text, which builds the default children for anEditableText.
Sourcepub fn editable(
app: &App,
clipboard_status: ClipboardStatus,
on_copy: Option<Listener>,
on_cut: Option<Listener>,
on_paste: Option<Listener>,
on_select_all: Option<Listener>,
on_look_up: Option<Listener>,
on_search_web: Option<Listener>,
on_share: Option<Listener>,
on_live_text_input: Option<Listener>,
anchors: TextSelectionToolbarAnchors,
) -> AdaptiveTextSelectionToolbar
pub fn editable( app: &App, clipboard_status: ClipboardStatus, on_copy: Option<Listener>, on_cut: Option<Listener>, on_paste: Option<Listener>, on_select_all: Option<Listener>, on_look_up: Option<Listener>, on_search_web: Option<Listener>, on_share: Option<Listener>, on_live_text_input: Option<Listener>, anchors: TextSelectionToolbarAnchors, ) -> AdaptiveTextSelectionToolbar
Create an instance of AdaptiveTextSelectionToolbar with the default
children for an editable field.
If an on* callback parameter is null, then its corresponding button will not be built.
These callbacks are called when their corresponding button is activated
and only then. For example, on_paste is called when the user taps the
“Paste” button in the context menu and not when the user pastes with the
keyboard.
See also:
AdaptiveTextSelectionToolbar::new, which takes the children directly as a list of widgets.AdaptiveTextSelectionToolbar::editable_text, which builds the default children for anEditableText.AdaptiveTextSelectionToolbar::button_items, which takes a list ofContextMenuButtonItems instead ofchildrenwidgets.
Sourcepub fn editable_text(
app: &mut App,
editable_text_state: Handle<EditableTextState>,
) -> AdaptiveTextSelectionToolbar
pub fn editable_text( app: &mut App, editable_text_state: Handle<EditableTextState>, ) -> AdaptiveTextSelectionToolbar
Create an instance of AdaptiveTextSelectionToolbar with the default
children for an EditableText.
See also:
AdaptiveTextSelectionToolbar::new, which takes the children directly as a list of widgets.AdaptiveTextSelectionToolbar::editable, which builds the default children for an editable field.AdaptiveTextSelectionToolbar::button_items, which takes a list ofContextMenuButtonItems instead ofchildrenwidgets.
Sourcepub fn selectable_region(
app: &mut App,
selectable_region_state: Handle<SelectableRegionState>,
) -> AdaptiveTextSelectionToolbar
pub fn selectable_region( app: &mut App, selectable_region_state: Handle<SelectableRegionState>, ) -> AdaptiveTextSelectionToolbar
Dart AdaptiveTextSelectionToolbar.selectableRegion.
Returns the default button label String for the button of the given
ContextMenuButtonType on any platform.
Returns a List of Widgets generated by turning button_items into
the default context menu buttons for the current platform.
This is useful when building a text selection toolbar with the default button appearance for the given platform, but where the toolbar and/or the button actions and labels may be custom.
See also:
CupertinoAdaptiveTextSelectionToolbar::get_adaptive_buttons, which is the Cupertino equivalent of this class and builds only the Cupertino buttons.
Trait Implementations§
Source§impl Debug for AdaptiveTextSelectionToolbar
impl Debug for AdaptiveTextSelectionToolbar
Source§impl StatelessWidget for AdaptiveTextSelectionToolbar
impl StatelessWidget for AdaptiveTextSelectionToolbar
Source§fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef
fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for AdaptiveTextSelectionToolbar
impl !Send for AdaptiveTextSelectionToolbar
impl !Sync for AdaptiveTextSelectionToolbar
impl !UnwindSafe for AdaptiveTextSelectionToolbar
impl Forget for AdaptiveTextSelectionToolbar
impl Freeze for AdaptiveTextSelectionToolbarwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<ContextMenuButtonItem>: Freeze,
PhantomData<Rc<dyn Widget>>: Freeze,
impl Move for AdaptiveTextSelectionToolbar
impl Unpin for AdaptiveTextSelectionToolbar
impl UnsafeUnpin for AdaptiveTextSelectionToolbarwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<ContextMenuButtonItem>: UnsafeUnpin,
PhantomData<Rc<dyn Widget>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.