mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-25 12:28:50 +00:00
Improve groups page performances
This commit is contained in:
parent
ccb1547523
commit
935d7dbb63
@ -10,7 +10,6 @@ import 'package:comunic/ui/widgets/group_membership_widget.dart';
|
||||
import 'package:comunic/ui/widgets/like_widget.dart';
|
||||
import 'package:comunic/ui/widgets/post_create_form_widget.dart';
|
||||
import 'package:comunic/ui/widgets/posts_list_widget.dart';
|
||||
import 'package:comunic/ui/widgets/scroll_watcher.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -42,30 +41,13 @@ class AuthorizedGroupPageScreen extends StatefulWidget {
|
||||
class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
|
||||
AdvancedGroupInfo get _group => widget.advancedGroupInfo;
|
||||
|
||||
// Allows load older posts when we reach the bottom of the page
|
||||
final _postsKey = GlobalKey<PostsListWidgetState>();
|
||||
ScrollWatcher _postsController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_postsController = ScrollWatcher(
|
||||
onReachBottom: () => _postsKey.currentState.reachedPostsBottom());
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => widget.needRefresh(),
|
||||
child: ListView(
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
controller: _postsController,
|
||||
children: <Widget>[
|
||||
_buildGroupPageHeader(),
|
||||
_buildPostCreationArea(),
|
||||
_buildGroupPagePostsList()
|
||||
],
|
||||
),
|
||||
child: _buildGroupPagePostsList(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -141,11 +123,14 @@ class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
|
||||
Widget _buildGroupPagePostsList() {
|
||||
return PostsListWidget(
|
||||
key: _postsKey,
|
||||
topWidgets: <Widget>[
|
||||
_buildGroupPageHeader(),
|
||||
_buildPostCreationArea(),
|
||||
],
|
||||
getPostsList: () => PostsHelper().getGroupPosts(_group.id),
|
||||
showPostsTarget: false,
|
||||
userNamesClickable: true,
|
||||
getOlder: (from) => PostsHelper().getGroupPosts(_group.id, from: from),
|
||||
buildListView: false,
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user