Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import io.flutter.plugin.common.StandardMessageCodec
import io.flutter.plugin.platform.PlatformView
import io.flutter.plugin.platform.PlatformViewFactory

class FLNativeViewFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
override fun create(context: Context, viewId: Int, args: Any?): PlatformView {
val creationParams = args as Map<String?, Any?>?
return FLNativeView(context, viewId, creationParams)
class FLNativeViewFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
override fun create(p0: Context?, p1: Int, p2: Any?): PlatformView {
val creationParams = p2 as Map<String?, Any?>?
val context = p0 as Context
return FLNativeView(context, p1, creationParams)
}
}


internal class FLNativeView(context: Context, id: Int, creationParams: Map<String?, Any?>?) : PlatformView {
private val webView: WebView = WebView(context)
private var arguments: Map<String?, Any?>? = creationParams
private val webView: WebView by lazy { WebView(context)}
private val arguments: Map<String?, Any?>? by lazy {creationParams}

override fun getView(): View {
return webView
Expand All @@ -26,6 +27,7 @@ internal class FLNativeView(context: Context, id: Int, creationParams: Map<Strin
override fun dispose() {}

init {
context?.let { ct ->
var width = (arguments!!["width"]!! as Number).toInt()
var height = (arguments!!["height"]!! as Number).toInt()
var content = arguments!!["content"] as String
Expand All @@ -36,7 +38,7 @@ internal class FLNativeView(context: Context, id: Int, creationParams: Map<Strin
webView.settings.useWideViewPort = true
webView.settings.javaScriptCanOpenWindowsAutomatically = true
webView.settings.loadWithOverviewMode = true

}

}

Expand Down