Skip to main content
package io.nacular.doodle.docs.apps import io.nacular.doodle.application.Application import io.nacular.doodle.core.Display import io.nacular.doodle.core.view import io.nacular.doodle.drawing.Color.Companion.Black import io.nacular.doodle.drawing.Color.Companion.White import io.nacular.doodle.drawing.FontLoader import io.nacular.doodle.drawing.TextMetrics import io.nacular.doodle.drawing.paint import io.nacular.doodle.drawing.text import io.nacular.doodle.geometry.Point import io.nacular.doodle.layout.constraints.constrain import io.nacular.doodle.layout.constraints.fill import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch class HelloDoodle( fonts : FontLoader, display : Display, appScope : CoroutineScope, textMetrics: TextMetrics ): Application { init { appScope.launch { // Fonts are loaded async val bold = fonts { family = "verdana" size = 40 weight = 700 } val textSize = textMetrics.size("Hello, Doodle!", bold) //sampleStart display += view { render = { text( "Hello, Doodle!", at = Point((width - textSize.width) / 2, (height - textSize.height) / 2), color = Black, font = bold ) } } //sampleEnd display.fill(White.paint) display.layout = constrain(display.first(), fill) } } override fun shutdown() {} }

Doodle helps you create beautiful, modern apps entirely in Kotlin. Its render model is intuitive yet powerful, making it easy to achieve complex UIs with pixel level precision and layouts. This simplicity and power applies to everything from user input to drag and drop. Doodle lets you build and animate anything.

Start creating your app for Web and Desktop; just define your View hierarchy and business logic, and go.

Feedback

Doodle is still under active development, so there are going to be gaps and bugs. Please report issues, and submit feature requests. You can also join the discussion on the #doodle Kotlin Slack channel.

tip

http://slack.kotl.in has instructions for invitations to Kotlin Slack.

Leave a star

Don't forget to drop us a star if you like what you see.