Skip to content

CupertinoSliverNavigationBar middle widget does not update/react when its value changes #173855

@GeonSeon

Description

@GeonSeon

Steps to reproduce

When using CupertinoSliverNavigationBar with a middle widget that depends on changing values (e.g., state changes), the middle widget does not update or rebuild accordingly. Unlike other parts of the navigation bar, such as largeTitle, the middle widget seems to ignore changes in its content, causing the UI to remain static even when the underlying data changes.

This behavior worked correctly in Flutter 3.32.x, where the middle widget would properly rebuild and update when its value changed. However, after updating to Flutter 3.35.1, the middle widget no longer reacts to changes and does not rebuild as expected.

This issue makes it difficult to dynamically update the middle widget based on state or props.

Expected results

The middle widget in CupertinoSliverNavigationBar should update and rebuild dynamically based on changing values (e.g., state or props). When the underlying data changes, the middle widget must reflect those changes immediately, just like the largeTitle widget does.

Actual results

The largeTitle widget updates and rebuilds correctly when its value changes. However, the middle widget does not update or rebuild when its underlying value changes.

Additionally, if the middle widget is left empty (null) and alwaysShowMiddle is set to true, the largeTitle content correctly appears in the middle area, indicating that middle updates properly in this scenario.

However, what I want is to set alwaysShowMiddle to false and provide a custom widget directly to the middle property that dynamically updates based on changing values. This currently does not work as expected.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions