Conversation
a0c1275 to
89ec8ea
Compare
e45bf37 to
42cff5f
Compare
42cff5f to
dd5c7b8
Compare
|
@hecrj Thank you for your feedback. I agree, passing the direction as a separate field makes more sense. And the good thing about it being a breaking change is that more developers may actually handle it and make their widgets bidirectional. Updated design
Each widget has to choose whether to care about it (e.g. row, column, toggler) or simply forward it down to its children (e.g. button). Overriding the direction for a subtreeTo avoid adding a ExampleI renamed my toy example to
Please let me know what you think of the new design. If you're OK with it, I can start working on adding RTL support to more widgets. And I assume that you're OK with my decision to not include a |
9d3e3a2 to
00e3993
Compare
|
Since Here's what other toolkits call it:
I think |
|
Just |
f19e578 to
5d026b2
Compare
Left-to-Right and Right-to-Left layout reading direction for LTR/RTL languages
5d026b2 to
a2e4be9
Compare


I have completed implementing RTL layout in Iced. But I have extracted a smaller piece of it with a small example in this PR to make reviewing and feedback easier.
Design
A
Directionprimitive is defined and added toSettings. It is then passed down to all children viaLimits.The direction for a widget can be explicitly set, or it can inherit it from its parent. You may want a part of your app to always be drawn in the same direction as you're designing for example if you have two buttons that say "<west, east>".
There is no
AutoinDirection, just LTR and RTL. The app developer can decide based on the translated language, or some other factor what the direction should be (whoever is doing i18n can decide). So, Iced doesn't need to automatically detect and change the direction.Request
The process of updating all widgets to support the direction can be done over time and widget by widget. However, the main thing that I need your input on is the
Directionprimitive and how to pass it down the tree? Is this the best approach for Iced? Is the design sound? I will be working on integrating this into libcosmic, but before I do that I want to get your opinion and make sure the design is solid on you're onboard, or ideally get this merged into Iced first.In this PR I have applied the direction to
rowandtogglerand added a small example that shows how changing the direction inSettingswould change the alignment and the order of the widgets.Here's a screenshot of the small example:
Note that the direction of the toggler widget is also mirrored. more info
Note: if you don't set the direction in the settings, everything should render exactly as before. If this feature is done right, people who don't need RTL won't notice anything!
Here's our discussion in zulip.
Here's how you set this in GTK.