This commit is contained in:
124
lib/presentation/home/widgets/quick_actions_row.dart
Normal file
124
lib/presentation/home/widgets/quick_actions_row.dart
Normal file
@@ -0,0 +1,124 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:trainhub_flutter/core/constants/ui_constants.dart';
|
||||
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
||||
|
||||
class QuickActionsRow extends StatelessWidget {
|
||||
const QuickActionsRow({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Quick Actions',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing12),
|
||||
Row(
|
||||
children: [
|
||||
QuickActionButton(
|
||||
icon: Icons.play_arrow_rounded,
|
||||
label: 'New Workout',
|
||||
color: AppColors.accent,
|
||||
onTap: () => AutoTabsRouter.of(context).setActiveIndex(1),
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing12),
|
||||
QuickActionButton(
|
||||
icon: Icons.description_outlined,
|
||||
label: 'View Plans',
|
||||
color: AppColors.info,
|
||||
onTap: () => AutoTabsRouter.of(context).setActiveIndex(1),
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing12),
|
||||
QuickActionButton(
|
||||
icon: Icons.chat_bubble_outline,
|
||||
label: 'AI Chat',
|
||||
color: AppColors.purple,
|
||||
onTap: () => AutoTabsRouter.of(context).setActiveIndex(4),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class QuickActionButton extends StatefulWidget {
|
||||
const QuickActionButton({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.color,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final Color color;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
State<QuickActionButton> createState() => _QuickActionButtonState();
|
||||
}
|
||||
|
||||
class _QuickActionButtonState extends State<QuickActionButton> {
|
||||
bool _isHovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _isHovered = true),
|
||||
onExit: (_) => setState(() => _isHovered = false),
|
||||
child: AnimatedContainer(
|
||||
duration: UIConstants.animationDuration,
|
||||
decoration: BoxDecoration(
|
||||
color: _isHovered
|
||||
? widget.color.withValues(alpha: 0.08)
|
||||
: Colors.transparent,
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
border: Border.all(
|
||||
color: _isHovered
|
||||
? widget.color.withValues(alpha: 0.4)
|
||||
: AppColors.border,
|
||||
),
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: widget.onTap,
|
||||
borderRadius: UIConstants.smallCardBorderRadius,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: UIConstants.spacing24,
|
||||
vertical: UIConstants.spacing12,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(widget.icon, size: 18, color: widget.color),
|
||||
const SizedBox(width: UIConstants.spacing8),
|
||||
Text(
|
||||
widget.label,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
_isHovered ? widget.color : AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user