-
Burak İmdat authored
The difference between header text style and subtitle text style and the reason why it doesn't work is the code difference below. If we make the subtitle text style the same as the title text style it will work <details> <summary>Title Text Style</summary> ### All Code ```dart TextStyle titleStyle = titleTextStyle ?? tileTheme.titleTextStyle ?? defaults.titleTextStyle!; final Color? titleColor = effectiveColor; titleStyle = titleStyle.copyWith( color: titleColor, fontSize: _isDenseLayout(theme, tileTheme) ? 13.0 : null, ); final Widget titleText = AnimatedDefaultTextStyle( style: titleStyle, duration: kThemeChangeDuration, child: title ?? const SizedBox(), ); ``` ## Different Code Section ```dart final Color? titleColor = effectiveColor; ``` </details> <details> <summary>Subtitle Text Style</summary> ## All Code ```dart subtitleStyle = subtitleTextStyle ?? tileTheme.subtitleTextStyle ?? defaults.subtitleTextStyle!; final Color? subtitleColor = effectiveColor ?? (theme.useMaterial3 ? null : theme.textTheme.bodySmall!.color); subtitleStyle = subtitleStyle.copyWith( color: subtitleColor, fontSize: _isDenseLayout(theme, tileTheme) ? 12.0 : null, ); subtitleText = AnimatedDefaultTextStyle( style: subtitleStyle, duration: kThemeChangeDuration, child: subtitle!, ); ``` ## Different Code Section ```dart final Color? subtitleColor = effectiveColor ?? (theme.useMaterial3 ? null : theme.textTheme.bodySmall!.color); ``` ### Description for code - The value `theme.textTheme.bodySmall!.color` is given because the `effectiveColor` value is `null` and the `theme.useMaterial3` value is `false` </details> <details> <summary>Problem solved code</summary> ## All Code ```dart subtitleStyle = subtitleTextStyle ?? tileTheme.subtitleTextStyle ?? defaults.subtitleTextStyle!; final Color? subtitleColor = effectiveColor; subtitleStyle = subtitleStyle.copyWith( color: subtitleColor, fontSize: _isDenseLayout(theme, tileTheme) ? 12.0 : null, ); subtitleText = AnimatedDefaultTextStyle( style: subtitleStyle, duration: kThemeChangeDuration, child: subtitle!, ); ``` </details> <details> <summary>Screenshot of the result after making the necessary change</summary> <img src="https://github.com/flutter/flutter/assets/70351342/b552fd4c-fdcd-4bf5-b4ba-d6b2cfe527cc" width=250> </details> #133412 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*