|
1 | | -import 'package:apidash/providers/ui_providers.dart'; |
2 | | -import 'package:apidash/screens/mobile/widgets/page_base.dart'; |
3 | 1 | import 'package:flutter/material.dart'; |
4 | 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; |
| 3 | +import 'package:apidash/extensions/context_extensions.dart'; |
| 4 | +import 'package:apidash/providers/ui_providers.dart'; |
| 5 | +import 'package:apidash/screens/mobile/widgets/page_base.dart'; |
5 | 6 | import '../settings_page.dart'; |
6 | 7 | import '../intro_page.dart'; |
7 | 8 |
|
@@ -183,67 +184,76 @@ Widget customNavigationDestination( |
183 | 184 | Function()? onTap, |
184 | 185 | }) { |
185 | 186 | bool isSelected = railIdx == buttonIdx; |
186 | | - return Tooltip( |
187 | | - message: label, |
188 | | - triggerMode: TooltipTriggerMode.longPress, |
189 | | - verticalOffset: 42, |
190 | | - child: GestureDetector( |
191 | | - behavior: HitTestBehavior.translucent, |
192 | | - onTap: isSelected |
193 | | - ? null |
194 | | - : () { |
195 | | - if (!isNavigator) { |
196 | | - ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; |
197 | | - } |
198 | | - onTap?.call(); |
199 | | - }, |
200 | | - child: Column( |
201 | | - mainAxisAlignment: MainAxisAlignment.center, |
202 | | - children: [ |
203 | | - Ink( |
204 | | - width: 65, |
205 | | - height: 32, |
206 | | - decoration: BoxDecoration( |
207 | | - color: isSelected |
208 | | - ? Theme.of(context).colorScheme.secondaryContainer |
209 | | - : Colors.transparent, |
210 | | - borderRadius: BorderRadius.circular(30), |
211 | | - ), |
212 | | - child: InkWell( |
213 | | - borderRadius: BorderRadius.circular(30), |
214 | | - onTap: isSelected |
215 | | - ? null |
216 | | - : () { |
217 | | - if (!isNavigator) { |
218 | | - ref.read(navRailIndexStateProvider.notifier).state = |
219 | | - buttonIdx; |
220 | | - } |
221 | | - onTap?.call(); |
222 | | - }, |
223 | | - child: Icon( |
224 | | - isSelected ? selectedIcon : icon, |
| 187 | + return TooltipVisibility( |
| 188 | + visible: context.isCompactWindow, |
| 189 | + child: Tooltip( |
| 190 | + message: label, |
| 191 | + triggerMode: TooltipTriggerMode.longPress, |
| 192 | + verticalOffset: 42, |
| 193 | + child: GestureDetector( |
| 194 | + behavior: HitTestBehavior.translucent, |
| 195 | + onTap: isSelected |
| 196 | + ? null |
| 197 | + : () { |
| 198 | + if (!isNavigator) { |
| 199 | + ref.read(navRailIndexStateProvider.notifier).state = |
| 200 | + buttonIdx; |
| 201 | + } |
| 202 | + onTap?.call(); |
| 203 | + }, |
| 204 | + child: Column( |
| 205 | + mainAxisAlignment: MainAxisAlignment.center, |
| 206 | + children: [ |
| 207 | + Ink( |
| 208 | + width: 65, |
| 209 | + height: 32, |
| 210 | + decoration: BoxDecoration( |
225 | 211 | color: isSelected |
226 | | - ? Theme.of(context).colorScheme.onSecondaryContainer |
227 | | - : Theme.of(context).colorScheme.onSurface.withOpacity(0.65), |
| 212 | + ? Theme.of(context).colorScheme.secondaryContainer |
| 213 | + : Colors.transparent, |
| 214 | + borderRadius: BorderRadius.circular(30), |
| 215 | + ), |
| 216 | + child: InkWell( |
| 217 | + borderRadius: BorderRadius.circular(30), |
| 218 | + onTap: isSelected |
| 219 | + ? null |
| 220 | + : () { |
| 221 | + if (!isNavigator) { |
| 222 | + ref.read(navRailIndexStateProvider.notifier).state = |
| 223 | + buttonIdx; |
| 224 | + } |
| 225 | + onTap?.call(); |
| 226 | + }, |
| 227 | + child: Icon( |
| 228 | + isSelected ? selectedIcon : icon, |
| 229 | + color: isSelected |
| 230 | + ? Theme.of(context).colorScheme.onSecondaryContainer |
| 231 | + : Theme.of(context) |
| 232 | + .colorScheme |
| 233 | + .onSurface |
| 234 | + .withOpacity(0.65), |
| 235 | + ), |
228 | 236 | ), |
229 | 237 | ), |
230 | | - ), |
231 | | - showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), |
232 | | - showLabel |
233 | | - ? Text( |
234 | | - label, |
235 | | - style: Theme.of(context).textTheme.labelSmall!.copyWith( |
236 | | - fontWeight: FontWeight.w600, |
237 | | - color: isSelected |
238 | | - ? Theme.of(context).colorScheme.onSecondaryContainer |
239 | | - : Theme.of(context) |
240 | | - .colorScheme |
241 | | - .onSurface |
242 | | - .withOpacity(0.65), |
243 | | - ), |
244 | | - ) |
245 | | - : const SizedBox.shrink(), |
246 | | - ], |
| 238 | + showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), |
| 239 | + showLabel |
| 240 | + ? Text( |
| 241 | + label, |
| 242 | + style: Theme.of(context).textTheme.labelSmall!.copyWith( |
| 243 | + fontWeight: FontWeight.w600, |
| 244 | + color: isSelected |
| 245 | + ? Theme.of(context) |
| 246 | + .colorScheme |
| 247 | + .onSecondaryContainer |
| 248 | + : Theme.of(context) |
| 249 | + .colorScheme |
| 250 | + .onSurface |
| 251 | + .withOpacity(0.65), |
| 252 | + ), |
| 253 | + ) |
| 254 | + : const SizedBox.shrink(), |
| 255 | + ], |
| 256 | + ), |
247 | 257 | ), |
248 | 258 | ), |
249 | 259 | ); |
|
0 commit comments