Trace:
Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
flutterui:checkbox_switch [2022/11/30 13:15] admin |
flutterui:checkbox_switch [2022/12/01 10:57] (current) admin |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ~~Title: Checkbox as switch~~ | ~~Title: Checkbox as switch~~ | ||
| - | On mobile devices, a checkbox should sometimes look like a switch (e.g. for settings). If you want to show a switch instead a checkbox, simply add the following style: | + | On mobile devices, a checkbox should sometimes look like a switch (e.g. for settings). If you want to show a switch instead a checkbox, simply use the following style: |
| <file java> | <file java> | ||
| + | //UICheckBox | ||
| Style.addStyleNames(checkbox, "f_switch"); | Style.addStyleNames(checkbox, "f_switch"); | ||
| + | //UIEditor | ||
| + | Style.addStyleNames(editor, "f_switch"); | ||
| + | |||
| + | //cell editors | ||
| + | cellEditor.setStyle(new Style("f_switch")); | ||
| </file> | </file> | ||
| + | |||
| + | It's possible to set an unbound checkbox as switch, a bound editor or a cell editor (for table and editor). | ||
| + | |||
| + | The result looks like: | ||
| + | |||
| + | {{:flutterui:checkbox.png?nolink&400|}} | ||
| + | {{:flutterui:switch.png?nolink&400|}} | ||
