Skip to content

Several minor issues were discovered. #1

Description

@MarioMuYao

What happened

First of all, this is a powerful library, but during the usage process, several minor issues were discovered.

  1. "onLoadMore" function is not working properly.

  2. "showInfoDialog" set "true" -> "false" -> "true" throw Exception
    ════════ Exception caught by widgets library ═══════════════════════════════════
    LateInitializationError: Field '_children@25042623' has not been initialized.

By the way,

  1. Support fixed priceAxis when scroll

How to reproduce it

-

ohlcv_chart version

2.3.1

Flutter version

3.47.1

Platform

iOS

Anything else

No response

Activity

  1. CtrlAltDevelop commented on Sep 9, 2026

    @CtrlAltDevelop
    Owner

    Thanks for the kind words, and for the detailed report — all three are addressed in 2.3.2.

    1. onLoadMore not working

    You were right that it never fired. The callback was declared and documented, but nothing in the library ever invoked it — so there was no way for it to work, regardless of how you wired it up.

    It's now called at both scroll edges, from the pan handler and the fling animation, with the flag true at the newest candle and false at the oldest. It fires once per arrival at an edge rather than once per frame, so a drag held against the edge won't spam your paging code, and it asks again if you scroll away and come back.

    2. showInfoDialog true → false → true throwing

    Reproduced, and the LateInitializationError you saw was a symptom rather than the cause. The info dialog subscribed to a single-subscription stream, and it's only in the widget tree while showInfoDialog is set. Turning the flag off unmounted it and cancelled the subscription; turning it back on tried to listen to that same stream a second time, which threw:

    Bad state: Stream has already been listened to.
    

    That throw happened while the enclosing Stack was mounting its children, which left the framework's _children field unassigned — and the next frame's access to it surfaced as the LateInitializationError: Field '_children' in your log.

    The controller is now a broadcast one, so the dialog can be mounted and unmounted as often as you like. There's a regression test that toggles the flag and asserts nothing throws.

    3. Fixed price axis when scrolling

    Added as ChartStyle.priceAxisWidth:

    KChartWidget(
      data,
      ChartColors(),
      chartStyle: const ChartStyle(priceAxisWidth: 56),
    )

    Given a width, a gutter is held back for the price labels: the candles, the grid and the date axis all stop short of it, so nothing scrolls underneath the axis any more. Which side it's held back on follows verticalTextAlignment. It defaults to 0, which is the previous behaviour — labels drawn over the plot — so this changes nothing for existing charts unless you opt in.

    Thanks again for taking the time to write these up.

  2. MarioMuYao commented on Sep 10, 2026

    @MarioMuYao
    Author

    Thank you for your reply.
    By the way, it is support intraday chart?ChartType.area,no scrolling,no scaling,fixed position, no load more.

    Have a good day.Looking forward to your reply.

  3. CtrlAltDevelop commented on Sep 10, 2026

    @CtrlAltDevelop
    Owner

    Yes — an intraday area chart works today, and one flag is missing for the rest.

    ChartType.area is supported, and onLoadMore is simply optional: leave it
    off and nothing pages in.

    For a fixed position, the trick is to let every candle fit the width. When the
    whole series fits, there is nothing to scroll — ChartStyle.pointWidth (8 by
    default) is what controls the spacing, so set it to roughly the chart's width
    divided by the number of candles:

    KChartWidget(
      sessionCandles,
      ChartColors(),
      isTrendLine: false,
      watermarkAssetPath: 'assets/logo.svg',
      timeFrame: const Duration(minutes: 5),
      chartType: ChartType.area,
      xFrontPadding: 0,
      volHidden: true,
      hideGrid: true,
      showNowPrice: false,
      showInfoDialog: false,
      crosshairOnHover: false,
      showContextMenu: false,
      showScrollToNowButton: false,
      priceScaleDrag: false,
      enableKeyboardShortcuts: false,
      // 78 candles in a ~400px box: 400 / 78 ≈ 5
      chartStyle: const ChartStyle(pointWidth: 5),
    );
    

    With that the chart cannot be dragged at all — the scroll clamps to zero
    because the series already fits.

    The one gap is pinch: zooming out is still possible, and once the scale
    changes the chart becomes scrollable again. There is currently no flag to turn
    that off, so I will add one for a fully static chart.

    Thanks for raising it.

  4. CtrlAltDevelop commented on Sep 10, 2026

    @CtrlAltDevelop
    Owner

    check /example/lib/intraday_demo.dart

  5. MarioMuYao commented on Sep 10, 2026

    @MarioMuYao
    Author

    It's simply amazing! Looking forward to your next update.

  6. added a commit that references this issue on Sep 10, 2026
    d2f4b3a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions