Uno.Themes
Uno.Themes copied to clipboard
Add Material 3 ToggleSwitch Styles

https://m3.material.io/components/switch/overview
Waiting for proper final specs and guidelines as of now until I can start creating the new styles (cc @kazo0, @NVLudwig)
Checking with @NVLudwig and @kazo0 if there is still some work to do for this item
I don't think any work has been started on the Themes side of things for M3 switches, unless I am forgetting about it
@NVLudwig is there a branch of the Figma file that has the new ToggleSwitch styles?
I sent you this rebuild one to review a few months back. It doesn't have labels or headers (what are your thoughts about that?
https://www.figma.com/file/trM3i5qUPmFBcnxWXXmnuF/branch/ncHDud1NhKKKmDZtGg8Ryj/Uno-Platform-Material-Toolkit?type=design&node-id=3036%3A47488&t=q0x6WsPkl1AnEoF6-1
Should we create a new ToggleSwitchExtensions
to handle the Icons with DP?
It should have OnIcon
and OffIcon
. Maybe OnIconVisible
and OffIconVisible
DPs to handle icons visibility?
@kazo0 @agneszitte @Xiaoy312
We already ghave an Icon in ControlExtensions... And this is lower priority for me unless Steve thinks we should tackle it now.
Would be good to get this unblocked so we can close out M3 ToggleSwitches
@eriklimakc
Perhaps we can just use the OnContent
and OffContent
from the WinUI ToggleSwitch API for this purpose. Instead of it showing as a label next to the switch, you can set it as content that will display within the thumb for the Material style.
Would be odd looking if someone tried to set it to text but we can document the difference in suggested usage
Thoughts @agneszitte / @Xiaoy312?
If we can't decide on something now that wouldn't require more work then let's just not deal with icons until another time
It works in my tests, but when OnContent and/or OffContent are not set, the default values are 'On' and 'Off' respectively. To avoid displaying 'On' and 'Off' in the thumb, we may need a converter.
https://github.com/unoplatform/Uno.Themes/assets/114886335/0af0d424-f7e8-4ce1-95c7-ec200b19263e
@kazo0 @agneszitte @Xiaoy312
if you are deciding to use On/OffContent
properties to let users customize the icons within the toggle,
then the base style for this "icon" ToggleButton, should have setters for these 2 properties as null by default (or, set to a generic icon that would result in the "Without icons" visual)
there shouldnt be any need of converter here
as for replacing the original functionality... it wasnt particularly useful to have "on" and "off" text beside the toggle not denying it is use, but it is not something hard to do with binding+converter on the users side plus they would have more control that ways for the text placement + font, and all.