mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Can change group registration level
This commit is contained in:
parent
dbf2ed868a
commit
d6f2df7002
@ -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;
|
||||
|
@ -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>[
|
||||
|
@ -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();
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user