Last active
January 18, 2019 13:57
-
-
Save 13k/3c6bb56d8751b4b610bb4ac136d5c3bb to your computer and use it in GitHub Desktop.
Flutter in Go (https://divan.github.io/posts/flutter_go) - Functional options approach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (m *MyHomePage) Build(ctx BuildContext) Widget { | |
return NewScaffold( | |
ScaffoldWithAppBar( | |
NewAppBar( | |
AppBarWithTitle( | |
NewTitle( | |
TitleWithText(NewText(TextWithText("My home page"))), | |
), | |
), | |
), | |
), | |
ScaffoldWithBody( | |
NewCenter( | |
CenterWithChild( | |
NewColumn( | |
ColumnWithMainAxisAlignment(MainAxisAlignment.center), | |
ColumnWithChildren( | |
[]Widget{ | |
NewText(TextWithText("You have pushed the button this many times:")), | |
NewText( | |
TextWithText(fmt.Sprintf("%d", m.counter)), | |
TextWithStyle(ctx.textTheme.display1), | |
), | |
}, | |
), | |
), | |
), | |
), | |
), | |
ScaffoldWithFloatingActionButton( | |
NewFloatingActionButton( | |
FloatingActionButtonWithOnPressed(m.incrementCounter), | |
FloatingActionButtonWithTooltip("Increment"), | |
FloatingActionButtonWithChild( | |
NewIcon(IconWithIcon(Icons.add)), | |
), | |
), | |
), | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment