From ed109d8c26257d7d52f89f22b1bdf536a865730f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 16 Mar 2021 18:41:16 +0100 Subject: [PATCH] Integrate members screen as a tab --- .../screens/authorized_group_page_screen.dart | 10 ++++++++- .../group_members_screen.dart | 21 +++++-------------- 2 files changed, 14 insertions(+), 17 deletions(-) rename lib/ui/screens/{ => group_sections}/group_members_screen.dart (93%) diff --git a/lib/ui/screens/authorized_group_page_screen.dart b/lib/ui/screens/authorized_group_page_screen.dart index 609d2c0..3906775 100644 --- a/lib/ui/screens/authorized_group_page_screen.dart +++ b/lib/ui/screens/authorized_group_page_screen.dart @@ -1,5 +1,6 @@ import 'package:comunic/models/advanced_group_info.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_settings_screen.dart'; import 'package:comunic/ui/widgets/group_following_widget.dart'; @@ -50,7 +51,14 @@ class _AuthorizedGroupPageScreenState widget: GroupPostsSection(group: _group), label: tr("Posts"), ), - ]; + ]..addAll(_group.isAtLeastModerator + ? [ + _GroupPageTab( + widget: GroupMembersSection(groupID: _group.id), + label: tr("Members"), + ), + ] + : []); @override void initState() { diff --git a/lib/ui/screens/group_members_screen.dart b/lib/ui/screens/group_sections/group_members_screen.dart similarity index 93% rename from lib/ui/screens/group_members_screen.dart rename to lib/ui/screens/group_sections/group_members_screen.dart index 37014d8..7fdf924 100644 --- a/lib/ui/screens/group_members_screen.dart +++ b/lib/ui/screens/group_sections/group_members_screen.dart @@ -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/widgets/account_image_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/intl_utils.dart'; import 'package:comunic/utils/ui_utils.dart'; @@ -19,18 +18,18 @@ import 'package:flutter/material.dart'; /// /// @author Pierre HUBERT -class GroupMembersScreen extends StatefulWidget { +class GroupMembersSection extends StatefulWidget { final int groupID; - const GroupMembersScreen({Key key, this.groupID}) + const GroupMembersSection({Key key, this.groupID}) : assert(groupID != null), super(key: key); @override - _GroupMembersScreenState createState() => _GroupMembersScreenState(); + _GroupMembersSectionState createState() => _GroupMembersSectionState(); } -class _GroupMembersScreenState extends State { +class _GroupMembersSectionState extends State { final _key = GlobalKey(); Group _group; GroupMembersList _members; @@ -47,17 +46,7 @@ class _GroupMembersScreenState extends State { } @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - leading: ComunicBackButton(), - title: Text(tr("Group members")), - ), - body: _buildBody(), - ); - } - - Widget _buildBody() => AsyncScreenWidget( + Widget build(BuildContext context) => AsyncScreenWidget( key: _key, onReload: _refresh, onBuild: _buildBodyContent,