|
1 | 1 | import 'package:flutter/material.dart'; |
2 | 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; |
3 | | -import 'package:apidash/extensions/context_extensions.dart'; |
4 | | -import 'package:apidash/providers/ui_providers.dart'; |
| 3 | +import 'package:apidash/extensions/extensions.dart'; |
| 4 | +import 'package:apidash/providers/providers.dart'; |
5 | 5 |
|
6 | 6 | class BottomNavBar extends ConsumerWidget { |
7 | 7 | const BottomNavBar({super.key}); |
@@ -87,78 +87,68 @@ Widget customNavigationDestination( |
87 | 87 | Function()? onTap, |
88 | 88 | }) { |
89 | 89 | bool isSelected = railIdx == buttonIdx; |
90 | | - return TooltipVisibility( |
91 | | - visible: context.isCompactWindow, |
92 | | - child: Tooltip( |
93 | | - message: label, |
94 | | - triggerMode: TooltipTriggerMode.longPress, |
95 | | - verticalOffset: 42, |
96 | | - child: GestureDetector( |
97 | | - behavior: HitTestBehavior.translucent, |
98 | | - onTap: isSelected |
99 | | - ? null |
100 | | - : () { |
101 | | - ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; |
102 | | - if (railIdx > 1 && buttonIdx <= 1) { |
103 | | - ref.read(leftDrawerStateProvider.notifier).state = false; |
104 | | - } |
105 | | - onTap?.call(); |
106 | | - }, |
107 | | - child: Column( |
108 | | - mainAxisAlignment: MainAxisAlignment.center, |
109 | | - children: [ |
110 | | - Ink( |
111 | | - width: 65, |
112 | | - height: 32, |
113 | | - decoration: BoxDecoration( |
| 90 | + return MouseRegion( |
| 91 | + cursor: SystemMouseCursors.click, |
| 92 | + child: GestureDetector( |
| 93 | + behavior: HitTestBehavior.translucent, |
| 94 | + onTap: isSelected |
| 95 | + ? null |
| 96 | + : () { |
| 97 | + ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; |
| 98 | + if (railIdx > 1 && buttonIdx <= 1) { |
| 99 | + ref.read(leftDrawerStateProvider.notifier).state = false; |
| 100 | + } |
| 101 | + onTap?.call(); |
| 102 | + }, |
| 103 | + child: Column( |
| 104 | + mainAxisAlignment: MainAxisAlignment.center, |
| 105 | + children: [ |
| 106 | + Ink( |
| 107 | + width: 65, |
| 108 | + height: 32, |
| 109 | + decoration: BoxDecoration( |
| 110 | + color: isSelected |
| 111 | + ? Theme.of(context).colorScheme.secondaryContainer |
| 112 | + : Colors.transparent, |
| 113 | + borderRadius: BorderRadius.circular(30), |
| 114 | + ), |
| 115 | + child: InkWell( |
| 116 | + borderRadius: BorderRadius.circular(30), |
| 117 | + onTap: isSelected |
| 118 | + ? null |
| 119 | + : () { |
| 120 | + ref.read(navRailIndexStateProvider.notifier).state = |
| 121 | + buttonIdx; |
| 122 | + if (railIdx > 1 && buttonIdx <= 1) { |
| 123 | + ref.read(leftDrawerStateProvider.notifier).state = |
| 124 | + false; |
| 125 | + } |
| 126 | + onTap?.call(); |
| 127 | + }, |
| 128 | + child: Icon( |
| 129 | + isSelected ? selectedIcon : icon, |
114 | 130 | color: isSelected |
115 | | - ? Theme.of(context).colorScheme.secondaryContainer |
116 | | - : Colors.transparent, |
117 | | - borderRadius: BorderRadius.circular(30), |
118 | | - ), |
119 | | - child: InkWell( |
120 | | - borderRadius: BorderRadius.circular(30), |
121 | | - onTap: isSelected |
122 | | - ? null |
123 | | - : () { |
124 | | - ref.read(navRailIndexStateProvider.notifier).state = |
125 | | - buttonIdx; |
126 | | - if (railIdx > 1 && buttonIdx <= 1) { |
127 | | - ref.read(leftDrawerStateProvider.notifier).state = |
128 | | - false; |
129 | | - } |
130 | | - onTap?.call(); |
131 | | - }, |
132 | | - child: Icon( |
133 | | - isSelected ? selectedIcon : icon, |
134 | | - color: isSelected |
135 | | - ? Theme.of(context).colorScheme.onSecondaryContainer |
136 | | - : Theme.of(context) |
137 | | - .colorScheme |
138 | | - .onSurface |
139 | | - .withOpacity(0.65), |
140 | | - ), |
| 131 | + ? Theme.of(context).colorScheme.onSecondaryContainer |
| 132 | + : Theme.of(context).colorScheme.onSurface.withOpacity(0.65), |
141 | 133 | ), |
142 | 134 | ), |
143 | | - showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), |
144 | | - showLabel |
145 | | - ? Text( |
146 | | - label, |
147 | | - style: Theme.of(context).textTheme.labelSmall!.copyWith( |
148 | | - fontWeight: FontWeight.w600, |
149 | | - color: isSelected |
150 | | - ? Theme.of(context) |
151 | | - .colorScheme |
152 | | - .onSecondaryContainer |
153 | | - : Theme.of(context) |
154 | | - .colorScheme |
155 | | - .onSurface |
156 | | - .withOpacity(0.65), |
157 | | - ), |
158 | | - ) |
159 | | - : const SizedBox.shrink(), |
160 | | - ], |
161 | | - ), |
| 135 | + ), |
| 136 | + showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), |
| 137 | + showLabel |
| 138 | + ? Text( |
| 139 | + label, |
| 140 | + style: Theme.of(context).textTheme.labelSmall!.copyWith( |
| 141 | + fontWeight: FontWeight.w600, |
| 142 | + color: isSelected |
| 143 | + ? Theme.of(context).colorScheme.onSecondaryContainer |
| 144 | + : Theme.of(context) |
| 145 | + .colorScheme |
| 146 | + .onSurface |
| 147 | + .withOpacity(0.65), |
| 148 | + ), |
| 149 | + ) |
| 150 | + : const SizedBox.shrink(), |
| 151 | + ], |
162 | 152 | ), |
163 | 153 | ), |
164 | 154 | ); |
|
0 commit comments