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:
TabBar, which displays a row of tabs.TabBarView, which displays a widget for the currently selected tab.TabController, which coordinates tab selection between aTabBarand aTabBarView.- https://material.io/design/components/tabs.html
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
impl Tab
Sourcepub fn icon<K>(self, icon: impl IntoWidget<K>) -> Tab
pub fn icon<K>(self, icon: impl IntoWidget<K>) -> Tab
Dart Tab(icon:).
Sourcepub fn icon_margin(self, icon_margin: impl Into<EdgeInsetsGeometry>) -> Tab
pub fn icon_margin(self, icon_margin: impl Into<EdgeInsetsGeometry>) -> Tab
Dart Tab(iconMargin:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> Tab
pub fn child<K>(self, child: impl IntoWidget<K>) -> Tab
Dart Tab(child:).
Trait Implementations§
Source§impl PreferredSizeWidget for Tab
impl PreferredSizeWidget for Tab
Source§fn preferred_size(&self) -> AnySize
fn preferred_size(&self) -> AnySize
Source§impl StatelessWidget for Tab
impl StatelessWidget for Tab
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 debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
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.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
impl Move for Tab
impl Unpin for Tab
impl UnsafeUnpin for Tabwhere
*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> 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<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.