Skip to content
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

Fix audio_player throws exception when max value is 0 #1156

Merged

Conversation

ngthailam
Copy link
Contributor

General:

Running on IOS simulator
Closes #980
Closes #981

Describe problem:

980:
Due to Slider assert constructor, when max == 0 and value == 0, it throws

The following assertion was thrown building CupertinoSlider(value: 0.0, min: 0.0, max: 0.0, dependencies: [_InheritedCupertinoTheme], state: _CupertinoSliderState#e94ea):
'package:flutter/src/cupertino/slider.dart': Failed assertion: line 334 pos 15: 'value >= 0.0 && value <= 1.0': is not true.

981:
Same issue, only when back to home_page, the slider max && value is reset to 0, causing the same exception but in a different screen

🔔 This affects not just the Demo app, but anywhere which has the same html element.

Changes:

  • Add max == 0 check along with null check ( I see no difference in behavior after adding the 0 check )

UI Evidence:

Before:

Screen.Recording.2024-01-11.at.8.54.48.PM.mov

After

Screen.Recording.2024-01-11.at.8.55.08.PM.mov

@ngthailam
Copy link
Contributor Author

@daohoangson Please have a look at the PR, simple fix but solves noticeable problem when running the Demo App.

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2dc197d) 99.58% compared to head (882ee43) 99.58%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1156   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files          72       72           
  Lines        4334     4335    +1     
=======================================
+ Hits         4316     4317    +1     
  Misses         18       18           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@daohoangson daohoangson merged commit 338f371 into daohoangson:master Jan 11, 2024
16 checks passed
@daohoangson
Copy link
Owner

This is great! I have merged the PR, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants