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, ___) {
|
builder: (_, height, ___) {
|
||||||
var paddingHeight = height;
|
var paddingHeight = height;
|
||||||
if (Platform.isAndroid) {
|
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(
|
return AnimatedContainer(
|
||||||
duration: const Duration(microseconds: 110),
|
duration: const Duration(microseconds: 110),
|
||||||
height: paddingHeight,
|
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';
|
import 'package:keyboard_height_plugin/keyboard_height_plugin.dart';
|
||||||
|
|
||||||
typedef KeyboardHeightCallback = void Function(double height);
|
typedef KeyboardHeightCallback = void Function(double height);
|
||||||
@ -9,8 +10,6 @@ class KeyboardHeightObserver {
|
|||||||
KeyboardHeightObserver._() {
|
KeyboardHeightObserver._() {
|
||||||
_keyboardHeightPlugin.onKeyboardHeightChanged((height) {
|
_keyboardHeightPlugin.onKeyboardHeightChanged((height) {
|
||||||
notify(height);
|
notify(height);
|
||||||
|
|
||||||
currentKeyboardHeight = height;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,14 +33,13 @@ class KeyboardHeightObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void notify(double height) {
|
void notify(double height) {
|
||||||
// the keyboard height will notify twice with the same value on Android 14
|
// the keyboard height will notify twice with the same value on Android
|
||||||
if (ApplicationInfo.androidSDKVersion == 34) {
|
if (Platform.isAndroid && height == currentKeyboardHeight) {
|
||||||
if (height == 0 && currentKeyboardHeight == 0) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (final listener in _listeners) {
|
for (final listener in _listeners) {
|
||||||
listener(height);
|
listener(height);
|
||||||
}
|
}
|
||||||
|
currentKeyboardHeight = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,9 @@ class EditorStyleCustomizer {
|
|||||||
DefaultAppearanceSettings.getDefaultSelectionColor(context),
|
DefaultAppearanceSettings.getDefaultSelectionColor(context),
|
||||||
defaultTextDirection: appearance.defaultTextDirection,
|
defaultTextDirection: appearance.defaultTextDirection,
|
||||||
textStyleConfiguration: TextStyleConfiguration(
|
textStyleConfiguration: TextStyleConfiguration(
|
||||||
|
lineHeight: 1.4,
|
||||||
|
applyHeightToFirstAscent: true,
|
||||||
|
applyHeightToLastDescent: true,
|
||||||
text: baseTextStyle(fontFamily).copyWith(
|
text: baseTextStyle(fontFamily).copyWith(
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: afThemeExtension.onBackground,
|
color: afThemeExtension.onBackground,
|
||||||
|
@ -53,8 +53,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: d6388a4
|
ref: "64c0be8"
|
||||||
resolved-ref: d6388a485789e1414a098366e0f38f14e86a0660
|
resolved-ref: "64c0be88a113c2eece5512701527e7d11b8c9239"
|
||||||
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
|
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "2.5.1"
|
version: "2.5.1"
|
||||||
|
@ -184,7 +184,7 @@ dependency_overrides:
|
|||||||
appflowy_editor:
|
appflowy_editor:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/AppFlowy-IO/appflowy-editor.git
|
url: https://github.com/AppFlowy-IO/appflowy-editor.git
|
||||||
ref: "d6388a4"
|
ref: "64c0be8"
|
||||||
|
|
||||||
appflowy_editor_plugins:
|
appflowy_editor_plugins:
|
||||||
git:
|
git:
|
||||||
|
Loading…
Reference in New Issue
Block a user