pub struct TextSelectionTheme {
pub key: Option<KeyRef>,
pub data: TextSelectionThemeData,
/* private fields */
}Expand description
An inherited widget that defines the appearance of text selection in this widget’s subtree.
Values specified here are used for TextField and SelectableText
properties that are not given an explicit non-null value.
Here is an example of a text selection theme that applies a blue cursor color with light blue selection handles to the child text field.
TextSelectionTheme::new(
TextSelectionThemeData::new()
.cursor_color(Colors::BLUE.primary())
.selection_handle_color(Colors::LIGHT_BLUE.primary()),
TextField::new(),
)This widget also creates a DefaultSelectionStyle for its subtree with
data.
Fields§
§key: Option<KeyRef>§data: TextSelectionThemeDataThe properties for descendant TextField and SelectableText widgets.
Implementations§
Source§impl TextSelectionTheme
impl TextSelectionTheme
Sourcepub fn new<K>(
data: TextSelectionThemeData,
child: impl IntoWidget<K>,
) -> TextSelectionTheme
pub fn new<K>( data: TextSelectionThemeData, child: impl IntoWidget<K>, ) -> TextSelectionTheme
Creates a text selection theme widget that specifies the text selection properties for all widgets below it in the widget tree.
Sourcepub fn key(self, key: KeyRef) -> TextSelectionTheme
pub fn key(self, key: KeyRef) -> TextSelectionTheme
Dart TextSelectionTheme(key:).
Sourcepub fn of(app: &mut App, context: BuildContext) -> TextSelectionThemeData
pub fn of(app: &mut App, context: BuildContext) -> TextSelectionThemeData
Returns the data from the closest TextSelectionTheme ancestor. If
there is no ancestor, it returns ThemeData::text_selection_theme.
Applications can assume that the returned value will not be null.
Typical usage is as follows:
let theme = TextSelectionTheme::of(app, context);Trait Implementations§
Source§impl Debug for TextSelectionTheme
impl Debug for TextSelectionTheme
Source§impl InheritedTheme for TextSelectionTheme
impl InheritedTheme for TextSelectionTheme
Source§impl InheritedWidget for TextSelectionTheme
impl InheritedWidget for TextSelectionTheme
Source§fn update_should_notify(&self, old_widget: &TextSelectionTheme) -> bool
fn update_should_notify(&self, old_widget: &TextSelectionTheme) -> bool
Source§fn as_inherited_theme(&self) -> Option<&dyn InheritedTheme>
fn as_inherited_theme(&self) -> Option<&dyn InheritedTheme>
this is InheritedTheme: an inherited widget that is an InheritedTheme
answers with itself, which is what InheritedTheme::capture collects.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.Auto Trait Implementations§
impl !RefUnwindSafe for TextSelectionTheme
impl !Send for TextSelectionTheme
impl !Sync for TextSelectionTheme
impl !UnwindSafe for TextSelectionTheme
impl Forget for TextSelectionTheme
impl Freeze for TextSelectionTheme
impl Move for TextSelectionTheme
impl Unpin for TextSelectionTheme
impl UnsafeUnpin for TextSelectionThemewhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: 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<InheritedKind> for Wwhere
W: InheritedWidget,
impl<W> IntoWidget<InheritedKind> for Wwhere
W: InheritedWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.