feat: Dynamic appbar elevation and FAB in chat list
This commit is contained in:
parent
d8da5c3a55
commit
538b06f8e9
2 changed files with 28 additions and 10 deletions
|
|
@ -32,6 +32,7 @@ class ChatList extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ChatListController extends State<ChatList> {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
StreamSubscription _intentDataStreamSubscription;
|
||||
|
||||
StreamSubscription _intentFileStreamSubscription;
|
||||
|
|
@ -42,6 +43,15 @@ class ChatListController extends State<ChatList> {
|
|||
|
||||
String get activeChat => VRouter.of(context).pathParameters['roomid'];
|
||||
|
||||
bool scrolledTop = true;
|
||||
|
||||
void updateScrolledTop() {
|
||||
final newScrolledTop = scrollController.offset == 0;
|
||||
if (scrolledTop != newScrolledTop) {
|
||||
setState(() => scrolledTop = newScrolledTop);
|
||||
}
|
||||
}
|
||||
|
||||
void _processIncomingSharedFiles(List<SharedMediaFile> files) {
|
||||
if (files?.isEmpty ?? true) return;
|
||||
VRouter.of(context).push('/rooms');
|
||||
|
|
@ -109,6 +119,7 @@ class ChatListController extends State<ChatList> {
|
|||
@override
|
||||
void initState() {
|
||||
_initReceiveSharingIntent();
|
||||
scrollController.addListener(updateScrolledTop);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +128,7 @@ class ChatListController extends State<ChatList> {
|
|||
_intentDataStreamSubscription?.cancel();
|
||||
_intentFileStreamSubscription?.cancel();
|
||||
_intentUriStreamSubscription?.cancel();
|
||||
scrollController.removeListener(updateScrolledTop);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue