pub struct InkWell {
pub ink_response: InkResponse,
}Expand description
A rectangular area of a Material that responds to touch.
For a variant of this widget that does not clip splashes, see InkResponse.
The InkWell widget must have a Material widget as an ancestor. The
Material widget is where the ink reactions are actually painted. This
matches the Material Design premise wherein the Material is what is
actually reacting to touches by spreading ink.
If a Widget uses this class directly, it should include the following line
at the top of its build function to call debug_check_has_material:
debug_assert!(debug_check_has_material(app, context));§Troubleshooting
§The ink splashes aren’t visible!
If there is an opaque graphic, e.g. painted using a Container, Image, or
DecoratedBox, between the Material widget and the InkWell widget, then
the splash won’t be visible because it will be under the opaque graphic.
This is because ink splashes draw on the underlying Material itself, as
if the ink was spreading inside the material.
The Ink widget can be used as a replacement for Image, Container, or
DecoratedBox to ensure that the image or decoration also paints in the
Material itself, below the ink.
If this is not possible for some reason, e.g. because you are using an
opaque CustomPaint widget, alternatively consider using a second
Material above the opaque widget but below the InkWell (as an
ancestor to the ink well). The MaterialType::Transparency
material kind can be used for this purpose.
§InkWell isn’t clipping properly
If you want to clip an InkWell or any Ink widgets you need to keep in mind
that the Material that the Ink will be printed on is responsible for clipping.
This means you can’t wrap the Ink widget in a clipping widget directly,
since this will leave the Material not clipped (and by extension the printed
Ink widgets as well).
An easy solution is to deliberately wrap the Ink widgets you want to clip
in a Material, and wrap that in a clipping widget instead. See Ink for
an example.
§The ink splashes don’t track the size of an animated container
If the size of an InkWell’s Material ancestor changes while the InkWell’s
splashes are expanding, you may notice that the splashes aren’t clipped
correctly. This can’t be avoided.
An InkWell’s splashes will not properly update to conform to changes if the
size of its underlying Material, where the splashes are rendered, changes
during animation. You should avoid using InkWells within Material widgets
that are changing size.
See also:
GestureDetector, for listening for gestures without ink splashes.ElevatedButtonandTextButton, two kinds of buttons in Material Design.InkResponse, a variant ofInkWellthat doesn’t force a rectangular shape on the ink reaction.
Fields§
§ink_response: InkResponseDart’s extends InkResponse: the fields it inherits.
Implementations§
Source§impl InkWell
impl InkWell
Sourcepub fn new() -> InkWell
pub fn new() -> InkWell
Creates an ink well; Dart’s named arguments are the setters.
Must have an ancestor Material widget in which to cause ink reactions.
Sourcepub fn on_tap(self, on_tap: GestureTapCallback) -> InkWell
pub fn on_tap(self, on_tap: GestureTapCallback) -> InkWell
Dart InkWell(on_tap:).
Sourcepub fn on_tap_down(self, on_tap_down: GestureTapDownCallback) -> InkWell
pub fn on_tap_down(self, on_tap_down: GestureTapDownCallback) -> InkWell
Dart InkWell(on_tap_down:).
Sourcepub fn on_tap_up(self, on_tap_up: GestureTapUpCallback) -> InkWell
pub fn on_tap_up(self, on_tap_up: GestureTapUpCallback) -> InkWell
Dart InkWell(on_tap_up:).
Sourcepub fn on_tap_cancel(self, on_tap_cancel: GestureTapCallback) -> InkWell
pub fn on_tap_cancel(self, on_tap_cancel: GestureTapCallback) -> InkWell
Dart InkWell(on_tap_cancel:).
Sourcepub fn on_double_tap(self, on_double_tap: GestureTapCallback) -> InkWell
pub fn on_double_tap(self, on_double_tap: GestureTapCallback) -> InkWell
Dart InkWell(on_double_tap:).
Sourcepub fn on_long_press(self, on_long_press: GestureLongPressCallback) -> InkWell
pub fn on_long_press(self, on_long_press: GestureLongPressCallback) -> InkWell
Dart InkWell(on_long_press:).
Sourcepub fn on_long_press_up(
self,
on_long_press_up: GestureLongPressUpCallback,
) -> InkWell
pub fn on_long_press_up( self, on_long_press_up: GestureLongPressUpCallback, ) -> InkWell
Dart InkWell(on_long_press_up:).
Sourcepub fn on_secondary_tap(self, on_secondary_tap: GestureTapCallback) -> InkWell
pub fn on_secondary_tap(self, on_secondary_tap: GestureTapCallback) -> InkWell
Dart InkWell(on_secondary_tap:).
Sourcepub fn on_secondary_tap_up(
self,
on_secondary_tap_up: GestureTapUpCallback,
) -> InkWell
pub fn on_secondary_tap_up( self, on_secondary_tap_up: GestureTapUpCallback, ) -> InkWell
Dart InkWell(on_secondary_tap_up:).
Sourcepub fn on_secondary_tap_down(
self,
on_secondary_tap_down: GestureTapDownCallback,
) -> InkWell
pub fn on_secondary_tap_down( self, on_secondary_tap_down: GestureTapDownCallback, ) -> InkWell
Dart InkWell(on_secondary_tap_down:).
Sourcepub fn on_secondary_tap_cancel(
self,
on_secondary_tap_cancel: GestureTapCallback,
) -> InkWell
pub fn on_secondary_tap_cancel( self, on_secondary_tap_cancel: GestureTapCallback, ) -> InkWell
Dart InkWell(on_secondary_tap_cancel:).
Sourcepub fn on_tertiary_tap_up(
self,
on_tertiary_tap_up: GestureTapUpCallback,
) -> InkWell
pub fn on_tertiary_tap_up( self, on_tertiary_tap_up: GestureTapUpCallback, ) -> InkWell
Dart InkWell(on_tertiary_tap_up:).
Sourcepub fn on_tertiary_tap_down(
self,
on_tertiary_tap_down: GestureTapDownCallback,
) -> InkWell
pub fn on_tertiary_tap_down( self, on_tertiary_tap_down: GestureTapDownCallback, ) -> InkWell
Dart InkWell(on_tertiary_tap_down:).
Sourcepub fn on_tertiary_tap_cancel(
self,
on_tertiary_tap_cancel: GestureTapCancelCallback,
) -> InkWell
pub fn on_tertiary_tap_cancel( self, on_tertiary_tap_cancel: GestureTapCancelCallback, ) -> InkWell
Dart InkWell(on_tertiary_tap_cancel:).
Sourcepub fn on_highlight_changed(
self,
on_highlight_changed: ValueChanged<bool>,
) -> InkWell
pub fn on_highlight_changed( self, on_highlight_changed: ValueChanged<bool>, ) -> InkWell
Dart InkWell(on_highlight_changed:).
Sourcepub fn on_hover(self, on_hover: ValueChanged<bool>) -> InkWell
pub fn on_hover(self, on_hover: ValueChanged<bool>) -> InkWell
Dart InkWell(on_hover:).
Sourcepub fn mouse_cursor(self, mouse_cursor: MouseCursorRef) -> InkWell
pub fn mouse_cursor(self, mouse_cursor: MouseCursorRef) -> InkWell
Dart InkWell(mouse_cursor:).
Sourcepub fn border_radius(self, border_radius: BorderRadius) -> InkWell
pub fn border_radius(self, border_radius: BorderRadius) -> InkWell
Dart InkWell(border_radius:).
Sourcepub fn focus_color(self, focus_color: Color) -> InkWell
pub fn focus_color(self, focus_color: Color) -> InkWell
Dart InkWell(focus_color:).
Sourcepub fn hover_color(self, hover_color: Color) -> InkWell
pub fn hover_color(self, hover_color: Color) -> InkWell
Dart InkWell(hover_color:).
Sourcepub fn highlight_color(self, highlight_color: Color) -> InkWell
pub fn highlight_color(self, highlight_color: Color) -> InkWell
Dart InkWell(highlight_color:).
Sourcepub fn overlay_color(
self,
overlay_color: WidgetStatePropertyRef<Option<Color>>,
) -> InkWell
pub fn overlay_color( self, overlay_color: WidgetStatePropertyRef<Option<Color>>, ) -> InkWell
Dart InkWell(overlay_color:).
Sourcepub fn splash_color(self, splash_color: Color) -> InkWell
pub fn splash_color(self, splash_color: Color) -> InkWell
Dart InkWell(splash_color:).
Sourcepub fn splash_factory(
self,
splash_factory: InteractiveInkFeatureFactoryRef,
) -> InkWell
pub fn splash_factory( self, splash_factory: InteractiveInkFeatureFactoryRef, ) -> InkWell
Dart InkWell(splash_factory:).
Sourcepub fn on_focus_change(self, on_focus_change: ValueChanged<bool>) -> InkWell
pub fn on_focus_change(self, on_focus_change: ValueChanged<bool>) -> InkWell
Dart InkWell(on_focus_change:).
Sourcepub fn focus_node(self, focus_node: FocusNodeRef) -> InkWell
pub fn focus_node(self, focus_node: FocusNodeRef) -> InkWell
Dart InkWell(focus_node:).
Sourcepub fn states_controller(
self,
states_controller: Ref<MaterialStatesController>,
) -> InkWell
pub fn states_controller( self, states_controller: Ref<MaterialStatesController>, ) -> InkWell
Dart InkWell(states_controller:).
Sourcepub fn hover_duration(self, hover_duration: Duration) -> InkWell
pub fn hover_duration(self, hover_duration: Duration) -> InkWell
Dart InkWell(hover_duration:).
Sourcepub fn enable_feedback(self, enable_feedback: bool) -> InkWell
pub fn enable_feedback(self, enable_feedback: bool) -> InkWell
Dart InkWell(enable_feedback:).
Sourcepub fn exclude_from_semantics(self, exclude_from_semantics: bool) -> InkWell
pub fn exclude_from_semantics(self, exclude_from_semantics: bool) -> InkWell
Dart InkWell(exclude_from_semantics:).
Sourcepub fn can_request_focus(self, can_request_focus: bool) -> InkWell
pub fn can_request_focus(self, can_request_focus: bool) -> InkWell
Dart InkWell(can_request_focus:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> InkWell
pub fn child<K>(self, child: impl IntoWidget<K>) -> InkWell
Dart InkWell(child:).
Sourcepub fn custom_border(self, custom_border: impl Into<ShapeBorderRef>) -> InkWell
pub fn custom_border(self, custom_border: impl Into<ShapeBorderRef>) -> InkWell
Dart InkWell(customBorder:).
Sourcepub fn override_get_rect_callback(
self,
get_rect_callback: impl Fn(&App, AnyRenderBox) -> Option<RectCallback> + 'static,
) -> InkWell
pub fn override_get_rect_callback( self, get_rect_callback: impl Fn(&App, AnyRenderBox) -> Option<RectCallback> + 'static, ) -> InkWell
Dart’s override of getRectCallback in a subclass: see
InkResponse::get_rect_callback.
Sourcepub fn override_debug_check_context(
self,
debug_check_context: impl Fn(&App, BuildContext) -> bool + 'static,
) -> InkWell
pub fn override_debug_check_context( self, debug_check_context: impl Fn(&App, BuildContext) -> bool + 'static, ) -> InkWell
Dart’s override of debugCheckContext in a subclass: see
InkResponse::debug_check_context.
Dart’s method is @mustCallSuper: debug_check_context also runs
InkResponse::debug_check_context.
Trait Implementations§
Source§impl StatelessWidget for InkWell
impl StatelessWidget for InkWell
Source§fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef
fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef
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 debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for InkWell
impl !Send for InkWell
impl !Sync for InkWell
impl !UnwindSafe for InkWell
impl Forget for InkWell
impl Freeze for InkWellwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<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 Fn(&mut App, TapDownDetails)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, TapDownDetails)>>: Freeze,
*const RcInner<dyn Fn(&mut App, TapUpDetails)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, TapUpDetails)>>: Freeze,
*const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze,
*const RcInner<dyn MouseCursor> is !null: Freeze,
PhantomData<RcInner<dyn MouseCursor>>: Freeze,
*const RcInner<dyn ShapeBorder> is !null: Freeze,
PhantomData<RcInner<dyn ShapeBorder>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze,
*const RcInner<dyn InteractiveInkFeatureFactory> is !null: Freeze,
PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: Freeze,
&'static FocusNodeVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
PhantomData<fn() -> WidgetStatesController>: Freeze,
*const RcInner<dyn Fn(&App, AnyRenderBox) -> Option<Rc<dyn Fn(&App) -> Rect>>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&App, AnyRenderBox) -> Option<Rc<dyn Fn(&App) -> Rect>>>>: Freeze,
*const RcInner<dyn Fn(&App, AnyElement) -> bool> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&App, AnyElement) -> bool>>: Freeze,
impl Move for InkWell
impl Unpin for InkWellwhere
Rc<dyn Key>: Unpin,
Rc<dyn Widget>: Unpin,
Rc<dyn Fn(&mut App)>: Unpin,
NonZero<u32>: Unpin,
*const (): Unpin,
Rc<dyn Fn(&mut App, TapDownDetails)>: Unpin,
Rc<dyn Fn(&mut App, TapUpDetails)>: Unpin,
Rc<dyn Fn(&mut App, bool)>: Unpin,
Rc<dyn MouseCursor>: Unpin,
Rc<dyn ShapeBorder>: Unpin,
Rc<dyn WidgetStateProperty<Option<Color>>>: Unpin,
Rc<dyn InteractiveInkFeatureFactory>: Unpin,
&'static FocusNodeVTable: Unpin,
Rc<Keep>: Unpin,
Rc<dyn Fn(&App, AnyRenderBox) -> Option<Rc<dyn Fn(&App) -> Rect>>>: Unpin,
Rc<dyn Fn(&App, AnyElement) -> bool>: Unpin,
impl UnsafeUnpin for InkWellwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<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 Fn(&mut App, TapDownDetails)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, TapDownDetails)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, TapUpDetails)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, TapUpDetails)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin,
*const RcInner<dyn MouseCursor> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn MouseCursor>>: UnsafeUnpin,
*const RcInner<dyn ShapeBorder> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ShapeBorder>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: UnsafeUnpin,
*const RcInner<dyn InteractiveInkFeatureFactory> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: UnsafeUnpin,
&'static FocusNodeVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
PhantomData<fn() -> WidgetStatesController>: UnsafeUnpin,
*const RcInner<dyn Fn(&App, AnyRenderBox) -> Option<Rc<dyn Fn(&App) -> Rect>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&App, AnyRenderBox) -> Option<Rc<dyn Fn(&App) -> Rect>>>>: UnsafeUnpin,
*const RcInner<dyn Fn(&App, AnyElement) -> bool> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&App, AnyElement) -> bool>>: 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.