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

处理Apple环境

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