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

Mix max both equal zero cause BoxConstraints exception #34

Open
leduchung opened this issue Feb 2, 2024 · 1 comment
Open

Mix max both equal zero cause BoxConstraints exception #34

leduchung opened this issue Feb 2, 2024 · 1 comment

Comments

@leduchung
Copy link

leduchung commented Feb 2, 2024

I built a range slider. If I put max and min both equal 0 as following code:

FlutterSlider(
    values: [_lowerValue, _upperValue],  // both are 0
    touchSize: 5,
    rangeSlider: true,
    trackBar: FlutterSliderTrackBar(
      activeTrackBarDraggable: false,
      inactiveTrackBar: BoxDecoration(
        borderRadius: BorderRadius.circular(20),
        color: Colors.black12,
      ),
      activeTrackBar: BoxDecoration(
        borderRadius: BorderRadius.circular(4.0),
        color: accentBlue,
      ),
    ),
    max: maxValue, // is 0
    min: minValue,  // is 0
)

I got following error when dragging handlers, then all the handlers jump to the top-left of the screen:

The following assertion was thrown building Container(bg: BoxDecoration(color: Color(0xff1884db), borderRadius: BorderRadius.circular(4.0)), constraints: BoxConstraints(NaN<=w<=NaN, h=3.5; NOT NORMALIZED)):
BoxConstraints has NaN values in minWidth and maxWidth.

The offending constraints were: BoxConstraints(NaN<=w<=NaN, h=3.5; NOT NORMALIZED)

Hint from BorderRadius.circular(4.0), I guess the problem is from the activeTrackBar.

P/S: The error occurs when setting all max, min, _lowerValue, _upperValue to any equal number.

@loonix
Copy link
Owner

loonix commented Apr 8, 2024

Why would you put max and min to be 0. that does not sound like a real world scenario.

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

No branches or pull requests

2 participants