mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Add about tab
This commit is contained in:
		@@ -45,4 +45,9 @@ class AdvancedGroupInfo extends Group implements LikeElement {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  LikesType likeType = LikesType.GROUP;
 | 
			
		||||
 | 
			
		||||
  get hasURL => url != null && url.isNotEmpty && url != "null";
 | 
			
		||||
 | 
			
		||||
  get hasDescription =>
 | 
			
		||||
      description != null && description.isNotEmpty && description != "null";
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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/about_group_section.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';
 | 
			
		||||
@@ -51,6 +52,12 @@ class _AuthorizedGroupPageScreenState
 | 
			
		||||
          widget: GroupPostsSection(group: _group),
 | 
			
		||||
          label: tr("Posts"),
 | 
			
		||||
        ),
 | 
			
		||||
 | 
			
		||||
        // About the group
 | 
			
		||||
        _GroupPageTab(
 | 
			
		||||
          widget: AboutGroupSection(group: _group),
 | 
			
		||||
          label: tr("About"),
 | 
			
		||||
        )
 | 
			
		||||
      ]..addAll(_group.isAtLeastModerator
 | 
			
		||||
          ? [
 | 
			
		||||
              _GroupPageTab(
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										93
									
								
								lib/ui/screens/group_sections/about_group_section.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								lib/ui/screens/group_sections/about_group_section.dart
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
import 'package:comunic/models/advanced_group_info.dart';
 | 
			
		||||
import 'package:comunic/models/group.dart';
 | 
			
		||||
import 'package:comunic/utils/date_utils.dart';
 | 
			
		||||
import 'package:comunic/utils/intl_utils.dart';
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:url_launcher/url_launcher.dart';
 | 
			
		||||
 | 
			
		||||
/// About group section
 | 
			
		||||
///
 | 
			
		||||
/// @author Pierre Hubert
 | 
			
		||||
 | 
			
		||||
class AboutGroupSection extends StatelessWidget {
 | 
			
		||||
  final AdvancedGroupInfo group;
 | 
			
		||||
 | 
			
		||||
  const AboutGroupSection({
 | 
			
		||||
    Key key,
 | 
			
		||||
    @required this.group,
 | 
			
		||||
  })  : assert(group != null),
 | 
			
		||||
        super(key: key);
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) => ListView(
 | 
			
		||||
        children: [
 | 
			
		||||
          // URL, if any
 | 
			
		||||
          group.hasURL
 | 
			
		||||
              ? ListTile(
 | 
			
		||||
                  leading: Icon(Icons.link),
 | 
			
		||||
                  title: Text(tr("URL")),
 | 
			
		||||
                  subtitle: Text(group.url),
 | 
			
		||||
                  onTap: () => launch(group.url),
 | 
			
		||||
                )
 | 
			
		||||
              : Container(),
 | 
			
		||||
 | 
			
		||||
          // Description, if any
 | 
			
		||||
          group.hasDescription
 | 
			
		||||
              ? ListTile(
 | 
			
		||||
                  leading: Icon(Icons.note),
 | 
			
		||||
                  title: Text(tr("Description")),
 | 
			
		||||
                  subtitle: Text(group.description),
 | 
			
		||||
                  onTap: () => launch(group.description),
 | 
			
		||||
                )
 | 
			
		||||
              : Container(),
 | 
			
		||||
 | 
			
		||||
          // Time create
 | 
			
		||||
          ListTile(
 | 
			
		||||
            leading: Icon(Icons.access_time),
 | 
			
		||||
            title: Text("Created"),
 | 
			
		||||
            subtitle: Text(diffTimeFromNowToStr(group.timeCreate)),
 | 
			
		||||
          ),
 | 
			
		||||
 | 
			
		||||
          // Number of members
 | 
			
		||||
          ListTile(
 | 
			
		||||
            leading: Icon(Icons.group),
 | 
			
		||||
            title: Text(tr("Members")),
 | 
			
		||||
            subtitle: Text(
 | 
			
		||||
                tr("%1% members", args: {"1": group.numberMembers.toString()})),
 | 
			
		||||
          ),
 | 
			
		||||
 | 
			
		||||
          // Who can create posts
 | 
			
		||||
          ListTile(
 | 
			
		||||
            leading: Icon(Icons.add),
 | 
			
		||||
            title: Text(tr("Who can create posts")),
 | 
			
		||||
            subtitle: Text(
 | 
			
		||||
                group.postCreationLevel == GroupPostCreationLevel.MEMBERS
 | 
			
		||||
                    ? tr("Every members")
 | 
			
		||||
                    : tr("Only moderators and administrators")),
 | 
			
		||||
          ),
 | 
			
		||||
 | 
			
		||||
          // Registration process
 | 
			
		||||
          ListTile(
 | 
			
		||||
            leading: Icon(Icons.login),
 | 
			
		||||
            title: Text(tr("Registration process")),
 | 
			
		||||
            subtitle: Text(group.registrationLevel ==
 | 
			
		||||
                    GroupRegistrationLevel.CLOSED
 | 
			
		||||
                ? tr("On invitation only")
 | 
			
		||||
                : (group.registrationLevel == GroupRegistrationLevel.MODERATED
 | 
			
		||||
                    ? tr("A moderator has to approve requests")
 | 
			
		||||
                    : tr("Anyone can join the group without approval"))),
 | 
			
		||||
          ),
 | 
			
		||||
 | 
			
		||||
          // Group visibility
 | 
			
		||||
          ListTile(
 | 
			
		||||
            leading: Icon(Icons.remove_red_eye),
 | 
			
		||||
            title: Text(tr("Visibility")),
 | 
			
		||||
            subtitle: Text(group.visibilityLevel == GroupVisibilityLevel.SECRETE
 | 
			
		||||
                ? tr("Secrete group")
 | 
			
		||||
                : (group.visibilityLevel == GroupVisibilityLevel.PRIVATE
 | 
			
		||||
                    ? tr("Private group")
 | 
			
		||||
                    : tr("Open group"))),
 | 
			
		||||
          ),
 | 
			
		||||
        ],
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user