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: BuildContextThe 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: DragStartBehaviorDetermines 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: TextMagnifierConfigurationThe configuration for the magnifier.
Implementations§
Source§impl SelectionOverlay
impl SelectionOverlay
Sourcepub const FADE_DURATION: Duration
pub const FADE_DURATION: Duration
Controls the fade-in and fade-out animations for the toolbar and handles.
Sourcepub 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>
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>
Sourcepub fn start_handles_visible(
self: Ref<Self>,
app: &mut App,
start_handles_visible: Ref<ValueNotifier<bool>>,
) -> Ref<Self>
pub fn start_handles_visible( self: Ref<Self>, app: &mut App, start_handles_visible: Ref<ValueNotifier<bool>>, ) -> Ref<Self>
Dart SelectionOverlay(startHandlesVisible:).
Sourcepub fn end_handles_visible(
self: Ref<Self>,
app: &mut App,
end_handles_visible: Ref<ValueNotifier<bool>>,
) -> Ref<Self>
pub fn end_handles_visible( self: Ref<Self>, app: &mut App, end_handles_visible: Ref<ValueNotifier<bool>>, ) -> Ref<Self>
Dart SelectionOverlay(endHandlesVisible:).
Sourcepub fn toolbar_visible(
self: Ref<Self>,
app: &mut App,
toolbar_visible: Ref<ValueNotifier<bool>>,
) -> Ref<Self>
pub fn toolbar_visible( self: Ref<Self>, app: &mut App, toolbar_visible: Ref<ValueNotifier<bool>>, ) -> Ref<Self>
Dart SelectionOverlay(toolbarVisible:).
Sourcepub fn magnifier_configuration(
self: Ref<Self>,
app: &mut App,
magnifier_configuration: TextMagnifierConfiguration,
) -> Ref<Self>
pub fn magnifier_configuration( self: Ref<Self>, app: &mut App, magnifier_configuration: TextMagnifierConfiguration, ) -> Ref<Self>
Dart SelectionOverlay(magnifierConfiguration:).
Sourcepub fn toolbar_location(
self: Ref<Self>,
app: &mut App,
toolbar_location: Offset,
) -> Ref<Self>
pub fn toolbar_location( self: Ref<Self>, app: &mut App, toolbar_location: Offset, ) -> Ref<Self>
Dart SelectionOverlay(toolbarLocation:).
Sourcepub fn drag_start_behavior(
self: Ref<Self>,
app: &mut App,
drag_start_behavior: DragStartBehavior,
) -> Ref<Self>
pub fn drag_start_behavior( self: Ref<Self>, app: &mut App, drag_start_behavior: DragStartBehavior, ) -> Ref<Self>
Dart SelectionOverlay(dragStartBehavior:).
Sourcepub fn on_selection_handle_tapped(
self: Ref<Self>,
app: &mut App,
on_selection_handle_tapped: Listener,
) -> Ref<Self>
pub fn on_selection_handle_tapped( self: Ref<Self>, app: &mut App, on_selection_handle_tapped: Listener, ) -> Ref<Self>
Dart SelectionOverlay(onSelectionHandleTapped:).
Sourcepub fn debug_required_for(
self: Ref<Self>,
app: &mut App,
widget: WidgetRef,
) -> Ref<Self>
pub fn debug_required_for( self: Ref<Self>, app: &mut App, widget: WidgetRef, ) -> Ref<Self>
Dart SelectionOverlay(debugRequiredFor:).
Sourcepub fn toolbar_is_visible(self: Handle<Self>, app: &App) -> bool
pub fn toolbar_is_visible(self: Handle<Self>, app: &App) -> bool
Whether the toolbar is currently visible.
Sourcepub fn magnifier_is_visible(self: Handle<Self>, app: &App) -> bool
pub fn magnifier_is_visible(self: Handle<Self>, app: &App) -> bool
Whether the magnifier is currently visible.
Sourcepub fn magnifier_exists(self: Handle<Self>, app: &App) -> bool
pub fn magnifier_exists(self: Handle<Self>, app: &App) -> bool
Whether the magnifier currently exists.
Sourcepub fn show_magnifier(
self: Handle<Self>,
app: &mut App,
initial_magnifier_info: MagnifierInfo,
)
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.
Sourcepub fn hide_magnifier(self: Handle<Self>, app: &mut App)
pub fn hide_magnifier(self: Handle<Self>, app: &mut App)
Hide the current magnifier.
Sourcepub fn start_handle_type(
self: Handle<Self>,
app: &App,
) -> TextSelectionHandleType
pub fn start_handle_type( self: Handle<Self>, app: &App, ) -> TextSelectionHandleType
The type of start selection handle.
Sourcepub fn set_start_handle_type(
self: Handle<Self>,
app: &mut App,
value: TextSelectionHandleType,
)
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.
Sourcepub fn line_height_at_start(self: Handle<Self>, app: &App) -> f64
pub fn line_height_at_start(self: Handle<Self>, app: &App) -> f64
The line height at the selection start.
Sourcepub fn set_line_height_at_start(self: Handle<Self>, app: &mut App, value: f64)
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.
Sourcepub fn is_dragging_start_handle(self: Handle<Self>, app: &App) -> bool
pub fn is_dragging_start_handle(self: Handle<Self>, app: &App) -> bool
Whether the selection start handle is currently being dragged.
Sourcepub fn end_handle_type(self: Handle<Self>, app: &App) -> TextSelectionHandleType
pub fn end_handle_type(self: Handle<Self>, app: &App) -> TextSelectionHandleType
The type of end selection handle.
Sourcepub fn set_end_handle_type(
self: Handle<Self>,
app: &mut App,
value: TextSelectionHandleType,
)
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.
Sourcepub fn line_height_at_end(self: Handle<Self>, app: &App) -> f64
pub fn line_height_at_end(self: Handle<Self>, app: &App) -> f64
The line height at the selection end.
Sourcepub fn set_line_height_at_end(self: Handle<Self>, app: &mut App, value: f64)
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.
Sourcepub fn is_dragging_end_handle(self: Handle<Self>, app: &App) -> bool
pub fn is_dragging_end_handle(self: Handle<Self>, app: &App) -> bool
Whether the selection end handle is currently being dragged.
Sourcepub fn selection_endpoints(
self: Handle<Self>,
app: &App,
) -> Vec<TextSelectionPoint>
pub fn selection_endpoints( self: Handle<Self>, app: &App, ) -> Vec<TextSelectionPoint>
The text selection positions of selection start and end.
Sourcepub fn set_selection_endpoints(
self: Handle<Self>,
app: &mut App,
value: Vec<TextSelectionPoint>,
)
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.
Sourcepub fn toolbar_location_value(self: Handle<Self>, app: &App) -> Option<Offset>
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.
Sourcepub fn set_toolbar_location(
self: Handle<Self>,
app: &mut App,
value: Option<Offset>,
)
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.
Sourcepub fn show_handles(self: Handle<Self>, app: &mut App)
pub fn show_handles(self: Handle<Self>, app: &mut App)
Builds the handles by inserting them into the context’s overlay.
Sourcepub fn hide_handles(self: Handle<Self>, app: &mut App)
pub fn hide_handles(self: Handle<Self>, app: &mut App)
Destroys the handles by removing them from overlay.
Sourcepub fn show_toolbar(
self: Handle<Self>,
app: &mut App,
context: Option<BuildContext>,
context_menu_builder: Option<WidgetBuilder>,
)
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.
Sourcepub fn show_spell_check_suggestions_toolbar(
self: Handle<Self>,
app: &mut App,
context: Option<BuildContext>,
builder: WidgetBuilder,
)
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.
Sourcepub fn mark_needs_build(self: Handle<Self>, app: &mut App)
pub fn mark_needs_build(self: Handle<Self>, app: &mut App)
Rebuilds the selection toolbar or handles if they are present.
Sourcepub fn hide(self: Handle<Self>, app: &mut App)
pub fn hide(self: Handle<Self>, app: &mut App)
Hides the entire overlay including the toolbar and the handles.
Sourcepub fn hide_toolbar(self: Handle<Self>, app: &mut App)
pub fn hide_toolbar(self: Handle<Self>, app: &mut App)
Hides the toolbar part of the overlay.
Sourcepub fn update_magnifier(
self: Handle<Self>,
app: &mut App,
magnifier_info: MagnifierInfo,
)
pub fn update_magnifier( self: Handle<Self>, app: &mut App, magnifier_info: MagnifierInfo, )
Update the current magnifier with new selection data.