maybe use Qt & Wt? :slightly_smiling_face:
# kotlin-native
s
maybe use Qt & Wt? 🙂
s
I'm working on something like that as experimental project. Generally it is inspired by Flutter. For now it supports React as web backend, JavaFX as java backend, and flutter-engine as native backend. Components looks like this:
Copy code
class MyPage(key: String) : PureWidget(key) {
  override fun render() = Column {
    +Text(
        text = "Page title",
        style = TextStyle(
            fontSize = 24.0,
            fontWeight = bold
        )
    )

    +Container(margin = Insets(leftRight = 10.0)) {
      +Row {
        +Container(padding = 10.allSides) {
          +Column {
            +BulletList {
              +MenuItem("1", "About")
              +MenuItem("2", "Documentation")
            }
          }
        }
      }
    }
  }
}

class MenuItem(
    key: String,
    val title: String
) : PureWidget(key) {
  override fun render() = ListItem {
    +Text(color = 0xFF0000.rgbColor) {
      +MouseListener(click = ::click) {
        +title
      }
    }
  }

  private fun click(mouseEvent: MouseEvent) {
  }
}
But it is really crazy. It is only my part-time experiment.
r
so you're using flutter on desktop ?
s
yes, but only flutter-engine
p
I tried something similar for JVM and Native, but built on very low-level libraries like SDL and cairo (output on both platforms is exactly the same, pixel-for-pixel, because almost all of the code is shared)
also don't have that much time to dedicate to it though 😄
s
In fact, flutter-engine is not so high-level. It responsible only for layers composition and painting. All layout/rendering logic is implemented in flutter (dart), which I'm going to rewrite in kotlin/native
p
how are you using it in Kotlin Native? it's written in C++ and doesn't seem to have a C API
s
yep. moreover flutter-engine is dart-centric. I'm going to use only engine itself (sky engine), and rewrite other parts, to bind it to kotlin native
hmm... looks like now flutter engine is only wrapping skia api. sky engine used only for text rendreing.
p
but it's all C++, no? Kotlin Native can only directly interop with C libraries
unless you write/generate the glue code for it
s
yes, it is C++. By "bind it to kotlin native" I mean C api.