Skip to content

Commit

Permalink
v3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zmtzawqlp committed Jan 13, 2024
1 parent 79366fb commit d92ab38
Show file tree
Hide file tree
Showing 89 changed files with 7,192 additions and 2,783 deletions.
70 changes: 67 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,74 @@
## 7.0.0-non-null-safety
# 11.0.1

* fix issue on ios after flutter version 3.7.0. #191 #198

# 11.0.0

* Migrate to 3.7.0

# 10.2.0

* Add TextInputBindingMixin to prevent system keyboard show.
* Add No SystemKeyboard demo

# 10.1.1

* Fix issue selection not right #172

# 10.1.0

* Migrate to 3.0.0
* Support Scribble Handwriting for iPads

# 10.0.1

* Public ExtendedTextFieldState and add bringIntoView method to support jump to caret when insert text with TextEditingController

# 10.0.0

* Migrate to 2.10.0.
* Add shouldShowSelectionHandles and textSelectionGestureDetectorBuilder call back to define the behavior of handles and toolbar.
* Shortcut support for web and desktop.

# 9.0.3

* Fix hittest is not right #131

# 9.0.2

* Fix selectionWidthStyle and selectionHeightStyle are not working.

## 9.0.1

* Support to use keyboard move cursor for SpecialInlineSpan. #135
* Fix issue that backspace delete two chars. #141

## 9.0.0

* Migrate to 2.8

## 8.0.0

* Add [SpecialTextSpan.mouseCursor], [SpecialTextSpan.onEnter] and [SpecialTextSpan.onExit].
* merge code from 2.2.0

## 7.0.1

* Fix issue that composing is not updated.#122

## 7.0.0

* Breaking change: [SpecialText.getContent] is not include endflag now.(please check if you call getContent and your endflag length is more than 1)
* Fix demo manualDelete error #120
## 6.0.0-non-null-safety

* non-null-safety
## 6.0.1

* Fix issue that toolbar is not shown when double tap
* Fix throw exception when selectWordAtOffset

## 6.0.0

* Support null-safety

## 5.0.4

Expand Down
143 changes: 142 additions & 1 deletion README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

[![pub package](https://img.shields.io/pub/v/extended_text_field.svg)](https://pub.dartlang.org/packages/extended_text_field) [![GitHub stars](https://img.shields.io/github/stars/fluttercandies/extended_text_field)](https://github.com/fluttercandies/extended_text_field/stargazers) [![GitHub forks](https://img.shields.io/github/forks/fluttercandies/extended_text_field)](https://github.com/fluttercandies/extended_text_field/network) [![GitHub license](https://img.shields.io/github/license/fluttercandies/extended_text_field)](https://github.com/fluttercandies/extended_text_field/blob/master/LICENSE) [![GitHub issues](https://img.shields.io/github/issues/fluttercandies/extended_text_field)](https://github.com/fluttercandies/extended_text_field/issues) <a target="_blank" href="https://jq.qq.com/?_wv=1027&k=5bcc0gy"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="flutter-candies" title="flutter-candies"></a>

文档语言: [English](README.md) | 中文简体

官方输入框的扩展组件,支持图片,@某人,自定义文字背景。也支持自定义菜单和选择器。

文档语言: [English](README.md) | [中文简体](README-ZH.md)
[ExtendedTextField 在线 Demo](https://fluttercandies.github.io/extended_text_field/)


- [extended_text_field](#extended_text_field)
- [限制](#限制)
Expand All @@ -16,6 +19,10 @@
- [缓存图片](#缓存图片)
- [文本选择控制器](#文本选择控制器)
- [WidgetSpan](#widgetspan)
- [阻止系统键盘](#阻止系统键盘)
- [TextInputBindingMixin](#textinputbindingmixin)
- [TextInputFocusNode](#textinputfocusnode)
- [CustomKeyboard](#customkeyboard)
- [☕️Buy me a coffee](#️buy-me-a-coffee)

## 限制
Expand Down Expand Up @@ -508,6 +515,140 @@ class EmailText extends SpecialText {
}
```

## 阻止系统键盘

我们不需要代码侵入到 [ExtendedTextField] 或者 [TextField] 当中, 就可以阻止系统键盘弹出,

### TextInputBindingMixin

我们通过阻止 Flutter Framework 发送 `TextInput.show` 到 Flutter 引擎来阻止系统键盘弹出

你可以直接使用 [TextInputBinding].

``` dart
void main() {
TextInputBinding();
runApp(const MyApp());
}
```

或者你如果有其他的 `binding`,你可以这样。

``` dart
class YourBinding extends WidgetsFlutterBinding with TextInputBindingMixin,YourBindingMixin {
}
void main() {
YourBinding();
runApp(const MyApp());
}
```

或者你需要重载 `ignoreTextInputShow` 方法,你可以这样。

``` dart
class YourBinding extends TextInputBinding {
@override
// ignore: unnecessary_overrides
bool ignoreTextInputShow() {
// you can override it base on your case
// if NoKeyboardFocusNode is not enough
return super.ignoreTextInputShow();
}
}
void main() {
YourBinding();
runApp(const MyApp());
}
```

### TextInputFocusNode

[TextInputFocusNode] 传递给 [ExtendedTextField] 或者 [TextField]


``` dart
final TextInputFocusNode _focusNode = TextInputFocusNode();
@override
Widget build(BuildContext context) {
return ExtendedTextField(
// request keyboard if need
focusNode: _focusNode..debugLabel = 'ExtendedTextField',
);
}
@override
Widget build(BuildContext context) {
return TextField(
// request keyboard if need
focusNode: _focusNode..debugLabel = 'CustomTextField',
);
}
```

我们通过当前的 `FocusNode` 是否是 [TextInputFocusNode],来决定是否阻止系统键盘弹出的。

``` dart
final FocusNode? focus = FocusManager.instance.primaryFocus;
if (focus != null &&
focus is TextInputFocusNode &&
focus.ignoreSystemKeyboardShow) {
return true;
}
```
### CustomKeyboard

你可以通过当前焦点的变化的时候,来显示或者隐藏自定义的键盘。

当你的自定义键盘可以关闭而不让焦点失去,你应该在 [ExtendedTextField] 或者 [TextField]
`onTap` 事件中,再次判断键盘是否显示。

``` dart
@override
void initState() {
super.initState();
_focusNode.addListener(_handleFocusChanged);
}
void _onTextFiledTap() {
if (_bottomSheetController == null) {
_handleFocusChanged();
}
}
void _handleFocusChanged() {
if (_focusNode.hasFocus) {
// just demo, you can define your custom keyboard as you want
_bottomSheetController = showBottomSheet<void>(
context: FocusManager.instance.primaryFocus!.context!,
// set false, if don't want to drag to close custom keyboard
enableDrag: true,
builder: (BuildContext b) {
// your custom keyboard
return Container();
});
// maybe drag close
_bottomSheetController?.closed.whenComplete(() {
_bottomSheetController = null;
});
} else {
_bottomSheetController?.close();
_bottomSheetController = null;
}
}
@override
void dispose() {
_focusNode.removeListener(_handleFocusChanged);
super.dispose();
}
```


查看 [完整的例子](https://github.com/fluttercandies/extended_text_field/tree/master/example/lib/pages/simple/no_keyboard.dart)

## ☕️Buy me a coffee

![img](http://zmtzawqlp.gitee.io/my_images/images/qrcode.png)
Loading

0 comments on commit d92ab38

Please sign in to comment.