Skip to main content

ElevatedButtonTheme

Struct ElevatedButtonTheme 

Source
pub struct ElevatedButtonTheme {
    pub key: Option<KeyRef>,
    pub data: ElevatedButtonThemeData,
    pub child: WidgetRef,
}
Expand description

Overrides the default ButtonStyle of its ElevatedButton descendants.

See also:

  • ElevatedButtonThemeData, which is used to configure this theme.
  • ElevatedButton::default_style_of, which returns the default ButtonStyle for elevated buttons.
  • ElevatedButton::style_from, which converts simple values into a ButtonStyle that’s consistent with ElevatedButton’s defaults.
  • ThemeData::elevated_button_theme, which can be used to override the default ButtonStyle for ElevatedButtons below the overall Theme.

Fields§

§key: Option<KeyRef>§data: ElevatedButtonThemeData

The configuration of this theme.

§child: WidgetRef

Implementations§

Source§

impl ElevatedButtonTheme

Source

pub fn new<K>( data: ElevatedButtonThemeData, child: impl IntoWidget<K>, ) -> ElevatedButtonTheme

Source

pub fn key(self, key: KeyRef) -> ElevatedButtonTheme

Dart ElevatedButtonTheme(key:).

Source

pub fn of(app: &mut App, context: BuildContext) -> ElevatedButtonThemeData

Retrieves the ElevatedButtonThemeData from the closest ancestor ElevatedButtonTheme.

If there is no enclosing ElevatedButtonTheme widget, then ThemeData::elevated_button_theme is used.

The returned ElevatedButtonThemeData::variant is the value specified by that theme, which can be null even when an ancestor specifies a variant. Use variant_of to get the variant that applies at the given context.

Typical usage is as follows:

let theme = ElevatedButtonTheme::of(app, context);
Source

pub fn variant_of(app: &mut App, context: BuildContext) -> StyleVariant

Returns the StyleVariant that ElevatedButtons use at the given context.

The closest enclosing ElevatedButtonTheme whose ElevatedButtonThemeData::variant is non-null determines the variant, so an ElevatedButtonTheme that doesn’t specify a variant inherits it from its ancestors. If none of the enclosing ElevatedButtonThemes specify a variant, the variant of ThemeData::elevated_button_theme is used. If that is also null, StyleVariant::Material3 is returned.

Typical usage is as follows:

let variant = ElevatedButtonTheme::variant_of(app, context);

Trait Implementations§

Source§

impl Debug for ElevatedButtonTheme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl InheritedTheme for ElevatedButtonTheme

Source§

fn wrap( &self, _app: &mut App, _context: BuildContext, child: WidgetRef, ) -> WidgetRef

Return a copy of this inherited theme with the specified child. Read more
Source§

impl InheritedWidget for ElevatedButtonTheme

Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn child(&self) -> &WidgetRef

The widget below this widget in the tree.
Source§

fn update_should_notify(&self, old_widget: &ElevatedButtonTheme) -> bool

Whether the framework should notify widgets that inherit from this widget. Read more
Source§

fn as_inherited_theme(&self) -> Option<&dyn InheritedTheme>

Dart’s 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, )

Dart’s 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)

Auto Trait Implementations§

§

impl !RefUnwindSafe for ElevatedButtonTheme

§

impl !Send for ElevatedButtonTheme

§

impl !Sync for ElevatedButtonTheme

§

impl !UnwindSafe for ElevatedButtonTheme

§

impl Forget for ElevatedButtonTheme

§

impl Freeze for ElevatedButtonTheme
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Size>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Size>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: Freeze, *const RcInner<dyn InteractiveInkFeatureFactory> is !null: Freeze, PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>>>: Freeze, *const (): Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for ElevatedButtonTheme

§

impl Unpin for ElevatedButtonTheme

§

impl UnsafeUnpin for ElevatedButtonTheme
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Size>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Size>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: UnsafeUnpin, *const RcInner<dyn InteractiveInkFeatureFactory> is !null: UnsafeUnpin, PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>>>: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: 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<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<W> IntoWidget<InheritedKind> for W
where W: InheritedWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
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>