搜索插件、代码仓与 APP 分类

flutter_interactive_keyboard 封面
插件详情v0.2.0

flutter_interactive_keyboard

一个 Flutter 插件,可交互式地关闭键盘,类似于 iOS 原生行为。在 Android 上,该功能通过无拖拽方式模拟实现。

AndroidiOS
近 30 天下载
56
喜欢数
33
Pub 分数
140

安装插件

flutter pub add flutter_interactive_keyboard

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 插件,可实现交互式键盘关闭功能,模拟 iOS 的原生拖拽关闭行为。在 iOS 上,用户可以通过滑动键盘将其关闭。在 Android 上,则通过模拟类似手势来实现,但不涉及实际的拖拽操作。该插件通过提供跨平台的直观键盘控制,提升了用户体验,保持与原生移动行为的一致性。它可无缝集成到现有的 Flutter 应用中,设置简单。

适合场景

  • 表单中的交互式键盘关闭
  • 在聊天或输入密集型应用中提升用户体验
  • 在 Android 上模仿 iOS 原生键盘手势
  • 通过手势控制提升可访问性

主要特点

  • iOS 风格的拖动关闭手势
  • Android 手势模拟
  • 最小集成工作量
  • 跨平台一致性
  • dismissal 期间的平滑动画

适合对象

  • 面向 iOS 风格用户体验的开发者
  • 频繁使用键盘的应用
  • 以用户体验为中心的移动应用
  • 表单密集型或消息界面

使用建议

  • 仅限键盘收起
  • 无手势灵敏度自定义
  • Android 的行为与真正的拖拽不同
  • 可能与其他手势检测器冲突

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

pub package

This plugin is not under active development. If you'd like to contribute, PRs are welcomed.

Flutter Interactive Keyboard

A way to mimic the iOS interactive dismissable keyboard in Flutter. For Android, the behavior will still be applied without animation due to the Android keyboard limitations.

How to use it

The KeyboardManagerWidget defines the area where the draggable keyboard is enabled. Gestures are passed to the widget in order to permit both scrolling and drag-to-dismiss behavior.

focusNode is required when using a TextField to manage the keyboard opening and closing.

See the full example to see a complete implementation.

KeyboardManagerWidget(
  focusNode: _focusNode,
  child: ListView.builder(
    itemCount: 100,
    itemBuilder: (context,index){
      return ListTile(
        title: Text("element $index"),
      );
    },
  ),
)

Advanced

Change focusNode

If your app has more than one TextField that should trigger the keyboard, you can change the current FocusNode from the KeyboardManagerWidgetState as follows:

// Init variable
GlobalKey<KeyboardManagerWidgetState> _key = GlobalKey();

// In the build method
KeyboardManagerWidget(
  key: _key,
  ...
)

// Wherever you like
_key.currentState.substituteFocusNode = newFocusNode;

所属分类

源码仓库

使用此插件的项目

暂无相关数据。