robiness / stage_craft

MIT License
5 stars 1 forks source link

Force size by default #36

Closed passsy closed 1 month ago

passsy commented 1 month ago

Stagecraft should automatically force the size of the widget, so that I can use the size controls to force a new size. I could see that it always works,

  @override
  Widget build(BuildContext context) {
    return StageBuilder(
      builder: (context) {
        return SizedBox(              // <-- should be added 
          width: double.infinity,     // <-- automatically
          height: double.infinity,    // <-- by stagecraft
          child: PillButton(
            onTap: _hasFunction.value ? () {} : null,
            label: _label.value,
            enabled: _enabled.value,
          ),
        );
      },
      controls: [
        _hasFunction,
        _label,
        _enabled,
      ],
    );
  }
}

I used this setup with double.infinity as a workaround. But now that stagecraft uses the intrinsic width/height it doesn't work anymore. I'd like to have it as a default option.

Without forced size

Screen-Shot-2024-07-10-15-20-15 78

With forced size

Screen-Shot-2024-07-10-15-19-42 87

robiness commented 1 month ago

Do you expect a forceSize which defaults to true on StageBuilder?

passsy commented 1 month ago

Yes, forceSize should default to true.

Maybe add a button "[ ] intrinsic width/height" that allows me to explicitly test the intrinsic size