fix: click cursor on hover & cleanup

This commit is contained in:
DenserMeerkat
2024-06-13 01:07:53 +05:30
parent 8228b28a24
commit 04f763eca5
2 changed files with 62 additions and 71 deletions

View File

@ -106,6 +106,7 @@ class CollectionPane extends ConsumerWidget {
const Expanded( const Expanded(
child: RequestList(), child: RequestList(),
), ),
kVSpacer5
], ],
), ),
); );

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:apidash/extensions/context_extensions.dart'; import 'package:apidash/extensions/extensions.dart';
import 'package:apidash/providers/ui_providers.dart'; import 'package:apidash/providers/providers.dart';
class BottomNavBar extends ConsumerWidget { class BottomNavBar extends ConsumerWidget {
const BottomNavBar({super.key}); const BottomNavBar({super.key});
@ -157,78 +157,68 @@ Widget customNavigationDestination(
Function()? onTap, Function()? onTap,
}) { }) {
bool isSelected = railIdx == buttonIdx; bool isSelected = railIdx == buttonIdx;
return TooltipVisibility( return MouseRegion(
visible: context.isCompactWindow, cursor: SystemMouseCursors.click,
child: Tooltip( child: GestureDetector(
message: label, behavior: HitTestBehavior.translucent,
triggerMode: TooltipTriggerMode.longPress, onTap: isSelected
verticalOffset: 42, ? null
child: GestureDetector( : () {
behavior: HitTestBehavior.translucent, ref.read(navRailIndexStateProvider.notifier).state = buttonIdx;
onTap: isSelected if (railIdx > 1 && buttonIdx <= 1) {
? null ref.read(leftDrawerStateProvider.notifier).state = false;
: () { }
ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; onTap?.call();
if (railIdx > 1 && buttonIdx <= 1) { },
ref.read(leftDrawerStateProvider.notifier).state = false; child: Column(
} mainAxisAlignment: MainAxisAlignment.center,
onTap?.call(); children: [
}, Ink(
child: Column( width: 65,
mainAxisAlignment: MainAxisAlignment.center, height: 32,
children: [ decoration: BoxDecoration(
Ink( color: isSelected
width: 65, ? Theme.of(context).colorScheme.secondaryContainer
height: 32, : Colors.transparent,
decoration: BoxDecoration( borderRadius: BorderRadius.circular(30),
),
child: InkWell(
borderRadius: BorderRadius.circular(30),
onTap: isSelected
? null
: () {
ref.read(navRailIndexStateProvider.notifier).state =
buttonIdx;
if (railIdx > 1 && buttonIdx <= 1) {
ref.read(leftDrawerStateProvider.notifier).state =
false;
}
onTap?.call();
},
child: Icon(
isSelected ? selectedIcon : icon,
color: isSelected color: isSelected
? Theme.of(context).colorScheme.secondaryContainer ? Theme.of(context).colorScheme.onSecondaryContainer
: Colors.transparent, : Theme.of(context).colorScheme.onSurface.withOpacity(0.65),
borderRadius: BorderRadius.circular(30),
),
child: InkWell(
borderRadius: BorderRadius.circular(30),
onTap: isSelected
? null
: () {
ref.read(navRailIndexStateProvider.notifier).state =
buttonIdx;
if (railIdx > 1 && buttonIdx <= 1) {
ref.read(leftDrawerStateProvider.notifier).state =
false;
}
onTap?.call();
},
child: Icon(
isSelected ? selectedIcon : icon,
color: isSelected
? Theme.of(context).colorScheme.onSecondaryContainer
: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.65),
),
), ),
), ),
showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), ),
showLabel showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(),
? Text( showLabel
label, ? Text(
style: Theme.of(context).textTheme.labelSmall!.copyWith( label,
fontWeight: FontWeight.w600, style: Theme.of(context).textTheme.labelSmall!.copyWith(
color: isSelected fontWeight: FontWeight.w600,
? Theme.of(context) color: isSelected
.colorScheme ? Theme.of(context).colorScheme.onSecondaryContainer
.onSecondaryContainer : Theme.of(context)
: Theme.of(context) .colorScheme
.colorScheme .onSurface
.onSurface .withOpacity(0.65),
.withOpacity(0.65), ),
), )
) : const SizedBox.shrink(),
: const SizedBox.shrink(), ],
],
),
), ),
), ),
); );