Skip to content

Workaround for timeline bar chart selection bug#1382

Merged
kenzieschmoll merged 3 commits intoflutter:masterfrom
kenzieschmoll:barChartFix
Nov 21, 2019
Merged

Workaround for timeline bar chart selection bug#1382
kenzieschmoll merged 3 commits intoflutter:masterfrom
kenzieschmoll:barChartFix

Conversation

@kenzieschmoll
Copy link
Member

@kenzieschmoll kenzieschmoll commented Nov 21, 2019

See #1381 for bug details.

This CL also

  • changes the bar colors to use the correct colors for dark mode.

void refreshContent(Entry e, Highlight highlight) {
void refreshContent(Entry e, Highlight highlight) async {
_entry = e;
final frameIndex = _entry.x.toInt();
Copy link
Contributor

Choose a reason for hiding this comment

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

is x a double or is it just typed as a num?

Copy link
Contributor

Choose a reason for hiding this comment

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

if it is really an int, probably better to wrote
final int frameIndex = _entry.x;

Copy link
Member Author

Choose a reason for hiding this comment

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

x is a double.

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm
With a nit.

void onBarSelected(int index) {
// TODO(terry): this is a hack. See
// https://github.com/flutter/devtools/issues/1381.
Timer(
Copy link
Contributor

Choose a reason for hiding this comment

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

WidgetsBinding.instance.addPostFrameCallback should help here.

If the chart library is calling this during build or paint, then we want to schedule the callback for after the current frame is painted.

Copy link
Member Author

Choose a reason for hiding this comment

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

this worked thanks dave!

@kenzieschmoll kenzieschmoll merged commit 8e67801 into flutter:master Nov 21, 2019
@kenzieschmoll kenzieschmoll deleted the barChartFix branch November 21, 2019 22:05
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.

3 participants