import 'package:flutter/material.dart';

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


class SaveButton extends StatelessWidget {
  final VoidCallback onSave;

  final double width;
  final double height;
  final double borderRadius;
  final String? text;
  final TextStyle? textStyle;

  const SaveButton({
    super.key,
    required this.onSave,
    this.width = 200,
    this.height = 45,
    this.borderRadius = 12,
    this.text,
    this.textStyle,
  });

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

    return Center(
      child: SizedBox(
        width: width,
        height: height,
        child: InkWell(
          borderRadius: BorderRadius.circular(borderRadius),
          onTap: onSave,
          child: Container(
            decoration: BoxDecoration(
              color: theme.colorScheme.primary,
              borderRadius: BorderRadius.circular(borderRadius),
            ),
            child: Center(
              child: Text(
                text ?? AppLocalizations.of(context)!.saveRecipient,
                style: textStyle ??
                    theme.textTheme.labelLarge?.copyWith(
                      color: theme.colorScheme.onPrimary,
                      fontWeight: FontWeight.w600,
                    ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
