瀏覽代碼

修复了自定义键盘切换回原生键盘无法输入的问题,发布0.1.14

Kevin 6 年之前
父節點
當前提交
9cb76004cf

+ 4 - 0
CHANGELOG.md

@@ -1,3 +1,7 @@
+## [0.1.14] - TODO:修复了自定义键盘切换回原生键盘无法输入的问题
+* 修复了自定义键盘切换回原生键盘无法输入的问题
+* Popover可以设置遮罩层颜色
+
 ## [0.1.13] - TODO:修复hide后pop无效的问题
 
 ## [0.1.8] - TODO:完善了键盘的文档

+ 1 - 1
README.md

@@ -7,7 +7,7 @@ Usage
 Add this to your package's pubspec.yaml file:
 ``` yaml
 dependencies:
-  cool_ui: "^0.1.12"
+  cool_ui: "^0.1.14"
 ```
 
 # 控件

+ 1 - 0
documents/popover.md

@@ -26,6 +26,7 @@ CupertinoPopoverButton({
 | [popoverConstraints] | <code>BoxConstraints</code> | maxHeight:123.0  maxWidth:150.0 | 弹出框的最大最小高宽|
 | [onTap] | <code>BoolCallback</code> |  | 按钮点击事件,返回true取消默认反应(不打开Popover) |
 | [popoverColor] | <code>Color</code> | 白色 | 弹出框的背景颜色 |
+| [barrierColor] | <code>Color</code> | Colors.black54 | 遮罩层的颜色,目前不允许设置透明,如需要透明则使用Color.fromRGBO(0, 0, 0, 0.01)可达到类似效果|
 | [transitionDuration] | <code>Duration</code> | 0.2s  | 过度动画时间 |
 | [radius] | <code>double</code> |  8.0 | 弹出框的圆角弧度 |
 

+ 7 - 3
lib/keyboards/keyboard_manager.dart

@@ -66,8 +66,12 @@ class CoolKeyboard {
               clearKeyboard();
               _currentKeyboard = keyboardConfig;
               _keyboardController = KeyboardController(client:client)..addListener((){
-                var callbackMethodCall = MethodCall("TextInputClient.updateEditingState",[_keyboardController.client.connectionId,_keyboardController.value.toJSON()]);
-                BinaryMessages.handlePlatformMessage("flutter/textinput", _codec.encodeMethodCall(callbackMethodCall), (data){});
+                var callbackMethodCall = MethodCall("TextInputClient.updateEditingState",[
+                                                    _keyboardController.client.connectionId,
+                                                    _keyboardController.value.toJSON()]);
+                BinaryMessages.handlePlatformMessage("flutter/textinput", _codec.encodeMethodCall(callbackMethodCall), (data){
+
+                });
               });
             }
           });
@@ -134,7 +138,7 @@ class CoolKeyboard {
   }
 
   static hideKeyboard({bool animation=true}){
-    if(_keyboardEntry != null) {
+    if(_keyboardEntry != null && _pageKey != null) {
       _keyboardHeight = null;
       _pageKey.currentState.animationController.addStatusListener((status) {
         if (status == AnimationStatus.dismissed ||

+ 1 - 0
lib/keyboards/keyboard_media_query.dart

@@ -14,6 +14,7 @@ class KeyboardMediaQuery extends StatefulWidget{
 class KeyboardMediaQueryState extends State<KeyboardMediaQuery >{
   @override
   Widget build(BuildContext context) {
+    
     // TODO: implement build
     var data = MediaQuery.of(context);
     print('KeyboardMediaQuery${CoolKeyboard.keyboardHeight}');

+ 3 - 1
lib/widgets/popover/cupertino_popover.dart

@@ -11,6 +11,7 @@ class CupertinoPopoverButton extends StatelessWidget{
   final Duration transitionDuration;
   final BoolCallback onTap;
   final BoxConstraints popoverConstraints;
+  final Color barrierColor;
 
   CupertinoPopoverButton({
     @required this.child,
@@ -21,6 +22,7 @@ class CupertinoPopoverButton extends StatelessWidget{
     BoxConstraints popoverConstraints,
     this.onTap,
     this.transitionDuration=const Duration(milliseconds: 200),
+    this.barrierColor = Colors.black54,
     this.radius=8.0}):
         assert(popoverBuild != null),
         this.popoverConstraints =
@@ -54,7 +56,7 @@ class CupertinoPopoverButton extends StatelessWidget{
           },
           barrierDismissible: true,
           barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
-          barrierColor: Colors.black54,
+          barrierColor: this.barrierColor,
           transitionDuration: transitionDuration,
           transitionBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
             if(body == null){

+ 1 - 1
pubspec.yaml

@@ -1,6 +1,6 @@
 name: cool_ui
 description: Some practical Widget for flutter,Popover,Weui,Custom Keyboard
-version: 0.1.13
+version: 0.1.14
 author: Kevin <liangkaikevin@gmail.com>
 homepage: https://github.com/Im-Kevin/cool_ui