2026-01-23 17:56:06 -07:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import '../helpers/chat_scroll_controller.dart';
|
|
|
|
|
|
|
|
|
|
class JumpToBottomButton extends StatelessWidget {
|
|
|
|
|
final ChatScrollController scrollController;
|
|
|
|
|
|
2026-02-04 08:32:35 -08:00
|
|
|
const JumpToBottomButton({super.key, required this.scrollController});
|
2026-01-23 17:56:06 -07:00
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return ValueListenableBuilder<bool>(
|
|
|
|
|
valueListenable: scrollController.showJumpToBottom,
|
|
|
|
|
builder: (context, show, _) {
|
|
|
|
|
if (!show) return const SizedBox.shrink();
|
|
|
|
|
return Positioned(
|
|
|
|
|
right: 16,
|
|
|
|
|
bottom: 16,
|
|
|
|
|
child: FloatingActionButton.small(
|
|
|
|
|
onPressed: scrollController.jumpToBottom,
|
|
|
|
|
child: const Icon(Icons.keyboard_arrow_down),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|