diff --git a/mobile/lib/pages/chat_details_page.dart b/mobile/lib/pages/chat_details_page.dart index 16bbb21..33403c7 100644 --- a/mobile/lib/pages/chat_details_page.dart +++ b/mobile/lib/pages/chat_details_page.dart @@ -4,6 +4,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:mobile/controllers/auth.dart'; import 'package:mobile/controllers/chat.dart'; +import 'package:mobile/pages/chat_page.dart'; import 'package:mobile/providers/group_controller_provider.dart'; import 'package:provider/provider.dart'; @@ -297,88 +298,107 @@ class _ChatDetailsPageState extends State { showModalBottomSheet( context: context, builder: (context) { - return SafeArea( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - ListTile( - title: Text('Message ${member.displayName}'), - onTap: () { - /* Navigate to 1-on-1 chat */ - }, - ), - ListTile( - title: Text('View Profile (@${member.username})'), - onTap: () { - Navigator.pop(context); - }, - ), - if (isCurrentUserAdmin && - member.userId != context.read().currentUser?.id) - ListTile( - title: const Text( - 'Remove from group', - style: TextStyle(color: Colors.red), - ), - onTap: () async { - Navigator.pop(context); - final confirm = await showDialog( - context: context, - builder: (context) => AlertDialog( - title: const Text('Remove Participant'), - content: Text( - 'Are you sure you want to remove ${member.displayName} from this group?', - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context, false), - child: const Text('Cancel'), - ), - TextButton( - onPressed: () { - Navigator.pop(context, true); - }, - child: const Text( - 'Remove', - style: TextStyle(color: Colors.red), - ), + return ClipRect( + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + title: Text('Message @${member.username}'), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => ChatPage( + chatUserId: member.userId, + displayName: member.displayName, + isGroup: false, ), - ], - ), - ); - - if (confirm == true && mounted) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Removing member...'), - duration: Duration(seconds: 1), ), ); - - final success = await context - .read() - .removeMemberFromGroup(widget.chatId, member.userId); - - if (success && mounted) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text('${member.displayName} removed.'), - ), - ); - context.read().fetchGroupMembers( - widget.chatId, - ); - } else if (mounted) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Failed to remove member.'), + }, + ), + // feels redundent to have a view profile option since we don't have a profile page yet + // ListTile( + // title: Text('View Profile (@${member.username})'), + // onTap: () { + // Navigator.pop(context); + // }, + // ), + if (isCurrentUserAdmin && + member.userId != + context.read().currentUser?.id) + ListTile( + title: const Text( + 'Remove from group', + style: TextStyle(color: Colors.red), + ), + onTap: () async { + Navigator.pop(context); + final confirm = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('Remove Participant'), + content: Text( + 'Are you sure you want to remove ${member.displayName} from this group?', + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () { + Navigator.pop(context, true); + }, + child: const Text( + 'Remove', + style: TextStyle(color: Colors.red), + ), + ), + ], ), ); - } - } - }, - ), - ], + + if (confirm == true && mounted) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Removing member...'), + duration: Duration(seconds: 1), + ), + ); + + final success = await context + .read() + .removeMemberFromGroup( + widget.chatId, + member.userId, + ); + + if (success && mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('${member.displayName} removed.'), + ), + ); + context.read().fetchGroupMembers( + widget.chatId, + ); + } else if (mounted) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Failed to remove member.'), + ), + ); + } + } + }, + ), + ], + ), + ), ), ); }, diff --git a/mobile/lib/pages/settings_page.dart b/mobile/lib/pages/settings_page.dart index 2ad31c0..6debb3a 100644 --- a/mobile/lib/pages/settings_page.dart +++ b/mobile/lib/pages/settings_page.dart @@ -171,37 +171,44 @@ class SettingsPage extends StatelessWidget { ), ), SizedBox(width: 20), - Hero( - tag: 'User Data', - child: Material( - type: MaterialType.transparency, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Spacer(), - Text( - user != null ? user.displayName : 'Profile N/A', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: Theme.of( - context, - ).colorScheme.onSurface, + Expanded( + child: Hero( + tag: 'User Data', + child: Material( + type: MaterialType.transparency, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Spacer(), + Text( + user != null + ? user.displayName + : 'Profile N/A', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Theme.of( + context, + ).colorScheme.onSurface, + ), + softWrap: true, + maxLines: 2, + overflow: TextOverflow.ellipsis, ), - ), - Text( - user != null - ? '@${user.username}' - : 'Could not load profile', - style: TextStyle( - fontSize: 12, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, + Text( + user != null + ? '@${user.username}' + : 'Could not load profile', + style: TextStyle( + fontSize: 12, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, + ), ), - ), - Spacer(), - ], + Spacer(), + ], + ), ), ), ),