File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -401,8 +401,11 @@ class _HelperErrorState extends State<_HelperError> with SingleTickerProviderSta
401401
402402 Widget _buildError () {
403403 assert (widget.error != null || widget.errorText != null );
404- final Widget ? capturedError = widget.error;
405404 final String ? capturedErrorText = widget.errorText;
405+ Widget ? capturedError = widget.error;
406+ if (capturedError != null && widget.errorStyle != null ) {
407+ capturedError = DefaultTextStyle (style: widget.errorStyle! , child: capturedError);
408+ }
406409 return Builder (
407410 builder: (BuildContext context) {
408411 return Semantics (
Original file line number Diff line number Diff line change @@ -6210,6 +6210,21 @@ void main() {
62106210 );
62116211 }, throwsAssertionError);
62126212 });
6213+
6214+ // Regression test for https://github.com/flutter/flutter/issues/174784.
6215+ testWidgets('InputDecorator error widget text style defaults to errorStyle', (
6216+ WidgetTester tester,
6217+ ) async {
6218+ await tester.pumpWidget(
6219+ buildInputDecorator(decoration: const InputDecoration(error: Text(errorText))),
6220+ );
6221+
6222+ expect(findError(), findsOneWidget);
6223+ final ThemeData theme = Theme.of(tester.element(findDecorator()));
6224+ final Color expectedColor = theme.colorScheme.error;
6225+ final TextStyle expectedStyle = theme.textTheme.bodySmall!.copyWith(color: expectedColor);
6226+ expect(getErrorStyle(tester), expectedStyle);
6227+ });
62136228 });
62146229
62156230 testWidgets('InputDecorator with counter does not crash when given a 0 size', (
You can’t perform that action at this time.
0 commit comments