Skip to main content

AdaptiveTextSelectionToolbar

Struct AdaptiveTextSelectionToolbar 

Source
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.contextMenuBuilder
  • TextField.contextMenuBuilder
  • CupertinoTextField.contextMenuBuilder
  • SelectionArea.contextMenuBuilder
  • SelectableText.contextMenuBuilder

See also:

Fields§

§key: Option<KeyRef>§button_items: Option<Vec<ContextMenuButtonItem>>

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: TextSelectionToolbarAnchors

The location on which to anchor the menu.

Implementations§

Source§

impl AdaptiveTextSelectionToolbar

Source

pub fn new( children: Option<Vec<WidgetRef>>, anchors: TextSelectionToolbarAnchors, ) -> AdaptiveTextSelectionToolbar

Create an instance of AdaptiveTextSelectionToolbar with the given children.

See also:

Source

pub fn key(self, key: KeyRef) -> AdaptiveTextSelectionToolbar

Dart AdaptiveTextSelectionToolbar(key:).

Source

pub fn button_items( button_items: Vec<ContextMenuButtonItem>, anchors: TextSelectionToolbarAnchors, ) -> AdaptiveTextSelectionToolbar

Create an instance of AdaptiveTextSelectionToolbar whose children will be built from the given button_items.

See also:

Source

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:

Source

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:

Source

pub fn selectable_region( app: &mut App, selectable_region_state: Handle<SelectableRegionState>, ) -> AdaptiveTextSelectionToolbar

Dart AdaptiveTextSelectionToolbar.selectableRegion.

Source

pub fn get_button_label( app: &mut App, context: BuildContext, button_item: &ContextMenuButtonItem, ) -> String

Returns the default button label String for the button of the given ContextMenuButtonType on any platform.

Source

pub fn get_adaptive_buttons( app: &mut App, context: BuildContext, button_items: Vec<ContextMenuButtonItem>, ) -> Vec<WidgetRef>

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StatelessWidget for AdaptiveTextSelectionToolbar

Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef

Describes the part of the user interface represented by this widget. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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)

Dart’s constructor asserts that relate two or more arguments. Read more
Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Dart’s 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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatelessKind> for W
where W: StatelessWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>