69 lines
2.2 KiB
Dart
69 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pshared/widgets/password/confirm_field.dart';
|
|
import 'package:pshared/widgets/password/field.dart';
|
|
|
|
|
|
class PasswordFields extends StatelessWidget {
|
|
const PasswordFields({
|
|
super.key,
|
|
required this.oldPasswordController,
|
|
required this.newPasswordController,
|
|
required this.confirmPasswordController,
|
|
required this.oldPasswordLabel,
|
|
required this.newPasswordLabel,
|
|
required this.confirmPasswordLabel,
|
|
required this.missingPasswordError,
|
|
required this.passwordsDoNotMatchError,
|
|
required this.fieldWidth,
|
|
required this.gapSmall,
|
|
required this.isEnabled,
|
|
});
|
|
|
|
final TextEditingController oldPasswordController;
|
|
final TextEditingController newPasswordController;
|
|
final TextEditingController confirmPasswordController;
|
|
final String oldPasswordLabel;
|
|
final String newPasswordLabel;
|
|
final String confirmPasswordLabel;
|
|
final String missingPasswordError;
|
|
final String passwordsDoNotMatchError;
|
|
final double fieldWidth;
|
|
final double gapSmall;
|
|
final bool isEnabled;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
PasswordField(
|
|
controller: oldPasswordController,
|
|
labelText: oldPasswordLabel,
|
|
fieldWidth: fieldWidth,
|
|
isEnabled: isEnabled,
|
|
validator: (value) =>
|
|
(value == null || value.isEmpty) ? missingPasswordError : null,
|
|
),
|
|
SizedBox(height: gapSmall),
|
|
PasswordField(
|
|
controller: newPasswordController,
|
|
labelText: newPasswordLabel,
|
|
fieldWidth: fieldWidth,
|
|
isEnabled: isEnabled,
|
|
validator: (value) =>
|
|
(value == null || value.isEmpty) ? missingPasswordError : null,
|
|
),
|
|
SizedBox(height: gapSmall),
|
|
ConfirmPasswordField(
|
|
controller: confirmPasswordController,
|
|
fieldWidth: fieldWidth,
|
|
isEnabled: isEnabled,
|
|
confirmPasswordLabel: confirmPasswordLabel,
|
|
newPasswordController: newPasswordController,
|
|
missingPasswordError: missingPasswordError,
|
|
passwordsDoNotMatchError: passwordsDoNotMatchError,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
} |