Last active
June 27, 2021 23:32
-
-
Save rbro112/c1ec7e56bb75334f6253a5c60806b31b to your computer and use it in GitHub Desktop.
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
// This annotation builds a Map<SectionComponentType, SectionComponent> that GP uses to render sections | |
@SectionComponentType(SectionComponentType.TITLE) | |
class TitleSectionComponent : SectionComponent<TitleSection>() { | |
// Developers override this method and build UI from TitleSection corresponding to TITLE | |
override fun buildSectionUI(section: TitleSection) { | |
// Text() Turns our title into a styled TextView | |
Text( | |
text = section.title, | |
style = section.titleStyle | |
) | |
// Optionally build a subtitle if present in the TitleSection data model | |
if (!section.subtitle.isNullOrEmpty() { | |
Text( | |
text = section.subtitle, | |
style = section.subtitleStyle | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment