From a15b5439f0ff5f4812e99d74e971f22ba1bbeb9f Mon Sep 17 00:00:00 2001 From: mohammad Date: Tue, 20 May 2025 16:39:10 +0300 Subject: [PATCH] Refactor user dropdown menu to display user's full name and arrow icon in a row for better layout consistency --- lib/utils/user_drop_down_menu.dart | 25 ++++++++++++++++++------- lib/web_layout/web_app_bar.dart | 23 ----------------------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/lib/utils/user_drop_down_menu.dart b/lib/utils/user_drop_down_menu.dart index c9fe492e..15da1f3a 100644 --- a/lib/utils/user_drop_down_menu.dart +++ b/lib/utils/user_drop_down_menu.dart @@ -41,13 +41,24 @@ class _UserDropdownMenuState extends State { _isDropdownOpen = false; }); }, - child: Transform.rotate( - angle: _isDropdownOpen ? -1.5708 : 1.5708, - child: const Icon( - Icons.arrow_forward_ios, - color: Colors.white, - size: 16, - ), + child: Row( + children: [ + const SizedBox(width: 12), + if (widget.user != null) + Text( + '${widget.user!.firstName} ${widget.user!.lastName}', + style: Theme.of(context).textTheme.bodyLarge, + ), + const SizedBox(width: 12), + Transform.rotate( + angle: _isDropdownOpen ? -1.5708 : 1.5708, + child: const Icon( + Icons.arrow_forward_ios, + color: Colors.white, + size: 16, + ), + ), + ], ), ), ], diff --git a/lib/web_layout/web_app_bar.dart b/lib/web_layout/web_app_bar.dart index 02b81522..3cfe171e 100644 --- a/lib/web_layout/web_app_bar.dart +++ b/lib/web_layout/web_app_bar.dart @@ -92,13 +92,6 @@ class DesktopAppBar extends StatelessWidget { if (rightBody != null) rightBody!, const SizedBox(width: 24), _UserAvatar(), - const SizedBox(width: 12), - if (user != null) - Text( - '${user.firstName} ${user.lastName}', - style: Theme.of(context).textTheme.bodyLarge, - ), - const SizedBox(width: 12), UserDropdownMenu(user: user), ], ); @@ -146,14 +139,6 @@ class TabletAppBar extends StatelessWidget { if (rightBody != null) rightBody!, const SizedBox(width: 16), _UserAvatar(), - if (user != null) ...[ - const SizedBox(width: 8), - Text( - '${user.firstName} ${user.lastName}', - style: - Theme.of(context).textTheme.bodyLarge?.copyWith(fontSize: 14), - ), - ], UserDropdownMenu(user: user), ], ); @@ -215,14 +200,6 @@ class MobileAppBar extends StatelessWidget { return Row( children: [ _UserAvatar(), - if (user != null) ...[ - const SizedBox(width: 8), - Text( - '${user.firstName} ${user.lastName}', - style: - Theme.of(context).textTheme.bodyLarge?.copyWith(fontSize: 14), - ), - ], UserDropdownMenu(user: user), ], );