Skip to content

Instantly share code, notes, and snippets.

@yaizudamashii
Last active March 23, 2021 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaizudamashii/6ae0c89aa064a3e529d3e548b4daaf96 to your computer and use it in GitHub Desktop.
Save yaizudamashii/6ae0c89aa064a3e529d3e548b4daaf96 to your computer and use it in GitHub Desktop.
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