43 lines
2.0 KiB
Dart
43 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../settings.dart';
|
|
|
|
// Provides a styled Password Input Field for use in Form Widgets.
|
|
// Callers must provide a text controller, label helper text and a validator.
|
|
class CwtchPasswordField extends StatefulWidget {
|
|
CwtchPasswordField({this.controller, this.validator});
|
|
final TextEditingController controller;
|
|
final FormFieldValidator validator;
|
|
|
|
@override
|
|
_CwtchTextFieldState createState() => _CwtchTextFieldState();
|
|
}
|
|
|
|
class _CwtchTextFieldState extends State<CwtchPasswordField> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<Settings>(builder: (context, theme, child) {
|
|
return TextFormField(
|
|
controller: widget.controller,
|
|
validator: widget.validator,
|
|
obscureText: true,
|
|
enableSuggestions: false,
|
|
autocorrect: false,
|
|
decoration: InputDecoration(
|
|
errorStyle: TextStyle(
|
|
color: theme.current().textfieldErrorColor(),
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0)),
|
|
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)),
|
|
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)),
|
|
filled: true,
|
|
fillColor: theme.current().textfieldBackgroundColor(),
|
|
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0)),
|
|
),
|
|
style: TextStyle(color: theme.current().mainTextColor(), backgroundColor: theme.current().textfieldBackgroundColor()),
|
|
);
|
|
});
|
|
}
|
|
}
|