-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check in linear percent indicator state is null if the size is null #203
Check in linear percent indicator state is null if the size is null #203
Conversation
It checks if size is null before assigning a measurement value. Sometimes it might happen that size comes as null, which is why the error occurs on certain occasions
LayoutBuilder is used to get the size of the container where the widget is rendered
lib/linear_percent_indicator.dart
Outdated
@@ -170,12 +170,11 @@ class _LinearPercentIndicatorState extends State<LinearPercentIndicator> | |||
WidgetsBinding.instance.addPostFrameCallback((_) { | |||
if (mounted) { | |||
setState(() { | |||
_containerWidth = _containerKey.currentContext?.size?.width ?? 0.0; | |||
_containerHeight = _containerKey.currentContext?.size?.height ?? 0.0; | |||
_containerWidth = (_containerKey.currentContext?.size != null) ? _containerKey.currentContext!.size!.width : 0.0; |
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.
can you revert these changes? I think this is not the root of the problem
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.
fixed in the last commit 🫡
…dth = _keyIndicator.currentContext?.size?.width ?? 0.0 rollback (_keyIndicator.currentContext?.size != null) to _indicatorWidth = _keyIndicator.currentContext?.size?.width ?? 0.0
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.
Thank you @victormanuelfrancodev
* Adding progressBorderColor property on progressBar (#196) * adding progressBorderColor on progressBar draw * fixing border colors on linear percent and adding examples * removing unnecessary parse comparsion on progress(double) * refactoring border correction symmetrics --------- Co-authored-by: Thiago Carvalho Ribeiro Bardez - TBA <[email protected]> * fix: divide 0 error when archType is not null (#200) * Check in linear percent indicator state is null if the size is null (#203) * Add function return current percent value if animation is true (#206) * Add an 'initialPercent' field to control the initial animation. (#209) * Update master.yml * Update release.yml --------- Co-authored-by: Bardez <[email protected]> Co-authored-by: Thiago Carvalho Ribeiro Bardez - TBA <[email protected]> Co-authored-by: fenghezhou <[email protected]> Co-authored-by: Victor Manuel Lagunas Franco <[email protected]> Co-authored-by: Le Anh Phi <[email protected]> Co-authored-by: Erik Fahlén <[email protected]>
* Adding progressBorderColor property on progressBar (#196) * adding progressBorderColor on progressBar draw * fixing border colors on linear percent and adding examples * removing unnecessary parse comparsion on progress(double) * refactoring border correction symmetrics --------- Co-authored-by: Thiago Carvalho Ribeiro Bardez - TBA <[email protected]> * fix: divide 0 error when archType is not null (#200) * Check in linear percent indicator state is null if the size is null (#203) * Add function return current percent value if animation is true (#206) * Add an 'initialPercent' field to control the initial animation. (#209) * Update master.yml * Update release.yml * Update release.yml --------- Co-authored-by: Bardez <[email protected]> Co-authored-by: Thiago Carvalho Ribeiro Bardez - TBA <[email protected]> Co-authored-by: fenghezhou <[email protected]> Co-authored-by: Victor Manuel Lagunas Franco <[email protected]> Co-authored-by: Le Anh Phi <[email protected]> Co-authored-by: Erik Fahlén <[email protected]>
Description:
It checks if size is null before assigning a measurement value. Sometimes it might happen that size comes as null, which is why the error occurs on certain occasions
Error:
Related:
#174 (comment)