Skip to content

[Documentation] AppBarTheme toolbarTextStyle and titleTextStyle documentation not following the current behavior #86127

@Charly6596

Description

@Charly6596

The documentation says we need to enable backwardsCompatibility to use toolbarTextStyle and titleTextStyle, but I can only use them when I disable it.

I've made a repo with a piece of code to try the functionality: https://github.com/Charly6596/Title-text-style-issue

Screenshots

image
image

The fact that the documentation says that toolbarTextStyle is obsolete also confuses me.

/// Overrides the default value for the obsolete [AppBar.toolbarTextStyle]

By reading #71184 (comment) I assume that the documentation should be fixed and the behaviour is correct.

Also, the AppBar documentation isn't updated regarding to the backwardsCompatibility flag.

The current behaviour can be observed in the implementation:

TextStyle? toolbarTextStyle = backwardsCompatibility
? widget.textTheme?.bodyText2
?? appBarTheme.textTheme?.bodyText2
?? theme.primaryTextTheme.bodyText2
: widget.toolbarTextStyle
?? appBarTheme.toolbarTextStyle
?? theme.textTheme.bodyText2?.copyWith(color: foregroundColor);
TextStyle? titleTextStyle = backwardsCompatibility
? widget.textTheme?.headline6
?? appBarTheme.textTheme?.headline6
?? theme.primaryTextTheme.headline6
: widget.titleTextStyle
?? appBarTheme.titleTextStyle
?? theme.textTheme.headline6?.copyWith(color: foregroundColor);

The fact that #81675 (comment) mentions that the value should be true to use titleTextStyle confused me, commenting it just so others can be redirected here if they had the same problem as the OP

Metadata

Metadata

Assignees

No one assigned

    Labels

    d: api docsIssues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions