MFlisar / ComposePreferences

Compose Preference Screen for Android - Material3 Design (including customisation, nesting and more)
Apache License 2.0
8 stars 0 forks source link

Option to change layout from ROW to column ? #1

Closed jscti closed 9 months ago

jscti commented 9 months ago

Hi there

Me again ^^

Still impressed by the quality of your lib. Just a little thing could be better : the Layout used in :

where the current value of the field is displayed at the right side : I think this design is OK for tablet, but not for smartphone. When dealing with small values it's ok (number) but when value is a string, text is very quickly wrapped on the next line. Same remark when dealing with accessibility (large fonts), 2-columns layout with long text on both side isn't working

A good solution could be maybe to add an option to transform the current horizontal (row) layout in a vertical (column) layout, thus displaying this zone under the main one. It's doable by overriding PreferenceList but I think this should be a base option.

Thanks

MFlisar commented 9 months ago

Internally this was already possible (e.g. the slider places its content below instead of behind the texts).

The new version does expose a itemSetup parameter to adjust some rules for each item type... E.g.:

https://github.com/MFlisar/ComposePreferences/blob/06bc9880b0434831fd0bd2a15bc8af507ade2a8a/library/modules/screen/list/src/main/java/com/michaelflisar/composepreferences/screen/list/PreferenceList.kt#L68

The class looks like following:

https://github.com/MFlisar/ComposePreferences/blob/06bc9880b0434831fd0bd2a15bc8af507ade2a8a/library/core/src/main/java/com/michaelflisar/composepreferences/core/composables/PreferenceItem.kt#L35-L51

If there is a default setup used, I suggest to copy its settings and only adjust what you need like e.g. PreferenceListDefaults.itemSetup().copy(contentPlacementBottom = true)

jscti commented 9 months ago

Perfect again, thanks alot !