X-SLAYER 4 лет назад
Родитель
Сommit
5c8a34b848
2 измененных файлов: 3 добавлений и 3 удалений
  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 Просмотреть файл

@@ -20,7 +20,7 @@ import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.platform.PlatformView 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 { PlatformView, MethodChannel.MethodCallHandler, PluginRegistry.RequestPermissionsResultListener {


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


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


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


+ 1
- 1
android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRViewFactory.kt Просмотреть файл

@@ -10,7 +10,7 @@ import io.flutter.plugin.platform.PlatformViewFactory
class QRViewFactory(private val messenger: BinaryMessenger) : class QRViewFactory(private val messenger: BinaryMessenger) :
PlatformViewFactory(StandardMessageCodec.INSTANCE) { 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> val params = args as HashMap<String, Any>
return QRView(context, messenger, id, params) return QRView(context, messenger, id, params)
} }


Загрузка…
Отмена
Сохранить