diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index 31eac46..3baf419 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -640,5 +640,13 @@ "other": "{} votes" }, "publisherDelete": "Delete Publisher {}", - "publisherDeleteDescription": "Are you sure you want to delete this publisher? This operation is irreversible." + "publisherDeleteDescription": "Are you sure you want to delete this publisher? This operation is irreversible.", + "channelIsPublic": "Public Channel", + "channelIsPublicDescription": "The channel is public, anyone can join.", + "channelIsCommunity": "Community Channel", + "channelIsCommunityDescription": "Currently, community channel has nothing special yet.", + "realmIsPublic": "Public Realm", + "realmIsPublicDescription": "The realm is public, anyone can join.", + "realmIsCommunity": "Community Realm", + "realmIsCommunityDescription": "Community realm will be displayed on the discover page." } diff --git a/assets/translations/zh-CN.json b/assets/translations/zh-CN.json index 2be0a9a..5bb8a34 100644 --- a/assets/translations/zh-CN.json +++ b/assets/translations/zh-CN.json @@ -639,5 +639,13 @@ "other": "{} 票" }, "publisherDelete": "删除发布者 {}", - "publisherDeleteDescription": "你确定要删除这个发布者吗?该操作不可撤销。" + "publisherDeleteDescription": "你确定要删除这个发布者吗?该操作不可撤销。", + "channelIsPublic": "公开频道", + "channelIsPublicDescription": "该频道是公开的,任何人都可以加入。", + "channelIsCommunity": "社区频道", + "channelIsCommunityDescription": "目前来说,社区频道还没有什么特别之处。", + "realmIsPublic": "公开领域", + "realmIsPublicDescription": "该领域是公开的,任何人都可以加入。", + "realmIsCommunity": "社区领域", + "realmIsCommunityDescription": "社区领域会显示在发现页面上。" } diff --git a/lib/screens/chat/manage.dart b/lib/screens/chat/manage.dart index f88edd1..64ef2f0 100644 --- a/lib/screens/chat/manage.dart +++ b/lib/screens/chat/manage.dart @@ -37,6 +37,9 @@ class _ChatManageScreenState extends State { SnChannel? _editingChannel; + bool _isPublic = false; + bool _isCommunity = false; + Future _fetchRealms() async { setState(() => _isBusy = true); try { @@ -67,6 +70,8 @@ class _ChatManageScreenState extends State { _aliasController.text = _editingChannel!.alias; _nameController.text = _editingChannel!.name; _descriptionController.text = _editingChannel!.description; + _isPublic = _editingChannel!.isPublic; + _isCommunity = _editingChannel!.isCommunity; } catch (err) { if (!mounted) return; context.showErrorDialog(err); @@ -88,6 +93,8 @@ class _ChatManageScreenState extends State { : uuid.v4().replaceAll('-', '').substring(0, 12), 'name': _nameController.text, 'description': _descriptionController.text, + 'is_public': _isPublic, + 'is_community': _isCommunity, }; try { @@ -271,6 +278,23 @@ class _ChatManageScreenState extends State { onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(), ), const Gap(12), + CheckboxListTile( + value: _isPublic, + title: Text('channelIsPublic'.tr()), + subtitle: Text('channelIsPublicDescription'.tr()), + onChanged: (value) { + setState(() => _isPublic = value ?? false); + }, + ), + CheckboxListTile( + value: _isCommunity, + title: Text('channelIsCommunity'.tr()), + subtitle: Text('channelIsCommunityDescription'.tr()), + onChanged: (value) { + setState(() => _isCommunity = value ?? false); + }, + ), + const Gap(12), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/lib/screens/realm/manage.dart b/lib/screens/realm/manage.dart index 3bdc99f..dc1aa06 100644 --- a/lib/screens/realm/manage.dart +++ b/lib/screens/realm/manage.dart @@ -50,6 +50,8 @@ class _RealmManageScreenState extends State { _aliasController.text = out.alias; _nameController.text = out.name; _descriptionController.text = out.description; + _isPublic = out.isPublic; + _isCommunity = out.isCommunity; } catch (err) { // ignore: use_build_context_synchronously if (context.mounted) context.showErrorDialog(err); @@ -67,6 +69,9 @@ class _RealmManageScreenState extends State { final _imagePicker = ImagePicker(); + bool _isPublic = false; + bool _isCommunity = false; + Future _updateImage(String place) async { final image = await _imagePicker.pickImage(source: ImageSource.gallery); if (image == null) return; @@ -138,6 +143,8 @@ class _RealmManageScreenState extends State { 'description': _descriptionController.text, 'avatar': _avatar, 'banner': _banner, + 'is_public': _isPublic, + 'is_community': _isCommunity, }; try { @@ -293,6 +300,23 @@ class _RealmManageScreenState extends State { FocusManager.instance.primaryFocus?.unfocus(), ), const Gap(12), + CheckboxListTile( + value: _isPublic, + title: Text('realmIsPublic'.tr()), + subtitle: Text('realmIsPublicDescription'.tr()), + onChanged: (value) { + setState(() => _isPublic = value ?? false); + }, + ), + CheckboxListTile( + value: _isCommunity, + title: Text('realmIsCommunity'.tr()), + subtitle: Text('realmIsCommunityDescription'.tr()), + onChanged: (value) { + setState(() => _isCommunity = value ?? false); + }, + ), + const Gap(12), Row( mainAxisAlignment: MainAxisAlignment.end, children: [