import 'package:flutter/material.dart';

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


class RecipientAddressBookHeader extends StatelessWidget {
  final VoidCallback onAddRecipient;

  const RecipientAddressBookHeader({super.key, required this.onAddRecipient});

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context).colorScheme;
    final l10 = AppLocalizations.of(context)!;
    return Padding(
      padding: const EdgeInsets.all(20.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            l10.recipients,
            style: Theme.of(context).textTheme.titleLarge!.copyWith(
                  fontSize: 28,
                  fontWeight: FontWeight.bold,
                ),
          ),
          TextButton.icon(
            onPressed: onAddRecipient,
            style: ButtonStyle(
              backgroundColor: WidgetStateProperty.all(theme.primary),
              shadowColor: WidgetStateProperty.all(theme.onPrimaryContainer),
              elevation: WidgetStateProperty.all(2),
              shape: WidgetStateProperty.all(
                RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
              ),
            ),
            icon: Icon(Icons.add, color: theme.onSecondary),
            label: Text(l10.addRecipient, style: TextStyle(color: theme.onSecondary)),
          ),
        ],
      ),
    );
  }
}