Actualizaciones de normalización de temas de componentes
`AppBarTheme`, `BottomAppBarTheme` e `InputDecorationTheme` han sido normalizados para seguir la convención de Flutter para temas de componentes en la librería Material.
Resumen
#AppBarTheme, BottomAppBarTheme y InputDecorationTheme fueron refactorizados
para ajustarse a las convenciones de Flutter para los temas de componentes.
Se agregaron AppBarThemeData, BottomAppBarThemeData y InputDecorationThemeData
para definir anulaciones para los valores predeterminados de las propiedades visuales del componente.
Los lanzamientos de Flutter continúan normalizando los temas de componentes como estos para
lograr una experiencia de temas más consistente en la librería material.
Guía de migración
#En ThemeData:
- El tipo de la propiedad
appBarThemeha cambiado deAppBarThemeaAppBarThemeData. - El tipo de la propiedad
bottomAppBarThemeha cambiado deBottomAppBarThemeaBottomAppBarThemeData. - El tipo de la propiedad
inputDecorationThemeha cambiado deInputDecorationThemeaInputDecorationThemeData.
El tipo de retorno de los métodos xTheme.of() del tema del componente y
Theme.of().xTheme también ha cambiado a xThemeData.
En DatePickerThemeData y TimePickerThemeData, el tipo de la
propiedad inputDecorationTheme ha cambiado de InputDecorationTheme
a InputDecorationThemeData.
Código antes de la migración:
final AppBarTheme appBarTheme = Theme.of(context).appBarTheme;
final AppBarTheme appBarTheme = AppBarTheme.of(context);
final BottomAppBarTheme bottomAppBarTheme = Theme.of(context).bottomAppBarTheme;
final BottomAppBarTheme bottomAppBarTheme = BottomAppBarTheme.of(context);
final InputDecorationTheme inputDecorationTheme = Theme.of(context).inputDecorationTheme;
final InputDecorationTheme inputDecorationTheme = InputDecorationTheme.of(context);
final InputDecorationTheme inputDecorationTheme = Theme.of(context).datePickerTheme.inputDecorationTheme;
final InputDecorationTheme inputDecorationTheme = Theme.of(context).timePickerTheme.inputDecorationTheme;
final ThemeData theme = ThemeData(
appBarTheme: AppBarTheme(),
bottomAppBarTheme: BottomAppBarTheme(),
inputDecorationTheme: InputDecorationTheme(),
);
final ThemeData theme = ThemeData().copyWith(
appBarTheme: AppBarTheme(),
bottomAppBarTheme: BottomAppBarTheme(),
inputDecorationTheme: InputDecorationTheme(),
);
const DatePickerThemeData datePickerTheme = DatePickerThemeData(inputDecorationTheme: InputDecorationTheme());
const TimePickerThemeData timePickerTheme = TimePickerThemeData(inputDecorationTheme: InputDecorationTheme());
Código después de la migración:
final AppBarThemeData appBarTheme = Theme.of(context).appBarTheme;
final AppBarThemeData appBarTheme = AppBarTheme.of(context);
final BottomAppBarThemeData bottomAppBarTheme = Theme.of(context).bottomAppBarTheme;
final BottomAppBarThemeData bottomAppBarTheme = BottomAppBarTheme.of(context);
final InputDecorationThemeData inputDecorationTheme = Theme.of(context).inputDecorationTheme;
final InputDecorationThemeData inputDecorationTheme = InputDecorationTheme.of(context);
final InputDecorationThemeData inputDecorationTheme = Theme.of(context).datePickerTheme.inputDecorationTheme;
final InputDecorationThemeData inputDecorationTheme = Theme.of(context).timePickerTheme.inputDecorationTheme;
final ThemeData theme = ThemeData(
appBarTheme: AppBarThemeData(),
bottomAppBarTheme: BottomAppBarThemeData(),
inputDecorationTheme: InputDecorationThemeData(),
);
final ThemeData theme = ThemeData().copyWith(
appBarTheme: AppBarThemeData(),
bottomAppBarTheme: BottomAppBarThemeData(),
inputDecorationTheme: InputDecorationThemeData(),
);
const DatePickerThemeData datePickerTheme = DatePickerThemeData(inputDecorationTheme: InputDecorationThemeData());
const TimePickerThemeData timePickerTheme = TimePickerThemeData(inputDecorationTheme: InputDecorationThemeData());
Timeline
#Introducido en la versión: 3.33.0-1.0.pre a 3.35.0-0.0.pre
Versión estable: 3.35
Referencias
#Documentación de la API:
PRs relevantes:
A menos que se indique lo contrario, la documentación de este sitio refleja Flutter 3.44.0. Página actualizada por última vez el 2026-05-05. Ver código fuente oreportar un problema.