Skip to main content

Tab

Struct Tab 

Source
pub struct Tab {
    pub key: Option<KeyRef>,
    pub text: Option<String>,
    pub child: Option<WidgetRef>,
    pub icon: Option<WidgetRef>,
    pub icon_margin: Option<EdgeInsetsGeometry>,
    pub height: Option<f64>,
}
Expand description

A Material Design TabBar tab.

If both icon and text are provided, the text is displayed below the icon.

See also:

Fields§

§key: Option<KeyRef>§text: Option<String>

The text to display as the tab’s label.

Must not be used in combination with child.

§child: Option<WidgetRef>

The widget to be used as the tab’s label.

Usually a Text widget, possibly wrapped in a Semantics widget.

Must not be used in combination with text.

§icon: Option<WidgetRef>

An icon to display as the tab’s label.

§icon_margin: Option<EdgeInsetsGeometry>

The margin added around the tab’s icon.

Only useful when used in combination with icon, and either one of text or child is non-null.

Defaults to 2 pixels of bottom margin. If ThemeData::use_material3 is false, then defaults to 10 pixels of bottom margin.

§height: Option<f64>

The height of the Tab.

If null, the height will be calculated based on the content of the Tab. When icon is not null along with child or text, the default height is 72.0 pixels. Without an icon, the height is 46.0 pixels.

The provided tab height cannot be lower than the default height. Use PreferredSize widget to adjust the overall TabBar height and match the provided tab height.

Implementations§

Source§

impl Tab

Source

pub fn new() -> Tab

Creates a Material Design TabBar tab; Dart’s named arguments are the setters.

At least one of text, icon, and child must be non-null. The text and child arguments must not be used at the same time. The icon_margin is only useful when icon and either one of text or child is non-null.

Source

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

Dart Tab(key:).

Source

pub fn text(self, text: impl Into<String>) -> Tab

Dart Tab(text:).

Source

pub fn icon<K>(self, icon: impl IntoWidget<K>) -> Tab

Dart Tab(icon:).

Source

pub fn icon_margin(self, icon_margin: impl Into<EdgeInsetsGeometry>) -> Tab

Dart Tab(iconMargin:).

Source

pub fn height(self, height: f64) -> Tab

Dart Tab(height:).

Source

pub fn child<K>(self, child: impl IntoWidget<K>) -> Tab

Dart Tab(child:).

Trait Implementations§

Source§

impl Debug for Tab

Source§

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

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

impl Default for Tab

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PreferredSizeWidget for Tab

Source§

fn preferred_size(&self) -> AnySize

The size this widget would prefer if it were otherwise unconstrained. Read more
Source§

impl StatelessWidget for Tab

Source§

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

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)

Dart’s constructor asserts that relate two or more arguments. Read more
Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Dart’s 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.
Source§

fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef

Describes the part of the user interface represented by this widget. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tab

§

impl !Send for Tab

§

impl !Sync for Tab

§

impl !UnwindSafe for Tab

§

impl Forget for Tab

§

impl Freeze for Tab
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for Tab

§

impl Unpin for Tab
where Rc<dyn Key>: Unpin, *const u8 is !null: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for Tab
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: 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<StatelessKind> for W
where W: StatelessWidget,

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>