feat: Implement compact sizing for controls via VisualDensity#1301
feat: Implement compact sizing for controls via VisualDensity#1301
Conversation
Co-authored-by: bdlukaa <[email protected]>
Co-authored-by: bdlukaa <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces compact sizing for a wide range of controls by leveraging VisualDensity. The changes are consistently applied across all affected components, such as TextBox, ComboBox, ListTile, and NavigationView. The implementation correctly adjusts height constraints based on visualDensity.baseSizeAdjustment.dy and safely clamps the resulting values to prevent negative heights. The code is clean and the approach is well-executed, effectively addressing the feature request.
|
@copilot Update the example app to support changing the visual density in the Settings page. |
Co-authored-by: bdlukaa <[email protected]>
Done in 993bdd1. Added a "Visual Density" section to the Settings page with Standard/Compact radio buttons. The setting is wired through Changes:
|
|
@copilot Suggest more widgets to apply the visual density factor. |
After analyzing the codebase, here are additional widgets that could benefit from visual density adjustments: Strong candidates:
Weaker / skip:
My recommendation is Expander, InfoBar, and TabView as the highest-value additions — they're interactive surface/navigation controls with clear compact equivalents. |
|
@copilot Update Expander, InfoBar, NumberBox and Tooltip to support visual density. |
…Tooltip Co-authored-by: bdlukaa <[email protected]>
Done in cbc4a6e. Applied visual density to all four controls:
CHANGELOG updated to list all 13 supported controls. |
FluentThemeData.visualDensityexisted but only buttons responded to it. This wires up compact sizing across all controls listed in the WinUI3Compact.xamldensity spec, plus additional surface and flyout controls.Each control reads
FluentTheme.of(context).visualDensity.baseSizeAdjustment.dyand applies it to height constraints. WithVisualDensity.compact(vertical=-2), this yields -8px — matching WinUI3 compact values (e.g., TextBox 32→24, NavigationView items 40→32).Controls updated
minHeightminHeightminHeightminHeightminHeightminHeightminHeightTooltipThemeData.standardheightAll adjusted values are clamped to
[0, ∞).Example app
Added a Visual Density setting to the Settings page with Standard and Compact radio options. The selection is wired through
AppThemeto both light and darkFluentThemeDataconfigurations, allowing live toggling of compact sizing across the entire example app.Usage
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.