From 16d62095cb4b958e45ead0850af375626cf708fc Mon Sep 17 00:00:00 2001 From: Ida631 <52692119+Ida631@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:02:58 +1300 Subject: [PATCH] bug fixes (#80) --- lib/presentation/chat/views/chat_screen.dart | 47 +++++++++++++++---- .../settings/views/forget_password_page.dart | 4 +- .../settings/views/settings_page.dart | 6 --- .../settings/views/sigup_page.dart | 2 +- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/lib/presentation/chat/views/chat_screen.dart b/lib/presentation/chat/views/chat_screen.dart index 226c4d0..c13193e 100644 --- a/lib/presentation/chat/views/chat_screen.dart +++ b/lib/presentation/chat/views/chat_screen.dart @@ -88,16 +88,45 @@ class _ChatScreenState extends State setState(() {}); // Rebuild the UI } }, - child: viewModel.user?.avatarUrl != null - ? CircleAvatar( - backgroundImage: NetworkImage(viewModel.user!.avatarUrl!), - radius: 16, // Adjust radius to fit in the app bar - ) - : const Icon( - Icons.account_circle, - size: 40, - color: Colors.white, + child: Stack( + alignment: Alignment.topRight, // Align everything to the top-right corner + children: [ + // Avatar or default icon + viewModel.user?.avatarUrl != null + ? CircleAvatar( + backgroundImage: NetworkImage(viewModel.user!.avatarUrl!), + radius: 20, // Slightly bigger radius for better visuals + ) + : const Icon( + Icons.account_circle, + size: 48, // Adjusted size for consistency + color: Colors.white, + ), + + // Blue verified icon with a white circular background + if (viewModel.user?.isCompositeExpert == true) + Positioned( + right: 0, // Align to the top-right corner + top: 0, + child: Container( + width: 20, // Ensure fixed width + height: 20, // Ensure fixed height + decoration: BoxDecoration( + color: Colors.white, // White background for contrast + shape: BoxShape.circle, // Ensure a perfect circle + ), + alignment: Alignment.center, // Center the icon + child: Icon( + Icons.verified, + color: Colors.blue, // Blue verification icon + size: 16, // Size of the icon itself + ), + ), + ), + ], ), + + ), const SizedBox(width: 8), ], diff --git a/lib/presentation/settings/views/forget_password_page.dart b/lib/presentation/settings/views/forget_password_page.dart index 71811af..1cbf4a5 100644 --- a/lib/presentation/settings/views/forget_password_page.dart +++ b/lib/presentation/settings/views/forget_password_page.dart @@ -44,13 +44,13 @@ class _ForgetPasswordPageState extends State { @override Widget build(BuildContext context) { return ChangeNotifierProvider( - create: (_) => sl(), + create: (_) => sl(),//Creates an instance of the ForgetPasswordViewModel using the create function child: Scaffold( appBar: AppBar( title: Text("Reset Password"), backgroundColor: Color(0xFF33424E), ), - body: Consumer( + body: Consumer(//widget listens to changes in the ForgetPasswordViewModel builder: (context, viewModel, child) { return Padding( padding: const EdgeInsets.all(16.0), diff --git a/lib/presentation/settings/views/settings_page.dart b/lib/presentation/settings/views/settings_page.dart index a51a127..db8f887 100644 --- a/lib/presentation/settings/views/settings_page.dart +++ b/lib/presentation/settings/views/settings_page.dart @@ -139,9 +139,6 @@ class _SettingsPageState extends State { child: ManageCompositeExpertsPage()), ), ); - /*if (result == 'submit') { - await viewModel.fetchAuthSessionNew(); - }*/ }, ), if (viewModel.isLoggedIn && !viewModel.isExpert) @@ -155,9 +152,6 @@ class _SettingsPageState extends State { builder: (context) => ApplyExpertPage(), ), ); - /*if (result == 'submit') { - await viewModel.fetchAuthSessionNew(); - }*/ }, ), MoreRow( diff --git a/lib/presentation/settings/views/sigup_page.dart b/lib/presentation/settings/views/sigup_page.dart index 776a43d..6b512b1 100644 --- a/lib/presentation/settings/views/sigup_page.dart +++ b/lib/presentation/settings/views/sigup_page.dart @@ -118,7 +118,7 @@ class _SignupFormState extends State { @override Widget build(BuildContext context) { - final viewModel = Provider.of(context); + final viewModel = Provider.of(context); //access an already provided instance of SignupViewModel return Scaffold( appBar: AppBar(title: Text('Signup')), body: SingleChildScrollView(