Fixes for Settings Page
This commit is contained in:
69
frontend/pshared/lib/widgets/password/fields.dart
Normal file
69
frontend/pshared/lib/widgets/password/fields.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
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,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user