{"id":21748314,"url":"https://github.com/surfstudio/flutter-bottom-inset-observer","last_synced_at":"2025-10-23T07:02:46.408Z","repository":{"id":40349647,"uuid":"384333077","full_name":"surfstudio/flutter-bottom-inset-observer","owner":"surfstudio","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-26T13:46:36.000Z","size":95,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-01-11T08:40:51.096Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/surfstudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-07-09T05:39:23.000Z","updated_at":"2024-01-11T08:40:51.096Z","dependencies_parsed_at":"2023-08-10T10:15:32.087Z","dependency_job_id":null,"html_url":"https://github.com/surfstudio/flutter-bottom-inset-observer","commit_stats":null,"previous_names":["surfstudio/flutter-keyboard-listener"],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-bottom-inset-observer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-bottom-inset-observer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-bottom-inset-observer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-bottom-inset-observer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surfstudio","download_url":"https://codeload.github.com/surfstudio/flutter-bottom-inset-observer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226462288,"owners_count":17629049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T08:13:02.189Z","updated_at":"2025-10-23T07:02:46.048Z","avatar_url":"https://github.com/surfstudio.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bottom inset observer\n\n[![Build Status](https://shields.io/github/actions/workflow/status/surfstudio/flutter-bottom-inset-observer/main.yml?logo=github\u0026logoColor=white)](https://github.com/surfstudio/flutter-bottom-inset-observer)\n[![Coverage Status](https://img.shields.io/codecov/c/github/surfstudio/flutter-bottom-inset-observer?logo=codecov\u0026logoColor=white)](https://app.codecov.io/gh/surfstudio/bottom_inset_observer)\n[![Pub Version](https://img.shields.io/pub/v/bottom_inset_observer?logo=dart\u0026logoColor=white)](https://pub.dev/packages/bottom_inset_observer)\n[![Pub Likes](https://badgen.net/pub/likes/bottom_inset_observer)](https://pub.dev/packages/bottom_inset_observer)\n[![Pub popularity](https://badgen.net/pub/popularity/bottom_inset_observer)](https://pub.dev/packages/bottom_inset_observer/score)\n![Flutter Platform](https://badgen.net/pub/flutter-platform/bottom_inset_observer)\n\nThis package is part of the [SurfGear](https://github.com/surfstudio/SurfGear) toolkit made by [Surf](https://surf.ru).\n\n[![Surf Logger](https://i.ibb.co/8XD9Cbw/Bunner-LOGO.png)](https://github.com/surfstudio/SurfGear)\n\n## Description\n\nBottomInsetObserver - a package for tracking changes of the bottom margin (viewInsets.bottom) using callBack functions.\n\n## Installation\n\nAdd `bottom_inset_observer` to your `pubspec.yaml` file:\n\n\n```yaml\ndependencies:\n  bottom_inset_observer: $currentVersion$\n```\n\n\u003cp\u003eAt this moment, the current version of \u003ccode\u003ebottom_inset_observer\u003c/code\u003e is \u003ca href=\"https://pub.dev/packages/bottom_inset_obserevr\"\u003e\u003cimg style=\"vertical-align:middle;\" src=\"https://img.shields.io/pub/v/bottom_inset_observer.svg\" alt=\"bottom_inset_observer version\"\u003e\u003c/a\u003e.\u003c/p\u003e\n\n## Example\nAs an example, this package can be used to track the presence of a keyboard and handle its visibility status\n```dart\n  String _status = '';\n\n  bool _isVisible = false;\n  late BottomInsetObserver _insetObserver;\n\n  @override\n  void initState() {\n    super.initState();\n\n    /// Create instance of the observer and add changes listener\n    /// Note: if viewInsets.bottom \u003e 0 -\u003e handler called immediately\n    /// with current inset and delta == 0\n    _insetObserver = BottomInsetObserver()..addListener(_keyboardHandle);\n  }\n\n  @override\n  void dispose() {\n    /// Unregisters the observer observer and remove all listeners\n    _insetObserver.dispose();\n    super.dispose();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: Text(widget.title),\n      ),\n      body: Column(\n        children: [\n          const SizedBox(height: 50),\n          Text(_isVisible ? 'Visible' : 'Hidden'),\n          Text('Change status: $_status'),\n          const SizedBox(height: 50),\n          const TextField(),\n          const SizedBox(height: 50),\n          ElevatedButton(\n            onPressed: () {\n              if (FocusManager.instance.primaryFocus != null) {\n                FocusManager.instance.primaryFocus!.unfocus();\n              } else {\n                FocusScope.of(context).requestFocus(FocusNode());\n              }\n            },\n            child: const Text('Reset focus'),\n          ),\n          ElevatedButton(\n            onPressed: () {\n              /// You can remove listener manually\n              _insetObserver.removeListener(_keyboardHandle);\n            },\n            child: const Text('Remove listener'),\n          ),\n        ],\n      ),\n    );\n  }\n\n  /// Inset change handler\n  /// Will be called when subscribing if there is an inset \u003e 0,\n  /// further on every inset change\n  void _keyboardHandle(BottomInsetChanges change) {\n    setState(() {\n      /// getting current inset and check current status\n      /// of keyboard visability\n      _isVisible = change.currentInset \u003e 0;\n\n      /// get delta since last change and check current status of changes\n      if (change.delta == 0) _status = 'idle';\n      if (change.delta \u003e 0) _status = 'increase';\n      if (change.delta \u003c 0) _status = 'decrease';\n    });\n  }\n ```\n\n## Changelog\n\nAll notable changes to this project will be documented in [this file](./CHANGELOG.md).\n\n## Issues\n\nTo report your issues, submit them directly in the [Issues](https://github.com/surfstudio/flutter-bottom-inset-observer/issues) section.\n\n## Contribute\n\nIf you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please review our [contribution guide](/CONTRIBUTING.md) first and send us your pull request.\n\nYour PRs are always welcome.\n\n## How to reach us\n\nPlease feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.\n\n[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-blue.svg)](https://t.me/SurfGear)\n\n## License\n\n[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fflutter-bottom-inset-observer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurfstudio%2Fflutter-bottom-inset-observer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fflutter-bottom-inset-observer/lists"}