Skip to content

Commit 0167f02

Browse files
authored
Update Tab.height parameter doc for tab height lower than default (#157443)
Fixes [TabBar.height adds a gap between the AppBar.toolbar and AppBar.bottom](flutter/flutter#156200)
1 parent 6bef61a commit 0167f02

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/flutter/lib/src/material/tabs.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,31 @@ class Tab extends StatelessWidget implements PreferredSizeWidget {
159159
/// If null, the height will be calculated based on the content of the [Tab]. When `icon` is not
160160
/// null along with `child` or `text`, the default height is 72.0 pixels. Without an `icon`, the
161161
/// height is 46.0 pixels.
162+
///
163+
/// {@tool snippet}
164+
///
165+
/// The provided tab height cannot be lower than the default height. Use
166+
/// [PreferredSize] widget to adjust the overall [TabBar] height and match
167+
/// the provided tab [height]:
168+
///
169+
/// ```dart
170+
/// bottom: const PreferredSize(
171+
/// preferredSize: Size.fromHeight(20.0),
172+
/// child: TabBar(
173+
/// tabs: <Widget>[
174+
/// Tab(
175+
/// text: 'Tab 1',
176+
/// height: 20.0,
177+
/// ),
178+
/// Tab(
179+
/// text: 'Tab 2',
180+
/// height: 20.0,
181+
/// ),
182+
/// ],
183+
/// ),
184+
/// ),
185+
/// ```
186+
/// {@end-tool}
162187
final double? height;
163188

164189
Widget _buildLabelText() {

0 commit comments

Comments
 (0)