From c3106cd341b4c1b55c7a3cc5ec6fb911f0a142b8 Mon Sep 17 00:00:00 2001 From: nahnah Date: Sat, 14 Feb 2026 23:25:15 +0000 Subject: [PATCH] [imp]: Use username for navigation label --- lib/screens/florid_app.dart | 22 +++++++-- lib/screens/user_screen.dart | 12 +++-- lib/widgets/f_navbar.dart | 86 ++++++++++++++++++++---------------- 3 files changed, 75 insertions(+), 45 deletions(-) diff --git a/lib/screens/florid_app.dart b/lib/screens/florid_app.dart index 4c9c583..4262cc5 100644 --- a/lib/screens/florid_app.dart +++ b/lib/screens/florid_app.dart @@ -255,7 +255,11 @@ class _FloridAppState extends State { FloridNavBarItem( icon: userIcon, selectedIcon: userSelectedIcon, - label: "User", + label: settings.userName.isNotEmpty + ? (settings.userName.length > 10 + ? '${settings.userName.substring(0, 10)}...' + : settings.userName) + : 'User', ), ]; @@ -273,7 +277,13 @@ class _FloridAppState extends State { NavigationRailDestination( icon: userIcon, selectedIcon: userSelectedIcon, - label: const Text('Me'), + label: Text( + settings.userName.isNotEmpty + ? (settings.userName.length > 10 + ? '${settings.userName.substring(0, 10)}...' + : settings.userName) + : 'User', + ), ), ]; @@ -501,14 +511,18 @@ class _FloridAppState extends State { ), label: localizations.device, ), - const NavigationDestination( + NavigationDestination( icon: Icon(Symbols.person_rounded), selectedIcon: Icon( Symbols.person_rounded, fill: 1, weight: 600, ), - label: 'User', + label: settings.userName.isNotEmpty + ? (settings.userName.length > 10 + ? '${settings.userName.substring(0, 10)}...' + : settings.userName) + : 'User', ), ]; diff --git a/lib/screens/user_screen.dart b/lib/screens/user_screen.dart index 719c2db..36d5cfb 100644 --- a/lib/screens/user_screen.dart +++ b/lib/screens/user_screen.dart @@ -282,10 +282,14 @@ class _UserScreenState extends State : const Icon(Symbols.person), ), const SizedBox(width: 12), - Text( - settingsProvider.userName.isNotEmpty - ? settingsProvider.userName - : 'User', + Flexible( + child: Text( + settingsProvider.userName.isNotEmpty + ? settingsProvider.userName + : 'User', + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), ), ], ), diff --git a/lib/widgets/f_navbar.dart b/lib/widgets/f_navbar.dart index 0c750cc..bb8d413 100644 --- a/lib/widgets/f_navbar.dart +++ b/lib/widgets/f_navbar.dart @@ -74,47 +74,59 @@ class FNavBar extends StatelessWidget { spacing: 16.0, mainAxisAlignment: MainAxisAlignment.center, children: [ - IconTheme( - data: IconThemeData( - color: selected - ? selectedColor - : unselectedColor, + Flexible( + child: IconTheme( + data: IconThemeData( + color: selected + ? selectedColor + : unselectedColor, + ), + child: selected + ? item.selectedIcon + : item.icon, ), - child: selected - ? item.selectedIcon - : item.icon, ), if (selected) - AnimatedDefaultTextStyle( - duration: const Duration( - milliseconds: 180, - ), - curve: Curves.easeOut, - style: isFlorid - ? TextStyle( - color: selected - ? selectedColor - : unselectedColor, - fontSize: 14, - fontVariations: [ - FontVariation( - 'ROND', - 100, - ), - ], - ) - : TextStyle(inherit: true), - child: Text(item.label), - ) - .animate() - .fadeIn(duration: 180.ms) - .slideX( - begin: 0.5, - end: 0, - duration: 180.ms, - curve: Curves.easeOut, - ), + Flexible( + child: + AnimatedDefaultTextStyle( + duration: const Duration( + milliseconds: 180, + ), + curve: Curves.easeOut, + style: isFlorid + ? TextStyle( + color: selected + ? selectedColor + : unselectedColor, + fontSize: 14, + fontVariations: [ + FontVariation( + 'ROND', + 100, + ), + ], + ) + : TextStyle( + inherit: true, + ), + child: Text( + item.label, + maxLines: 1, + overflow: + TextOverflow.ellipsis, + ), + ) + .animate() + .fadeIn(duration: 180.ms) + .slideX( + begin: 0.5, + end: 0, + duration: 180.ms, + curve: Curves.easeOut, + ), + ), ], ), ),