From adfd309c8b06e031eb3ad454b201c7a93fca4991 Mon Sep 17 00:00:00 2001 From: Warakorn Sitthirit Date: Thu, 15 Aug 2024 13:43:24 +0700 Subject: [PATCH] fix: Fix sample app UI --- lib/core/widget/community_widget.dart | 11 ++++------- .../channel_profile_screen.dart | 18 ++---------------- .../screen/dashboard/dashboard_screen.dart | 11 +++++++---- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/lib/core/widget/community_widget.dart b/lib/core/widget/community_widget.dart index 8a2a348..493554d 100644 --- a/lib/core/widget/community_widget.dart +++ b/lib/core/widget/community_widget.dart @@ -11,13 +11,6 @@ class CommunityWidget extends StatelessWidget { @override Widget build(BuildContext context) { - if (amityCommunity.isDeleted ?? false) { - return Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration(color: Colors.grey.withOpacity(.05)), - child: Text('Community Deleted - ${amityCommunity.communityId}'), - ); - } return StreamBuilder( stream: amityCommunity.listen.stream, initialData: amityCommunity, @@ -114,6 +107,10 @@ class _CommunityInfoWidget extends StatelessWidget { 'Public: ${amityCommunity.isPublic}', style: themeData.textTheme.bodySmall, ), + Text( + 'isDeleted: ${amityCommunity.isDeleted}', + style: themeData.textTheme.bodySmall, + ), ], ), ), diff --git a/lib/presentation/screen/channel_profile/channel_profile_screen.dart b/lib/presentation/screen/channel_profile/channel_profile_screen.dart index 93d4414..fbe41fd 100644 --- a/lib/presentation/screen/channel_profile/channel_profile_screen.dart +++ b/lib/presentation/screen/channel_profile/channel_profile_screen.dart @@ -84,20 +84,11 @@ class _ChannelProfileScreenState extends State ), const PopupMenuItem( value: 2, - child: Text("Delete (Soft)"), - ), - const PopupMenuItem( - value: 3, - enabled: false, - child: Text("Delete (Hard)"), - ), - const PopupMenuItem( - value: 4, enabled: true, child: Text("Check my permission"), ), PopupMenuItem( - value: 5, + value: 3, child: Text((_amityChannel.isMuted ?? false) ? 'Unmute' : 'Mute'), @@ -116,11 +107,6 @@ class _ChannelProfileScreenState extends State queryParams: {'channelId': widget.channelId}); } if (index == 2) { - //Delete Channel - // AmitySocialClient.newChannelRepository() - // .deleteChannel(widget.channelId); - } - if (index == 4) { EditTextDialog.show(context, title: 'Check my permission in this community', @@ -145,7 +131,7 @@ class _ChannelProfileScreenState extends State } }); } - if (index == 5) { + if (index == 3) { ///Mute/Unmute Channel if (_amityChannel.isMuted ?? false) { AmityChatClient.newChannelRepository() diff --git a/lib/presentation/screen/dashboard/dashboard_screen.dart b/lib/presentation/screen/dashboard/dashboard_screen.dart index 7fad791..f1b1f63 100644 --- a/lib/presentation/screen/dashboard/dashboard_screen.dart +++ b/lib/presentation/screen/dashboard/dashboard_screen.dart @@ -1,4 +1,5 @@ import 'dart:io'; + import 'package:amity_sdk/amity_sdk.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; @@ -348,8 +349,9 @@ class _DashboardScreenState extends State { TextButton( onPressed: () { EditTextDialog.show(context, - hintText: 'Enter Channel Name', - buttonText: 'Join', onPress: (value) { + title: 'Go to Chat Screen', + hintText: 'Enter Channel ID', + buttonText: 'Submit', onPress: (value) { GoRouter.of(context) .goNamed(AppRoute.chat, params: {'channelId': value}); }); @@ -360,9 +362,10 @@ class _DashboardScreenState extends State { TextButton( onPressed: () { EditTextDialog.show(context, - hintText: 'Enter Channel Name', + title: 'Get Channel', + hintText: 'Enter Channel ID', // defString: 'live200', - buttonText: 'Join', onPress: (value) { + buttonText: 'Submit', onPress: (value) { GoRouter.of(context).pushNamed(AppRoute.channelProfile, params: {'channelId': value}); // AmityChatClient.newChannelRepository().getChannel(value);