Deprecate `ThemeData.indicatorColor` in favor of `TabBarThemeData.indicatorColor`
Summary
#
The ThemeData.indicatorColor
parameter was deprecated in favor of
the TabBarThemeData.indicatorColor
parameter.
Context
#
The defaults for the TabBar
widget can be overridden with a
component-specific theme like TabBarThemeData.
Previously, the ThemeData.indicatorColor parameter was used to
override the default tab bar indicator color in Material Design 2,
which was made redundant by TabBarThemeData.
Description of change
#
The ThemeData.indicatorColor
is deprecated in
favor of a component-specific theme.
Use TabBarThemeData
to override the default indicator color.
Migration guide
#
Replace ThemeData.indicatorColor
with
TabBarThemeData.indicatorColor
to override the default tab bar
indicator color when ThemeData.useMaterial3
flag is set to false.
Code before migration:
theme: ThemeData(
indicatorColor: Colors.red,
useMaterial3: false,
),
Code after migration:
theme: ThemeData(
tabBarTheme: const TabBarThemeData(indicatorColor: Colors.red),
useMaterial3: false,
),
Timeline
#
Landed in version: 3.30.0-0.0.pre
In stable release: 3.32
References
#API documentation:
-
ThemeData.indicatorColor -
ThemeData.useMaterial3 -
TabBarThemeData.indicatorColor -
TabBarThemeData TabBar
Relevant issues:
Relevant PRs:
除非另有说明,本文档之所提及适用于 Flutter 3.38.1 版本。本页面最后更新时间:2025-10-28。查看文档源码 或者 为本页面内容提出建议。