Skip to content

fix: sks favs headers text overflow#1166

Draft
MaksymilianMazurkiewicz wants to merge 1 commit into
mainfrom
fix/1032-sks_favs_headers_text_overflow
Draft

fix: sks favs headers text overflow#1166
MaksymilianMazurkiewicz wants to merge 1 commit into
mainfrom
fix/1032-sks_favs_headers_text_overflow

Conversation

@MaksymilianMazurkiewicz
Copy link
Copy Markdown
Contributor

@MaksymilianMazurkiewicz MaksymilianMazurkiewicz commented May 17, 2026

Fixed overflow in sks favs headers

Screen_Recording_20260517_204709.mp4

@simon-the-shark simon-the-shark force-pushed the main branch 4 times, most recently from cc32eb0 to 6740f6d Compare May 19, 2026 22:08
@MaksymilianMazurkiewicz MaksymilianMazurkiewicz force-pushed the fix/1032-sks_favs_headers_text_overflow branch from 0ab0660 to 40ae9f8 Compare May 24, 2026 19:07
@MaksymilianMazurkiewicz MaksymilianMazurkiewicz marked this pull request as ready for review May 24, 2026 19:18
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 24, 2026

Greptile Summary

Elo żelo solvrowiczu! This PR fixes a text overflow in the SKS favourite dishes screen by replacing the fixed-height SliverPersistentHeader/SksSectionHeaderDelegate pair with a custom SliverStickyHeader that derives its extent from the child widget's intrinsic height.

  • sliver_sticky_header.dart introduces a hand-rolled render object (based on a known Flutter workaround) that pins the header while allowing variable height; the old sks_section_header_delegate.dart is deleted.
  • sks_favourite_dishes_view.dart is updated to use the new widget, wrapping the localized Text in a Container instead of providing a hard-coded SksMenuConfig.headerHeight.
  • A widgetbook story is added for the new widget, but its part directive contains a doubled stories segment that will break the widgetbook build.

Confidence Score: 4/5

Two issues need fixing before merge: the widgetbook story has a doubled stories segment in its part directive that breaks the widgetbook build, and the custom element's update method won't propagate same-type child changes (locale/theme) to the rendered header.

The core view change is straightforward and correct. The widgetbook story's part directive references a file that the code generator will never emit (sliver_sticky_header.stories.stories.g.dart), causing a build failure in the widgetbook package. Separately, SliverStickyHeaderElement.update gates its rebuild on a runtimeType comparison, so when the locale or theme changes the sticky header will silently retain stale content until the next scroll event forces a relayout.

sliver_sticky_header.dart (element update logic) and sliver_sticky_header.stories.dart (part directive naming)

Important Files Changed

Filename Overview
lib/features/sks/sks_favourite_dishes/presentation/widgets/sliver_sticky_header.dart New custom sliver render object that sizes itself from its child's intrinsic height (fixing the overflow). The update method in SliverStickyHeaderElement has a logic bug: same-type child changes don't trigger a rebuild, so locale/theme updates won't repaint the header.
packages/widgetbook/lib/features/sks/sks_favourite_dishes/presentation/widgets/sliver_sticky_header.stories.dart Widgetbook story for the new widget. The part directive uses sliver_sticky_header.stories.stories.g.dart (doubled "stories") instead of the correct sliver_sticky_header.stories.g.dart, which will cause a build failure.
lib/features/sks/sks_favourite_dishes/presentation/sks_favourite_dishes_view.dart Replaces SliverPersistentHeader + fixed-height delegate with SliverStickyHeader, allowing the header to size itself from child content and eliminate the text overflow.
lib/features/sks/sks_favourite_dishes/presentation/widgets/sks_section_header_delegate.dart Deleted — the fixed-height SliverPersistentHeaderDelegate is no longer needed after switching to SliverStickyHeader.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[_SksFavouriteDishesView build] --> B[SliverStickyHeader]
    B --> C[SliverStickyHeaderElement]
    C --> D{_needsUpdateChild?}
    D -- yes --> E[_element._build\nupdateChild with new widget]
    D -- no --> F[child.layout only]
    E --> G[RenderSliverStickyHeader performLayout]
    F --> G
    G --> H[updateGeometry\nextent = child.size.height]
    H --> I[SliverGeometry\nvariable paintExtent]

    J[Parent rebuild\nnew child same type] --> K{runtimeType changed?}
    K -- no --> L[triggerRebuild NOT called\n_needsUpdateChild stays false]
    K -- yes --> M[triggerRebuild called\nmarkNeedsLayout]
    L --> N[Stale header rendered]
    M --> D
Loading

Reviews (2): Last reviewed commit: "fix: sks favs headers text overflow" | Re-trigger Greptile

Comment thread lib/features/sks/sks_favourite_dishes/presentation/sks_favourite_dishes_view.dart Outdated
@MaksymilianMazurkiewicz MaksymilianMazurkiewicz force-pushed the fix/1032-sks_favs_headers_text_overflow branch from 40ae9f8 to bfbadaf Compare May 24, 2026 19:41
Comment on lines +52 to +59
renderObject.triggerRebuild();
}
}

@override
void performRebuild() {
super.performRebuild();
renderObject.triggerRebuild();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 update only calls triggerRebuild() when the child's runtime type changes, so updates where the runtime type stays the same (e.g. Container with a different color or Text with a different string) are silently dropped. In practice, this means a locale or theme change inside _SksFavouriteDishesView won't repaint the sticky header: the parent rebuilds, calls update with a new Container, the condition is false (Container == Container), triggerRebuild() is never called, _needsUpdateChild stays false, and _build() is never re-invoked during layout. The guard should be newChild != oldChild without the runtimeType restriction.

@MaksymilianMazurkiewicz MaksymilianMazurkiewicz marked this pull request as draft May 24, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants