import 'package:flutter/material.dart';
import 'package:fotodocumentation/l10n/app_localizations.dart';
import 'package:fotodocumentation/pages/ui_utils/general_style.dart';
import 'package:fotodocumentation/utils/di_container.dart';

typedef SubmitCallback = void Function();

class GeneralSubmitWidget extends StatelessWidget {
  GeneralStyle get _generalStyle => DiContainer.get();
  
  final SubmitCallback onSelect;
  final String? title;

  const GeneralSubmitWidget({super.key, required this.onSelect, this.title});

  @override
  Widget build(BuildContext context) {
    String text = title ?? AppLocalizations.of(context)!.submitWidget;
    return Row(
      mainAxisAlignment: MainAxisAlignment.end,
      crossAxisAlignment: CrossAxisAlignment.end,
      children: [
        ElevatedButton(
          key: Key("SubmitWidgetButton"),
          style: _generalStyle.elevatedButtonStyle,
          onPressed: onSelect,
          child: Text(text),
        ),
      ],
    );
  }
}
