Add scroll down button in chat

This commit is contained in:
Christian Pauly 2020-02-09 16:58:49 +01:00
parent 5451216695
commit 061d76bbab
2 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,7 @@
### New features
- Select mode in chat
- Implement replies
- Add scroll down button in chat
# Version 0.6.0 - 2020-02-09
### New features

View File

@ -70,6 +70,8 @@ class _ChatState extends State<_Chat> {
Event replyEvent;
bool showScrollDownButton = false;
bool get selectMode => selectedEvents.isNotEmpty;
@override
@ -82,6 +84,13 @@ class _ChatState extends State<_Chat> {
EventTypes.RoomCreate) {
await timeline.requestHistory(historyCount: 100);
}
if (_scrollController.position.pixels > 0 &&
showScrollDownButton == false) {
setState(() => showScrollDownButton = true);
} else if (_scrollController.position.pixels == 0 &&
showScrollDownButton == true) {
setState(() => showScrollDownButton = false);
}
});
super.initState();
@ -366,6 +375,18 @@ class _ChatState extends State<_Chat> {
]
: <Widget>[ChatSettingsPopupMenu(room, !room.isDirectChat)],
),
floatingActionButton: showScrollDownButton
? Padding(
padding: const EdgeInsets.only(bottom: 56.0),
child: FloatingActionButton(
child: Icon(Icons.arrow_downward,
color: Theme.of(context).primaryColor),
onPressed: () => _scrollController.jumpTo(0),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
mini: true,
),
)
: null,
body: SafeArea(
child: Column(
children: <Widget>[