# Deprecate `ThemeData.indicatorColor` in favor of `TabBarThemeData.indicatorColor`

> The `ThemeData.indicatorColor` parameter has been replaced by `TabBarThemeData.indicatorColor`.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## 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:

```dart
theme: ThemeData(
  indicatorColor: Colors.red,
  useMaterial3: false,
),
```

Code after migration:

```dart
theme: ThemeData(
  tabBarTheme: const TabBarThemeData(indicatorColor: Colors.red),
  useMaterial3: false,
),
```

## Timeline

Landed in version: 3.30.0-0.0.pre<br>
In stable release: 3.32

## References

API documentation:

- [`ThemeData.indicatorColor`][]
- [`ThemeData.useMaterial3`][]
- [`TabBarThemeData.indicatorColor`][]
- [`TabBarThemeData`][]
- [`TabBar`][]

Relevant issues:

- [Issue #91772][]

Relevant PRs:

- [Deprecate `ThemeData.indicatorColor` in favor of `TabBarThemeData.indicatorColor`][]

[`ThemeData.indicatorColor`]: https://api.flutter-io.cn/flutter/material/ThemeData/indicatorColor.html
[`ThemeData.useMaterial3`]: https://api.flutter-io.cn/flutter/material/ThemeData/useMaterial3.html
[`TabBarThemeData.indicatorColor`]: https://api.flutter-io.cn/flutter/material/TabBarThemeData/indicatorColor.html
[`TabBarThemeData`]: https://api.flutter-io.cn/flutter/material/TabBarThemeData-class.html
[`TabBar`]: https://api.flutter-io.cn/flutter/material/TabBar-class.html
[Issue #91772]: https://github.com/flutter/flutter/issues/91772
[Deprecate `ThemeData.indicatorColor` in favor of `TabBarThemeData.indicatorColor`]: https://github.com/flutter/flutter/pull/160024

