mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
Add scroll down button in chat
This commit is contained in:
parent
5451216695
commit
061d76bbab
@ -2,6 +2,7 @@
|
|||||||
### New features
|
### New features
|
||||||
- Select mode in chat
|
- Select mode in chat
|
||||||
- Implement replies
|
- Implement replies
|
||||||
|
- Add scroll down button in chat
|
||||||
|
|
||||||
# Version 0.6.0 - 2020-02-09
|
# Version 0.6.0 - 2020-02-09
|
||||||
### New features
|
### New features
|
||||||
|
@ -70,6 +70,8 @@ class _ChatState extends State<_Chat> {
|
|||||||
|
|
||||||
Event replyEvent;
|
Event replyEvent;
|
||||||
|
|
||||||
|
bool showScrollDownButton = false;
|
||||||
|
|
||||||
bool get selectMode => selectedEvents.isNotEmpty;
|
bool get selectMode => selectedEvents.isNotEmpty;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -82,6 +84,13 @@ class _ChatState extends State<_Chat> {
|
|||||||
EventTypes.RoomCreate) {
|
EventTypes.RoomCreate) {
|
||||||
await timeline.requestHistory(historyCount: 100);
|
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();
|
super.initState();
|
||||||
@ -366,6 +375,18 @@ class _ChatState extends State<_Chat> {
|
|||||||
]
|
]
|
||||||
: <Widget>[ChatSettingsPopupMenu(room, !room.isDirectChat)],
|
: <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(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Loading…
Reference in New Issue
Block a user