mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-24 06:22:34 +01:00
Add scroll down button in chat
This commit is contained in:
parent
5451216695
commit
061d76bbab
@ -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
|
||||
|
@ -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>[
|
||||
|
Loading…
Reference in New Issue
Block a user