提交 4d6653f2 authored 作者: 祁增奎's avatar 祁增奎

处理Apple环境

上级 cbccb2ae
## 0.0.1
* TODO: Describe initial release.
## 0.0.2
* MAINTENANCE: 判断只在Apple环境下处理
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
......@@ -8,15 +9,22 @@ class ClXListenerScreen {
StreamSubscription? _streamSubscription;
Future<bool> setSecureTextEntry({show = true}) async {
return await methodChannel.invokeMethod('secureTextEntry', {'show': show});
if (Platform.isIOS || Platform.isMacOS) {
return await methodChannel
.invokeMethod('secureTextEntry', {'show': show});
} else {
return true;
}
}
void addListener(Function(dynamic result) callback) {
if (Platform.isIOS || Platform.isMacOS) {
_streamSubscription ??=
eventChannel.receiveBroadcastStream().listen((event) {
callback(event);
});
}
}
void removeListener() {
if (_streamSubscription != null) {
......
name: clx_listener_screen
description: A new Flutter plugin project.
version: 1.0.0
version: 1.0.1
homepage: https://t.clxkj.cn/openSourceLibrary/clx_listener_screen
environment:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论