1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-26 04:48:51 +00:00

Can change group registration level

This commit is contained in:
Pierre HUBERT 2020-05-01 21:04:50 +02:00
parent dbf2ed868a
commit d6f2df7002
3 changed files with 47 additions and 19 deletions

View File

@ -26,7 +26,7 @@ class Group {
final int numberMembers;
GroupMembershipLevel membershipLevel;
GroupVisibilityLevel visibilityLevel;
final GroupRegistrationLevel registrationLevel;
GroupRegistrationLevel registrationLevel;
final GroupPostCreationLevel postCreationLevel;
String virtualDirectory;
bool following;

View File

@ -1,3 +1,4 @@
import 'package:comunic/ui/widgets/auto_sized_dialog_content_widget.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -70,21 +71,19 @@ class __MultiChoicesEntryDialogState<T>
Widget build(BuildContext context) {
return AlertDialog(
title: Text(widget.title),
content: SingleChildScrollView(
child: IntrinsicHeight(
child: Column(
children: widget.choices
.map((f) => ListTile(
leading: Radio<T>(
groupValue: _currChoice,
value: f.id,
onChanged: (v) => setState(() => _currChoice = v),
),
title: Text(f.title),
subtitle: Text(f.subtitle),
))
.toList(),
),
content: AutoSizeDialogContentWidget(
child: Column(
children: widget.choices
.map((f) => ListTile(
leading: Radio<T>(
groupValue: _currChoice,
value: f.id,
onChanged: (v) => setState(() => _currChoice = v),
),
title: Text(f.title),
subtitle: Text(f.subtitle),
))
.toList(),
),
),
actions: <Widget>[

View File

@ -153,16 +153,37 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
),
MultiChoiceEntry(
id: GroupVisibilityLevel.PRIVATE,
title: tr("Private groupe"),
title: tr("Private group"),
subtitle: tr("The group is accessible to accepted members only."),
),
MultiChoiceEntry(
id: GroupVisibilityLevel.SECRETE,
title: tr("Secrete groupe"),
title: tr("Secrete group"),
subtitle: tr("The group is visible only to invited members."),
),
];
List<MultiChoiceEntry<GroupRegistrationLevel>> get _registrationLevels => [
MultiChoiceEntry(
id: GroupRegistrationLevel.OPEN,
title: tr("Open registration"),
subtitle: tr(
"Everyone can choose to join the group without moderator approval"),
),
MultiChoiceEntry(
id: GroupRegistrationLevel.MODERATED,
title: tr("Moderated registration"),
subtitle: tr(
"Everyone can request a membership, but a moderator review the request"),
),
MultiChoiceEntry(
id: GroupRegistrationLevel.CLOSED,
title: tr("Closed registration"),
subtitle: tr(
"The only way to join the group is to be invited by a moderator"),
),
];
Widget _buildAccessRestrictions() => SettingsSection(
title: tr("Access restrictions"),
tiles: [
@ -173,7 +194,15 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
onChanged: (v) {
_groupSettings.visibilityLevel = v;
_updateSettings();
})
}),
MultiChoicesSettingsTile(
title: tr("Group registration level"),
choices: _registrationLevels,
currentValue: _groupSettings.registrationLevel,
onChanged: (v) {
_groupSettings.registrationLevel = v;
_updateSettings();
}),
],
);
}