robiness / stage_craft

MIT License
5 stars 1 forks source link

Add min/max to `IntControl` #38

Open passsy opened 1 month ago

passsy commented 1 month ago

I'd love to set min and max values to clamp the values. I'm currently running into issues when I create a duration.

  late final duration = IntControl(
    initialValue: initialWidget.duration.inMilliseconds,
    label: 'duration',
    min: 100, // <-- missing
  );

I use it later in an AnimationController but it doesn't allow values <=0

The following assertion was thrown building ListenableBuilder(listenable: Listenable.merge([DoubleControlNullable#028b4(null), DoubleControlNullable#013f3(1.6), IntControl#1a4de(0), ColorControl#68e46(Color(0xffffffff)), ValueNotifier<Key>#f164d([#e6e9d])]), state: _AnimatedState#b954d):
'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 923 pos 12: '_periodInSeconds > 0.0': is not true.