Drawer tooltip on collapse mode

This commit is contained in:
LittleSheep 2024-08-21 19:35:29 +08:00
parent bc99865ba8
commit 2ec25fd1a2
2 changed files with 40 additions and 28 deletions

View File

@ -241,7 +241,9 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
children: AppNavigation.destinations children: AppNavigation.destinations
.map( .map(
(e) => _isCollapsed (e) => _isCollapsed
? InkWell( ? Tooltip(
message: e.label,
child: InkWell(
child: Icon(e.icon, size: 20).paddingSymmetric( child: Icon(e.icon, size: 20).paddingSymmetric(
horizontal: 28, horizontal: 28,
vertical: 16, vertical: 16,
@ -250,6 +252,7 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
AppRouter.instance.goNamed(e.page); AppRouter.instance.goNamed(e.page);
_closeDrawer(); _closeDrawer();
}, },
),
) )
: ListTile( : ListTile(
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
@ -279,7 +282,9 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
Column( Column(
children: [ children: [
if (_isCollapsed) if (_isCollapsed)
InkWell( Tooltip(
message: 'settings'.tr,
child: InkWell(
child: const Icon( child: const Icon(
Icons.settings, Icons.settings,
size: 20, size: 20,
@ -291,6 +296,7 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
AppRouter.instance.pushNamed('settings'); AppRouter.instance.pushNamed('settings');
_closeDrawer(); _closeDrawer();
}, },
),
) )
else else
ListTile( ListTile(
@ -306,7 +312,9 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
}, },
), ),
if (_isCollapsed) if (_isCollapsed)
InkWell( Tooltip(
message: 'expand'.tr,
child: InkWell(
child: const Icon(Icons.chevron_right, size: 20) child: const Icon(Icons.chevron_right, size: 20)
.paddingSymmetric( .paddingSymmetric(
horizontal: 28, horizontal: 28,
@ -315,6 +323,7 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
onTap: () { onTap: () {
_expandDrawer(); _expandDrawer();
}, },
),
) )
else else
ListTile( ListTile(

View File

@ -77,7 +77,10 @@ class AppNavigationRegion extends StatelessWidget {
final element = index >= noRealmGroupChannels.length final element = index >= noRealmGroupChannels.length
? hasRealmGroupChannels[index - noRealmGroupChannels.length] ? hasRealmGroupChannels[index - noRealmGroupChannels.length]
: noRealmGroupChannels[index]; : noRealmGroupChannels[index];
return _buildEntry(context, element); return Tooltip(
message: element.name,
child: _buildEntry(context, element),
);
}, },
), ),
], ],