import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pshared/provider/account.dart';

import 'package:pweb/controllers/auth/password_form.dart';
import 'package:pweb/pages/settings/profile/account/password/form/form.dart';

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


class AccountPasswordContent extends StatelessWidget {
  const AccountPasswordContent({
    required this.successText,
    required this.errorText,
    required this.oldPasswordLabel,
    required this.newPasswordLabel,
    required this.confirmPasswordLabel,
    required this.savePassword,
    required this.loc,
  });

  final String successText;
  final String errorText;
  final String oldPasswordLabel;
  final String newPasswordLabel;
  final String confirmPasswordLabel;
  final String savePassword;
  final AppLocalizations loc;

  @override
  Widget build(BuildContext context) {
    return Consumer2<AccountProvider, PasswordFormController>(
      builder: (context, accountProvider, formProvider, _) {
        return PasswordForm(
          formProvider: formProvider,
          accountProvider: accountProvider,
          isBusy: accountProvider.isLoading,
          oldPasswordLabel: oldPasswordLabel,
          newPasswordLabel: newPasswordLabel,
          confirmPasswordLabel: confirmPasswordLabel,
          savePassword: savePassword,
          successText: successText,
          errorText: errorText,
          loc: loc,
        );
      },
    );
  }
}
