Skip to main content

SelectionOverlay

Struct SelectionOverlay 

Source
pub struct SelectionOverlay {
Show 20 fields pub context: BuildContext, pub debug_required_for: Option<WidgetRef>, pub start_handles_visible: Option<Ref<ValueNotifier<bool>>>, pub on_start_handle_drag_start: Option<ValueChanged<DragStartDetails>>, pub on_start_handle_drag_update: Option<ValueChanged<DragUpdateDetails>>, pub on_start_handle_drag_end: Option<ValueChanged<DragEndDetails>>, pub end_handles_visible: Option<Ref<ValueNotifier<bool>>>, pub on_end_handle_drag_start: Option<ValueChanged<DragStartDetails>>, pub on_end_handle_drag_update: Option<ValueChanged<DragUpdateDetails>>, pub on_end_handle_drag_end: Option<ValueChanged<DragEndDetails>>, pub toolbar_visible: Option<Ref<ValueNotifier<bool>>>, pub selection_controls: Option<Rc<dyn TextSelectionControls>>, pub selection_delegate: Option<AnyTextSelectionDelegate>, pub clipboard_status: Option<Ref<ClipboardStatusNotifier>>, pub start_handle_layer_link: Ref<LayerLink>, pub end_handle_layer_link: Ref<LayerLink>, pub toolbar_layer_link: Ref<LayerLink>, pub drag_start_behavior: DragStartBehavior, pub on_selection_handle_tapped: Option<Listener>, pub magnifier_configuration: TextMagnifierConfiguration, /* private fields */
}
Expand description

An object that manages a pair of selection handles and a toolbar.

The selection handles are displayed in the Overlay that most closely encloses the given BuildContext.

Fields§

§context: BuildContext

The context in which the selection UI should appear.

§debug_required_for: Option<WidgetRef>

Debugging information for explaining why the Overlay is required.

§start_handles_visible: Option<Ref<ValueNotifier<bool>>>

Whether the start handle is visible.

§on_start_handle_drag_start: Option<ValueChanged<DragStartDetails>>

Called when the users start dragging the start selection handles.

§on_start_handle_drag_update: Option<ValueChanged<DragUpdateDetails>>

Called when the users drag the start selection handles to new locations.

§on_start_handle_drag_end: Option<ValueChanged<DragEndDetails>>

Called when the users lift their fingers after dragging the start selection handles.

§end_handles_visible: Option<Ref<ValueNotifier<bool>>>

Whether the end handle is visible.

§on_end_handle_drag_start: Option<ValueChanged<DragStartDetails>>

Called when the users start dragging the end selection handles.

§on_end_handle_drag_update: Option<ValueChanged<DragUpdateDetails>>

Called when the users drag the end selection handles to new locations.

§on_end_handle_drag_end: Option<ValueChanged<DragEndDetails>>

Called when the users lift their fingers after dragging the end selection handles.

§toolbar_visible: Option<Ref<ValueNotifier<bool>>>

Whether the toolbar is visible.

§selection_controls: Option<Rc<dyn TextSelectionControls>>

Builds text selection handles and toolbar.

§selection_delegate: Option<AnyTextSelectionDelegate>

The delegate for manipulating the current selection in the owning text field.

§clipboard_status: Option<Ref<ClipboardStatusNotifier>>

Maintains the status of the clipboard for determining if its contents can be pasted.

§start_handle_layer_link: Ref<LayerLink>

The objects supplied to the location of start selection handle.

§end_handle_layer_link: Ref<LayerLink>

The objects supplied to the location of end selection handle.

§toolbar_layer_link: Ref<LayerLink>

The object supplied to the location of the toolbar.

§drag_start_behavior: DragStartBehavior

Determines the way that drag start behavior is handled.

§on_selection_handle_tapped: Option<Listener>

A callback that’s optionally invoked when a selection handle is tapped.

§magnifier_configuration: TextMagnifierConfiguration

The configuration for the magnifier.

Implementations§

Source§

impl SelectionOverlay

Source

pub const FADE_DURATION: Duration

Controls the fade-in and fade-out animations for the toolbar and handles.

Source

pub fn new( app: &mut App, context: BuildContext, start_handle_type: TextSelectionHandleType, line_height_at_start: f64, end_handle_type: TextSelectionHandleType, line_height_at_end: f64, selection_endpoints: Vec<TextSelectionPoint>, selection_controls: Option<Rc<dyn TextSelectionControls>>, selection_delegate: Option<AnyTextSelectionDelegate>, clipboard_status: Option<Ref<ClipboardStatusNotifier>>, start_handle_layer_link: Ref<LayerLink>, end_handle_layer_link: Ref<LayerLink>, toolbar_layer_link: Ref<LayerLink>, ) -> Ref<Self>

Creates an object that manages overlay entries for selection handles.

The context must have an Overlay as an ancestor.

Source

pub fn start_handles_visible( self: Ref<Self>, app: &mut App, start_handles_visible: Ref<ValueNotifier<bool>>, ) -> Ref<Self>

Dart SelectionOverlay(startHandlesVisible:).

Source

pub fn end_handles_visible( self: Ref<Self>, app: &mut App, end_handles_visible: Ref<ValueNotifier<bool>>, ) -> Ref<Self>

Dart SelectionOverlay(endHandlesVisible:).

Source

pub fn toolbar_visible( self: Ref<Self>, app: &mut App, toolbar_visible: Ref<ValueNotifier<bool>>, ) -> Ref<Self>

Dart SelectionOverlay(toolbarVisible:).

Source

pub fn magnifier_configuration( self: Ref<Self>, app: &mut App, magnifier_configuration: TextMagnifierConfiguration, ) -> Ref<Self>

Dart SelectionOverlay(magnifierConfiguration:).

Source

pub fn toolbar_location( self: Ref<Self>, app: &mut App, toolbar_location: Offset, ) -> Ref<Self>

Dart SelectionOverlay(toolbarLocation:).

Source

pub fn drag_start_behavior( self: Ref<Self>, app: &mut App, drag_start_behavior: DragStartBehavior, ) -> Ref<Self>

Dart SelectionOverlay(dragStartBehavior:).

Source

pub fn on_selection_handle_tapped( self: Ref<Self>, app: &mut App, on_selection_handle_tapped: Listener, ) -> Ref<Self>

Dart SelectionOverlay(onSelectionHandleTapped:).

Source

pub fn debug_required_for( self: Ref<Self>, app: &mut App, widget: WidgetRef, ) -> Ref<Self>

Dart SelectionOverlay(debugRequiredFor:).

Source

pub fn toolbar_is_visible(self: Handle<Self>, app: &App) -> bool

Whether the toolbar is currently visible.

Source

pub fn magnifier_is_visible(self: Handle<Self>, app: &App) -> bool

Whether the magnifier is currently visible.

Source

pub fn magnifier_exists(self: Handle<Self>, app: &App) -> bool

Whether the magnifier currently exists.

Source

pub fn show_magnifier( self: Handle<Self>, app: &mut App, initial_magnifier_info: MagnifierInfo, )

Shows the magnifier, and hides the toolbar if it was showing.

Source

pub fn hide_magnifier(self: Handle<Self>, app: &mut App)

Hide the current magnifier.

Source

pub fn start_handle_type( self: Handle<Self>, app: &App, ) -> TextSelectionHandleType

The type of start selection handle.

Source

pub fn set_start_handle_type( self: Handle<Self>, app: &mut App, value: TextSelectionHandleType, )

Changing the value while the handles are visible causes them to rebuild.

Source

pub fn line_height_at_start(self: Handle<Self>, app: &App) -> f64

The line height at the selection start.

Source

pub fn set_line_height_at_start(self: Handle<Self>, app: &mut App, value: f64)

Changing the value while the handles are visible causes them to rebuild.

Source

pub fn is_dragging_start_handle(self: Handle<Self>, app: &App) -> bool

Whether the selection start handle is currently being dragged.

Source

pub fn end_handle_type(self: Handle<Self>, app: &App) -> TextSelectionHandleType

The type of end selection handle.

Source

pub fn set_end_handle_type( self: Handle<Self>, app: &mut App, value: TextSelectionHandleType, )

Changing the value while the handles are visible causes them to rebuild.

Source

pub fn line_height_at_end(self: Handle<Self>, app: &App) -> f64

The line height at the selection end.

Source

pub fn set_line_height_at_end(self: Handle<Self>, app: &mut App, value: f64)

Changing the value while the handles are visible causes them to rebuild.

Source

pub fn is_dragging_end_handle(self: Handle<Self>, app: &App) -> bool

Whether the selection end handle is currently being dragged.

Source

pub fn selection_endpoints( self: Handle<Self>, app: &App, ) -> Vec<TextSelectionPoint>

The text selection positions of selection start and end.

Source

pub fn set_selection_endpoints( self: Handle<Self>, app: &mut App, value: Vec<TextSelectionPoint>, )

Changing the endpoints while the handles are visible causes them to rebuild.

Source

pub fn toolbar_location_value(self: Handle<Self>, app: &App) -> Option<Offset>

The location of where the toolbar should be drawn relative to toolbar_layer_link.

Source

pub fn set_toolbar_location( self: Handle<Self>, app: &mut App, value: Option<Offset>, )

Changing the location while the toolbar is visible causes it to rebuild.

Source

pub fn show_handles(self: Handle<Self>, app: &mut App)

Builds the handles by inserting them into the context’s overlay.

Source

pub fn hide_handles(self: Handle<Self>, app: &mut App)

Destroys the handles by removing them from overlay.

Source

pub fn show_toolbar( self: Handle<Self>, app: &mut App, context: Option<BuildContext>, context_menu_builder: Option<WidgetBuilder>, )

Shows the toolbar by inserting it into the context’s overlay.

Source

pub fn show_spell_check_suggestions_toolbar( self: Handle<Self>, app: &mut App, context: Option<BuildContext>, builder: WidgetBuilder, )

Shows toolbar with spell check suggestions of misspelled words.

Source

pub fn mark_needs_build(self: Handle<Self>, app: &mut App)

Rebuilds the selection toolbar or handles if they are present.

Source

pub fn hide(self: Handle<Self>, app: &mut App)

Hides the entire overlay including the toolbar and the handles.

Source

pub fn hide_toolbar(self: Handle<Self>, app: &mut App)

Hides the toolbar part of the overlay.

Source

pub fn dispose(self: Handle<Self>, app: &mut App)

Disposes this object and release resources.

Source

pub fn update_magnifier( self: Handle<Self>, app: &mut App, magnifier_info: MagnifierInfo, )

Update the current magnifier with new selection data.

Auto Trait Implementations§

§

impl !RefUnwindSafe for SelectionOverlay

§

impl !Send for SelectionOverlay

§

impl !Sync for SelectionOverlay

§

impl !UnwindSafe for SelectionOverlay

§

impl Forget for SelectionOverlay

§

impl Freeze for SelectionOverlay
where NonZero<u32>: Freeze, &'static ElementVTable: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, PhantomData<fn() -> ValueNotifier<bool>>: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const RcInner<dyn Fn(&mut App, DragStartDetails)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, DragStartDetails)>>: Freeze, *const RcInner<dyn Fn(&mut App, DragUpdateDetails)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, DragUpdateDetails)>>: Freeze, *const RcInner<dyn Fn(&mut App, DragEndDetails)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, DragEndDetails)>>: Freeze, *const u8 is !null: Freeze, PhantomData<TextSelectionPoint>: Freeze, *const RcInner<dyn TextSelectionControls> is !null: Freeze, PhantomData<RcInner<dyn TextSelectionControls>>: Freeze, &'static TextSelectionDelegateVTable: Freeze, PhantomData<fn() -> ClipboardStatusNotifier>: Freeze, PhantomData<fn() -> LayerLink>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, *const (): Freeze, *const RcInner<dyn Fn(&mut App, AnyElement, Retained<Handle<MagnifierController>>, Retained<Handle<ValueNotifier<MagnifierInfo>>>) -> Option<Rc<dyn Widget>>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Retained<Handle<MagnifierController>>, Retained<Handle<ValueNotifier<MagnifierInfo>>>) -> Option<Rc<dyn Widget>>>>: Freeze, PhantomData<fn() -> ValueNotifier<MagnifierInfo>>: Freeze, PhantomData<fn() -> MagnifierController>: Freeze, PhantomData<fn() -> OverlayEntry>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>>: Freeze,

§

impl Move for SelectionOverlay

§

impl Unpin for SelectionOverlay
where NonZero<u32>: Unpin, &'static ElementVTable: Unpin, Rc<dyn Widget>: Unpin, Rc<Keep>: Unpin, Rc<dyn Fn(&mut App, DragStartDetails)>: Unpin, Rc<dyn Fn(&mut App, DragUpdateDetails)>: Unpin, Rc<dyn Fn(&mut App, DragEndDetails)>: Unpin, *const u8 is !null: Unpin, Rc<dyn TextSelectionControls>: Unpin, &'static TextSelectionDelegateVTable: Unpin, Rc<dyn Fn(&mut App)>: Unpin, *const (): Unpin, Rc<dyn Fn(&mut App, AnyElement, Retained<Handle<MagnifierController>>, Retained<Handle<ValueNotifier<MagnifierInfo>>>) -> Option<Rc<dyn Widget>>>: Unpin, Rc<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>: Unpin,

§

impl UnsafeUnpin for SelectionOverlay
where NonZeroU32Inner: UnsafeUnpin, &'static ElementVTable: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, PhantomData<fn() -> ValueNotifier<bool>>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, DragStartDetails)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, DragStartDetails)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, DragUpdateDetails)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, DragUpdateDetails)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, DragEndDetails)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, DragEndDetails)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<TextSelectionPoint>: UnsafeUnpin, *const RcInner<dyn TextSelectionControls> is !null: UnsafeUnpin, PhantomData<RcInner<dyn TextSelectionControls>>: UnsafeUnpin, &'static TextSelectionDelegateVTable: UnsafeUnpin, PhantomData<fn() -> ClipboardStatusNotifier>: UnsafeUnpin, PhantomData<fn() -> LayerLink>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement, Retained<Handle<MagnifierController>>, Retained<Handle<ValueNotifier<MagnifierInfo>>>) -> Option<Rc<dyn Widget>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Retained<Handle<MagnifierController>>, Retained<Handle<ValueNotifier<MagnifierInfo>>>) -> Option<Rc<dyn Widget>>>>: UnsafeUnpin, PhantomData<fn() -> ValueNotifier<MagnifierInfo>>: UnsafeUnpin, PhantomData<fn() -> MagnifierController>: UnsafeUnpin, PhantomData<fn() -> OverlayEntry>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> 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<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>