diff --git a/android/src/main/kotlin/com/ayeee/blue_print_pos/FLNativeViewFactory.kt b/android/src/main/kotlin/com/ayeee/blue_print_pos/FLNativeViewFactory.kt index 6dc8656..2357d71 100644 --- a/android/src/main/kotlin/com/ayeee/blue_print_pos/FLNativeViewFactory.kt +++ b/android/src/main/kotlin/com/ayeee/blue_print_pos/FLNativeViewFactory.kt @@ -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? - 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? + val context = p0 as Context + return FLNativeView(context, p1, creationParams) } } internal class FLNativeView(context: Context, id: Int, creationParams: Map?) : PlatformView { - private val webView: WebView = WebView(context) - private var arguments: Map? = creationParams + private val webView: WebView by lazy { WebView(context)} + private val arguments: Map? by lazy {creationParams} override fun getView(): View { return webView @@ -26,6 +27,7 @@ internal class FLNativeView(context: Context, id: Int, creationParams: Map var width = (arguments!!["width"]!! as Number).toInt() var height = (arguments!!["height"]!! as Number).toInt() var content = arguments!!["content"] as String @@ -36,7 +38,7 @@ internal class FLNativeView(context: Context, id: Int, creationParams: Map