1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Integrate members screen as a tab

This commit is contained in:
Pierre HUBERT 2021-03-16 18:41:16 +01:00
parent a14a701f4d
commit ed109d8c26
2 changed files with 14 additions and 17 deletions

View File

@ -1,5 +1,6 @@
import 'package:comunic/models/advanced_group_info.dart'; import 'package:comunic/models/advanced_group_info.dart';
import 'package:comunic/ui/routes/main_route/main_route.dart'; import 'package:comunic/ui/routes/main_route/main_route.dart';
import 'package:comunic/ui/screens/group_sections/group_members_screen.dart';
import 'package:comunic/ui/screens/group_sections/group_posts_section.dart'; import 'package:comunic/ui/screens/group_sections/group_posts_section.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';
@ -50,7 +51,14 @@ class _AuthorizedGroupPageScreenState
widget: GroupPostsSection(group: _group), widget: GroupPostsSection(group: _group),
label: tr("Posts"), label: tr("Posts"),
), ),
]; ]..addAll(_group.isAtLeastModerator
? [
_GroupPageTab(
widget: GroupMembersSection(groupID: _group.id),
label: tr("Members"),
),
]
: []);
@override @override
void initState() { void initState() {

View File

@ -9,7 +9,6 @@ import 'package:comunic/ui/dialogs/multi_choices_dialog.dart';
import 'package:comunic/ui/dialogs/pick_user_dialog.dart'; import 'package:comunic/ui/dialogs/pick_user_dialog.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart'; import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart'; import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
import 'package:comunic/utils/account_utils.dart'; import 'package:comunic/utils/account_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
@ -19,18 +18,18 @@ import 'package:flutter/material.dart';
/// ///
/// @author Pierre HUBERT /// @author Pierre HUBERT
class GroupMembersScreen extends StatefulWidget { class GroupMembersSection extends StatefulWidget {
final int groupID; final int groupID;
const GroupMembersScreen({Key key, this.groupID}) const GroupMembersSection({Key key, this.groupID})
: assert(groupID != null), : assert(groupID != null),
super(key: key); super(key: key);
@override @override
_GroupMembersScreenState createState() => _GroupMembersScreenState(); _GroupMembersSectionState createState() => _GroupMembersSectionState();
} }
class _GroupMembersScreenState extends State<GroupMembersScreen> { class _GroupMembersSectionState extends State<GroupMembersSection> {
final _key = GlobalKey<AsyncScreenWidgetState>(); final _key = GlobalKey<AsyncScreenWidgetState>();
Group _group; Group _group;
GroupMembersList _members; GroupMembersList _members;
@ -47,17 +46,7 @@ class _GroupMembersScreenState extends State<GroupMembersScreen> {
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) => AsyncScreenWidget(
return Scaffold(
appBar: AppBar(
leading: ComunicBackButton(),
title: Text(tr("Group members")),
),
body: _buildBody(),
);
}
Widget _buildBody() => AsyncScreenWidget(
key: _key, key: _key,
onReload: _refresh, onReload: _refresh,
onBuild: _buildBodyContent, onBuild: _buildBodyContent,