mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Ready to implement group members screen
This commit is contained in:
parent
df111e393a
commit
bff73dbb21
@ -61,6 +61,10 @@ class Group {
|
|||||||
|
|
||||||
bool get isAdmin => membershipLevel == GroupMembershipLevel.ADMINISTRATOR;
|
bool get isAdmin => membershipLevel == GroupMembershipLevel.ADMINISTRATOR;
|
||||||
|
|
||||||
|
bool get isAtLeastModerator =>
|
||||||
|
membershipLevel == GroupMembershipLevel.ADMINISTRATOR ||
|
||||||
|
membershipLevel == GroupMembershipLevel.MODERATOR;
|
||||||
|
|
||||||
bool get canCreatePost =>
|
bool get canCreatePost =>
|
||||||
membershipLevel == GroupMembershipLevel.ADMINISTRATOR ||
|
membershipLevel == GroupMembershipLevel.ADMINISTRATOR ||
|
||||||
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
||||||
|
@ -2,6 +2,7 @@ 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/routes/main_route.dart';
|
import 'package:comunic/ui/routes/main_route.dart';
|
||||||
|
import 'package:comunic/ui/screens/group_members_screen.dart';
|
||||||
import 'package:comunic/ui/screens/group_settings_screen.dart';
|
import 'package:comunic/ui/screens/group_settings_screen.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';
|
||||||
@ -19,7 +20,7 @@ import 'package:flutter/material.dart';
|
|||||||
///
|
///
|
||||||
/// @author Pierre Hubert
|
/// @author Pierre Hubert
|
||||||
|
|
||||||
enum _MenuItems { OPEN_SETTINGS }
|
enum _MenuItems { OPEN_MEMBERS, OPEN_SETTINGS }
|
||||||
|
|
||||||
class AuthorizedGroupPageScreen extends StatefulWidget {
|
class AuthorizedGroupPageScreen extends StatefulWidget {
|
||||||
final AdvancedGroupInfo advancedGroupInfo;
|
final AdvancedGroupInfo advancedGroupInfo;
|
||||||
@ -107,11 +108,16 @@ class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
|
|||||||
),
|
),
|
||||||
PopupMenuButton<_MenuItems>(
|
PopupMenuButton<_MenuItems>(
|
||||||
itemBuilder: (c) => [
|
itemBuilder: (c) => [
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Text(tr("Group members")),
|
||||||
|
value: _MenuItems.OPEN_MEMBERS,
|
||||||
|
enabled: _group.isAtLeastModerator,
|
||||||
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: Text(tr("Group settings")),
|
child: Text(tr("Group settings")),
|
||||||
value: _MenuItems.OPEN_SETTINGS,
|
value: _MenuItems.OPEN_SETTINGS,
|
||||||
enabled: _group.isAdmin,
|
enabled: _group.isAdmin,
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
onSelected: _handleMenuSelection,
|
onSelected: _handleMenuSelection,
|
||||||
),
|
),
|
||||||
@ -146,6 +152,10 @@ class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
|
|||||||
/// Handles menu selection
|
/// Handles menu selection
|
||||||
void _handleMenuSelection(_MenuItems item) {
|
void _handleMenuSelection(_MenuItems item) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
|
case _MenuItems.OPEN_MEMBERS:
|
||||||
|
MainController.of(context).push(GroupMembersScreen(groupID: _group.id));
|
||||||
|
break;
|
||||||
|
|
||||||
case _MenuItems.OPEN_SETTINGS:
|
case _MenuItems.OPEN_SETTINGS:
|
||||||
MainController.of(context)
|
MainController.of(context)
|
||||||
.push(GroupSettingsScreen(groupID: _group.id));
|
.push(GroupSettingsScreen(groupID: _group.id));
|
||||||
|
30
lib/ui/screens/group_members_screen.dart
Normal file
30
lib/ui/screens/group_members_screen.dart
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||||
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Group members screen
|
||||||
|
///
|
||||||
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
|
class GroupMembersScreen extends StatefulWidget {
|
||||||
|
final int groupID;
|
||||||
|
|
||||||
|
const GroupMembersScreen({Key key, this.groupID})
|
||||||
|
: assert(groupID != null),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_GroupMembersScreenState createState() => _GroupMembersScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GroupMembersScreenState extends State<GroupMembersScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
leading: ComunicBackButton(),
|
||||||
|
title: Text(tr("Group members")),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user