import 'package:flutter/material.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class HeaderWidget extends StatelessWidget {
  final bool isEditing;
  final VoidCallback? onBack;

  final double spacing;
  final TextStyle? textStyle;

  const HeaderWidget({
    super.key,
    required this.isEditing,
    this.onBack,
    this.spacing = 8,
    this.textStyle,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final l10n = AppLocalizations.of(context)!;

    return Row(
      children: [
        IconButton(
          icon: const Icon(Icons.arrow_back),
          color: theme.colorScheme.primary,
          onPressed: onBack,
        ),
        SizedBox(width: spacing),
        Text(
          isEditing ? l10n.editRecipient : l10n.addRecipient,
          style: textStyle ??
              theme.textTheme.headlineSmall?.copyWith(
                fontWeight: FontWeight.bold,
              ),
        ),
      ],
    );
  }
}
