Skip to content

Commit

Permalink
Change validation error color
Browse files Browse the repository at this point in the history
Co-authored-by: Alisa Vynohradova <[email protected]>
  • Loading branch information
ANDREYDEN and alisondraV committed Oct 3, 2024
1 parent 38752aa commit 9dd3fb4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/widgets/inputs/new_user_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _NewUserInputState extends State<NewUserInput> {
return null;
}

Text? getErrorWidget(String? Function() errorGetter) {
Text? getErrorWidget(BuildContext context, String? Function() errorGetter) {
if (!_isDirty) {
return null;
}
Expand All @@ -69,7 +69,10 @@ class _NewUserInputState extends State<NewUserInput> {
return null;
}

return Text(error);
return Text(
error,
style: TextStyle(color: Theme.of(context).colorScheme.error),
);
}

bool get _formValid {
Expand All @@ -93,7 +96,7 @@ class _NewUserInputState extends State<NewUserInput> {
controller: _nameController,
decoration: InputDecoration(
hintText: 'User name',
error: getErrorWidget(_getNameError),
error: getErrorWidget(context, _getNameError),
),
),
),
Expand All @@ -104,7 +107,7 @@ class _NewUserInputState extends State<NewUserInput> {
controller: _emailController,
decoration: InputDecoration(
hintText: 'User email',
error: getErrorWidget(_getEmailError),
error: getErrorWidget(context, _getEmailError),
),
),
),
Expand Down

0 comments on commit 9dd3fb4

Please sign in to comment.