mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 06:37:14 -04:00
fix: toolbar menu not showing beacase keyboard height is not updated in time (#7060)
This commit is contained in:
parent
3836545682
commit
bdc0fa1f2a
1 changed files with 11 additions and 1 deletions
|
@ -20,6 +20,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
|||
|
||||
abstract class AppFlowyMobileToolbarWidgetService {
|
||||
void closeItemMenu();
|
||||
|
||||
void closeKeyboard();
|
||||
|
||||
PropertyValueNotifier<bool> get showMenuNotifier;
|
||||
|
@ -179,7 +180,13 @@ class _MobileToolbarState extends State<_MobileToolbar>
|
|||
// but in this case, we don't want to update the cached keyboard height.
|
||||
// This is because we want to keep the same height when the menu is shown.
|
||||
bool canUpdateCachedKeyboardHeight = true;
|
||||
ValueNotifier<double> cachedKeyboardHeight = ValueNotifier(0.0);
|
||||
|
||||
/// when the [_MobileToolbar] disposed before the keyboard height can be updated in time,
|
||||
/// there will be an issue with the height being 0
|
||||
/// this is used to globally record the height.
|
||||
static double _globalCachedKeyboardHeight = 0.0;
|
||||
ValueNotifier<double> cachedKeyboardHeight =
|
||||
ValueNotifier(_globalCachedKeyboardHeight);
|
||||
|
||||
// used to check if click the same item again
|
||||
int? selectedMenuIndex;
|
||||
|
@ -408,6 +415,9 @@ class _MobileToolbarState extends State<_MobileToolbar>
|
|||
);
|
||||
}
|
||||
}
|
||||
if (keyboardHeight > 0) {
|
||||
_globalCachedKeyboardHeight = keyboardHeight;
|
||||
}
|
||||
return SizedBox(
|
||||
height: keyboardHeight,
|
||||
child: (showingMenu && selectedMenuIndex != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue