forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
TabBar.textScaler
for tab label upper text scale limit (#…
…147232) fixes [Tab is hardcoding the height of the icons and the text ](flutter/flutter#13322) ### Description This PR introduces `TabBar.textScaler` to provide upper text scale limit for tab label. ### Code sample <details> <summary>expand to view the code sample</summary> ```dart import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @OverRide Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: MediaQuery( data: const MediaQueryData(textScaler: TextScaler.linear(3.0)), child: DefaultTabController( length: 3, child: Scaffold( appBar: AppBar( title: const Text('Sample'), bottom: const TabBar( textScaler: TextScaler.linear(2.0), tabs: <Widget>[ Tab(text: 'Tab 1'), Tab(text: 'Tab 2'), Tab(text: 'Tab 3'), ], ), ), floatingActionButton: Builder(builder: (BuildContext context) { return FloatingActionButton( onPressed: () { print(MediaQuery.textScalerOf(context)); }, child: const Icon(Icons.add), ); }), ), ), ), ); } } ``` </details> ### Without `TabBar.textScaler`  ### With `TabBar.textScaler` ```dart bottom: const TabBar( textScaler: TextScaler.linear(2.0), tabs: <Widget>[ Tab(text: 'Tab 1'), Tab(text: 'Tab 2'), Tab(text: 'Tab 3'), ], ), ``` 
- Loading branch information
1 parent
8796562
commit 74356f3
Showing
4 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters