diff --git a/lib/ui/screens/authorized_group_page_screen.dart b/lib/ui/screens/authorized_group_page_screen.dart index 8329fef..6e69978 100644 --- a/lib/ui/screens/authorized_group_page_screen.dart +++ b/lib/ui/screens/authorized_group_page_screen.dart @@ -58,15 +58,14 @@ class _AuthorizedGroupPageScreenState _GroupPageTab( widget: (c) => AboutGroupSection(group: _group), label: tr("About"), + ), + + _GroupPageTab( + widget: (c) => GroupMembersSection(groupID: _group.id), + label: tr("Members"), + visible: _group.isAtLeastModerator || _group.isMembersListPublic, ) - ]..addAll(_group.isAtLeastModerator - ? [ - _GroupPageTab( - widget: (c) => GroupMembersSection(groupID: _group.id), - label: tr("Members"), - ), - ] - : []); + ].where((element) => element.visible).toList(); @override void initState() { @@ -173,12 +172,15 @@ class _AuthorizedGroupPageScreenState class _GroupPageTab { final WidgetBuilder widget; + final bool visible; final String label; const _GroupPageTab({ @required this.widget, + this.visible = true, @required this.label, }) : assert(widget != null), + assert(visible != null), assert(label != null); Tab get tab => Tab(text: label); diff --git a/lib/ui/screens/group_sections/group_members_screen.dart b/lib/ui/screens/group_sections/group_members_screen.dart index 7fdf924..2db22bd 100644 --- a/lib/ui/screens/group_sections/group_members_screen.dart +++ b/lib/ui/screens/group_sections/group_members_screen.dart @@ -58,7 +58,7 @@ class _GroupMembersSectionState extends State { return Stack( children: [ ListView(children: _members.map(_buildGroupMemberTile).toList()), - _buildInvitationFAB() + _group.isAtLeastModerator ? _buildInvitationFAB() : Container() ], ); } @@ -172,7 +172,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> { subtitle: Text(_membershipLevels .firstWhere((f) => f.id == widget.membership.level) .title), - trailing: _buildTrailing(), + trailing: widget.group.isAtLeastModerator ? _buildTrailing() : null, ); } diff --git a/lib/ui/widgets/group_membership_widget.dart b/lib/ui/widgets/group_membership_widget.dart index 410f6c8..cd7d194 100644 --- a/lib/ui/widgets/group_membership_widget.dart +++ b/lib/ui/widgets/group_membership_widget.dart @@ -52,7 +52,7 @@ class _GroupMembershipWidgetState extends SafeState { return _buildVisitorState(); default: - throw Exception("Unkonwn group pmembership level state: $_level"); + throw Exception("Unknown group membership level state: $_level"); } } @@ -140,7 +140,6 @@ class _GroupMembershipWidgetState extends SafeState { return RichText( text: TextSpan( text: tr("Request membership"), - style: TextStyle(color: Colors.blue), recognizer: TapGestureRecognizer() ..onTap = () => _requestMembership()), );