Tab Animation Sample Video (#32177)
* Improve tabs documentation regarding matching lengths
* Add Tabs animation to docs
diff --git a/packages/flutter/lib/src/material/tab_controller.dart b/packages/flutter/lib/src/material/tab_controller.dart
index b8073a1..244813a 100644
--- a/packages/flutter/lib/src/material/tab_controller.dart
+++ b/packages/flutter/lib/src/material/tab_controller.dart
@@ -21,6 +21,8 @@
/// ancestor, a [TabController] can be shared by providing a
/// [DefaultTabController] inherited widget.
///
+/// {@animation 700 540 https://flutter.github.io/assets-for-api-docs/assets/material/tabs.mp4}
+///
/// {@tool sample}
///
/// This widget introduces a [Scaffold] with an [AppBar] and a [TabBar].
@@ -64,7 +66,13 @@
/// body: TabBarView(
/// controller: _tabController,
/// children: myTabs.map((Tab tab) {
-/// return Center(child: Text(tab.text));
+/// final String label = tab.text.toLowerCase();
+/// return Center(
+/// child: Text(
+/// 'This is the $label tab',
+/// style: const TextStyle(fontSize: 36),
+/// ),
+/// );
/// }).toList(),
/// ),
/// );
@@ -76,7 +84,7 @@
/// Creates an object that manages the state required by [TabBar] and a
/// [TabBarView].
///
- /// The [length] must not be null or negative. Typically its a value greater
+ /// The [length] must not be null or negative. Typically it's a value greater
/// than one, i.e. typically there are two or more tabs. The [length] must
/// match [TabBar.tabs]'s and [TabBarView.children]'s length.
///
@@ -134,8 +142,10 @@
Animation<double> get animation => _animationController?.view;
AnimationController _animationController;
- /// The total number of tabs. Typically greater than one. Must match
- /// [TabBar.tabs]'s and [TabBarView.children]'s length.
+ /// The total number of tabs.
+ ///
+ /// Typically greater than one. Must match [TabBar.tabs]'s and
+ /// [TabBarView.children]'s length.
final int length;
void _changeIndex(int value, { Duration duration, Curve curve }) {
@@ -251,6 +261,8 @@
/// widgets are created by a stateless parent widget or by different parent
/// widgets.
///
+/// {@animation 700 540 https://flutter.github.io/assets-for-api-docs/assets/material/tabs.mp4}
+///
/// ```dart
/// class MyDemo extends StatelessWidget {
/// final List<Tab> myTabs = <Tab>[
@@ -270,7 +282,13 @@
/// ),
/// body: TabBarView(
/// children: myTabs.map((Tab tab) {
-/// return Center(child: Text(tab.text));
+/// final String label = tab.text.toLowerCase();
+/// return Center(
+/// child: Text(
+/// 'This is the $label tab',
+/// style: const TextStyle(fontSize: 36),
+/// ),
+/// );
/// }).toList(),
/// ),
/// ),
diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart
index aedd016..b1a109a 100644
--- a/packages/flutter/lib/src/material/tabs.dart
+++ b/packages/flutter/lib/src/material/tabs.dart
@@ -1115,7 +1115,9 @@
/// will be used.
final TabController controller;
- /// One widget per tab. Its length must match the length of the [TabBar.tabs]
+ /// One widget per tab.
+ ///
+ /// Its length must match the length of the [TabBar.tabs]
/// list, as well as the [controller]'s [TabController.length].
final List<Widget> children;