-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
], | ||
), | ||
), | ||
); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this 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!
SVG dynamically changes based on new time.