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,15 +241,18 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
children: AppNavigation.destinations children: AppNavigation.destinations
.map( .map(
(e) => _isCollapsed (e) => _isCollapsed
? InkWell( ? Tooltip(
child: Icon(e.icon, size: 20).paddingSymmetric( message: e.label,
horizontal: 28, child: InkWell(
vertical: 16, 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( : ListTile(
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
@ -279,18 +282,21 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
Column( Column(
children: [ children: [
if (_isCollapsed) if (_isCollapsed)
InkWell( Tooltip(
child: const Icon( message: 'settings'.tr,
Icons.settings, child: InkWell(
size: 20, child: const Icon(
).paddingSymmetric( Icons.settings,
horizontal: 28, size: 20,
vertical: 10, ).paddingSymmetric(
horizontal: 28,
vertical: 10,
),
onTap: () {
AppRouter.instance.pushNamed('settings');
_closeDrawer();
},
), ),
onTap: () {
AppRouter.instance.pushNamed('settings');
_closeDrawer();
},
) )
else else
ListTile( ListTile(
@ -306,15 +312,18 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer>
}, },
), ),
if (_isCollapsed) if (_isCollapsed)
InkWell( Tooltip(
child: const Icon(Icons.chevron_right, size: 20) message: 'expand'.tr,
.paddingSymmetric( child: InkWell(
horizontal: 28, child: const Icon(Icons.chevron_right, size: 20)
vertical: 10, .paddingSymmetric(
horizontal: 28,
vertical: 10,
),
onTap: () {
_expandDrawer();
},
), ),
onTap: () {
_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),
);
}, },
), ),
], ],