[PATCH] page/buffer: Fix always showing the jump button in compact mode
Export this patch
---
lib/page/buffer.dart | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/lib/page/buffer.dart b/lib/page/buffer.dart
index 135591d..034fd06 100644
--- a/lib/page/buffer.dart
+++ b/lib/page/buffer.dart
@@ -88,7 +88,6 @@ class _BufferPageState extends State<BufferPage> with WidgetsBindingObserver, Si
bool _isAtBottom = false;
bool _initialChatHistoryLoaded = false;
- bool _showJumpToBottom = false;
int? _blinkMsgIndex;
@override
@@ -138,16 +137,11 @@ class _BufferPageState extends State<BufferPage> with WidgetsBindingObserver, Si
}
_isAtTop = isAtTop;
- var showJumpToBottom = positions.any((pos) => pos.index >= 20);
- if (_showJumpToBottom != showJumpToBottom) {
- setState(() {
- _showJumpToBottom = showJumpToBottom;
- });
- }
-
var isAtBottom = positions.any((pos) => pos.index < 2);
if (_isAtBottom != isAtBottom) {
- _isAtBottom = isAtBottom;
+ setState(() {
+ _isAtBottom = isAtBottom;
+ });
_updateBufferFocus();
}
@@ -462,7 +456,7 @@ class _BufferPageState extends State<BufferPage> with WidgetsBindingObserver, Si
}
Widget? jumpToBottom;
- if (_showJumpToBottom) {
+ if (_initialChatHistoryLoaded && !messages.isEmpty && !_isAtBottom) {
jumpToBottom = Positioned(
right: 15,
bottom: 15,
base-commit: 871810712fad3dd5aea917ed7b73ec7774efa492
--
2.40.0
Pushed a less intrusive fix in 0e943f86d874 ("page/buffer: ensure
"jump to bottom" button is hidden at bottom").