Skip to content

Instantly share code, notes, and snippets.

@marenovakovic
Created January 24, 2023 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marenovakovic/548e45c4a8365c757edbd8f9814e0187 to your computer and use it in GitHub Desktop.
Save marenovakovic/548e45c4a8365c757edbd8f9814e0187 to your computer and use it in GitHub Desktop.
F# Flutter app view definition
let buttons dispatch : Widget =
Row(
mainAxisAlignment = MainAxisAlignment.center,
children =
[| MaterialButton(child = Text("Increment"), onPressed = fun () -> Increment |> dispatch)
MaterialButton(child = Text("Decrement"), onPressed = fun () -> Decrement |> dispatch)
SizedBox(width = 8) |]
)
let view model dispatch context : Widget =
Scaffold(
appBar = AppBar(title = Text("Hello from F#!")),
body =
Center(
child =
Column(
mainAxisAlignment = MainAxisAlignment.center,
children =
[| Text("Count:")
Text(model.count |> string)
SizedBox(height = 8)
buttons dispatch |]
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment