mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Add group create post form
This commit is contained in:
parent
d6f0147339
commit
f5914a8d34
@ -58,4 +58,10 @@ class Group {
|
|||||||
membershipLevel == GroupMembershipLevel.ADMINISTRATOR ||
|
membershipLevel == GroupMembershipLevel.ADMINISTRATOR ||
|
||||||
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
||||||
membershipLevel == GroupMembershipLevel.MEMBER;
|
membershipLevel == GroupMembershipLevel.MEMBER;
|
||||||
|
|
||||||
|
bool get canCreatePost =>
|
||||||
|
membershipLevel == GroupMembershipLevel.ADMINISTRATOR ||
|
||||||
|
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
||||||
|
(membershipLevel == GroupMembershipLevel.MEMBER &&
|
||||||
|
postCreationLevel == GroupPostCreationLevel.MEMBERS);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
import 'package:comunic/enums/post_target.dart';
|
||||||
import 'package:comunic/helpers/posts_helper.dart';
|
import 'package:comunic/helpers/posts_helper.dart';
|
||||||
import 'package:comunic/models/advanced_group_info.dart';
|
import 'package:comunic/models/advanced_group_info.dart';
|
||||||
import 'package:comunic/ui/widgets/group_following_widget.dart';
|
import 'package:comunic/ui/widgets/group_following_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/group_icon_widget.dart';
|
import 'package:comunic/ui/widgets/group_icon_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/group_membership_widget.dart';
|
import 'package:comunic/ui/widgets/group_membership_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/like_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/posts_list_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@ -38,51 +40,68 @@ class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
|
|||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
onRefresh: () => widget.needRefresh(),
|
onRefresh: () => widget.needRefresh(),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[_buildGroupPageHeader(), _buildGroupPagePostsList()],
|
children: <Widget>[
|
||||||
|
_buildGroupPageHeader(),
|
||||||
|
_buildPostCreationArea(),
|
||||||
|
_buildGroupPagePostsList()
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Build group page header
|
/// Build group page header
|
||||||
Widget _buildGroupPageHeader() {
|
Widget _buildGroupPageHeader() {
|
||||||
return Padding(
|
return Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
color: Colors.black45,
|
||||||
child: Row(
|
child: Padding(
|
||||||
children: <Widget>[
|
padding: const EdgeInsets.all(8.0),
|
||||||
GroupIcon(
|
child: Row(
|
||||||
group: _group,
|
children: <Widget>[
|
||||||
),
|
GroupIcon(
|
||||||
Text(
|
group: _group,
|
||||||
" ${_group.displayName}",
|
),
|
||||||
style: TextStyle(fontSize: 20),
|
Text(
|
||||||
),
|
" ${_group.displayName}",
|
||||||
Spacer(),
|
style: TextStyle(fontSize: 20),
|
||||||
Column(
|
),
|
||||||
children: <Widget>[
|
Spacer(),
|
||||||
GroupMembershipWidget(
|
Column(
|
||||||
group: _group,
|
children: <Widget>[
|
||||||
onUpdated: () => widget.needRefresh(),
|
GroupMembershipWidget(
|
||||||
),
|
group: _group,
|
||||||
Container(
|
onUpdated: () => widget.needRefresh(),
|
||||||
height: 4,
|
),
|
||||||
),
|
Container(
|
||||||
GroupFollowingWidget(
|
height: 4,
|
||||||
group: _group,
|
),
|
||||||
onUpdated: () => widget.needRefresh(),
|
GroupFollowingWidget(
|
||||||
),
|
group: _group,
|
||||||
Container(
|
onUpdated: () => widget.needRefresh(),
|
||||||
height: 2,
|
),
|
||||||
),
|
Container(
|
||||||
LikeWidget(
|
height: 2,
|
||||||
likeElement: _group,
|
),
|
||||||
)
|
LikeWidget(
|
||||||
],
|
likeElement: _group,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add create post target
|
||||||
|
Widget _buildPostCreationArea() {
|
||||||
|
if (!_group.canCreatePost) return Container();
|
||||||
|
|
||||||
|
return PostCreateFormWidget(
|
||||||
|
postTarget: PostTarget.GROUP_PAGE,
|
||||||
|
targetID: _group.id,
|
||||||
|
onCreated: () => widget.needRefresh());
|
||||||
|
}
|
||||||
|
|
||||||
/// Build the list of posts of the group
|
/// Build the list of posts of the group
|
||||||
Widget _buildGroupPagePostsList() {
|
Widget _buildGroupPagePostsList() {
|
||||||
return PostsListWidget(
|
return PostsListWidget(
|
||||||
|
Loading…
Reference in New Issue
Block a user