Skip to content

A note about the DSL #1096

@MangelMaxime

Description

@MangelMaxime

Hello,

While looking online about Fabulous I stumbled on this fslang-suggestions - Allow dot notation after body of computation expression without need for parenthesis.

While reading the issue discussion it made me think about how Oxpecker solve a similar problem. Instead of using members after the CE, it use properties to set information inside of the "CE constructor".

This code

ContentPage(
    "Dashboard",
    ScrollView(
        (VStack() {
            Label("Hello, World!")
                .textColor(Color.Red.ToFabColor())

            Button("Click me!")
                .backgroundColor(Color.Blue.ToFabColor())
        })
            .margin(Thickness(10., 0.))
    )
        .verticalScrollBarVisibility(ScrollBarVisibility.Never)
)
    .hasNavigationBar(false)

could be something like

ContentPage(
    "Dashboard",
    ScrollView(
        VStack(margin = Thickness(10., 0.)) {
            Label("Hello, World!", textColor = Color.Red.ToFabColor())
            Button("Click me!", backgroundColor = Color.Blue.ToFabColor())
        },
        verticalScrollBarVisibility = ScrollBarVisibility.Never
    )
    navigationBar = false
)

I didn't test my code out as I just wanted to mention the idea

You can see some example of working code in Oxpecker repository:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions