Skip to content

Commit

Permalink
fix: toolbar menu not showing beacase keyboard height is not updated …
Browse files Browse the repository at this point in the history
…in time
  • Loading branch information
asjqkkkk committed Dec 26, 2024
1 parent 7db11c7 commit 08c92a7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';

abstract class AppFlowyMobileToolbarWidgetService {
void closeItemMenu();

void closeKeyboard();

PropertyValueNotifier<bool> get showMenuNotifier;
Expand Down Expand Up @@ -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 _maxKeyboardHeight = 0.0;
ValueNotifier<double> cachedKeyboardHeight =
ValueNotifier(_maxKeyboardHeight);

// used to check if click the same item again
int? selectedMenuIndex;
Expand Down Expand Up @@ -408,6 +415,7 @@ class _MobileToolbarState extends State<_MobileToolbar>
);
}
}
if (keyboardHeight > 0) _maxKeyboardHeight = keyboardHeight;
return SizedBox(
height: keyboardHeight,
child: (showingMenu && selectedMenuIndex != null)
Expand Down

0 comments on commit 08c92a7

Please sign in to comment.