Last active
March 23, 2021 20:46
-
-
Save yaizudamashii/6ae0c89aa064a3e529d3e548b4daaf96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeStatefulWidget extends StatefulWidget { | |
@override | |
_SomeStatefulWidgetState createState() => _SomeStatefulWidgetState(); | |
} | |
class _SomeStatefulWidgetState extends State<SomeStatefulWidget> { | |
static const platform = const MethodChannel('your.app.identifier/qrcode'); | |
final PermissionsManager _permissionsManager = PermissionsManager(); | |
bool _iOSDidSendQRCode = false; | |
@override | |
void initState() { | |
super.initState(); | |
platform.setMethodCallHandler((MethodCall methodCall) { | |
switch (methodCall.method) { | |
case 'cameraPermissionChanged': // カメラの権限が変わった時は再描画 | |
setState(() { | |
}); | |
return null; | |
case 'resumeScan': // 画面のスキャンを再開 | |
_iOSDidSendQRCode = false; | |
this.controller.resumeCamera(); | |
return null; | |
default: | |
throw MissingPluginException('notImplemented'); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment