1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-30 00:36:28 +00:00
comunicmobile/lib/ui/screens/group_sections/about_group_section.dart

109 lines
3.5 KiB
Dart
Raw Normal View History

2021-03-16 18:01:50 +00:00
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,
2022-03-11 16:02:06 +00:00
}) : super(key: key);
2021-03-16 18:01:50 +00:00
@override
Widget build(BuildContext context) => ListView(
children: [
// URL, if any
group.hasURL
? ListTile(
leading: Icon(Icons.link),
title: Text(tr("URL")!),
2021-03-16 18:01:50 +00:00
subtitle: Text(group.url),
onTap: () => launch(group.url),
)
: Container(),
// Description, if any
group.hasDescription
? ListTile(
leading: Icon(Icons.note),
title: Text(tr("Description")!),
2021-03-16 18:01:50 +00:00
subtitle: Text(group.description),
)
: Container(),
// Time create
ListTile(
leading: Icon(Icons.access_time),
title: Text("Created"),
subtitle: Text(diffTimeFromNowToStr(group.timeCreate!)!),
2021-03-16 18:01:50 +00:00
),
// Number of members
ListTile(
leading: Icon(Icons.group),
title: Text(tr("Members")!),
2022-03-11 16:02:06 +00:00
subtitle: Text(tr("%1% members",
args: {"1": group.numberMembers.toString()})!),
2021-03-16 18:01:50 +00:00
),
// Who can create posts
ListTile(
leading: Icon(Icons.add),
title: Text(tr("Who can create posts")!),
2021-03-16 18:01:50 +00:00
subtitle: Text(
group.postCreationLevel == GroupPostCreationLevel.MEMBERS
? tr("Every members")!
: tr("Only moderators and administrators")!),
2021-03-16 18:01:50 +00:00
),
// Registration process
ListTile(
leading: Icon(Icons.login),
title: Text(tr("Registration process")!),
2021-03-16 18:01:50 +00:00
subtitle: Text(group.registrationLevel ==
GroupRegistrationLevel.CLOSED
? tr("On invitation only")!
2021-03-16 18:01:50 +00:00
: (group.registrationLevel == GroupRegistrationLevel.MODERATED
? tr("A moderator has to approve requests")!
: tr("Anyone can join the group without approval")!)),
2021-03-16 18:01:50 +00:00
),
// Group visibility
ListTile(
leading: Icon(Icons.remove_red_eye),
title: Text(tr("Visibility")!),
2021-03-16 18:01:50 +00:00
subtitle: Text(group.visibilityLevel == GroupVisibilityLevel.SECRETE
? tr("Secrete group")!
2021-03-16 18:01:50 +00:00
: (group.visibilityLevel == GroupVisibilityLevel.PRIVATE
? tr("Private group")!
: tr("Open group")!)),
2021-03-16 18:01:50 +00:00
),
// Group members visibility
ListTile(
leading: Icon(Icons.remove_red_eye),
title: Text(tr("Members list visibility")!),
2022-03-11 16:02:06 +00:00
subtitle: Text(
group.isMembersListPublic! ? tr("Public")! : tr("Private")!),
),
2021-04-22 13:58:11 +00:00
group.isForezGroup
? // Group members visibility
ListTile(
leading: Icon(Icons.info_outline),
title: Text(tr("Forez group")!),
subtitle: Text(tr("Forez special features enabled")!),
2021-04-22 13:58:11 +00:00
)
: Container(),
2021-03-16 18:01:50 +00:00
],
);
}