Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: cursor height is inconsistent after upgrading to Flutter 3.22 (#5574)
Lucas.Xu8557383a89a1
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dartindex c9e09a04f0..f6a18ff45e 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart@@ -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,diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/keyboard_height_observer.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/keyboard_height_observer.dartindex 912bdb044f..d72f722eb6 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/keyboard_height_observer.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/keyboard_height_observer.dart@@ -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;}}diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dartindex 49be13cd8d..c691e7d821 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart@@ -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,diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lockindex c02bac5f1c..a16b2e4163 100644--- a/frontend/appflowy_flutter/pubspec.lock+++ b/frontend/appflowy_flutter/pubspec.lock@@ -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: gitversion: "2.5.1"diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yamlindex 25574a7440..6276425e78 100644--- a/frontend/appflowy_flutter/pubspec.yaml+++ b/frontend/appflowy_flutter/pubspec.yaml@@ -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: