forked from cwtch.im/cwtch-ui
Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Sarah Jamie Lewis | 1baa0ca31e |
|
@ -163,6 +163,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
||||||
),
|
),
|
||||||
CwtchPasswordField(
|
CwtchPasswordField(
|
||||||
controller: ctrlrOldPass,
|
controller: ctrlrOldPass,
|
||||||
|
autoFillHints: [AutofillHints.newPassword],
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
// Password field can be empty when just updating the profile, not on creation
|
// Password field can be empty when just updating the profile, not on creation
|
||||||
if (Provider.of<ProfileInfoState>(context).isEncrypted && Provider.of<ProfileInfoState>(context, listen: false).onion.isEmpty && value.isEmpty && usePassword) {
|
if (Provider.of<ProfileInfoState>(context).isEncrypted && Provider.of<ProfileInfoState>(context, listen: false).onion.isEmpty && value.isEmpty && usePassword) {
|
||||||
|
|
|
@ -4,14 +4,17 @@ import 'package:provider/provider.dart';
|
||||||
import '../settings.dart';
|
import '../settings.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
const hints = [AutofillHints.password];
|
||||||
|
|
||||||
// Provides a styled Password Input Field for use in Form Widgets.
|
// Provides a styled Password Input Field for use in Form Widgets.
|
||||||
// Callers must provide a text controller, label helper text and a validator.
|
// Callers must provide a text controller, label helper text and a validator.
|
||||||
class CwtchPasswordField extends StatefulWidget {
|
class CwtchPasswordField extends StatefulWidget {
|
||||||
CwtchPasswordField({required this.controller, required this.validator, this.action, this.autofocus = false});
|
CwtchPasswordField({required this.controller, required this.validator, this.action, this.autofocus = false, this.autoFillHints = hints});
|
||||||
final TextEditingController controller;
|
final TextEditingController controller;
|
||||||
final FormFieldValidator validator;
|
final FormFieldValidator validator;
|
||||||
final Function(String)? action;
|
final Function(String)? action;
|
||||||
final bool autofocus;
|
final bool autofocus;
|
||||||
|
final Iterable<String> autoFillHints;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CwtchTextFieldState createState() => _CwtchTextFieldState();
|
_CwtchTextFieldState createState() => _CwtchTextFieldState();
|
||||||
|
@ -34,6 +37,7 @@ class _CwtchTextFieldState extends State<CwtchPasswordField> {
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
validator: widget.validator,
|
validator: widget.validator,
|
||||||
obscureText: obscureText,
|
obscureText: obscureText,
|
||||||
|
autofillHints: widget.autoFillHints,
|
||||||
autovalidateMode: AutovalidateMode.always,
|
autovalidateMode: AutovalidateMode.always,
|
||||||
onFieldSubmitted: widget.action,
|
onFieldSubmitted: widget.action,
|
||||||
textInputAction: TextInputAction.unspecified,
|
textInputAction: TextInputAction.unspecified,
|
||||||
|
|
Loading…
Reference in New Issue