Skip to main content

TextSelectionToolbar

Struct TextSelectionToolbar 

Source
pub struct TextSelectionToolbar {
    pub key: Option<KeyRef>,
    pub anchor_above: Offset,
    pub anchor_below: Offset,
    pub children: Vec<WidgetRef>,
    pub toolbar_builder: ToolbarBuilder,
}
Expand description

A fully-functional Material-style text selection toolbar.

Tries to position itself above anchor_above, but if it doesn’t fit, then it positions itself below anchor_below.

If any children don’t fit in the menu, an overflow menu will automatically be created.

See also:

  • AdaptiveTextSelectionToolbar, which builds the toolbar for the current platform.
  • CupertinoTextSelectionToolbar, which is similar, but builds an iOS- style toolbar.

Fields§

§key: Option<KeyRef>§anchor_above: Offset

The focal point above which the toolbar attempts to position itself.

If there is not enough room above before reaching the top of the screen, then the toolbar will position itself below anchor_below.

§anchor_below: Offset

The focal point below which the toolbar attempts to position itself, if it doesn’t fit above anchor_above.

§children: Vec<WidgetRef>

The children that will be displayed in the text selection toolbar.

Typically these are buttons.

Must not be empty.

See also:

  • TextSelectionToolbarTextButton, which builds a default Material- style text selection toolbar text button.
§toolbar_builder: ToolbarBuilder

Builds the toolbar container.

Useful for customizing the high-level background of the toolbar. The given child Widget will contain all of the children.

Implementations§

Source§

impl TextSelectionToolbar

Source

pub const K_HANDLE_SIZE: f64 = 22.0

The size of the text selection handles.

See also:

  • SpellCheckSuggestionsToolbar, which references this value to calculate the padding between the toolbar and anchor.
Source

pub const K_TOOLBAR_CONTENT_DISTANCE_BELOW: f64

Padding between the toolbar and the anchor.

Source

pub fn new( anchor_above: Offset, anchor_below: Offset, children: impl IntoIterator<Item = WidgetRef>, ) -> TextSelectionToolbar

Creates an instance of TextSelectionToolbar.

Source

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

Dart TextSelectionToolbar(key:).

Source

pub fn toolbar_builder( self, toolbar_builder: ToolbarBuilder, ) -> TextSelectionToolbar

Dart TextSelectionToolbar(toolbarBuilder:).

Trait Implementations§

Source§

impl Debug for TextSelectionToolbar

Source§

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

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

impl StatelessWidget for TextSelectionToolbar

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§

§

impl !RefUnwindSafe for TextSelectionToolbar

§

impl !Send for TextSelectionToolbar

§

impl !Sync for TextSelectionToolbar

§

impl !UnwindSafe for TextSelectionToolbar

§

impl Forget for TextSelectionToolbar

§

impl Freeze for TextSelectionToolbar
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const u8 is !null: Freeze, PhantomData<Rc<dyn Widget>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Widget>) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Widget>) -> Rc<dyn Widget>>>: Freeze,

§

impl Move for TextSelectionToolbar

§

impl Unpin for TextSelectionToolbar
where Rc<dyn Key>: Unpin, *const u8 is !null: Unpin, Rc<dyn Widget>: Unpin, Rc<dyn Fn(&mut App, AnyElement, Rc<dyn Widget>) -> Rc<dyn Widget>>: Unpin,

§

impl UnsafeUnpin for TextSelectionToolbar
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<Rc<dyn Widget>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Widget>) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Widget>) -> Rc<dyn Widget>>>: UnsafeUnpin,

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>