✨ Community and public chat, realm
This commit is contained in:
		| @@ -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." | ||||
| } | ||||
|   | ||||
| @@ -639,5 +639,13 @@ | ||||
|     "other": "{} 票" | ||||
|   }, | ||||
|   "publisherDelete": "删除发布者 {}", | ||||
|   "publisherDeleteDescription": "你确定要删除这个发布者吗?该操作不可撤销。" | ||||
|   "publisherDeleteDescription": "你确定要删除这个发布者吗?该操作不可撤销。", | ||||
|   "channelIsPublic": "公开频道", | ||||
|   "channelIsPublicDescription": "该频道是公开的,任何人都可以加入。", | ||||
|   "channelIsCommunity": "社区频道", | ||||
|   "channelIsCommunityDescription": "目前来说,社区频道还没有什么特别之处。", | ||||
|   "realmIsPublic": "公开领域", | ||||
|   "realmIsPublicDescription": "该领域是公开的,任何人都可以加入。", | ||||
|   "realmIsCommunity": "社区领域", | ||||
|   "realmIsCommunityDescription": "社区领域会显示在发现页面上。" | ||||
| } | ||||
|   | ||||
| @@ -37,6 +37,9 @@ class _ChatManageScreenState extends State<ChatManageScreen> { | ||||
|  | ||||
|   SnChannel? _editingChannel; | ||||
|  | ||||
|   bool _isPublic = false; | ||||
|   bool _isCommunity = false; | ||||
|  | ||||
|   Future<void> _fetchRealms() async { | ||||
|     setState(() => _isBusy = true); | ||||
|     try { | ||||
| @@ -67,6 +70,8 @@ class _ChatManageScreenState extends State<ChatManageScreen> { | ||||
|       _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<ChatManageScreen> { | ||||
|           : 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<ChatManageScreen> { | ||||
|                   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: [ | ||||
|   | ||||
| @@ -50,6 +50,8 @@ class _RealmManageScreenState extends State<RealmManageScreen> { | ||||
|       _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<RealmManageScreen> { | ||||
|  | ||||
|   final _imagePicker = ImagePicker(); | ||||
|  | ||||
|   bool _isPublic = false; | ||||
|   bool _isCommunity = false; | ||||
|  | ||||
|   Future<void> _updateImage(String place) async { | ||||
|     final image = await _imagePicker.pickImage(source: ImageSource.gallery); | ||||
|     if (image == null) return; | ||||
| @@ -138,6 +143,8 @@ class _RealmManageScreenState extends State<RealmManageScreen> { | ||||
|       'description': _descriptionController.text, | ||||
|       'avatar': _avatar, | ||||
|       'banner': _banner, | ||||
|       'is_public': _isPublic, | ||||
|       'is_community': _isCommunity, | ||||
|     }; | ||||
|  | ||||
|     try { | ||||
| @@ -293,6 +300,23 @@ class _RealmManageScreenState extends State<RealmManageScreen> { | ||||
|                       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: [ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user