import 'package:flutter/material.dart'; import 'package:flutter_lucide/flutter_lucide.dart'; import '../../core/theme/app_colors.dart'; import '../../core/theme/app_spacing.dart'; import '../../core/theme/app_typography.dart'; import 'credits_badge.dart'; /// Top navigation bar - matches Pencil topNav class TopNavBar extends StatelessWidget implements PreferredSizeWidget { const TopNavBar({ super.key, required this.title, this.credits, this.showBackButton = false, this.onBack, this.onCreditsTap, }); final String title; final String? credits; final bool showBackButton; final VoidCallback? onBack; final VoidCallback? onCreditsTap; @override Size get preferredSize => const Size.fromHeight(56); @override Widget build(BuildContext context) { return Container( height: 56, padding: const EdgeInsets.symmetric(horizontal: AppSpacing.screenPadding), decoration: const BoxDecoration( color: AppColors.surface, boxShadow: [ BoxShadow( color: AppColors.shadowLight, blurRadius: 8, offset: Offset(0, 2), ), ], ), child: Row( children: [ if (showBackButton) GestureDetector( onTap: onBack ?? () => Navigator.of(context).pop(), behavior: HitTestBehavior.opaque, child: const SizedBox( width: 40, height: 40, child: Center( child: Icon( LucideIcons.arrow_left, size: 24, color: AppColors.textPrimary, ), ), ), ), Expanded( child: showBackButton ? Center( child: Text( title, style: AppTypography.navTitle, ), ) : Align( alignment: Alignment.centerLeft, child: Text( title, style: AppTypography.navTitle, ), ), ), if (credits != null) CreditsBadge(credits: credits!, onTap: onCreditsTap) else const SizedBox(width: 40), ], ), ); } }