Error Styling
This commit is contained in:
parent
ec951c0a89
commit
120bf28881
|
@ -15,22 +15,27 @@ class CwtchPasswordField extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _CwtchTextFieldState extends State<CwtchPasswordField> {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<OpaqueTheme> (
|
||||
builder: (context, theme, child) {
|
||||
return TextFormField(
|
||||
controller: widget.controller,
|
||||
validator: widget.validator,
|
||||
obscureText: true, enableSuggestions: false, autocorrect: false,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: theme.current().textfieldBackgroundColor(),
|
||||
border: OutlineInputBorder(borderSide: BorderSide(color: theme.current().textfieldBorderColor()), borderRadius: BorderRadius.circular(15))),
|
||||
style: TextStyle(color: theme.current().mainTextColor(), backgroundColor: theme.current().textfieldBackgroundColor()),
|
||||
);
|
||||
return Consumer<OpaqueTheme>(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,
|
||||
),
|
||||
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(),
|
||||
border: OutlineInputBorder(borderSide: BorderSide(color: theme.current().textfieldBorderColor()), borderRadius: BorderRadius.circular(15))),
|
||||
style: TextStyle(color: theme.current().mainTextColor(), backgroundColor: theme.current().textfieldBackgroundColor()),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
import '../opaque.dart';
|
||||
|
||||
|
||||
// Provides a styled Text Field for use in Form Widgets.
|
||||
// Callers must provide a text controller, label helper text and a validator.
|
||||
class CwtchTextField extends StatefulWidget {
|
||||
|
@ -18,17 +17,24 @@ class CwtchTextField extends StatefulWidget {
|
|||
class _CwtchTextFieldState extends State<CwtchTextField> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<OpaqueTheme> (
|
||||
builder: (context, theme, child) {
|
||||
return TextFormField(
|
||||
return Consumer<OpaqueTheme>(builder: (context, theme, child) {
|
||||
return TextFormField(
|
||||
controller: widget.controller,
|
||||
validator: widget.validator,
|
||||
decoration: InputDecoration(
|
||||
|
||||
labelText: widget.labelText,
|
||||
labelStyle: TextStyle(color: theme.current().mainTextColor(), backgroundColor: theme.current().textfieldBackgroundColor()),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
filled: true,
|
||||
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)),
|
||||
errorStyle: TextStyle (color: theme.current().textfieldErrorColor(), fontWeight: FontWeight.bold,),
|
||||
fillColor: theme.current().textfieldBackgroundColor(),
|
||||
border: OutlineInputBorder(borderSide: BorderSide(color: theme.current().textfieldBorderColor()), borderRadius: BorderRadius.circular(15))),
|
||||
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
|
||||
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()),
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue