pub struct DefaultTabController {
pub key: Option<KeyRef>,
pub length: usize,
pub initial_index: usize,
pub animation_duration: Option<Duration>,
pub child: WidgetRef,
}Expand description
The TabController for descendant widgets that don’t specify one
explicitly.
DefaultTabController is an inherited widget that is used to share a
TabController with a TabBar or a TabBarView. It’s used when sharing an
explicitly created TabController isn’t convenient because the tab bar
widgets are created by a stateless parent widget or by different parent
widgets.
Fields§
§key: Option<KeyRef>§length: usizeThe total number of tabs.
Typically greater than one. Must match TabBar::tabs’s and
TabBarView::children’s length.
initial_index: usizeThe initial index of the selected tab.
Defaults to zero.
animation_duration: Option<Duration>Controls the duration of DefaultTabController and TabBarView animations.
Defaults to K_TAB_SCROLL_DURATION.
child: WidgetRefThe widget below this widget in the tree.
Typically a Scaffold whose AppBar includes a TabBar.
Implementations§
Source§impl DefaultTabController
impl DefaultTabController
Sourcepub fn new<K>(length: usize, child: impl IntoWidget<K>) -> DefaultTabController
pub fn new<K>(length: usize, child: impl IntoWidget<K>) -> DefaultTabController
Sourcepub fn key(self, key: KeyRef) -> DefaultTabController
pub fn key(self, key: KeyRef) -> DefaultTabController
Dart DefaultTabController(key:).
Sourcepub fn initial_index(self, initial_index: usize) -> DefaultTabController
pub fn initial_index(self, initial_index: usize) -> DefaultTabController
Dart DefaultTabController(initialIndex:).
Sourcepub fn animation_duration(
self,
animation_duration: Duration,
) -> DefaultTabController
pub fn animation_duration( self, animation_duration: Duration, ) -> DefaultTabController
Dart DefaultTabController(animationDuration:).
Sourcepub fn maybe_of(
app: &mut App,
context: BuildContext,
) -> Option<Ref<TabController>>
pub fn maybe_of( app: &mut App, context: BuildContext, ) -> Option<Ref<TabController>>
The closest instance of DefaultTabController that encloses the given
context, or None if none is found.
Typical usage is as follows:
let controller = DefaultTabController::maybe_of(app, context);Calling this method will create a dependency on the closest
DefaultTabController in the context, if there is one.
See also:
DefaultTabController::of, which is similar to this method, but asserts if noDefaultTabControllerancestor is found.
Sourcepub fn of(app: &mut App, context: BuildContext) -> Ref<TabController>
pub fn of(app: &mut App, context: BuildContext) -> Ref<TabController>
The closest instance of DefaultTabController that encloses the given
context.
If no instance is found, this method will assert in debug mode and throw an exception in release mode.
Calling this method will create a dependency on the closest
DefaultTabController in the context.
Typical usage is as follows:
let controller = DefaultTabController::of(app, context);See also:
DefaultTabController::maybe_of, which is similar to this method, but returnsNoneif noDefaultTabControllerancestor is found.
Trait Implementations§
Source§impl Debug for DefaultTabController
impl Debug for DefaultTabController
Source§impl StatefulWidget for DefaultTabController
impl StatefulWidget for DefaultTabController
Source§type State = DefaultTabControllerState
type State = DefaultTabControllerState
Source§fn create_state(&self) -> DefaultTabControllerState
fn create_state(&self) -> DefaultTabControllerState
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 as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
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 DefaultTabController
impl !Send for DefaultTabController
impl !Sync for DefaultTabController
impl !UnwindSafe for DefaultTabController
impl Forget for DefaultTabController
impl Freeze for DefaultTabController
impl Move for DefaultTabController
impl Unpin for DefaultTabController
impl UnsafeUnpin for DefaultTabControllerwhere
*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<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.