diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 217cbb9..660e9cf 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -15,15 +15,21 @@ jobs:
with:
channel: 'stable'
- run: flutter pub get
- - run: flutter test
+ working-directory: ./flutter_keyboard_visibility_platform_interface
- run: flutter pub get
- working-directory: ./example
- - run: flutter test
- working-directory: ./example
+ working-directory: ./flutter_keyboard_visibility_web
+ - run: flutter pub get
+ working-directory: ./flutter_keyboard_visibility
- run: flutter pub get
- working-directory: ./example_old
+ working-directory: ./flutter_keyboard_visibility/example
+ - run: flutter pub get
+ working-directory: ./flutter_keyboard_visibility/example_old
+ - run: flutter test
+ working-directory: ./flutter_keyboard_visibility
- run: flutter test
- working-directory: ./example_old
+ working-directory: ./flutter_keyboard_visibility/example
+ - run: flutter test
+ working-directory: ./flutter_keyboard_visibility/example_old
lint:
name: Lint
@@ -34,12 +40,22 @@ jobs:
with:
channel: 'stable'
- run: flutter pub get
+ working-directory: ./flutter_keyboard_visibility_platform_interface
+ - run: flutter pub get
+ working-directory: ./flutter_keyboard_visibility_web
+ - run: flutter pub get
+ working-directory: ./flutter_keyboard_visibility
- run: flutter pub get
- working-directory: ./example
+ working-directory: ./flutter_keyboard_visibility/example
- run: flutter pub get
- working-directory: ./example_old
+ working-directory: ./flutter_keyboard_visibility/example_old
+ - run: flutter analyze
+ working-directory: ./flutter_keyboard_visibility_platform_interface
+ - run: flutter analyze
+ working-directory: ./flutter_keyboard_visibility_web
- run: flutter analyze
+ working-directory: ./flutter_keyboard_visibility
- run: flutter analyze
- working-directory: ./example
+ working-directory: ./flutter_keyboard_visibility/example
- run: flutter analyze
- working-directory: ./example_old
\ No newline at end of file
+ working-directory: ./flutter_keyboard_visibility/example_old
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 2a8a04d..ac7e1bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,6 @@
.DS_Store
-.dart_tool/
-
-.packages
-.pub/
-
-pubspec.lock
-
-build/
-
-*.iml
# Ignore the root .idea folder except the runConfigurations folder
!idea/
.idea/*
-!/.idea/runConfigurations/
\ No newline at end of file
+!/.idea/runConfigurations/
diff --git a/.idea/runConfigurations/demo_with_provider.xml b/.idea/runConfigurations/demo_with_provider.xml
index 139e969..7a6f1dd 100644
--- a/.idea/runConfigurations/demo_with_provider.xml
+++ b/.idea/runConfigurations/demo_with_provider.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/example.xml b/.idea/runConfigurations/example.xml
index 5650683..aa626f9 100644
--- a/.idea/runConfigurations/example.xml
+++ b/.idea/runConfigurations/example.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/example_old.xml b/.idea/runConfigurations/example_old.xml
index 38a4aac..9f531d9 100644
--- a/.idea/runConfigurations/example_old.xml
+++ b/.idea/runConfigurations/example_old.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/README.md b/README.md
index cfb18ef..4684f7a 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,6 @@
React to keyboard visibility changes.
-This is a fork, original project [here](https://github.com/adee42/flutter_keyboard_visibility).
-
## Install
Add the dependency to your pubspec.yaml
```yaml
diff --git a/.gitattributes b/flutter_keyboard_visibility/.gitattributes
similarity index 100%
rename from .gitattributes
rename to flutter_keyboard_visibility/.gitattributes
diff --git a/flutter_keyboard_visibility/.gitignore b/flutter_keyboard_visibility/.gitignore
new file mode 100644
index 0000000..4b5762b
--- /dev/null
+++ b/flutter_keyboard_visibility/.gitignore
@@ -0,0 +1,13 @@
+.DS_Store
+.dart_tool/
+
+.packages
+.pub/
+
+pubspec.lock
+
+build/
+
+*.iml
+
+.idea/
\ No newline at end of file
diff --git a/flutter_keyboard_visibility/.idea/runConfigurations/demo_with_provider.xml b/flutter_keyboard_visibility/.idea/runConfigurations/demo_with_provider.xml
new file mode 100644
index 0000000..139e969
--- /dev/null
+++ b/flutter_keyboard_visibility/.idea/runConfigurations/demo_with_provider.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flutter_keyboard_visibility/.idea/runConfigurations/example.xml b/flutter_keyboard_visibility/.idea/runConfigurations/example.xml
new file mode 100644
index 0000000..5650683
--- /dev/null
+++ b/flutter_keyboard_visibility/.idea/runConfigurations/example.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flutter_keyboard_visibility/.idea/runConfigurations/example_old.xml b/flutter_keyboard_visibility/.idea/runConfigurations/example_old.xml
new file mode 100644
index 0000000..38a4aac
--- /dev/null
+++ b/flutter_keyboard_visibility/.idea/runConfigurations/example_old.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.metadata b/flutter_keyboard_visibility/.metadata
similarity index 100%
rename from .metadata
rename to flutter_keyboard_visibility/.metadata
diff --git a/CHANGELOG.md b/flutter_keyboard_visibility/CHANGELOG.md
similarity index 100%
rename from CHANGELOG.md
rename to flutter_keyboard_visibility/CHANGELOG.md
diff --git a/LICENSE b/flutter_keyboard_visibility/LICENSE
similarity index 100%
rename from LICENSE
rename to flutter_keyboard_visibility/LICENSE
diff --git a/flutter_keyboard_visibility/README.md b/flutter_keyboard_visibility/README.md
new file mode 100644
index 0000000..4684f7a
--- /dev/null
+++ b/flutter_keyboard_visibility/README.md
@@ -0,0 +1,96 @@
+# Flutter Keyboard Visibility
+[![pub package](https://img.shields.io/pub/v/flutter_keyboard_visibility.svg?label=flutter_keyboard_visibility&color=blue)](https://pub.dev/packages/flutter_keyboard_visibility)
+
+React to keyboard visibility changes.
+
+## Install
+Add the dependency to your pubspec.yaml
+```yaml
+dependencies:
+ flutter_keyboard_visibility: ^3.3.0
+```
+## Usage: React to Keyboard Visibility Changes
+### Option 1: Within your `Widget` tree using a builder
+Build your Widget tree based on whether or not the keyboard is visible by using `KeyboardVisibilityBuilder`.
+```dart
+import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
+
+/// In any of your widgets...
+@override
+Widget build(BuildContext context) {
+ return KeyboardVisibilityBuilder(
+ builder: (context, isKeyboardVisible) {
+ return Text(
+ 'The keyboard is: ${isKeyboardVisible ? 'VISIBLE' : 'NOT VISIBLE'}',
+ );
+ }
+ );
+```
+### Option 2: Within your `Widget` tree using a provider
+Build your `Widget` tree based on whether or not the keyboard is
+visible by including a `KeyboardVisibilityProvider` near the top
+of your tree.
+```dart
+import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
+
+// Somewhere near the top of your tree...
+@override
+Widget build(BuildContext context) {
+ return KeyboardVisibilityProvider(
+ child: MyDemoPage(),
+ );
+}
+
+// Within MyDemoPage...
+@override
+Widget build(BuildContext context) {
+ final bool isKeyboardVisible = KeyboardVisibilityProvider.isKeyboardVisible(context);
+ return Text(
+ 'The keyboard is: ${isKeyboardVisible ? 'VISIBLE' : 'NOT VISIBLE'}',
+ );
+}
+```
+
+### Option 3: Direct query and subscription
+
+Query and/or subscribe to keyboard visibility directly with the
+`KeyboardVisibility` class.
+
+```dart
+import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
+
+@override
+void initState() {
+ super.initState();
+ // Query
+ print('Keyboard visibility direct query: ${KeyboardVisibility.isVisible}');
+
+ // Subscribe
+ KeyboardVisibility.onChange.listen((bool visible) {
+ print('Keyboard visibility update. Is visible: ${visible}');
+ });
+}
+```
+## Usage: Dismiss keyboard on tap
+Place a `KeyboardDismissOnTap` near the top of your `Widget` tree. When a user taps outside of the currently focused `Widget`, the `Widget` will drop focus and the keyboard will be dismissed.
+```dart
+import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
+
+// Somewhere near the top of your tree...
+@override
+Widget build(BuildContext context) {
+ return KeyboardDismissOnTap(
+ child: MyDemoPage(),
+ );
+}
+```
+## Testing
+Call `KeyboardVisibility.setVisibilityForTesting(value)` to set a custom value to use during `flutter test`
+```dart
+void main() {
+ testWidgets('My Test', (WidgetTester tester) async {
+ KeyboardVisibility.setVisibilityForTesting(true);
+ await tester.pumpWidget(MyApp());
+ });
+}
+```
\ No newline at end of file
diff --git a/analysis_options.yaml b/flutter_keyboard_visibility/analysis_options.yaml
similarity index 100%
rename from analysis_options.yaml
rename to flutter_keyboard_visibility/analysis_options.yaml
diff --git a/android/.gitignore b/flutter_keyboard_visibility/android/.gitignore
similarity index 100%
rename from android/.gitignore
rename to flutter_keyboard_visibility/android/.gitignore
diff --git a/android/build.gradle b/flutter_keyboard_visibility/android/build.gradle
similarity index 100%
rename from android/build.gradle
rename to flutter_keyboard_visibility/android/build.gradle
diff --git a/android/gradle.properties b/flutter_keyboard_visibility/android/gradle.properties
similarity index 100%
rename from android/gradle.properties
rename to flutter_keyboard_visibility/android/gradle.properties
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/flutter_keyboard_visibility/android/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from android/gradle/wrapper/gradle-wrapper.properties
rename to flutter_keyboard_visibility/android/gradle/wrapper/gradle-wrapper.properties
diff --git a/android/settings.gradle b/flutter_keyboard_visibility/android/settings.gradle
similarity index 100%
rename from android/settings.gradle
rename to flutter_keyboard_visibility/android/settings.gradle
diff --git a/android/src/main/AndroidManifest.xml b/flutter_keyboard_visibility/android/src/main/AndroidManifest.xml
similarity index 100%
rename from android/src/main/AndroidManifest.xml
rename to flutter_keyboard_visibility/android/src/main/AndroidManifest.xml
diff --git a/android/src/main/java/com/jrai/flutter_keyboard_visibility/FlutterKeyboardVisibilityPlugin.java b/flutter_keyboard_visibility/android/src/main/java/com/jrai/flutter_keyboard_visibility/FlutterKeyboardVisibilityPlugin.java
similarity index 100%
rename from android/src/main/java/com/jrai/flutter_keyboard_visibility/FlutterKeyboardVisibilityPlugin.java
rename to flutter_keyboard_visibility/android/src/main/java/com/jrai/flutter_keyboard_visibility/FlutterKeyboardVisibilityPlugin.java
diff --git a/example/.gitignore b/flutter_keyboard_visibility/example/.gitignore
similarity index 100%
rename from example/.gitignore
rename to flutter_keyboard_visibility/example/.gitignore
diff --git a/example/.metadata b/flutter_keyboard_visibility/example/.metadata
similarity index 100%
rename from example/.metadata
rename to flutter_keyboard_visibility/example/.metadata
diff --git a/example/README.md b/flutter_keyboard_visibility/example/README.md
similarity index 100%
rename from example/README.md
rename to flutter_keyboard_visibility/example/README.md
diff --git a/example/analysis_options.yaml b/flutter_keyboard_visibility/example/analysis_options.yaml
similarity index 100%
rename from example/analysis_options.yaml
rename to flutter_keyboard_visibility/example/analysis_options.yaml
diff --git a/example/android/.gitignore b/flutter_keyboard_visibility/example/android/.gitignore
similarity index 100%
rename from example/android/.gitignore
rename to flutter_keyboard_visibility/example/android/.gitignore
diff --git a/example/android/app/build.gradle b/flutter_keyboard_visibility/example/android/app/build.gradle
similarity index 100%
rename from example/android/app/build.gradle
rename to flutter_keyboard_visibility/example/android/app/build.gradle
diff --git a/example/android/app/src/debug/AndroidManifest.xml b/flutter_keyboard_visibility/example/android/app/src/debug/AndroidManifest.xml
similarity index 100%
rename from example/android/app/src/debug/AndroidManifest.xml
rename to flutter_keyboard_visibility/example/android/app/src/debug/AndroidManifest.xml
diff --git a/example/android/app/src/main/AndroidManifest.xml b/flutter_keyboard_visibility/example/android/app/src/main/AndroidManifest.xml
similarity index 100%
rename from example/android/app/src/main/AndroidManifest.xml
rename to flutter_keyboard_visibility/example/android/app/src/main/AndroidManifest.xml
diff --git a/example/android/app/src/main/java/com/jrai/flutter_keyboard_visibility_example/MainActivity.java b/flutter_keyboard_visibility/example/android/app/src/main/java/com/jrai/flutter_keyboard_visibility_example/MainActivity.java
similarity index 100%
rename from example/android/app/src/main/java/com/jrai/flutter_keyboard_visibility_example/MainActivity.java
rename to flutter_keyboard_visibility/example/android/app/src/main/java/com/jrai/flutter_keyboard_visibility_example/MainActivity.java
diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/flutter_keyboard_visibility/example/android/app/src/main/res/drawable/launch_background.xml
similarity index 100%
rename from example/android/app/src/main/res/drawable/launch_background.xml
rename to flutter_keyboard_visibility/example/android/app/src/main/res/drawable/launch_background.xml
diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/example/android/app/src/main/res/values/styles.xml b/flutter_keyboard_visibility/example/android/app/src/main/res/values/styles.xml
similarity index 100%
rename from example/android/app/src/main/res/values/styles.xml
rename to flutter_keyboard_visibility/example/android/app/src/main/res/values/styles.xml
diff --git a/example/android/app/src/profile/AndroidManifest.xml b/flutter_keyboard_visibility/example/android/app/src/profile/AndroidManifest.xml
similarity index 100%
rename from example/android/app/src/profile/AndroidManifest.xml
rename to flutter_keyboard_visibility/example/android/app/src/profile/AndroidManifest.xml
diff --git a/example/android/build.gradle b/flutter_keyboard_visibility/example/android/build.gradle
similarity index 100%
rename from example/android/build.gradle
rename to flutter_keyboard_visibility/example/android/build.gradle
diff --git a/example/android/gradle.properties b/flutter_keyboard_visibility/example/android/gradle.properties
similarity index 100%
rename from example/android/gradle.properties
rename to flutter_keyboard_visibility/example/android/gradle.properties
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/flutter_keyboard_visibility/example/android/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from example/android/gradle/wrapper/gradle-wrapper.properties
rename to flutter_keyboard_visibility/example/android/gradle/wrapper/gradle-wrapper.properties
diff --git a/example/android/settings.gradle b/flutter_keyboard_visibility/example/android/settings.gradle
similarity index 100%
rename from example/android/settings.gradle
rename to flutter_keyboard_visibility/example/android/settings.gradle
diff --git a/example/ios/.gitignore b/flutter_keyboard_visibility/example/ios/.gitignore
similarity index 100%
rename from example/ios/.gitignore
rename to flutter_keyboard_visibility/example/ios/.gitignore
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/flutter_keyboard_visibility/example/ios/Flutter/AppFrameworkInfo.plist
similarity index 100%
rename from example/ios/Flutter/AppFrameworkInfo.plist
rename to flutter_keyboard_visibility/example/ios/Flutter/AppFrameworkInfo.plist
diff --git a/example/ios/Flutter/Debug.xcconfig b/flutter_keyboard_visibility/example/ios/Flutter/Debug.xcconfig
similarity index 100%
rename from example/ios/Flutter/Debug.xcconfig
rename to flutter_keyboard_visibility/example/ios/Flutter/Debug.xcconfig
diff --git a/example/ios/Flutter/Release.xcconfig b/flutter_keyboard_visibility/example/ios/Flutter/Release.xcconfig
similarity index 100%
rename from example/ios/Flutter/Release.xcconfig
rename to flutter_keyboard_visibility/example/ios/Flutter/Release.xcconfig
diff --git a/example/ios/Podfile b/flutter_keyboard_visibility/example/ios/Podfile
similarity index 100%
rename from example/ios/Podfile
rename to flutter_keyboard_visibility/example/ios/Podfile
diff --git a/example/ios/Podfile.lock b/flutter_keyboard_visibility/example/ios/Podfile.lock
similarity index 100%
rename from example/ios/Podfile.lock
rename to flutter_keyboard_visibility/example/ios/Podfile.lock
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.pbxproj
similarity index 100%
rename from example/ios/Runner.xcodeproj/project.pbxproj
rename to flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.pbxproj
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
similarity index 100%
rename from example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename to flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
similarity index 100%
rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
rename to flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
similarity index 100%
rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
rename to flutter_keyboard_visibility/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_keyboard_visibility/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
similarity index 100%
rename from example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
rename to flutter_keyboard_visibility/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/flutter_keyboard_visibility/example/ios/Runner.xcworkspace/contents.xcworkspacedata
similarity index 100%
rename from example/ios/Runner.xcworkspace/contents.xcworkspacedata
rename to flutter_keyboard_visibility/example/ios/Runner.xcworkspace/contents.xcworkspacedata
diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter_keyboard_visibility/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
similarity index 100%
rename from example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
rename to flutter_keyboard_visibility/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter_keyboard_visibility/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
similarity index 100%
rename from example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
rename to flutter_keyboard_visibility/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
diff --git a/example/ios/Runner/AppDelegate.h b/flutter_keyboard_visibility/example/ios/Runner/AppDelegate.h
similarity index 100%
rename from example/ios/Runner/AppDelegate.h
rename to flutter_keyboard_visibility/example/ios/Runner/AppDelegate.h
diff --git a/example/ios/Runner/AppDelegate.m b/flutter_keyboard_visibility/example/ios/Runner/AppDelegate.m
similarity index 100%
rename from example/ios/Runner/AppDelegate.m
rename to flutter_keyboard_visibility/example/ios/Runner/AppDelegate.m
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
similarity index 100%
rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
rename to flutter_keyboard_visibility/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/flutter_keyboard_visibility/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
similarity index 100%
rename from example/ios/Runner/Base.lproj/LaunchScreen.storyboard
rename to flutter_keyboard_visibility/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/flutter_keyboard_visibility/example/ios/Runner/Base.lproj/Main.storyboard
similarity index 100%
rename from example/ios/Runner/Base.lproj/Main.storyboard
rename to flutter_keyboard_visibility/example/ios/Runner/Base.lproj/Main.storyboard
diff --git a/example/ios/Runner/Info.plist b/flutter_keyboard_visibility/example/ios/Runner/Info.plist
similarity index 100%
rename from example/ios/Runner/Info.plist
rename to flutter_keyboard_visibility/example/ios/Runner/Info.plist
diff --git a/example/ios/Runner/main.m b/flutter_keyboard_visibility/example/ios/Runner/main.m
similarity index 100%
rename from example/ios/Runner/main.m
rename to flutter_keyboard_visibility/example/ios/Runner/main.m
diff --git a/example/lib/demo_with_provider.dart b/flutter_keyboard_visibility/example/lib/demo_with_provider.dart
similarity index 100%
rename from example/lib/demo_with_provider.dart
rename to flutter_keyboard_visibility/example/lib/demo_with_provider.dart
diff --git a/example/lib/main.dart b/flutter_keyboard_visibility/example/lib/main.dart
similarity index 100%
rename from example/lib/main.dart
rename to flutter_keyboard_visibility/example/lib/main.dart
diff --git a/example/pubspec.yaml b/flutter_keyboard_visibility/example/pubspec.yaml
similarity index 100%
rename from example/pubspec.yaml
rename to flutter_keyboard_visibility/example/pubspec.yaml
diff --git a/example/test/widget_test.dart b/flutter_keyboard_visibility/example/test/widget_test.dart
similarity index 100%
rename from example/test/widget_test.dart
rename to flutter_keyboard_visibility/example/test/widget_test.dart
diff --git a/flutter_keyboard_visibility/example/web/favicon.png b/flutter_keyboard_visibility/example/web/favicon.png
new file mode 100644
index 0000000..8aaa46a
Binary files /dev/null and b/flutter_keyboard_visibility/example/web/favicon.png differ
diff --git a/flutter_keyboard_visibility/example/web/icons/Icon-192.png b/flutter_keyboard_visibility/example/web/icons/Icon-192.png
new file mode 100644
index 0000000..b749bfe
Binary files /dev/null and b/flutter_keyboard_visibility/example/web/icons/Icon-192.png differ
diff --git a/flutter_keyboard_visibility/example/web/icons/Icon-512.png b/flutter_keyboard_visibility/example/web/icons/Icon-512.png
new file mode 100644
index 0000000..88cfd48
Binary files /dev/null and b/flutter_keyboard_visibility/example/web/icons/Icon-512.png differ
diff --git a/flutter_keyboard_visibility/example/web/index.html b/flutter_keyboard_visibility/example/web/index.html
new file mode 100644
index 0000000..1460b5e
--- /dev/null
+++ b/flutter_keyboard_visibility/example/web/index.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ example
+
+
+
+
+
+
+
+
diff --git a/flutter_keyboard_visibility/example/web/manifest.json b/flutter_keyboard_visibility/example/web/manifest.json
new file mode 100644
index 0000000..8c01291
--- /dev/null
+++ b/flutter_keyboard_visibility/example/web/manifest.json
@@ -0,0 +1,23 @@
+{
+ "name": "example",
+ "short_name": "example",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#0175C2",
+ "theme_color": "#0175C2",
+ "description": "A new Flutter project.",
+ "orientation": "portrait-primary",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "icons/Icon-192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ]
+}
diff --git a/example_old/.gitignore b/flutter_keyboard_visibility/example_old/.gitignore
similarity index 100%
rename from example_old/.gitignore
rename to flutter_keyboard_visibility/example_old/.gitignore
diff --git a/example_old/.metadata b/flutter_keyboard_visibility/example_old/.metadata
similarity index 100%
rename from example_old/.metadata
rename to flutter_keyboard_visibility/example_old/.metadata
diff --git a/example_old/analysis_options.yaml b/flutter_keyboard_visibility/example_old/analysis_options.yaml
similarity index 100%
rename from example_old/analysis_options.yaml
rename to flutter_keyboard_visibility/example_old/analysis_options.yaml
diff --git a/example_old/android/app/build.gradle b/flutter_keyboard_visibility/example_old/android/app/build.gradle
similarity index 100%
rename from example_old/android/app/build.gradle
rename to flutter_keyboard_visibility/example_old/android/app/build.gradle
diff --git a/example_old/android/app/src/debug/AndroidManifest.xml b/flutter_keyboard_visibility/example_old/android/app/src/debug/AndroidManifest.xml
similarity index 100%
rename from example_old/android/app/src/debug/AndroidManifest.xml
rename to flutter_keyboard_visibility/example_old/android/app/src/debug/AndroidManifest.xml
diff --git a/example_old/android/app/src/main/AndroidManifest.xml b/flutter_keyboard_visibility/example_old/android/app/src/main/AndroidManifest.xml
similarity index 100%
rename from example_old/android/app/src/main/AndroidManifest.xml
rename to flutter_keyboard_visibility/example_old/android/app/src/main/AndroidManifest.xml
diff --git a/example_old/android/app/src/main/java/com/example/MainActivity.java b/flutter_keyboard_visibility/example_old/android/app/src/main/java/com/example/MainActivity.java
similarity index 100%
rename from example_old/android/app/src/main/java/com/example/MainActivity.java
rename to flutter_keyboard_visibility/example_old/android/app/src/main/java/com/example/MainActivity.java
diff --git a/example_old/android/app/src/main/res/drawable/launch_background.xml b/flutter_keyboard_visibility/example_old/android/app/src/main/res/drawable/launch_background.xml
similarity index 100%
rename from example_old/android/app/src/main/res/drawable/launch_background.xml
rename to flutter_keyboard_visibility/example_old/android/app/src/main/res/drawable/launch_background.xml
diff --git a/example_old/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from example_old/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
diff --git a/example_old/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from example_old/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
diff --git a/example_old/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from example_old/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
diff --git a/example_old/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from example_old/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/example_old/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from example_old/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
rename to flutter_keyboard_visibility/example_old/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/example_old/android/app/src/main/res/values/styles.xml b/flutter_keyboard_visibility/example_old/android/app/src/main/res/values/styles.xml
similarity index 100%
rename from example_old/android/app/src/main/res/values/styles.xml
rename to flutter_keyboard_visibility/example_old/android/app/src/main/res/values/styles.xml
diff --git a/example_old/android/app/src/profile/AndroidManifest.xml b/flutter_keyboard_visibility/example_old/android/app/src/profile/AndroidManifest.xml
similarity index 100%
rename from example_old/android/app/src/profile/AndroidManifest.xml
rename to flutter_keyboard_visibility/example_old/android/app/src/profile/AndroidManifest.xml
diff --git a/example_old/android/build.gradle b/flutter_keyboard_visibility/example_old/android/build.gradle
similarity index 100%
rename from example_old/android/build.gradle
rename to flutter_keyboard_visibility/example_old/android/build.gradle
diff --git a/example_old/android/gradle.properties b/flutter_keyboard_visibility/example_old/android/gradle.properties
similarity index 100%
rename from example_old/android/gradle.properties
rename to flutter_keyboard_visibility/example_old/android/gradle.properties
diff --git a/example_old/android/gradle/wrapper/gradle-wrapper.properties b/flutter_keyboard_visibility/example_old/android/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from example_old/android/gradle/wrapper/gradle-wrapper.properties
rename to flutter_keyboard_visibility/example_old/android/gradle/wrapper/gradle-wrapper.properties
diff --git a/example_old/android/settings.gradle b/flutter_keyboard_visibility/example_old/android/settings.gradle
similarity index 100%
rename from example_old/android/settings.gradle
rename to flutter_keyboard_visibility/example_old/android/settings.gradle
diff --git a/example_old/ios/Flutter/AppFrameworkInfo.plist b/flutter_keyboard_visibility/example_old/ios/Flutter/AppFrameworkInfo.plist
similarity index 100%
rename from example_old/ios/Flutter/AppFrameworkInfo.plist
rename to flutter_keyboard_visibility/example_old/ios/Flutter/AppFrameworkInfo.plist
diff --git a/example_old/ios/Flutter/Debug.xcconfig b/flutter_keyboard_visibility/example_old/ios/Flutter/Debug.xcconfig
similarity index 100%
rename from example_old/ios/Flutter/Debug.xcconfig
rename to flutter_keyboard_visibility/example_old/ios/Flutter/Debug.xcconfig
diff --git a/example_old/ios/Flutter/Flutter.podspec b/flutter_keyboard_visibility/example_old/ios/Flutter/Flutter.podspec
similarity index 100%
rename from example_old/ios/Flutter/Flutter.podspec
rename to flutter_keyboard_visibility/example_old/ios/Flutter/Flutter.podspec
diff --git a/example_old/ios/Flutter/Release.xcconfig b/flutter_keyboard_visibility/example_old/ios/Flutter/Release.xcconfig
similarity index 100%
rename from example_old/ios/Flutter/Release.xcconfig
rename to flutter_keyboard_visibility/example_old/ios/Flutter/Release.xcconfig
diff --git a/example_old/ios/Podfile b/flutter_keyboard_visibility/example_old/ios/Podfile
similarity index 100%
rename from example_old/ios/Podfile
rename to flutter_keyboard_visibility/example_old/ios/Podfile
diff --git a/example_old/ios/Podfile.lock b/flutter_keyboard_visibility/example_old/ios/Podfile.lock
similarity index 100%
rename from example_old/ios/Podfile.lock
rename to flutter_keyboard_visibility/example_old/ios/Podfile.lock
diff --git a/example_old/ios/Runner.xcodeproj/project.pbxproj b/flutter_keyboard_visibility/example_old/ios/Runner.xcodeproj/project.pbxproj
similarity index 100%
rename from example_old/ios/Runner.xcodeproj/project.pbxproj
rename to flutter_keyboard_visibility/example_old/ios/Runner.xcodeproj/project.pbxproj
diff --git a/example_old/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/flutter_keyboard_visibility/example_old/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
similarity index 100%
rename from example_old/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename to flutter_keyboard_visibility/example_old/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/example_old/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_keyboard_visibility/example_old/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
similarity index 100%
rename from example_old/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
rename to flutter_keyboard_visibility/example_old/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
diff --git a/example_old/ios/Runner.xcworkspace/contents.xcworkspacedata b/flutter_keyboard_visibility/example_old/ios/Runner.xcworkspace/contents.xcworkspacedata
similarity index 100%
rename from example_old/ios/Runner.xcworkspace/contents.xcworkspacedata
rename to flutter_keyboard_visibility/example_old/ios/Runner.xcworkspace/contents.xcworkspacedata
diff --git a/example_old/ios/Runner/AppDelegate.swift b/flutter_keyboard_visibility/example_old/ios/Runner/AppDelegate.swift
similarity index 100%
rename from example_old/ios/Runner/AppDelegate.swift
rename to flutter_keyboard_visibility/example_old/ios/Runner/AppDelegate.swift
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
diff --git a/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
diff --git a/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
diff --git a/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
similarity index 100%
rename from example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
rename to flutter_keyboard_visibility/example_old/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
diff --git a/example_old/ios/Runner/Base.lproj/LaunchScreen.storyboard b/flutter_keyboard_visibility/example_old/ios/Runner/Base.lproj/LaunchScreen.storyboard
similarity index 100%
rename from example_old/ios/Runner/Base.lproj/LaunchScreen.storyboard
rename to flutter_keyboard_visibility/example_old/ios/Runner/Base.lproj/LaunchScreen.storyboard
diff --git a/example_old/ios/Runner/Base.lproj/Main.storyboard b/flutter_keyboard_visibility/example_old/ios/Runner/Base.lproj/Main.storyboard
similarity index 100%
rename from example_old/ios/Runner/Base.lproj/Main.storyboard
rename to flutter_keyboard_visibility/example_old/ios/Runner/Base.lproj/Main.storyboard
diff --git a/example_old/ios/Runner/Info.plist b/flutter_keyboard_visibility/example_old/ios/Runner/Info.plist
similarity index 100%
rename from example_old/ios/Runner/Info.plist
rename to flutter_keyboard_visibility/example_old/ios/Runner/Info.plist
diff --git a/example_old/ios/Runner/Runner-Bridging-Header.h b/flutter_keyboard_visibility/example_old/ios/Runner/Runner-Bridging-Header.h
similarity index 100%
rename from example_old/ios/Runner/Runner-Bridging-Header.h
rename to flutter_keyboard_visibility/example_old/ios/Runner/Runner-Bridging-Header.h
diff --git a/example_old/lib/main.dart b/flutter_keyboard_visibility/example_old/lib/main.dart
similarity index 100%
rename from example_old/lib/main.dart
rename to flutter_keyboard_visibility/example_old/lib/main.dart
diff --git a/example_old/pubspec.yaml b/flutter_keyboard_visibility/example_old/pubspec.yaml
similarity index 100%
rename from example_old/pubspec.yaml
rename to flutter_keyboard_visibility/example_old/pubspec.yaml
diff --git a/example_old/test/widget_test.dart b/flutter_keyboard_visibility/example_old/test/widget_test.dart
similarity index 100%
rename from example_old/test/widget_test.dart
rename to flutter_keyboard_visibility/example_old/test/widget_test.dart
diff --git a/ios/.gitignore b/flutter_keyboard_visibility/ios/.gitignore
similarity index 100%
rename from ios/.gitignore
rename to flutter_keyboard_visibility/ios/.gitignore
diff --git a/ios/Assets/.gitkeep b/flutter_keyboard_visibility/ios/Assets/.gitkeep
similarity index 100%
rename from ios/Assets/.gitkeep
rename to flutter_keyboard_visibility/ios/Assets/.gitkeep
diff --git a/ios/Classes/FlutterKeyboardVisibilityPlugin.h b/flutter_keyboard_visibility/ios/Classes/FlutterKeyboardVisibilityPlugin.h
similarity index 100%
rename from ios/Classes/FlutterKeyboardVisibilityPlugin.h
rename to flutter_keyboard_visibility/ios/Classes/FlutterKeyboardVisibilityPlugin.h
diff --git a/ios/Classes/FlutterKeyboardVisibilityPlugin.m b/flutter_keyboard_visibility/ios/Classes/FlutterKeyboardVisibilityPlugin.m
similarity index 100%
rename from ios/Classes/FlutterKeyboardVisibilityPlugin.m
rename to flutter_keyboard_visibility/ios/Classes/FlutterKeyboardVisibilityPlugin.m
diff --git a/ios/flutter_keyboard_visibility.podspec b/flutter_keyboard_visibility/ios/flutter_keyboard_visibility.podspec
similarity index 100%
rename from ios/flutter_keyboard_visibility.podspec
rename to flutter_keyboard_visibility/ios/flutter_keyboard_visibility.podspec
diff --git a/flutter_keyboard_visibility/lib/flutter_keyboard_visibility.dart b/flutter_keyboard_visibility/lib/flutter_keyboard_visibility.dart
new file mode 100644
index 0000000..8bafd1a
--- /dev/null
+++ b/flutter_keyboard_visibility/lib/flutter_keyboard_visibility.dart
@@ -0,0 +1,6 @@
+library flutter_keyboard_visibility;
+
+export 'package:flutter_keyboard_visibility/src/keyboard_visibility.dart';
+export 'package:flutter_keyboard_visibility/src/ui/keyboard_visibility_provider.dart';
+export 'package:flutter_keyboard_visibility/src/ui/keyboard_visibility_builder.dart';
+export 'package:flutter_keyboard_visibility/src/ui/keyboard_dismiss_on_tap.dart';
diff --git a/flutter_keyboard_visibility/lib/src/keyboard_visibility.dart b/flutter_keyboard_visibility/lib/src/keyboard_visibility.dart
new file mode 100644
index 0000000..7e78097
--- /dev/null
+++ b/flutter_keyboard_visibility/lib/src/keyboard_visibility.dart
@@ -0,0 +1,53 @@
+import 'dart:async';
+import 'package:meta/meta.dart';
+import 'package:flutter_keyboard_visibility_platform_interface/flutter_keyboard_visibility_platform_interface.dart';
+
+/// Provides access to the current keyboard visibility state and emits
+/// changes as they happen.
+class KeyboardVisibility {
+ KeyboardVisibility._();
+
+ static FlutterKeyboardVisibilityPlatform get _platform =>
+ FlutterKeyboardVisibilityPlatform.instance;
+
+ static bool _isInitialized = false;
+ static final _onChangeController = StreamController();
+ static final _onChange = _onChangeController.stream.asBroadcastStream();
+
+ /// Emits true every time the keyboard is shown, and false every time the
+ /// keyboard is dismissed.
+ static Stream get onChange {
+ // If _testIsVisible set, don't try to create the EventChannel
+ if (!_isInitialized && _testIsVisible == null) {
+ _platform.onChange.listen(_updateValue);
+ _isInitialized = true;
+ }
+ return _onChange;
+ }
+
+ /// Returns true if the keyboard is currently visible, false if not.
+ static bool get isVisible => _testIsVisible ?? _isVisible;
+ static bool _isVisible = false;
+
+ /// Fake representation of whether or not the keyboard is visible
+ /// for testing purposes. When this value is non-null, it will be
+ /// reported exclusively by the `isVisible` getter.
+ static bool _testIsVisible;
+
+ /// Forces `KeyboardVisibility` to report `isKeyboardVisible`
+ /// for testing purposes.
+ ///
+ /// `KeyboardVisibility` will continue reporting `isKeyboardVisible`
+ /// until the value is changed again with this method. To stop
+ /// using fake values altogether, set `isKeyboardVisible` to null.
+ @visibleForTesting
+ static void setVisibilityForTesting(bool isKeyboardVisible) {
+ _updateValue(isKeyboardVisible);
+ }
+
+ static void _updateValue(bool newValue) {
+ _isVisible = newValue;
+ _testIsVisible = newValue;
+ _onChangeController.add(newValue);
+ }
+}
diff --git a/flutter_keyboard_visibility/lib/src/ui/keyboard_dismiss_on_tap.dart b/flutter_keyboard_visibility/lib/src/ui/keyboard_dismiss_on_tap.dart
new file mode 100644
index 0000000..6acc3d0
--- /dev/null
+++ b/flutter_keyboard_visibility/lib/src/ui/keyboard_dismiss_on_tap.dart
@@ -0,0 +1,34 @@
+import 'package:flutter/widgets.dart';
+
+/// Removes the current focus and hides the keyboard when
+/// the user taps on this widget.
+///
+/// Place this widget somewhere near the top of your widget
+/// tree and when the user taps outside of a focused widget,
+/// the focus will be removed and the keyboard will be hidden.
+class KeyboardDismissOnTap extends StatelessWidget {
+ const KeyboardDismissOnTap({
+ Key key,
+ this.child,
+ }) : super(key: key);
+
+ final Widget child;
+
+ void _hideKeyboard(BuildContext context) {
+ final currentFocus = FocusScope.of(context);
+
+ if (!currentFocus.hasPrimaryFocus && currentFocus.hasFocus) {
+ FocusManager.instance.primaryFocus.unfocus();
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () {
+ _hideKeyboard(context);
+ },
+ child: child,
+ );
+ }
+}
diff --git a/flutter_keyboard_visibility/lib/src/ui/keyboard_visibility_builder.dart b/flutter_keyboard_visibility/lib/src/ui/keyboard_visibility_builder.dart
new file mode 100644
index 0000000..8db0171
--- /dev/null
+++ b/flutter_keyboard_visibility/lib/src/ui/keyboard_visibility_builder.dart
@@ -0,0 +1,23 @@
+import 'package:flutter/widgets.dart';
+import 'package:flutter_keyboard_visibility/src/keyboard_visibility.dart';
+
+/// A convenience builder that exposes if the native keyboard is visible.
+class KeyboardVisibilityBuilder extends StatelessWidget {
+ const KeyboardVisibilityBuilder({Key key, this.builder}) : super(key: key);
+
+ /// A builder method that exposes if the native keyboard is visible.
+ final Widget Function(BuildContext, bool isKeyboardVisible) builder;
+
+ @override
+ Widget build(BuildContext context) {
+ return StreamBuilder(
+ stream: KeyboardVisibility.onChange,
+ initialData: KeyboardVisibility.isVisible,
+ builder: (context, snapshot) {
+ final isKeyboardVisible = snapshot.data;
+
+ return builder(context, isKeyboardVisible);
+ },
+ );
+ }
+}
diff --git a/flutter_keyboard_visibility/lib/src/ui/keyboard_visibility_provider.dart b/flutter_keyboard_visibility/lib/src/ui/keyboard_visibility_provider.dart
new file mode 100644
index 0000000..5dc04ab
--- /dev/null
+++ b/flutter_keyboard_visibility/lib/src/ui/keyboard_visibility_provider.dart
@@ -0,0 +1,103 @@
+import 'dart:async';
+import 'package:flutter/widgets.dart';
+import 'package:flutter_keyboard_visibility/src/keyboard_visibility.dart';
+
+/// Widget that reports to its descendants whether or not
+/// the keyboard is currently visible.
+///
+/// Example usage:
+///
+/// ```
+/// // A Builder is used in this example solely for the purpose
+/// // of demonstrating ancestor access from within a single
+/// // build() method. You do not need to use a Builder if you
+/// // access KeyboardVisibilityProvider from within a custom
+/// // StatelessWidget or StatefulWidget.
+/// return KeyboardVisibilityProvider(
+/// child: Builder(
+/// builder: (BuildContext context) {
+/// final bool isKeyboardVisible = KeyboarVisibilityProvider.isKeyboardVisible(context);
+///
+/// return Text('Keyboard is visible: $isKeyboardVisible');
+/// },
+/// ),
+/// );
+/// ```
+class KeyboardVisibilityProvider extends StatefulWidget {
+ /// Returns `true` if the keyboard is currently visible, `false`
+ /// if the keyboard is not currently visible, or `null` if
+ /// the `flutter_keyboard_visibility` plugin does not yet
+ /// know if the keyboard is visible.
+ ///
+ /// This method also establishes an `InheritedWidget` dependency
+ /// with the given `context`, and therefore the given `context`
+ /// will automatically rebuild if the keyboard visibility changes.
+ static bool isKeyboardVisible(BuildContext context) {
+ return context
+ .dependOnInheritedWidgetOfExactType<
+ _KeyboardVisibilityInheritedWidget>()
+ .isKeyboardVisible;
+ }
+
+ const KeyboardVisibilityProvider({
+ Key key,
+ this.child,
+ }) : super(key: key);
+
+ final Widget child;
+
+ @override
+ _KeyboardVisibilityProviderState createState() =>
+ _KeyboardVisibilityProviderState();
+}
+
+class _KeyboardVisibilityProviderState
+ extends State {
+ StreamSubscription _subscription;
+ bool _isKeyboardVisible = false;
+
+ @override
+ void initState() {
+ super.initState();
+ _isKeyboardVisible = KeyboardVisibility.isVisible;
+ _subscription =
+ KeyboardVisibility.onChange.listen(_onKeyboardVisibilityChange);
+ }
+
+ void _onKeyboardVisibilityChange(bool isKeyboardVisible) {
+ setState(() {
+ _isKeyboardVisible = isKeyboardVisible;
+ });
+ }
+
+ @override
+ void dispose() {
+ _subscription.cancel();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return _KeyboardVisibilityInheritedWidget(
+ isKeyboardVisible: _isKeyboardVisible,
+ child: widget.child,
+ );
+ }
+}
+
+/// `InheritedWidget` that rebuilds descendants whenever
+/// `isKeyboardVisible` changes.
+class _KeyboardVisibilityInheritedWidget extends InheritedWidget {
+ _KeyboardVisibilityInheritedWidget({
+ Key key,
+ @required this.isKeyboardVisible,
+ Widget child,
+ }) : super(key: key, child: child);
+
+ final bool isKeyboardVisible;
+
+ @override
+ bool updateShouldNotify(_KeyboardVisibilityInheritedWidget oldWidget) {
+ return isKeyboardVisible != oldWidget.isKeyboardVisible;
+ }
+}
diff --git a/pubspec.yaml b/flutter_keyboard_visibility/pubspec.yaml
similarity index 62%
rename from pubspec.yaml
rename to flutter_keyboard_visibility/pubspec.yaml
index 6fb665b..9ff5964 100644
--- a/pubspec.yaml
+++ b/flutter_keyboard_visibility/pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_keyboard_visibility
description: Flutter plugin for discovering the state of the soft-keyboard visibility on Android and iOS.
-version: 3.3.0
+version: 4.0.0
homepage: https://github.com/MisterJimson/flutter_keyboard_visibility
environment:
@@ -8,6 +8,11 @@ environment:
flutter: ">=1.12.13+hotfix.6"
dependencies:
+ meta: any
+ flutter_keyboard_visibility_platform_interface:
+ path: ../flutter_keyboard_visibility_platform_interface
+ flutter_keyboard_visibility_web:
+ path: ../flutter_keyboard_visibility_web
flutter:
sdk: flutter
@@ -23,4 +28,6 @@ flutter:
package: com.jrai.flutter_keyboard_visibility
pluginClass: FlutterKeyboardVisibilityPlugin
ios:
- pluginClass: FlutterKeyboardVisibilityPlugin
\ No newline at end of file
+ pluginClass: FlutterKeyboardVisibilityPlugin
+ web:
+ default_package: flutter_keyboard_visibility_web
\ No newline at end of file
diff --git a/test/flutter_keyboard_visibility_test.dart b/flutter_keyboard_visibility/test/flutter_keyboard_visibility_test.dart
similarity index 100%
rename from test/flutter_keyboard_visibility_test.dart
rename to flutter_keyboard_visibility/test/flutter_keyboard_visibility_test.dart
diff --git a/flutter_keyboard_visibility_platform_interface/.gitignore b/flutter_keyboard_visibility_platform_interface/.gitignore
new file mode 100644
index 0000000..4b5762b
--- /dev/null
+++ b/flutter_keyboard_visibility_platform_interface/.gitignore
@@ -0,0 +1,13 @@
+.DS_Store
+.dart_tool/
+
+.packages
+.pub/
+
+pubspec.lock
+
+build/
+
+*.iml
+
+.idea/
\ No newline at end of file
diff --git a/flutter_keyboard_visibility_platform_interface/CHANGELOG.md b/flutter_keyboard_visibility_platform_interface/CHANGELOG.md
new file mode 100644
index 0000000..f307bd4
--- /dev/null
+++ b/flutter_keyboard_visibility_platform_interface/CHANGELOG.md
@@ -0,0 +1,3 @@
+## [1.0.0] - November 11, 2020
+
+* Initial interface
\ No newline at end of file
diff --git a/flutter_keyboard_visibility_platform_interface/analysis_options.yaml b/flutter_keyboard_visibility_platform_interface/analysis_options.yaml
new file mode 100644
index 0000000..b4ab8c9
--- /dev/null
+++ b/flutter_keyboard_visibility_platform_interface/analysis_options.yaml
@@ -0,0 +1,5 @@
+include: package:pedantic/analysis_options.yaml
+
+analyzer:
+ strong-mode:
+ implicit-casts: false
diff --git a/flutter_keyboard_visibility_platform_interface/lib/flutter_keyboard_visibility_platform_interface.dart b/flutter_keyboard_visibility_platform_interface/lib/flutter_keyboard_visibility_platform_interface.dart
new file mode 100644
index 0000000..15e99c8
--- /dev/null
+++ b/flutter_keyboard_visibility_platform_interface/lib/flutter_keyboard_visibility_platform_interface.dart
@@ -0,0 +1,29 @@
+import 'dart:async';
+import 'package:flutter_keyboard_visibility_platform_interface/src/method_channel_flutter_keyboard_visibility.dart';
+import 'package:plugin_platform_interface/plugin_platform_interface.dart';
+
+abstract class FlutterKeyboardVisibilityPlatform extends PlatformInterface {
+ FlutterKeyboardVisibilityPlatform() : super(token: _token);
+
+ static final Object _token = Object();
+
+ static FlutterKeyboardVisibilityPlatform _instance =
+ MethodChannelFlutterKeyboardVisibility();
+
+ /// The default instance of [FlutterKeyboardVisibilityPlatform] to use.
+ ///
+ /// Defaults to [MethodChannelFlutterKeyboardVisibility].
+ static FlutterKeyboardVisibilityPlatform get instance => _instance;
+
+ /// Platform-specific plugins should set this with their own platform-specific
+ /// class that extends [FlutterKeyboardVisibilityPlatform] when they register
+ /// themselves.
+ static set instance(FlutterKeyboardVisibilityPlatform instance) {
+ PlatformInterface.verifyToken(instance, _token);
+ _instance = instance;
+ }
+
+ Stream get onChange {
+ throw UnimplementedError('get onChange has not been implemented.');
+ }
+}
diff --git a/flutter_keyboard_visibility_platform_interface/lib/src/method_channel_flutter_keyboard_visibility.dart b/flutter_keyboard_visibility_platform_interface/lib/src/method_channel_flutter_keyboard_visibility.dart
new file mode 100644
index 0000000..00210b7
--- /dev/null
+++ b/flutter_keyboard_visibility_platform_interface/lib/src/method_channel_flutter_keyboard_visibility.dart
@@ -0,0 +1,19 @@
+import 'package:flutter/services.dart';
+import 'package:flutter_keyboard_visibility_platform_interface/flutter_keyboard_visibility_platform_interface.dart';
+import 'package:meta/meta.dart';
+
+class MethodChannelFlutterKeyboardVisibility
+ extends FlutterKeyboardVisibilityPlatform {
+ @visibleForTesting
+ EventChannel eventChannel = EventChannel('flutter_keyboard_visibility');
+
+ Stream _onKeyboardVisibilityChange;
+
+ @override
+ Stream get onChange {
+ _onKeyboardVisibilityChange ??= eventChannel
+ .receiveBroadcastStream()
+ .map((dynamic event) => (event as int) == 1);
+ return _onKeyboardVisibilityChange;
+ }
+}
diff --git a/flutter_keyboard_visibility_platform_interface/pubspec.yaml b/flutter_keyboard_visibility_platform_interface/pubspec.yaml
new file mode 100644
index 0000000..07189e8
--- /dev/null
+++ b/flutter_keyboard_visibility_platform_interface/pubspec.yaml
@@ -0,0 +1,20 @@
+name: flutter_keyboard_visibility_platform_interface
+description: A common platform interface for the flutter_keyboard_visibility plugin.
+version: 1.0.0
+homepage: https://github.com/MisterJimson/flutter_keyboard_visibility
+repository: https://github.com/MisterJimson/flutter_keyboard_visibility
+
+environment:
+ sdk: ">=2.1.0 <3.0.0"
+ flutter: ">=1.12.13+hotfix.6"
+
+dependencies:
+ flutter:
+ sdk: flutter
+ meta: any
+ plugin_platform_interface: ^1.0.3
+
+dev_dependencies:
+ pedantic: 1.9.0
+ flutter_test:
+ sdk: flutter
\ No newline at end of file
diff --git a/flutter_keyboard_visibility_web/.gitignore b/flutter_keyboard_visibility_web/.gitignore
new file mode 100644
index 0000000..60d5593
--- /dev/null
+++ b/flutter_keyboard_visibility_web/.gitignore
@@ -0,0 +1,16 @@
+.DS_Store
+.dart_tool/
+
+.packages
+.pub/
+
+pubspec.lock
+
+build/
+
+*.iml
+
+.idea/
+
+.flutter-plugins
+.flutter-plugins-dependencies
\ No newline at end of file
diff --git a/flutter_keyboard_visibility_web/CHANGELOG.md b/flutter_keyboard_visibility_web/CHANGELOG.md
new file mode 100644
index 0000000..2684462
--- /dev/null
+++ b/flutter_keyboard_visibility_web/CHANGELOG.md
@@ -0,0 +1,3 @@
+## [1.0.0] - November 11, 2020
+
+* Initial support so Flutter apps that run on web won't encounter errors. Visibility is returned as false.
\ No newline at end of file
diff --git a/flutter_keyboard_visibility_web/README.md b/flutter_keyboard_visibility_web/README.md
new file mode 100644
index 0000000..8bbd156
--- /dev/null
+++ b/flutter_keyboard_visibility_web/README.md
@@ -0,0 +1,4 @@
+# Flutter Keyboard Visibility Web
+Web support for Flutter Keyboard Visibility
+## Status
+Currently just returns false for visibility. In the future we would like to offer virtual keyboard detection.
\ No newline at end of file
diff --git a/flutter_keyboard_visibility_web/analysis_options.yaml b/flutter_keyboard_visibility_web/analysis_options.yaml
new file mode 100644
index 0000000..b4ab8c9
--- /dev/null
+++ b/flutter_keyboard_visibility_web/analysis_options.yaml
@@ -0,0 +1,5 @@
+include: package:pedantic/analysis_options.yaml
+
+analyzer:
+ strong-mode:
+ implicit-casts: false
diff --git a/flutter_keyboard_visibility_web/lib/flutter_keyboard_visibility_web.dart b/flutter_keyboard_visibility_web/lib/flutter_keyboard_visibility_web.dart
new file mode 100644
index 0000000..da9edb2
--- /dev/null
+++ b/flutter_keyboard_visibility_web/lib/flutter_keyboard_visibility_web.dart
@@ -0,0 +1,22 @@
+import 'dart:html' as html show window, Navigator;
+import 'package:flutter_keyboard_visibility_platform_interface/flutter_keyboard_visibility_platform_interface.dart';
+import 'package:flutter_web_plugins/flutter_web_plugins.dart';
+
+/// The web implementation of the [FlutterKeyboardVisibilityPlatform] of the Battery plugin.
+class FlutterKeyboardVisibilityPlugin
+ extends FlutterKeyboardVisibilityPlatform {
+ /// Constructs a [FlutterKeyboardVisibilityPlugin].
+ FlutterKeyboardVisibilityPlugin(html.Navigator navigator);
+
+ /// Factory method that initializes the Battery plugin platform with an instance
+ /// of the plugin for the web.
+ static void registerWith(Registrar registrar) {
+ FlutterKeyboardVisibilityPlatform.instance =
+ FlutterKeyboardVisibilityPlugin(html.window.navigator);
+ }
+
+ @override
+ Stream get onChange async* {
+ yield false;
+ }
+}
diff --git a/flutter_keyboard_visibility_web/pubspec.yaml b/flutter_keyboard_visibility_web/pubspec.yaml
new file mode 100644
index 0000000..7f00056
--- /dev/null
+++ b/flutter_keyboard_visibility_web/pubspec.yaml
@@ -0,0 +1,29 @@
+name: flutter_keyboard_visibility_web
+description: An implementation for the web platform of `flutter_keyboard_visibility'
+version: 1.0.0
+homepage: https://github.com/MisterJimson/flutter_keyboard_visibility
+repository: https://github.com/MisterJimson/flutter_keyboard_visibility
+
+environment:
+ sdk: ">=2.1.0 <3.0.0"
+ flutter: ">=1.12.13+hotfix.6"
+
+flutter:
+ plugin:
+ platforms:
+ web:
+ pluginClass: FlutterKeyboardVisibilityPlugin
+ fileName: flutter_keyboard_visibility_web.dart
+
+dependencies:
+ flutter_keyboard_visibility_platform_interface:
+ path: ../flutter_keyboard_visibility_platform_interface
+ flutter_web_plugins:
+ sdk: flutter
+ flutter:
+ sdk: flutter
+
+dev_dependencies:
+ pedantic: 1.9.0
+ flutter_test:
+ sdk: flutter
\ No newline at end of file
diff --git a/lib/flutter_keyboard_visibility.dart b/lib/flutter_keyboard_visibility.dart
deleted file mode 100644
index 05c271c..0000000
--- a/lib/flutter_keyboard_visibility.dart
+++ /dev/null
@@ -1,210 +0,0 @@
-import 'package:flutter/services.dart';
-import 'dart:async';
-
-import 'package:flutter/widgets.dart';
-
-/// Provides access to the current keyboard visibility state and emits
-/// changes as they happen.
-class KeyboardVisibility {
- static const _keyboardVisibilityStream =
- EventChannel('flutter_keyboard_visibility');
-
- static bool _isInitialized = false;
- static final _onChangeController = StreamController();
- static final _onChange = _onChangeController.stream.asBroadcastStream();
-
- /// Emits true every time the keyboard is shown, and false every time the
- /// keyboard is dismissed.
- static Stream get onChange {
- // If _testIsVisible set, don't try to create the EventChannel
- if (!_isInitialized && _testIsVisible == null) {
- _keyboardVisibilityStream
- .receiveBroadcastStream()
- .listen(_onKeyboardEvent);
- _isInitialized = true;
- }
- return _onChange;
- }
-
- /// Returns true if the keyboard is currently visible, false if not.
- static bool get isVisible => _testIsVisible ?? _isVisible;
- static bool _isVisible = false;
-
- /// Fake representation of whether or not the keyboard is visible
- /// for testing purposes. When this value is non-null, it will be
- /// reported exclusively by the `isVisible` getter.
- static bool _testIsVisible;
-
- /// Forces `KeyboardVisibility` to report `isKeyboardVisible`
- /// for testing purposes.
- ///
- /// `KeyboardVisibility` will continue reporting `isKeyboardVisible`
- /// until the value is changed again with this method. To stop
- /// using fake values altogether, set `isKeyboardVisible` to null.
- @visibleForTesting
- static void setVisibilityForTesting(bool isKeyboardVisible) {
- _testIsVisible = isKeyboardVisible;
- _onChangeController.add(_testIsVisible);
- }
-
- KeyboardVisibility._();
-
- static void _onKeyboardEvent(dynamic arg) {
- _isVisible = (arg as int) == 1;
- _onChangeController.add(isVisible);
- }
-}
-
-/// Widget that reports to its descendants whether or not
-/// the keyboard is currently visible.
-///
-/// Example usage:
-///
-/// ```
-/// // A Builder is used in this example solely for the purpose
-/// // of demonstrating ancestor access from within a single
-/// // build() method. You do not need to use a Builder if you
-/// // access KeyboardVisibilityProvider from within a custom
-/// // StatelessWidget or StatefulWidget.
-/// return KeyboardVisibilityProvider(
-/// child: Builder(
-/// builder: (BuildContext context) {
-/// final bool isKeyboardVisible = KeyboarVisibilityProvider.isKeyboardVisible(context);
-///
-/// return Text('Keyboard is visible: $isKeyboardVisible');
-/// },
-/// ),
-/// );
-/// ```
-class KeyboardVisibilityProvider extends StatefulWidget {
- /// Returns `true` if the keyboard is currently visible, `false`
- /// if the keyboard is not currently visible, or `null` if
- /// the `flutter_keyboard_visibility` plugin does not yet
- /// know if the keyboard is visible.
- ///
- /// This method also establishes an `InheritedWidget` dependency
- /// with the given `context`, and therefore the given `context`
- /// will automatically rebuild if the keyboard visibility changes.
- static bool isKeyboardVisible(BuildContext context) {
- return context
- .dependOnInheritedWidgetOfExactType<
- _KeyboardVisibilityInheritedWidget>()
- .isKeyboardVisible;
- }
-
- const KeyboardVisibilityProvider({
- Key key,
- this.child,
- }) : super(key: key);
-
- final Widget child;
-
- @override
- _KeyboardVisibilityProviderState createState() =>
- _KeyboardVisibilityProviderState();
-}
-
-class _KeyboardVisibilityProviderState
- extends State {
- StreamSubscription _subscription;
- bool _isKeyboardVisible = false;
-
- @override
- void initState() {
- super.initState();
- _isKeyboardVisible = KeyboardVisibility.isVisible;
- _subscription =
- KeyboardVisibility.onChange.listen(_onKeyboardVisibilityChange);
- }
-
- void _onKeyboardVisibilityChange(bool isKeyboardVisible) {
- setState(() {
- _isKeyboardVisible = isKeyboardVisible;
- });
- }
-
- @override
- void dispose() {
- _subscription.cancel();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) {
- return _KeyboardVisibilityInheritedWidget(
- isKeyboardVisible: _isKeyboardVisible,
- child: widget.child,
- );
- }
-}
-
-/// `InheritedWidget` that rebuilds descendants whenever
-/// `isKeyboardVisible` changes.
-class _KeyboardVisibilityInheritedWidget extends InheritedWidget {
- _KeyboardVisibilityInheritedWidget({
- Key key,
- @required this.isKeyboardVisible,
- Widget child,
- }) : super(key: key, child: child);
-
- final bool isKeyboardVisible;
-
- @override
- bool updateShouldNotify(_KeyboardVisibilityInheritedWidget oldWidget) {
- return isKeyboardVisible != oldWidget.isKeyboardVisible;
- }
-}
-
-/// Removes the current focus and hides the keyboard when
-/// the user taps on this widget.
-///
-/// Place this widget somewhere near the top of your widget
-/// tree and when the user taps outside of a focused widget,
-/// the focus will be removed and the keyboard will be hidden.
-class KeyboardDismissOnTap extends StatelessWidget {
- const KeyboardDismissOnTap({
- Key key,
- this.child,
- }) : super(key: key);
-
- final Widget child;
-
- void _hideKeyboard(BuildContext context) {
- final currentFocus = FocusScope.of(context);
-
- if (!currentFocus.hasPrimaryFocus && currentFocus.hasFocus) {
- FocusManager.instance.primaryFocus.unfocus();
- }
- }
-
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- _hideKeyboard(context);
- },
- child: child,
- );
- }
-}
-
-/// A convenience builder that exposes if the native keyboard is visible.
-class KeyboardVisibilityBuilder extends StatelessWidget {
- const KeyboardVisibilityBuilder({Key key, this.builder}) : super(key: key);
-
- /// A builder method that exposes if the native keyboard is visible.
- final Widget Function(BuildContext, bool isKeyboardVisible) builder;
-
- @override
- Widget build(BuildContext context) {
- return StreamBuilder(
- stream: KeyboardVisibility.onChange,
- initialData: KeyboardVisibility.isVisible,
- builder: (context, snapshot) {
- final isKeyboardVisible = snapshot.data;
-
- return builder(context, isKeyboardVisible);
- },
- );
- }
-}
diff --git a/pub_get.sh b/pub_get.sh
new file mode 100755
index 0000000..c4c1e34
--- /dev/null
+++ b/pub_get.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+(cd flutter_keyboard_visibility_platform_interface && flutter pub get)
+(cd flutter_keyboard_visibility_web && flutter pub get)
+(cd flutter_keyboard_visibility && flutter pub get)