Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Workaround on svg change dynamically #162

Merged
merged 1 commit into from
Jun 18, 2021

Conversation

Crdzbird
Copy link

SVG dynamically changes based on new time.

  • Do the tests pass? Consistently?
  • Did this change improve test coverage?
  • [ x] Has it been reviewed/approved by relevant teammates?
  • [ x] Can it be QA’d in staging or something like staging?
  • [ x] Is the code in question being linted? If not, consider adding a linter step to CI. If yes, make sure the linter is happy.
  • [ x] Do we know how we’re going to deploy this?
  • [ x] Are we clear on what the support and maintenance impact is?
  • [ x] Did you create new documentation? Is it accessible and in the right place?
  • Has existing documentation been updated?
  • Have you logged tickets for related technical debt with the label “techdebt”?

@Crdzbird Crdzbird requested a review from cosmicespresso June 18, 2021 16:59
],
),
),
);
Copy link
Author

Choose a reason for hiding this comment

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

Is more safe to use flexible, to avoid rendering problem like an overflow

Choose a reason for hiding this comment

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

Sounds good, will update wherever I can 👍

}
return position;
}
}
Copy link
Author

Choose a reason for hiding this comment

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

Because the time is set as milliseconds on an int data type. I assume that it can be more convenient to have an extension to handle those interactions based on time differences, instead of create a new class.

Choose a reason for hiding this comment

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

That makes total sense and is really clean. 💯


return TweenAnimationBuilder<int>(
tween: IntTween(begin: begin, end: lifeSpan),
duration: Duration(milliseconds: lifeSpan),
curve: Curves.linear,
builder: (BuildContext context, int time, Widget? child) {
var index = (time / step).floor();
var index = begin.position(segments: segments, extraTime: time);
Copy link
Author

Choose a reason for hiding this comment

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

the issue was that the time was being called based on the lifespan ex: lifespan is: 3000 and the end is: 50000.

the index always is gonna be 0 due to that, so the trick was just to create a function that obtain the number of segments based on the time difference, and with that just sum the begin with the time inside the TweenAnimation to have the exact time and just check if the value < segments[position] if that's true then we just retrieve that index.

Copy link

@cosmicespresso cosmicespresso left a comment

Choose a reason for hiding this comment

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

Thanks for the help - merging!

@cosmicespresso cosmicespresso merged commit f80eb0b into kr/status-updates Jun 18, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants