fix(editor): incorrect position of toolbar in android (#12614)

### Before
Extra padding between toolbaar and keyboard
![CleanShot 2025-05-28 at 18 56 02](https://github.com/user-attachments/assets/9c865f7c-3acf-41b6-9436-d8d2d4c89c83)

### After
![CleanShot 2025-05-28 at 18 55 19](https://github.com/user-attachments/assets/0a4aeb01-32af-4420-b204-feca3981641b)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Bug Fixes**
  - Improved accuracy of keyboard height calculations by properly accounting for the navigation bar height on Android devices.

- **Refactor**
  - Standardized naming conventions for navigation bar height methods and unit conversion utilities to enhance consistency across the app.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
L-Sun
2025-05-29 04:19:01 +00:00
parent 1aa0cd27d5
commit 32a29657e4
5 changed files with 27 additions and 18 deletions

View File

@@ -116,10 +116,14 @@ framework.impl(VirtualKeyboardProvider, {
Promise.all([
Keyboard.addListener('keyboardWillShow', info => {
callback({
visible: true,
height: info.keyboardHeight,
});
(async () => {
const navBarHeight = (await AffineTheme.getSystemNavBarHeight())
.height;
callback({
visible: true,
height: info.keyboardHeight - navBarHeight,
});
})().catch(console.error);
}),
Keyboard.addListener('keyboardWillHide', () => {
callback({

View File

@@ -1,4 +1,4 @@
export interface AffineThemePlugin {
onThemeChanged(options: { darkMode: boolean }): Promise<void>;
getSystemNaviBarHeight(): Promise<{ height: number }>;
getSystemNavBarHeight(): Promise<{ height: number }>;
}