Skip to main content

InkHighlight

Struct InkHighlight 

Source
pub struct InkHighlight { /* private fields */ }
Expand description

A visual emphasis on a part of a Material receiving user interaction.

This object is rarely created directly. Instead of creating an ink highlight directly, consider using an InkResponse or InkWell widget, which uses gestures (such as tap and long-press) to trigger ink highlights.

See also:

  • InkResponse, which uses gestures to trigger ink highlights and ink splashes in the parent Material.
  • InkWell, which is a rectangular InkResponse (the most common type of ink response).
  • Material, which is the widget on which the ink highlight is painted.
  • InkSplash, which is an ink feature that shows a reaction to user input on a Material.
  • Ink, a convenience widget for drawing images and other decorations on Material widgets.

Implementations§

Source§

impl InkHighlight

Source

pub const DEFAULT_FADE_DURATION: Duration = K_DEFAULT_HIGHLIGHT_FADE_DURATION

The default fade duration of InkHighlight::new: Dart’s _kDefaultHighlightFadeDuration.

Source

pub fn new( app: &mut App, controller: AnyMaterialInkController, reference_box: AnyRenderBox, color: Color, text_direction: TextDirection, shape: BoxShape, radius: Option<f64>, border_radius: Option<BorderRadius>, custom_border: Option<ShapeBorderRef>, rect_callback: Option<RectCallback>, on_removed: Option<Listener>, fade_duration: Duration, ) -> Ref<InkHighlight>

Begin a highlight animation.

The controller argument is typically obtained via Material::of(app, context).

If a rect_callback is given, then it provides the highlight rectangle, otherwise, the highlight rectangle is coincident with the reference_box.

When the highlight is removed, on_removed will be called.

Dart’s defaults: shape BoxShape::Rectangle, border_radius BorderRadius::ZERO, fade_duration InkHighlight::DEFAULT_FADE_DURATION.

Source

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

Whether this part of the material is being visually emphasized.

Source

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

Start visually emphasizing this part of the material.

Source

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

Stop visually emphasizing this part of the material.

Trait Implementations§

Source§

impl InkFeatureLeaf for InkHighlight

Source§

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

Free up the resources associated with this ink feature. Read more
Source§

fn paint_feature( self: Handle<Self>, app: &mut App, canvas: &mut Canvas, transform: &Matrix4, )

Override this method to paint the ink feature. Read more
Source§

impl InkFeatureLeafData for InkHighlight

Source§

fn ink_feature(&self) -> &InkFeatureData

The leaf’s InkFeature bag.
Source§

fn ink_feature_mut(&mut self) -> &mut InkFeatureData

The leaf’s InkFeature bag, mutably.
Source§

impl InteractiveInkFeatureLeaf for InkHighlight

Source§

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

Called when the user input that triggered this feature’s appearance was confirmed. Read more
Source§

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

Called when the user input that triggered this feature’s appearance was canceled. Read more
Source§

impl InteractiveInkFeatureLeafData for InkHighlight

Auto Trait Implementations§

§

impl !RefUnwindSafe for InkHighlight

§

impl !Send for InkHighlight

§

impl !Sync for InkHighlight

§

impl !UnwindSafe for InkHighlight

§

impl Forget for InkHighlight

§

impl Freeze for InkHighlight
where NonZero<u32>: Freeze, PhantomData<fn() -> RenderInkFeatures>: Freeze, &'static RenderBoxVTable: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, *const (): Freeze, *const RcInner<dyn ShapeBorder> is !null: Freeze, PhantomData<RcInner<dyn ShapeBorder>>: Freeze, *const RcInner<dyn Fn(&App) -> Rect> is !null: Freeze, PhantomData<RcInner<dyn Fn(&App) -> Rect>>: Freeze, &'static AnimationVTable<i64>: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, PhantomData<fn() -> AnimationController>: Freeze,

§

impl Move for InkHighlight

§

impl Unpin for InkHighlight
where NonZero<u32>: Unpin, &'static RenderBoxVTable: Unpin, Rc<dyn Fn(&mut App)>: Unpin, *const (): Unpin, Rc<dyn ShapeBorder>: Unpin, Rc<dyn Fn(&App) -> Rect>: Unpin, &'static AnimationVTable<i64>: Unpin, Rc<Keep>: Unpin,

§

impl UnsafeUnpin for InkHighlight
where NonZeroU32Inner: UnsafeUnpin, PhantomData<fn() -> RenderInkFeatures>: UnsafeUnpin, &'static RenderBoxVTable: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn ShapeBorder> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ShapeBorder>>: UnsafeUnpin, *const RcInner<dyn Fn(&App) -> Rect> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&App) -> Rect>>: UnsafeUnpin, &'static AnimationVTable<i64>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, PhantomData<fn() -> AnimationController>: 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<F> InkFeatureObject for F
where F: InkFeatureLeaf,

Source§

fn as_ink_feature(self: Handle<F>) -> AnyInkFeature

This feature as the erased AnyInkFeature — what to pass where a Dart API takes an InkFeature.
Source§

impl<F> InteractiveInkFeatureObject for F

Source§

fn as_interactive_ink_feature(self: Handle<F>) -> AnyInteractiveInkFeature

This feature as the erased AnyInteractiveInkFeature — what to pass where a Dart API takes an InteractiveInkFeature.
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>