Skip to content

feat: bring the redesigned indicator label to web - #496

Merged
behnam-deriv merged 4 commits into
masterfrom
revamp-indicators-label-web
Sep 2, 2026
Merged

feat: bring the redesigned indicator label to web#496
behnam-deriv merged 4 commits into
masterfrom
revamp-indicators-label-web

Conversation

@behnam-deriv

@behnam-deriv behnam-deriv commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

What

The on-chart indicator label added in #487 shipped for mobile only — Chart picks its state class with kIsWeb, and only _ChartStateMobile built the label. Web kept the older always-visible icon row, had no labels at all for overlay indicators, and no way to hide one.

Web now renders the same label, with the same expand/collapse, hide/unhide, reorder, settings and delete actions as mobile.

How

  • The pieces both platforms need moved up into _ChartState — the expanded-label set, icon accessors, hide toggle, overlay-label column, title composer and referenceIndexOf — so there is one implementation rather than two.
  • _ChartStateWeb iterates the repository instead of bottomConfigs, keeping each panel's true index so hidden status can be looked up. Hidden panels collapse to their label while holding their size, as on mobile.
  • Fullscreen expand is dropped along with expandedIndex. It was web-only, has no equivalent in the design, and the resizable dividers from feat: indicators panel resize and toolbar #487 cover the need.
  • BottomChartMobileBottomChartWithLabel and IndicatorLabelMobileIndicatorLabel, now that both platforms use them. Neither is exported, so nothing outside the package is affected.

Also in here

  • DerivChartLite never accepted panelSizeRepo or indicatorLabelIconsfeat: indicators panel resize and toolbar #487 wired only the full DerivChart. Consumers on the lite variant therefore got neither persisted panel sizes nor custom label icons. Both are now passed through, with the same ownership rules as DerivChart (it creates and disposes its own repo only when the host doesn't supply one).
  • The label's icon size and title style move to ChartTheme (indicatorLabelIconSize, indicatorLabelTextStyle), alongside the component-level styling it already carries. Defaults are unchanged, so mobile renders exactly as before; a host on a wider canvas — where the same absolute size reads much smaller — scales them by overriding the theme rather than threading parameters through the widget tree.

Compatibility

Defaults are preserved throughout, so deriv-mobile-app is visually unchanged. Two notes for reviewers:

  • Adding getters to the ChartTheme interface is breaking for anyone implementing it directly rather than extending ChartDefaultTheme. The concrete defaults mean the normal path is unaffected.
  • BottomChart is now unused by the layout but kept, since it still owns the SwapCallback typedef.

Testing

flutter test passes in full (133 tests in test/deriv_chart/chart/, including the label, panel-fraction, panel-size-repository and divider suites from #487). flutter analyze lib/ reports no new issues.

Verified end to end through deriv-smartcharts on a desktop-width chart: collapsed pills on bottom panels and overlays; chevron expands the action row; eye hides the series and collapses the panel, restoring its exact size on unhide; gear and delete route to the host; reorder arrows reorder; dividers resize and persist across a reload; light and dark themes.

Summary by Sourcery

Bring the redesigned indicator labels and consistent panel interactions to web while aligning lite-chart configuration, persistence, and theming with the full chart.

New Features:

  • Render redesigned indicator labels on web for both overlay and bottom indicators with expand, hide, reorder, edit, and delete actions.
  • Add indicator-label customization and panel-size repository forwarding to DerivChartLite, including default persistence when no repository is supplied.

Bug Fixes:

  • Preserve hidden indicator panels and their exact sizes across hiding, unhiding, reordering, and reloads on web.
  • Ensure web overlay series reflect repository visibility while retaining labels for hidden indicators.

Enhancements:

  • Share indicator-label behavior and state management across mobile and web.
  • Move indicator-label icon sizing and title styling into ChartTheme while preserving existing defaults.
  • Replace web-only fullscreen panel expansion with consistent resizable panel layout behavior.

Tests:

  • Update indicator-label tests for the shared cross-platform components.
  • Add coverage verifying DerivChartLite forwards panel-size repositories and custom indicator-label icons.

@sourcery-ai

sourcery-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Brings the redesigned indicator labels to web by sharing the mobile implementation and state, adding overlay labels and hide/reorder/actions to repository-driven web panels, and replacing fullscreen expansion with persistent resizable layouts. Also wires panel persistence and custom label icons through DerivChartLite and moves label styling into ChartTheme while preserving defaults.

Sequence diagram for web indicator label actions

sequenceDiagram
    actor User
    participant Label as IndicatorLabel
    participant State as _ChartStateWeb
    participant Repo as IndicatorConfig repository
    participant Host as Host callbacks

    User->>Label: expand or collapse
    Label->>State: _toggleLabelExpanded
    State-->>Label: rebuild action row
    User->>Label: hide or unhide
    Label->>State: _onIndicatorHideToggleTapped
    State->>Repo: updateHiddenStatus
    Repo-->>State: hidden status changes
    State-->>Label: rebuild label or panel
    User->>Label: edit or delete
    Label->>Host: onEdit or onRemove
    User->>Label: reorder
    Label->>State: onSwap
    State->>Host: reorder indicator config
Loading

Flow diagram for persistent web panel sizing

flowchart TD
    Repo[IndicatorConfig repository] --> Keys[Build ordered panel keys]
    Keys --> Sync[_syncPanelFractions]
    Sync --> Layout[Render main chart and bottom panels]
    Layout --> Divider[ResizableChartDivider]
    Divider --> Resize[_resizeCascadingPanels]
    Resize --> Persist[_persistPanelFractions]
    Persist --> Storage[PanelSizeRepository]
    Storage --> Layout
    Hidden[Hidden bottom indicator] --> Layout
    Layout --> Restore[Unhide restores stored panel fraction]
Loading

File-Level Changes

Change Details Files
Unify indicator-label behavior across mobile and web.
  • Move label state, title/icon helpers, overlay rendering, hide handling, and identity-based indexing into the shared chart state.
  • Rename the label widgets to platform-neutral names and reuse them on both platforms.
  • Render web overlays and bottom indicators from repository order, preserving true repository indices for hidden-state and reorder actions.
  • Replace web fullscreen expansion with persistent panel fractions, minimum label height handling, and cascading resizable dividers.
lib/src/deriv_chart/chart/chart.dart
lib/src/deriv_chart/chart/chart_state_mobile.dart
lib/src/deriv_chart/chart/chart_state_web.dart
lib/src/deriv_chart/chart/bottom_chart_with_label.dart
lib/src/deriv_chart/chart/indicator_label_icons.dart
Expose panel persistence and label customization through the lite chart variant.
  • Add optional panel-size repository and indicator-label icon parameters.
  • Create, load, and dispose an internal panel repository only when the host does not provide one.
  • Forward the repository and icons into Chart.
lib/src/deriv_chart/deriv_chart_lite.dart
Make label sizing and typography theme-configurable.
  • Add icon-size and title-style getters to ChartTheme.
  • Provide unchanged defaults through ChartDefaultTheme and Dimens.
lib/src/theme/chart_theme.dart
lib/src/theme/chart_default_theme.dart
lib/src/theme/dimens.dart
Update indicator-label tests for the shared widget names.
  • Rename imports, widget references, and test group names to cover IndicatorLabel.
test/deriv_chart/chart/indicator_label_test.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Claude Code is working…

I'll analyze this and get back to you.

View job run

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="lib/src/deriv_chart/chart/chart_state_web.dart" line_range="54-84" />
<code_context>
+    final List<Series> visibleOverlaySeries = <Series>[];
</code_context>
<issue_to_address>
**issue (broader_impact):** The web layout ignores the `overlaySeries` argument built from `widget.overlayConfigs` and passes only repository-backed overlays to `MainChart`, so overlays supplied through `Chart.overlayConfigs` disappear on web.

**Triggers:** When a consumer supplies overlay indicators through `Chart.overlayConfigs` rather than `indicatorsRepo`.

**Suggested fix:** Include the existing `overlaySeries` in the visible overlay list, while applying repository hidden-status filtering to repository-backed overlays.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread lib/src/deriv_chart/chart/chart_state_web.dart
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Claude finished @behnam-deriv's task in 8m 59s —— View job


I'll analyze this and get back to you.

Web fell back to reading only `indicatorsRepo`, so a host passing plain
`overlayConfigs`/`bottomConfigs` to `Chart` - both public and independent of
the repository, which is optional - got no indicators at all. The repository
stays the source of truth when present, since it is what carries hidden status,
and the passed-in configs and series are used when it is absent.

The two are deliberately not merged, as the review suggested: `DerivChart`
derives `overlayConfigs` *from* the repository it also passes, so combining them
would draw every overlay twice on the path that matters most.

Adds tests pinning `DerivChartLite`'s forwarding of `panelSizeRepo` and
`indicatorLabelIcons` - the two parameters it was missing - since neither has a
visible effect until the chart renders on web.

Corrects two doc comments the rename left stale: `BottomChartWithLabel` no
longer calls itself mobile-only, and `DerivChartLite` no longer claims to avoid
`shared_preferences`, which it now uses for default panel-size persistence.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Claude finished @behnam-deriv's task in 2m 10s —— View job


I'll analyze this and get back to you.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Claude finished @behnam-deriv's task in 1m 8s —— View job


I'll analyze this and get back to you.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🤖 Claude PR Review Complete

Model: claude-sonnet-5 | Review Type: 🔄 Follow-up Review

Summary

3 of 4 issues from the previous review have been resolved. This push (b438b253e725b1) is a dart format commit only — the incremental diff shows a single cosmetic line-wrap in test/deriv_chart/deriv_chart_lite_test.dart. All substantive fixes from the prior round (overlay/bottom fallback for repo-less consumers, and the two doc-comment corrections) remain intact. The one open item — no widget test exercising _ChartStateWeb's actual rendering path — was not addressed by this commit.

Recommendation: APPROVE (one non-blocking follow-up suggested)


🟡 Medium Priority Issues

🟡 1. Web layout integration (_ChartStateWeb) still has no widget-level rendering testlib/src/deriv_chart/chart/chart_state_web.dart

Details

Severity File Lines
MEDIUM lib/src/deriv_chart/chart/chart_state_web.dart whole file

❌ Problematic Code:

test/deriv_chart/deriv_chart_lite_test.dart only asserts that DerivChartLite forwards its new parameters to the Chart widget it builds:

final Chart chart =
    await pumpAndFindChart(tester, app(panelSizeRepo: repo));

expect(chart.panelSizeRepo, same(repo));

No test pumps _ChartStateWeb (or forces Chart onto the web code path) to assert that overlay/bottom panels actually render from overlayConfigs/bottomConfigs when no indicatorsRepo is supplied, that hide/unhide toggles a panel's visibility, or that reordering swaps panels correctly.

📋 Issue: This commit is formatting-only (dart format), so it doesn't touch test coverage. The gap that would have caught the now-fixed regression in bottomPanelConfigs/visibleOverlaySeries branching (Issue #1 from the previous review) is still untested at the widget level.

⚠️ Impact: No automated guardrail exists if that repo/no-repo fallback logic is touched again in a future refactor — this exact class of regression would only surface via manual testing.

✅ Fix:

Add a widget test that pumps Chart (with debugDefaultTargetPlatformOverride or an equivalent web-forcing shim) covering: (a) overlayConfigs/bottomConfigs supplied with no indicatorsRepo still renders panels, (b) an indicatorsRepo with one overlay + one bottom indicator renders both labels, (c) hiding one collapses its panel while keeping the label.

💡 Explanation: Widget-level coverage of buildChartsLayout's actual output — not just DerivChartLite's forwarding — is what guards against a repeat of the issue that was just fixed.

Summary Table

Priority Count Categories
🔴 Critical 0
🟠 High 0
🟡 Medium 1 Missing _ChartStateWeb rendering/hide-unhide test coverage
🟢 Low 0

Recommendations

  1. Non-blocking: add a widget test exercising _ChartStateWeb's actual rendering path (with and without indicatorsRepo, plus hide/unhide) to fully close the coverage gap.

Auto Fix Claude Reviews

Action Open Dashboard

@behnam-deriv
behnam-deriv merged commit aea4a0a into master Sep 2, 2026
8 checks passed
@behnam-deriv
behnam-deriv deleted the revamp-indicators-label-web branch September 2, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant