Skip to main content

TextSelectionToolbarLayoutDelegate

Struct TextSelectionToolbarLayoutDelegate 

Source
pub struct TextSelectionToolbarLayoutDelegate {
    pub anchor_above: Offset,
    pub anchor_below: Offset,
    pub fits_above: Option<bool>,
}
Expand description

A SingleChildLayoutDelegate for use with CustomSingleChildLayout that positions its child above anchor_above if it fits, or otherwise below anchor_below.

Primarily intended for use with toolbars or context menus.

See also:

  • TextSelectionToolbar, which uses this to position itself.
  • CupertinoTextSelectionToolbar, which also uses this to position itself.

Fields§

§anchor_above: Offset

The location that the toolbar should attempt to position itself at.

Should be provided in local coordinates.

§anchor_below: Offset

The fallback position that should be used if anchor_above doesn’t work.

Should be provided in local coordinates.

§fits_above: Option<bool>

Whether or not the child should be considered to fit above anchor_above.

Typically used to force the child to be drawn at anchor_above even when it doesn’t fit, such as when the Material TextSelectionToolbar draws an open overflow menu.

If not provided, it will be calculated.

Implementations§

Source§

impl TextSelectionToolbarLayoutDelegate

Source

pub fn new( anchor_above: Offset, anchor_below: Offset, ) -> TextSelectionToolbarLayoutDelegate

Creates an instance of TextSelectionToolbarLayoutDelegate.

Source

pub fn fits_above(self, fits_above: bool) -> TextSelectionToolbarLayoutDelegate

Dart TextSelectionToolbarLayoutDelegate(fitsAbove:).

Source

pub fn center_on(position: f64, width: f64, max: f64) -> f64

Return the distance from zero that centers width as closely as possible to position from zero while fitting between zero and max.

Trait Implementations§

Source§

impl Debug for TextSelectionToolbarLayoutDelegate

Source§

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

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

impl Display for TextSelectionToolbarLayoutDelegate

Source§

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

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

impl SingleChildLayoutDelegate for TextSelectionToolbarLayoutDelegate

Source§

fn get_constraints_for_child( &self, constraints: BoxConstraints, ) -> BoxConstraints

The constraints for the child given the incoming constraints. Read more
Source§

fn get_position_for_child(&self, size: Size, child_size: Size) -> Offset

The position where the child should be placed. Read more
Source§

fn should_relayout(&self, old_delegate: &dyn SingleChildLayoutDelegate) -> bool

Called whenever a new instance of the custom layout delegate class is provided to the RenderCustomSingleChildLayoutBox object, or any time that a new CustomSingleChildLayout object is created with a new instance of the custom layout delegate class (which amounts to the same thing, because the latter is implemented in terms of the former). Read more
Source§

fn as_any(&self) -> &dyn Any

The concrete delegate, for Dart’s runtimeType comparison and its covariant narrowing of should_relayout’s argument.
Source§

fn relayout(&self) -> Option<&Rc<dyn Listenable>>

The Listenable the layout will update on, Dart’s relayout constructor argument. Read more
Source§

fn get_size(&self, constraints: BoxConstraints) -> Size

The size of this object given the incoming constraints. Read more

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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,