From 0167f02e90c14ea5f476398d2fe7f1d3bbaedd8e Mon Sep 17 00:00:00 2001 From: Taha Tesser Date: Thu, 24 Oct 2024 12:43:36 +0300 Subject: [PATCH] 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](https://github.com/flutter/flutter/issues/156200) --- packages/flutter/lib/src/material/tabs.dart | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index d16a3369ff2..f6ab83a1426 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -159,6 +159,31 @@ class Tab extends StatelessWidget implements PreferredSizeWidget { /// 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. + /// + /// {@tool snippet} + /// + /// 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]: + /// + /// ```dart + /// bottom: const PreferredSize( + /// preferredSize: Size.fromHeight(20.0), + /// child: TabBar( + /// tabs: [ + /// Tab( + /// text: 'Tab 1', + /// height: 20.0, + /// ), + /// Tab( + /// text: 'Tab 2', + /// height: 20.0, + /// ), + /// ], + /// ), + /// ), + /// ``` + /// {@end-tool} final double? height; Widget _buildLabelText() {