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,14 +40,20 @@ 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(
|
||||||
|
color: Colors.black45,
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -80,9 +88,20 @@ class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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