@@ -5,8 +5,7 @@ import 'package:querya_desktop/core/ui/querya_icons.dart';
55import 'package:querya_desktop/core/extensions/extension_driver_catalog.dart' ;
66import 'package:querya_desktop/core/extensions/local_extension_registry.dart' ;
77import 'package:querya_desktop/core/layout/window_layout.dart' ;
8- import 'package:querya_desktop/core/motion/querya_motion.dart' ;
9- import 'package:querya_desktop/core/motion/querya_motion_context.dart' ;
8+ import 'package:querya_desktop/core/motion/querya_hover_surface.dart' ;
109import 'package:querya_desktop/features/connections/connection_type_choice.dart' ;
1110import 'package:querya_desktop/features/connections/driver_icon.dart' ;
1211import 'package:querya_desktop/shared/widgets/widgets.dart' ;
@@ -385,7 +384,7 @@ class _FilterDropdowns extends StatelessWidget {
385384 }
386385}
387386
388- class _DbTypeCard extends material.StatefulWidget {
387+ class _DbTypeCard extends material.StatelessWidget {
389388 const _DbTypeCard ({
390389 required this .choice,
391390 required this .theme,
@@ -398,89 +397,70 @@ class _DbTypeCard extends material.StatefulWidget {
398397 final bool selected;
399398 final VoidCallback onTap;
400399
401- @override
402- material.State <_DbTypeCard > createState () => _DbTypeCardState ();
403- }
404-
405- class _DbTypeCardState extends material.State <_DbTypeCard > {
406- bool _hovered = false ;
407-
408400 @override
409401 material.Widget build (material.BuildContext context) {
410- final t = widget.theme;
411- final highlighted = widget.selected || _hovered;
412- return material.MouseRegion (
413- onEnter: (_) => setState (() => _hovered = true ),
414- onExit: (_) => setState (() => _hovered = false ),
415- cursor: material.SystemMouseCursors .click,
416- child: material.GestureDetector (
417- onTap: widget.onTap,
418- child: material.AnimatedContainer (
419- duration: context.motionDuration (QueryaMotion .fast),
420- curve: context.motionCurve (QueryaMotion .enter),
421- padding:
422- const material.EdgeInsets .symmetric (vertical: 10 , horizontal: 8 ),
423- decoration: material.BoxDecoration (
424- color: highlighted
425- ? t.muted.withValues (alpha: 0.4 )
426- : t.muted.withValues (alpha: 0.12 ),
427- borderRadius: material.BorderRadius .circular (10 ),
428- border: material.Border .all (
429- color: widget.selected
430- ? t.primary.withValues (alpha: 0.6 )
431- : t.border.withValues (alpha: 0.35 ),
432- width: widget.selected ? 1.5 : 1 ,
402+ final t = theme;
403+ final highlight = t.muted.withValues (alpha: 0.4 );
404+ return QueryaHoverSurface (
405+ borderRadius: material.BorderRadius .circular (10 ),
406+ padding:
407+ const material.EdgeInsets .symmetric (vertical: 10 , horizontal: 8 ),
408+ idleColor: selected ? highlight : t.muted.withValues (alpha: 0.12 ),
409+ hoveredColor: highlight,
410+ border: material.Border .all (
411+ color: selected
412+ ? t.primary.withValues (alpha: 0.6 )
413+ : t.border.withValues (alpha: 0.35 ),
414+ width: selected ? 1.5 : 1 ,
415+ ),
416+ onTap: onTap,
417+ child: material.Column (
418+ crossAxisAlignment: material.CrossAxisAlignment .stretch,
419+ children: [
420+ material.Expanded (
421+ child: material.Center (
422+ child: material.SizedBox (
423+ width: 52 ,
424+ height: 52 ,
425+ child: DriverIcon (
426+ filePath: choice.iconFile,
427+ assetPath: choice.iconAsset,
428+ size: 52 ,
429+ fallbackIcon: choice.icon,
430+ ),
431+ ),
433432 ),
434433 ),
435- child: material.Column (
436- crossAxisAlignment: material.CrossAxisAlignment .stretch,
437- children: [
438- material.Expanded (
439- child: material.Center (
440- child: material.SizedBox (
441- width: 52 ,
442- height: 52 ,
443- child: DriverIcon (
444- filePath: widget.choice.iconFile,
445- assetPath: widget.choice.iconAsset,
446- size: 52 ,
447- fallbackIcon: widget.choice.icon,
434+ const material.SizedBox (height: 6 ),
435+ material.LayoutBuilder (
436+ builder: (context, lc) {
437+ return material.SizedBox (
438+ height: 38 ,
439+ child: material.FittedBox (
440+ fit: material.BoxFit .scaleDown,
441+ alignment: material.Alignment .center,
442+ child: material.ConstrainedBox (
443+ constraints: material.BoxConstraints (
444+ maxWidth: math.max (48.0 , lc.maxWidth),
448445 ),
449- ),
450- ),
451- ),
452- const material.SizedBox (height: 6 ),
453- material.LayoutBuilder (
454- builder: (context, lc) {
455- return material.SizedBox (
456- height: 38 ,
457- child: material.FittedBox (
458- fit: material.BoxFit .scaleDown,
459- alignment: material.Alignment .center,
460- child: material.ConstrainedBox (
461- constraints: material.BoxConstraints (
462- maxWidth: math.max (48.0 , lc.maxWidth),
463- ),
464- child: material.Text (
465- widget.choice.label,
466- textAlign: material.TextAlign .center,
467- maxLines: 2 ,
468- overflow: material.TextOverflow .ellipsis,
469- style: material.TextStyle (
470- fontSize: 13 ,
471- fontWeight: material.FontWeight .w600,
472- height: 1.2 ,
473- color: t.foreground,
474- ),
475- ),
446+ child: material.Text (
447+ choice.label,
448+ textAlign: material.TextAlign .center,
449+ maxLines: 2 ,
450+ overflow: material.TextOverflow .ellipsis,
451+ style: material.TextStyle (
452+ fontSize: 13 ,
453+ fontWeight: material.FontWeight .w600,
454+ height: 1.2 ,
455+ color: t.foreground,
476456 ),
477457 ),
478- );
479- } ,
480- ),
481- ] ,
458+ ),
459+ ) ,
460+ );
461+ } ,
482462 ),
483- ) ,
463+ ] ,
484464 ),
485465 );
486466 }
0 commit comments