pub struct Shortcuts {
pub key: Option<KeyRef>,
pub manager: Option<ShortcutManagerRef>,
pub child: WidgetRef,
pub debug_label: Option<String>,
pub include_semantics: bool,
/* private fields */
}Expand description
A widget that creates key bindings to specific actions for its descendants.
This widget establishes a ShortcutManager to be used by its descendants when invoking an
Action via a keyboard key combination that maps to an Intent.
This is similar to but more powerful than the CallbackShortcuts widget. Unlike
CallbackShortcuts, this widget separates key bindings and their implementations. This
separation allows Shortcuts to have key bindings that adapt to the focused context.
See also:
CallbackShortcuts, a simpler but less flexible widget that defines key bindings that invoke callbacks.Intent, a trait for values containing a description of a user action to be invoked.Action, a trait for defining an invocation of a user action.CallbackAction, a class for creating an action from a callback.
Fields§
§key: Option<KeyRef>See Widget::key.
manager: Option<ShortcutManagerRef>The ShortcutManagerBase that will manage the mapping between key combinations and
Actions.
If this widget was created with Shortcuts::manager, then
ShortcutManagerBase::shortcuts will be used as the source for shortcuts. If
Shortcuts::new is used, this manager will be None, and a default-constructed
ShortcutManager will be used.
child: WidgetRefThe widget below this widget in the tree.
debug_label: Option<String>The debug label that is printed for this node when logged.
If this label is set, then it will be displayed instead of the shortcut map when logged.
include_semantics: boolWhether to include semantics from Focus.
Defaults to true.
Implementations§
Source§impl Shortcuts
impl Shortcuts
Sourcepub fn new<K>(shortcuts: ShortcutMap, child: impl IntoWidget<K>) -> Shortcuts
pub fn new<K>(shortcuts: ShortcutMap, child: impl IntoWidget<K>) -> Shortcuts
Creates a Shortcuts widget that owns the map of shortcuts and creates its own
manager.
When using this constructor, manager is None.
See also:
Shortcuts::manager, a constructor that uses aShortcutManagerBaseto manage the shortcuts list instead.
Sourcepub fn manager<K>(
manager: ShortcutManagerRef,
child: impl IntoWidget<K>,
) -> Shortcuts
pub fn manager<K>( manager: ShortcutManagerRef, child: impl IntoWidget<K>, ) -> Shortcuts
Creates a Shortcuts widget that uses the manager to manage the map of shortcuts.
If this constructor is used, get_shortcuts will return the
contents of ShortcutManagerBase::shortcuts.
Sourcepub fn debug_label(self, debug_label: impl Into<String>) -> Shortcuts
pub fn debug_label(self, debug_label: impl Into<String>) -> Shortcuts
Dart Shortcuts(debugLabel:).
Sourcepub fn include_semantics(self, include_semantics: bool) -> Shortcuts
pub fn include_semantics(self, include_semantics: bool) -> Shortcuts
Dart Shortcuts(includeSemantics:).
Sourcepub fn get_shortcuts(&self, app: &App) -> ShortcutMap
pub fn get_shortcuts(&self, app: &App) -> 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.
Trait Implementations§
Source§impl StatefulWidget for Shortcuts
impl StatefulWidget for Shortcuts
Source§type State = ShortcutsState
type State = ShortcutsState
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) -> ShortcutsState
fn create_state(&self) -> ShortcutsState
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 Shortcuts
impl !Send for Shortcuts
impl !Sync for Shortcuts
impl !UnwindSafe for Shortcuts
impl Forget for Shortcuts
impl Freeze for Shortcutswhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
NonZero<u32>: Freeze,
&'static ShortcutManagerVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: Freeze,
impl Move for Shortcuts
impl Unpin for Shortcuts
impl UnsafeUnpin for Shortcutswhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
&'static ShortcutManagerVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: 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.