mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Can create posts
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
import 'package:comunic/enums/post_target.dart';
|
||||
import 'package:comunic/helpers/posts_helper.dart';
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/models/advanced_user_info.dart';
|
||||
import 'package:comunic/ui/routes/other_friends_lists_route.dart';
|
||||
import 'package:comunic/ui/routes/user_access_denied_route.dart';
|
||||
import 'package:comunic/ui/widgets/network_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/post_create_form_widget.dart';
|
||||
import 'package:comunic/ui/widgets/posts_list_widget.dart';
|
||||
import 'package:comunic/utils/conversations_utils.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
@ -38,6 +40,8 @@ class _UserPageRouteState extends State<UserPageRoute> {
|
||||
final double _appBarHeight = 256.0;
|
||||
_PageStatus _status = _PageStatus.LOADING;
|
||||
AdvancedUserInfo _userInfo;
|
||||
GlobalKey<RefreshIndicatorState> _refreshIndicatorKey =
|
||||
GlobalKey<RefreshIndicatorState>();
|
||||
|
||||
_setStatus(_PageStatus s) => setState(() => _status = s);
|
||||
|
||||
@ -80,8 +84,10 @@ class _UserPageRouteState extends State<UserPageRoute> {
|
||||
|
||||
return Scaffold(
|
||||
body: RefreshIndicator(
|
||||
key: _refreshIndicatorKey,
|
||||
child: CustomScrollView(
|
||||
slivers: <Widget>[_buildHeader(), _buildBody()],
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
),
|
||||
onRefresh: _getUserInfo,
|
||||
),
|
||||
@ -175,6 +181,16 @@ class _UserPageRouteState extends State<UserPageRoute> {
|
||||
return SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
<Widget>[
|
||||
// Posts create form
|
||||
_userInfo.canPostTexts
|
||||
? PostCreateFormWidget(
|
||||
postTarget: PostTarget.USER_PAGE,
|
||||
targetID: _userInfo.id,
|
||||
onCreated: _postCreated,
|
||||
)
|
||||
: Container(),
|
||||
|
||||
// Posts list
|
||||
PostsListWidget(
|
||||
getPostsList: () => _postsHelper.getUserPosts(widget.userID),
|
||||
showPostsTarget: false,
|
||||
@ -199,4 +215,9 @@ class _UserPageRouteState extends State<UserPageRoute> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Method called once a post has been created
|
||||
void _postCreated() {
|
||||
_refreshIndicatorKey.currentState.show();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user