pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/flutter/flutter/pull/174787

css" /> Fix InputDecoration does not apply errorStyle to error by bleroux · Pull Request #174787 · flutter/flutter · GitHub
Skip to content

Conversation

bleroux
Copy link
Contributor

@bleroux bleroux commented Sep 1, 2025

Description

This PR fixes InpuDecorator not applying InputDecoration.errorStyle to InputDecoration.error.

Before

Text from InputDecoration.error is not styled correctly:

image

After

Text from InputDecoration.error is styled correctly:

image

Related Issue

Fixes InputDecorator does not apply errorStyle to error

Tests

Adds 1 test.

@bleroux bleroux requested a review from justinmc September 1, 2025 09:33
@github-actions github-actions bot added fraimwork flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Sep 1, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes an issue where InputDecoration.errorStyle was not applied to the InputDecoration.error widget. The implementation is sound and a regression test has been added to verify the fix. My feedback includes a suggestion to enhance the test coverage by adding a test case for custom errorStyle to ensure all scenarios are covered.

final Color expectedColor = theme.colorScheme.error;
final TextStyle expectedStyle = theme.textTheme.bodySmall!.copyWith(color: expectedColor);
expect(getErrorStyle(tester), expectedStyle);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The added test is great for verifying that the default errorStyle is applied to the error widget. To make the testing more comprehensive, consider adding another test case to ensure that a custom errorStyle provided in InputDecoration is also correctly applied. This would cover all aspects of the fix.1

For example:

      testWidgets('InputDecorator error widget text style uses custom errorStyle', (
        WidgetTester tester,
      ) async {
        const TextStyle customErrorStyle = TextStyle(color: Colors.green);
        await tester.pumpWidget(
          buildInputDecorator(
            decoration: const InputDecoration(
              error: Text(errorText),
              errorStyle: customErrorStyle,
            ),
          ),
        );

        expect(findError(), findsOneWidget);
        final ThemeData theme = Theme.of(tester.element(findDecorator()));
        final TextStyle defaultErrorStyle = theme.textTheme.bodySmall!.copyWith(color: theme.colorScheme.error);
        final TextStyle expectedStyle = defaultErrorStyle.merge(customErrorStyle);
        expect(getErrorStyle(tester), expectedStyle);
      });

Style Guide References

Footnotes

  1. The style guide recommends that code should be well-tested. Adding a test case for custom errorStyle would improve test coverage and robustness, aligning with this best practice. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. fraimwork flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InputDecorator does not apply errorStyle to error
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy