pub struct FocusableActionDetector {Show 14 fields
pub key: Option<KeyRef>,
pub enabled: bool,
pub focus_node: Option<FocusNodeRef>,
pub autofocus: bool,
pub descendants_are_focusable: bool,
pub descendants_are_traversable: bool,
pub actions: Option<HashMap<TypeId, ActionRef>>,
pub shortcuts: Option<ShortcutMap>,
pub on_show_focus_highlight: Option<ValueChanged<bool>>,
pub on_show_hover_highlight: Option<ValueChanged<bool>>,
pub on_focus_change: Option<ValueChanged<bool>>,
pub mouse_cursor: MouseCursorRef,
pub include_focus_semantics: bool,
pub child: WidgetRef,
}Expand description
A widget that combines the functionality of Actions, Shortcuts, MouseRegion and a
Focus widget to create a detector that defines actions and key bindings, and provides
callbacks for handling focus and hover highlights.
This widget can be used to give a control the required detection modes for focus and hover handling. It is most often used when authoring a new control widget, and the new control should be enabled for keyboard traversal and activation.
This widget doesn’t have any visual representation, it is just a detector that provides focus and hover capabilities.
It hosts its own FocusNode or uses focus_node, if given.
Fields§
§key: Option<KeyRef>See Widget::key.
enabled: boolIs this widget enabled or not.
If disabled, will not send any notifications needed to update highlight or focus state, and will not define or respond to any actions or shortcuts.
When disabled, adds Focus to the widget tree, but sets Focus::can_request_focus to
false.
focus_node: Option<FocusNodeRef>An optional focus node to use as the focus node for this widget.
autofocus: boolTrue if this widget will be selected as the initial focus when no other node in its scope is currently focused.
descendants_are_focusable: boolIf false, will make this widget’s descendants unfocusable.
descendants_are_traversable: boolIf false, will make this widget’s descendants untraversable.
actions: Option<HashMap<TypeId, ActionRef>>§shortcuts: Option<ShortcutMap>The map of shortcuts that describes the mapping between a key sequence defined by a
ShortcutActivator and the Intent that will be emitted when that key sequence is
pressed.
on_show_focus_highlight: Option<ValueChanged<bool>>A function that will be called when the focus highlight should be shown or hidden.
This method is not triggered at the unmount of the widget.
on_show_hover_highlight: Option<ValueChanged<bool>>A function that will be called when the hover highlight should be shown or hidden.
This method is not triggered at the unmount of the widget.
on_focus_change: Option<ValueChanged<bool>>A function that will be called when the focus changes.
Called with true if the focus_node has primary focus.
mouse_cursor: MouseCursorRefThe cursor for a mouse pointer when it enters or is hovering over the widget.
The mouse_cursor defaults to MouseCursor.defer, deferring the
choice of cursor to the next region behind it in hit-test order.
include_focus_semantics: boolWhether to include semantics from Focus.
Defaults to true.
child: WidgetRefThe child widget for this FocusableActionDetector widget.
Implementations§
Source§impl FocusableActionDetector
impl FocusableActionDetector
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> FocusableActionDetector
pub fn new<K>(child: impl IntoWidget<K>) -> FocusableActionDetector
Creates a FocusableActionDetector.
Sourcepub fn key(self, key: KeyRef) -> FocusableActionDetector
pub fn key(self, key: KeyRef) -> FocusableActionDetector
Dart FocusableActionDetector(key:).
Sourcepub fn enabled(self, enabled: bool) -> FocusableActionDetector
pub fn enabled(self, enabled: bool) -> FocusableActionDetector
Dart FocusableActionDetector(enabled:).
Sourcepub fn focus_node(self, focus_node: FocusNodeRef) -> FocusableActionDetector
pub fn focus_node(self, focus_node: FocusNodeRef) -> FocusableActionDetector
Dart FocusableActionDetector(focusNode:).
Sourcepub fn autofocus(self, autofocus: bool) -> FocusableActionDetector
pub fn autofocus(self, autofocus: bool) -> FocusableActionDetector
Dart FocusableActionDetector(autofocus:).
Sourcepub fn descendants_are_focusable(
self,
descendants_are_focusable: bool,
) -> FocusableActionDetector
pub fn descendants_are_focusable( self, descendants_are_focusable: bool, ) -> FocusableActionDetector
Dart FocusableActionDetector(descendantsAreFocusable:).
Sourcepub fn descendants_are_traversable(
self,
descendants_are_traversable: bool,
) -> FocusableActionDetector
pub fn descendants_are_traversable( self, descendants_are_traversable: bool, ) -> FocusableActionDetector
Dart FocusableActionDetector(descendantsAreTraversable:).
Sourcepub fn actions(
self,
actions: HashMap<TypeId, ActionRef>,
) -> FocusableActionDetector
pub fn actions( self, actions: HashMap<TypeId, ActionRef>, ) -> FocusableActionDetector
Dart FocusableActionDetector(actions:).
Sourcepub fn shortcuts(self, shortcuts: ShortcutMap) -> FocusableActionDetector
pub fn shortcuts(self, shortcuts: ShortcutMap) -> FocusableActionDetector
Dart FocusableActionDetector(shortcuts:).
Sourcepub fn on_show_focus_highlight(
self,
on_show_focus_highlight: impl Fn(&mut App, bool) + 'static,
) -> FocusableActionDetector
pub fn on_show_focus_highlight( self, on_show_focus_highlight: impl Fn(&mut App, bool) + 'static, ) -> FocusableActionDetector
Dart FocusableActionDetector(onShowFocusHighlight:).
Sourcepub fn on_show_hover_highlight(
self,
on_show_hover_highlight: impl Fn(&mut App, bool) + 'static,
) -> FocusableActionDetector
pub fn on_show_hover_highlight( self, on_show_hover_highlight: impl Fn(&mut App, bool) + 'static, ) -> FocusableActionDetector
Dart FocusableActionDetector(onShowHoverHighlight:).
Sourcepub fn on_focus_change(
self,
on_focus_change: impl Fn(&mut App, bool) + 'static,
) -> FocusableActionDetector
pub fn on_focus_change( self, on_focus_change: impl Fn(&mut App, bool) + 'static, ) -> FocusableActionDetector
Dart FocusableActionDetector(onFocusChange:).
Sourcepub fn mouse_cursor(
self,
mouse_cursor: MouseCursorRef,
) -> FocusableActionDetector
pub fn mouse_cursor( self, mouse_cursor: MouseCursorRef, ) -> FocusableActionDetector
Dart FocusableActionDetector(mouseCursor:).
Sourcepub fn include_focus_semantics(
self,
include_focus_semantics: bool,
) -> FocusableActionDetector
pub fn include_focus_semantics( self, include_focus_semantics: bool, ) -> FocusableActionDetector
Dart FocusableActionDetector(includeFocusSemantics:).
Trait Implementations§
Source§impl Debug for FocusableActionDetector
impl Debug for FocusableActionDetector
Source§impl StatefulWidget for FocusableActionDetector
impl StatefulWidget for FocusableActionDetector
Source§type State = FocusableActionDetectorState
type State = FocusableActionDetectorState
Source§fn create_state(&self) -> FocusableActionDetectorState
fn create_state(&self) -> FocusableActionDetectorState
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 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 FocusableActionDetector
impl !Send for FocusableActionDetector
impl !Sync for FocusableActionDetector
impl !UnwindSafe for FocusableActionDetector
impl Forget for FocusableActionDetector
impl Freeze for FocusableActionDetectorwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
NonZero<u32>: Freeze,
&'static FocusNodeVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<(TypeId, Retained<AnyAction>)>: Freeze,
PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: 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 Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for FocusableActionDetector
impl Unpin for FocusableActionDetectorwhere
Rc<dyn Key>: Unpin,
NonZero<u32>: Unpin,
&'static FocusNodeVTable: Unpin,
Rc<Keep>: Unpin,
*const u8 is !null: Unpin,
*const (): Unpin,
&'static ActionVTable: Unpin,
Rc<dyn ShortcutActivator>: Unpin,
Rc<dyn Intent>: Unpin,
Rc<dyn Fn(&mut App, bool)>: Unpin,
Rc<dyn MouseCursor>: Unpin,
Rc<dyn Widget>: Unpin,
impl UnsafeUnpin for FocusableActionDetectorwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
&'static FocusNodeVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(TypeId, Retained<AnyAction>)>: UnsafeUnpin,
PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: 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 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.