init
This commit is contained in:
1 parent
f54d552798
commit
c2ecf63462
82 files changed
+2143
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
typedef KeyboardHeightCallback = void Function(double height);
|
||||
|
||||
class KeyboardHeightPlugin {
|
||||
static const EventChannel _keyboardHeightEventChannel = const EventChannel('keyboardHeightEventChannel');
|
||||
|
||||
StreamSubscription? _keyboardHeightSubscription;
|
||||
|
||||
|
||||
void onKeyboardHeightChanged(KeyboardHeightCallback callback) {
|
||||
if (_keyboardHeightSubscription != null) {
|
||||
_keyboardHeightSubscription!.cancel();
|
||||
}
|
||||
_keyboardHeightSubscription = _keyboardHeightEventChannel
|
||||
.receiveBroadcastStream()
|
||||
.listen((dynamic height) {
|
||||
callback(height as double);
|
||||
});
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
if (_keyboardHeightSubscription != null) {
|
||||
_keyboardHeightSubscription!.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user