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({
|
2022-03-10 18:39:57 +00:00
|
|
|
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),
|
2022-03-10 18:39:57 +00:00
|
|
|
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),
|
2022-03-10 18:39:57 +00:00
|
|
|
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"),
|
2022-03-10 18:39:57 +00:00
|
|
|
subtitle: Text(diffTimeFromNowToStr(group.timeCreate!)!),
|
2021-03-16 18:01:50 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
// Number of members
|
|
|
|
ListTile(
|
|
|
|
leading: Icon(Icons.group),
|
2022-03-10 18:39:57 +00:00
|
|
|
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),
|
2022-03-10 18:39:57 +00:00
|
|
|
title: Text(tr("Who can create posts")!),
|
2021-03-16 18:01:50 +00:00
|
|
|
subtitle: Text(
|
|
|
|
group.postCreationLevel == GroupPostCreationLevel.MEMBERS
|
2022-03-10 18:39:57 +00:00
|
|
|
? tr("Every members")!
|
|
|
|
: tr("Only moderators and administrators")!),
|
2021-03-16 18:01:50 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
// Registration process
|
|
|
|
ListTile(
|
|
|
|
leading: Icon(Icons.login),
|
2022-03-10 18:39:57 +00:00
|
|
|
title: Text(tr("Registration process")!),
|
2021-03-16 18:01:50 +00:00
|
|
|
subtitle: Text(group.registrationLevel ==
|
|
|
|
GroupRegistrationLevel.CLOSED
|
2022-03-10 18:39:57 +00:00
|
|
|
? tr("On invitation only")!
|
2021-03-16 18:01:50 +00:00
|
|
|
: (group.registrationLevel == GroupRegistrationLevel.MODERATED
|
2022-03-10 18:39:57 +00:00
|
|
|
? 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),
|
2022-03-10 18:39:57 +00:00
|
|
|
title: Text(tr("Visibility")!),
|
2021-03-16 18:01:50 +00:00
|
|
|
subtitle: Text(group.visibilityLevel == GroupVisibilityLevel.SECRETE
|
2022-03-10 18:39:57 +00:00
|
|
|
? tr("Secrete group")!
|
2021-03-16 18:01:50 +00:00
|
|
|
: (group.visibilityLevel == GroupVisibilityLevel.PRIVATE
|
2022-03-10 18:39:57 +00:00
|
|
|
? tr("Private group")!
|
|
|
|
: tr("Open group")!)),
|
2021-03-16 18:01:50 +00:00
|
|
|
),
|
2021-03-17 17:50:37 +00:00
|
|
|
|
|
|
|
// Group members visibility
|
|
|
|
ListTile(
|
|
|
|
leading: Icon(Icons.remove_red_eye),
|
2022-03-10 18:39:57 +00:00
|
|
|
title: Text(tr("Members list visibility")!),
|
2022-03-11 16:02:06 +00:00
|
|
|
subtitle: Text(
|
|
|
|
group.isMembersListPublic! ? tr("Public")! : tr("Private")!),
|
2021-03-17 17:50:37 +00:00
|
|
|
),
|
2021-04-22 13:58:11 +00:00
|
|
|
|
|
|
|
group.isForezGroup
|
|
|
|
? // Group members visibility
|
|
|
|
ListTile(
|
|
|
|
leading: Icon(Icons.info_outline),
|
2022-03-10 18:39:57 +00:00
|
|
|
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
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|