mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: cursor height is inconsistent after upgrading to Flutter 3.22 (#5574)
* fix: cursor height is inconsistent after upgrading to Flutter 3.22 * fix: cursor height is inconsistent after upgrading to Flutter 3.22 * fix: android toolbar height issue
This commit is contained in:
parent
fa86480458
commit
8557383a89
@ -385,8 +385,15 @@ class _MobileToolbarState extends State<_MobileToolbar>
|
||||
builder: (_, height, ___) {
|
||||
var paddingHeight = height;
|
||||
if (Platform.isAndroid) {
|
||||
paddingHeight += MediaQuery.of(context).viewPadding.bottom;
|
||||
// use the viewInsets to get the keyboard height on Android
|
||||
paddingHeight = MediaQuery.of(context).viewInsets.bottom;
|
||||
// if the padding height is 0 and the keyboard height is not 0,
|
||||
// use the keyboard height
|
||||
if (paddingHeight == 0 && height != 0) {
|
||||
paddingHeight = height + MediaQuery.of(context).viewPadding.bottom;
|
||||
}
|
||||
}
|
||||
debugPrint('Keyboard height: $paddingHeight');
|
||||
return AnimatedContainer(
|
||||
duration: const Duration(microseconds: 110),
|
||||
height: paddingHeight,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:appflowy/startup/tasks/prelude.dart';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:keyboard_height_plugin/keyboard_height_plugin.dart';
|
||||
|
||||
typedef KeyboardHeightCallback = void Function(double height);
|
||||
@ -9,8 +10,6 @@ class KeyboardHeightObserver {
|
||||
KeyboardHeightObserver._() {
|
||||
_keyboardHeightPlugin.onKeyboardHeightChanged((height) {
|
||||
notify(height);
|
||||
|
||||
currentKeyboardHeight = height;
|
||||
});
|
||||
}
|
||||
|
||||
@ -34,14 +33,13 @@ class KeyboardHeightObserver {
|
||||
}
|
||||
|
||||
void notify(double height) {
|
||||
// the keyboard height will notify twice with the same value on Android 14
|
||||
if (ApplicationInfo.androidSDKVersion == 34) {
|
||||
if (height == 0 && currentKeyboardHeight == 0) {
|
||||
return;
|
||||
}
|
||||
// the keyboard height will notify twice with the same value on Android
|
||||
if (Platform.isAndroid && height == currentKeyboardHeight) {
|
||||
return;
|
||||
}
|
||||
for (final listener in _listeners) {
|
||||
listener(height);
|
||||
}
|
||||
currentKeyboardHeight = height;
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ class EditorStyleCustomizer {
|
||||
DefaultAppearanceSettings.getDefaultSelectionColor(context),
|
||||
defaultTextDirection: appearance.defaultTextDirection,
|
||||
textStyleConfiguration: TextStyleConfiguration(
|
||||
lineHeight: 1.4,
|
||||
applyHeightToFirstAscent: true,
|
||||
applyHeightToLastDescent: true,
|
||||
text: baseTextStyle(fontFamily).copyWith(
|
||||
fontSize: fontSize,
|
||||
color: afThemeExtension.onBackground,
|
||||
|
@ -53,8 +53,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: d6388a4
|
||||
resolved-ref: d6388a485789e1414a098366e0f38f14e86a0660
|
||||
ref: "64c0be8"
|
||||
resolved-ref: "64c0be88a113c2eece5512701527e7d11b8c9239"
|
||||
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
|
||||
source: git
|
||||
version: "2.5.1"
|
||||
|
@ -184,7 +184,7 @@ dependency_overrides:
|
||||
appflowy_editor:
|
||||
git:
|
||||
url: https://github.com/AppFlowy-IO/appflowy-editor.git
|
||||
ref: "d6388a4"
|
||||
ref: "64c0be8"
|
||||
|
||||
appflowy_editor_plugins:
|
||||
git:
|
||||
|
Loading…
Reference in New Issue
Block a user