Mobile templates

Hi Anvil team,

It will make anvil more awesome than it is, if you guys create a template/page specific for mobile phones.

Anvil members, please vote with me to make this request a priority!

Thanks

2 Likes

How do you envision this actually working, in practice?

For example, Embarcadero’s RAD Studio recognizes different screen sizes and form factors on a per-device basis. So, for any Form, after defining your “default” or “generic” layout, you can also derive alternate layouts, for use on devices with smaller or differently-oriented screens.

When it comes time to actually build & run the application, then the builder chooses a suitable layout, for each Form.

1 Like

I don’t have experience with HTML. I imagine if you have a template that works for most phones, so when you open it in the phone it doesn’t look so awkward, like what happens when you open a webpage that is not suitable for mobile browsers.

Sorry, sometimes I get too long-winded.

It’s not about HTML. It’s about the relationship between a Form (as defined by its Python class definition) and the visual layout of its visible components (as defined by the Form’s .yaml file). Currently, there is exactly one layout file per Form, so there is exactly one visual layout for each Form.

In the Embarcadero approach, it’s generalized. You aren’t limited to one layout per Form. You can have as many layouts (layout files) as you want, per Form;, e.g., one that’s small, tall and narrow (phone), and one that’s big and wide (desktop). One Form, many layouts, all sharing the same Python class definition.

Another way to do it is to force each Form into a particular layout. Then you’d need to define multiple Forms (multiple class definitions), one desktop, one mobile, to achieve the same effect. You would choose to display one, or the other, depending on the device.