From 2ec25fd1a234fdd3ea5f5b6e6e53273e626f7ce6 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 21 Aug 2024 19:35:29 +0800 Subject: [PATCH] :sparkles: Drawer tooltip on collapse mode --- .../navigation/app_navigation_drawer.dart | 63 +++++++++++-------- .../navigation/app_navigation_region.dart | 5 +- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/lib/widgets/navigation/app_navigation_drawer.dart b/lib/widgets/navigation/app_navigation_drawer.dart index ff5ec67..b8f7e3c 100644 --- a/lib/widgets/navigation/app_navigation_drawer.dart +++ b/lib/widgets/navigation/app_navigation_drawer.dart @@ -241,15 +241,18 @@ class _AppNavigationDrawerState extends State children: AppNavigation.destinations .map( (e) => _isCollapsed - ? InkWell( - child: Icon(e.icon, size: 20).paddingSymmetric( - horizontal: 28, - vertical: 16, + ? Tooltip( + message: e.label, + child: InkWell( + child: Icon(e.icon, size: 20).paddingSymmetric( + horizontal: 28, + vertical: 16, + ), + onTap: () { + AppRouter.instance.goNamed(e.page); + _closeDrawer(); + }, ), - onTap: () { - AppRouter.instance.goNamed(e.page); - _closeDrawer(); - }, ) : ListTile( contentPadding: const EdgeInsets.symmetric( @@ -279,18 +282,21 @@ class _AppNavigationDrawerState extends State Column( children: [ if (_isCollapsed) - InkWell( - child: const Icon( - Icons.settings, - size: 20, - ).paddingSymmetric( - horizontal: 28, - vertical: 10, + Tooltip( + message: 'settings'.tr, + child: InkWell( + child: const Icon( + Icons.settings, + size: 20, + ).paddingSymmetric( + horizontal: 28, + vertical: 10, + ), + onTap: () { + AppRouter.instance.pushNamed('settings'); + _closeDrawer(); + }, ), - onTap: () { - AppRouter.instance.pushNamed('settings'); - _closeDrawer(); - }, ) else ListTile( @@ -306,15 +312,18 @@ class _AppNavigationDrawerState extends State }, ), if (_isCollapsed) - InkWell( - child: const Icon(Icons.chevron_right, size: 20) - .paddingSymmetric( - horizontal: 28, - vertical: 10, + Tooltip( + message: 'expand'.tr, + child: InkWell( + child: const Icon(Icons.chevron_right, size: 20) + .paddingSymmetric( + horizontal: 28, + vertical: 10, + ), + onTap: () { + _expandDrawer(); + }, ), - onTap: () { - _expandDrawer(); - }, ) else ListTile( diff --git a/lib/widgets/navigation/app_navigation_region.dart b/lib/widgets/navigation/app_navigation_region.dart index f6c683e..7ca8447 100644 --- a/lib/widgets/navigation/app_navigation_region.dart +++ b/lib/widgets/navigation/app_navigation_region.dart @@ -77,7 +77,10 @@ class AppNavigationRegion extends StatelessWidget { final element = index >= noRealmGroupChannels.length ? hasRealmGroupChannels[index - noRealmGroupChannels.length] : noRealmGroupChannels[index]; - return _buildEntry(context, element); + return Tooltip( + message: element.name, + child: _buildEntry(context, element), + ); }, ), ],