Kaynağa Gözat

some fixes

flutter-beta
X-SLAYER 4 yıl önce
ebeveyn
işleme
5c8a34b848
2 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. +2
    -2
      android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRView.kt
  2. +1
    -1
      android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRViewFactory.kt

+ 2
- 2
android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRView.kt Dosyayı Görüntüle

@@ -20,7 +20,7 @@ import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.platform.PlatformView


class QRView(private val context: Context, messenger: BinaryMessenger, private val id: Int, private val params: HashMap<String, Any>) :
class QRView(private val context: Context?, messenger: BinaryMessenger, private val id: Int, private val params: HashMap<String, Any>) :
PlatformView, MethodChannel.MethodCallHandler, PluginRegistry.RequestPermissionsResultListener {

private var isTorchOn: Boolean = false
@@ -279,7 +279,7 @@ class QRView(private val context: Context, messenger: BinaryMessenger, private v
}

private fun convertDpToPixels(dp: Double) =
(dp * context.resources.displayMetrics.density).toInt()
(dp * context!!.resources.displayMetrics.density).toInt()

private fun hasCameraPermission(): Boolean {
return permissionGranted ||


+ 1
- 1
android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRViewFactory.kt Dosyayı Görüntüle

@@ -10,7 +10,7 @@ import io.flutter.plugin.platform.PlatformViewFactory
class QRViewFactory(private val messenger: BinaryMessenger) :
PlatformViewFactory(StandardMessageCodec.INSTANCE) {

override fun create(context: Context, id: Int, args: Any?): PlatformView {
override fun create(context: Context?, id: Int, args: Any?): PlatformView {
val params = args as HashMap<String, Any>
return QRView(context, messenger, id, params)
}


Yükleniyor…
İptal
Kaydet