Make widgets fill their container when a stretch sizing_mode is set#689
Closed
ghostiee-11 wants to merge 2 commits into
Closed
Make widgets fill their container when a stretch sizing_mode is set#689ghostiee-11 wants to merge 2 commits into
ghostiee-11 wants to merge 2 commits into
Conversation
MaterialWidget defaults to a fixed width=300, so setting sizing_mode='stretch_width' without also passing width=None left the fixed width in place and the widget did not fill its container. Drop the default width/height when a stretch/scale sizing_mode is requested and no explicit size was passed, so widgets are responsive by intent while standalone widgets keep their default size and explicit sizes are still respected. Vertical sliders swap width and height at render, so a _responsive_axes hook remaps the axis for them. Adds unit and UI tests.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #689 +/- ##
==========================================
+ Coverage 83.07% 83.21% +0.13%
==========================================
Files 33 33
Lines 3805 3824 +19
==========================================
+ Hits 3161 3182 +21
+ Misses 644 642 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Contributor
Author
|
I am closing this, Thanks Andrew for reviewing!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Overview
MaterialWidgetdefaults to a fixedwidth=300, so settingsizing_mode="stretch_width"(without also passingwidth=None) leaves the fixed width in place and the widget does not fill its container. This drops the default width/height when a stretch/scalesizing_modeis requested and no explicit size was passed, so widgets are responsive by intent. Standalone widgets keep their 300px default and explicit sizes are still respected.Vertical sliders swap width and height at render, so a small
_responsive_axeshook remaps the axis for them.Demo