pub struct RawTooltip {Show 14 fields
pub key: Option<KeyRef>,
pub semantics_tooltip: Option<String>,
pub tooltip_builder: TooltipComponentBuilder,
pub hover_delay: Duration,
pub touch_delay: Duration,
pub dismiss_delay: Duration,
pub enable_tap_to_dismiss: bool,
pub trigger_mode: TooltipTriggerMode,
pub enable_feedback: bool,
pub on_triggered: Option<TooltipTriggeredCallback>,
pub animation_style: AnimationStyle,
pub position_delegate: Option<TooltipPositionDelegate>,
pub ignore_pointer: bool,
pub child: WidgetRef,
}Expand description
A widget that wraps a child to display an informative overlay in response to user interactions, such as hovering or long-pressing.
Tooltips provide essential context by displaying text labels or brief descriptions that explain the function of a button or other user interface elements.
The tooltip can be triggered in several ways:
- By hovering a mouse pointer over the widget.
- By touch interactions, such as a long press or a tap, depending on the
configuration of
trigger_mode. - Manually, by calling
RawTooltipState::ensure_tooltip_visible.
See also:
Tooltip, a Material-themedRawTooltip.
Fields§
§key: Option<KeyRef>§semantics_tooltip: Option<String>The text to display in the tooltip’s semantics announcement.
This string is used by assistive technologies, most notably screen readers like TalkBack and VoiceOver, to describe the tooltip’s purpose.
Providing a non-empty string adds a Semantics tooltip string for
assistive technologies. If the tooltip should not have a semantic
description, this property must be explicitly set to None.
tooltip_builder: TooltipComponentBuilderBuilds the widget that will be displayed in the tooltip’s overlay.
The animation parameter is an Animation that maps to the tooltip’s
show and hide animation. Its value goes from 0.0 to 1.0 when the tooltip
is shown, and from 1.0 to 0.0 when it is hidden.
This animation can be used to create custom transitions for the tooltip,
such as fading or scaling, by wrapping the tooltip’s content in a
FadeTransition or ScaleTransition and using the provided animation.
The characteristics of the animation, such as its duration and curve, can
be customized using the animation_style property.
hover_delay: DurationThe length of time that a pointer must hover over a tooltip’s widget before the tooltip will be shown.
Defaults to 0 milliseconds (the tooltip is shown immediately upon hover).
touch_delay: DurationThe length of time that the tooltip will be shown after a long press is
released (if trigger_mode is TooltipTriggerMode::LongPress) or a tap is
released (if trigger_mode is TooltipTriggerMode::Tap).
This property does not affect mouse pointer devices.
Defaults to 1.5 seconds (the tooltip is shown 1.5 seconds after a tap or long press is released).
See also:
dismiss_delay, which allows configuring the time until a pointer disappears when hovering.
dismiss_delay: DurationThe length of time that a pointer must have stopped hovering over a tooltip’s widget before the tooltip will be hidden.
Defaults to 100 milliseconds.
See also:
touch_delay, which allows configuring the length of time that a tooltip will be visible after touch events are released.
enable_tap_to_dismiss: boolWhether the tooltip can be dismissed by tap.
The default value is true.
trigger_mode: TooltipTriggerModeThe TooltipTriggerMode that will show the tooltip.
This property does not affect mouse devices. Setting trigger_mode
to TooltipTriggerMode::Manual will not prevent the tooltip from showing when
the mouse cursor hovers over it.
enable_feedback: boolWhether the tooltip should provide acoustic and/or haptic feedback.
For example, on Android a tap will produce a clicking sound and a long-press will produce a short vibration, when feedback is enabled.
When null, the default value is true.
See also:
Feedback, for providing platform-specific feedback to certain actions.
on_triggered: Option<TooltipTriggeredCallback>Called when the RawTooltip is triggered programmatically, on tap, or on
long press.
The tooltip is triggered after a tap when trigger_mode is
TooltipTriggerMode::Tap or after a long press when
trigger_mode is TooltipTriggerMode::LongPress.
Hovering over the tooltip with a mouse pointer does not trigger this callback.
See also:
TooltipTriggerMode, which defines the different ways a tooltip can be triggered.
animation_style: AnimationStyleUsed to override the curve and duration of the animation that shows and hides the tooltip.
If AnimationStyle::duration is provided, it will be used to override
the show tooltip animation duration. If it is null, defaults to 150ms.
If AnimationStyle::curve is provided, it will be used to override
the show tooltip animation curve. If it is null, defaults to
Curves::fast_out_slow_in.
If AnimationStyle::reverse_duration is provided, it will be used to
override the hide tooltip animation duration. If it is null, defaults to
75ms.
If AnimationStyle::reverse_curve is provided, it will be used to
override the hide tooltip animation curve. If it is null, the same curve will be
used as for the show tooltip animation. The reverse curve only takes
effect when the tooltip starts hiding from the fully shown state; a
tooltip dismissed while it is still animating in continues to use the
show curve, to avoid a visual discontinuity. See
CurvedAnimation::reverse_curve.
To disable the tooltip show/hide animation, use
AnimationStyle::NO_ANIMATION.
position_delegate: Option<TooltipPositionDelegate>A custom position delegate function for computing where the tooltip should be positioned.
If provided, this function will be called with a TooltipPositionContext
containing all the necessary information for positioning the tooltip. The
function should return an Offset indicating where to place the tooltip
in the closest Overlay.
This allows for custom positioning such as left/right positioning, or any other arbitrary positioning logic.
For example, if the Overlay takes up the entire screen, returning
Offset::ZERO will position the tooltip at the top-left corner of the
screen.
The TooltipPositionContext provides information that can be used to
position the tooltip relative to the target/child.
If null, defaults to positioning the tooltip center-aligned and below the
target using position_dependent_box.
See also:
TooltipPositionContext, which contains the positioning parameters.TooltipPositionDelegate, the function signature for custom positioning.
ignore_pointer: boolWhether the tooltip should be invisible to hit testing.
Defaults to false.
See also:
IgnorePointer, for more information about how pointer events are handled or ignored.
child: WidgetRefThe widget below this widget in the tree.
The widget returned in tooltip_builder will be shown when
the user hovers over this child widget.
Implementations§
Source§impl RawTooltip
impl RawTooltip
Sourcepub fn new<K>(
semantics_tooltip: Option<String>,
tooltip_builder: impl Fn(&mut App, BuildContext, AnimationRef<f64>) -> WidgetRef + 'static,
child: impl IntoWidget<K>,
) -> RawTooltip
pub fn new<K>( semantics_tooltip: Option<String>, tooltip_builder: impl Fn(&mut App, BuildContext, AnimationRef<f64>) -> WidgetRef + 'static, child: impl IntoWidget<K>, ) -> RawTooltip
Creates a raw tooltip.
The semantics_tooltip, tooltip_builder, and child arguments are
required.
Sourcepub fn key(self, key: KeyRef) -> RawTooltip
pub fn key(self, key: KeyRef) -> RawTooltip
Dart RawTooltip(key:).
Sourcepub fn hover_delay(self, hover_delay: Duration) -> RawTooltip
pub fn hover_delay(self, hover_delay: Duration) -> RawTooltip
Dart RawTooltip(hoverDelay:).
Sourcepub fn touch_delay(self, touch_delay: Duration) -> RawTooltip
pub fn touch_delay(self, touch_delay: Duration) -> RawTooltip
Dart RawTooltip(touchDelay:).
Sourcepub fn dismiss_delay(self, dismiss_delay: Duration) -> RawTooltip
pub fn dismiss_delay(self, dismiss_delay: Duration) -> RawTooltip
Dart RawTooltip(dismissDelay:).
Sourcepub fn enable_tap_to_dismiss(self, enable_tap_to_dismiss: bool) -> RawTooltip
pub fn enable_tap_to_dismiss(self, enable_tap_to_dismiss: bool) -> RawTooltip
Dart RawTooltip(enableTapToDismiss:).
Sourcepub fn trigger_mode(self, trigger_mode: TooltipTriggerMode) -> RawTooltip
pub fn trigger_mode(self, trigger_mode: TooltipTriggerMode) -> RawTooltip
Dart RawTooltip(triggerMode:).
Sourcepub fn enable_feedback(self, enable_feedback: bool) -> RawTooltip
pub fn enable_feedback(self, enable_feedback: bool) -> RawTooltip
Dart RawTooltip(enableFeedback:).
Sourcepub fn on_triggered(self, on_triggered: TooltipTriggeredCallback) -> RawTooltip
pub fn on_triggered(self, on_triggered: TooltipTriggeredCallback) -> RawTooltip
Dart RawTooltip(onTriggered:).
Sourcepub fn animation_style(self, animation_style: AnimationStyle) -> RawTooltip
pub fn animation_style(self, animation_style: AnimationStyle) -> RawTooltip
Dart RawTooltip(animationStyle:).
Sourcepub fn position_delegate(
self,
position_delegate: TooltipPositionDelegate,
) -> RawTooltip
pub fn position_delegate( self, position_delegate: TooltipPositionDelegate, ) -> RawTooltip
Dart RawTooltip(positionDelegate:).
Sourcepub fn ignore_pointer(self, ignore_pointer: bool) -> RawTooltip
pub fn ignore_pointer(self, ignore_pointer: bool) -> RawTooltip
Dart RawTooltip(ignorePointer:).
Sourcepub fn dismiss_all_tool_tips(app: &mut App) -> bool
pub fn dismiss_all_tool_tips(app: &mut App) -> bool
Dismiss all of the tooltips that are currently shown on the screen, including those with mouse cursors currently hovering over them.
This method returns true if it successfully dismisses at least one tooltip and returns false if there is no tooltip currently displayed.
Trait Implementations§
Source§impl Debug for RawTooltip
impl Debug for RawTooltip
Source§impl StatefulWidget for RawTooltip
impl StatefulWidget for RawTooltip
Source§type State = RawTooltipState
type State = RawTooltipState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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 create_state(&self) -> RawTooltipState
fn create_state(&self) -> RawTooltipState
Source§fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for RawTooltip
impl !Send for RawTooltip
impl !Sync for RawTooltip
impl !UnwindSafe for RawTooltip
impl Forget for RawTooltip
impl Freeze for RawTooltipwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
*const RcInner<dyn Curve> is !null: Freeze,
PhantomData<RcInner<dyn Curve>>: Freeze,
*const RcInner<dyn Fn(TooltipPositionContext) -> Offset> is !null: Freeze,
PhantomData<RcInner<dyn Fn(TooltipPositionContext) -> Offset>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for RawTooltip
impl Unpin for RawTooltipwhere
Rc<dyn Key>: Unpin,
*const u8 is !null: Unpin,
Rc<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>: Unpin,
Rc<dyn Fn(&mut App)>: Unpin,
NonZero<u32>: Unpin,
*const (): Unpin,
Rc<dyn Curve>: Unpin,
Rc<dyn Fn(TooltipPositionContext) -> Offset>: Unpin,
Rc<dyn Widget>: Unpin,
impl UnsafeUnpin for RawTooltipwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const RcInner<dyn Curve> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Curve>>: UnsafeUnpin,
*const RcInner<dyn Fn(TooltipPositionContext) -> Offset> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(TooltipPositionContext) -> Offset>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.