Skip to content

Commit 5f49837

Browse files
Fix misleading error message for color/decoration conflict (relands #180325) (#181882)
_This PR is a clone of #180325 and relands it._ ## Description Fixes the contradictory error message that says "Cannot provide both... To provide both". Updated wording to match `Ink` and `AnimatedContainer` widgets which use clearer phrasing. ## Related Issue Fixes #119484 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Nathan Nguyen <[email protected]>
1 parent 295e3f6 commit 5f49837

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎packages/flutter/lib/src/cupertino/search_field.dart‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,16 @@ class CupertinoSearchTextField extends StatefulWidget {
149149
}) : assert(
150150
!((decoration != null) && (backgroundColor != null)),
151151
'Cannot provide both a background color and a decoration\n'
152-
'To provide both, use "decoration: BoxDecoration(color: '
153-
'backgroundColor)"',
152+
'The backgroundColor argument is just a shorthand for '
153+
'"decoration: BoxDecoration(color: backgroundColor)".\n'
154+
'To use both a backgroundColor and other decoration properties, set the color in the BoxDecoration instead.',
154155
),
155156
assert(
156157
!((decoration != null) && (borderRadius != null)),
157158
'Cannot provide both a border radius and a decoration\n'
158-
'To provide both, use "decoration: BoxDecoration(borderRadius: '
159-
'borderRadius)"',
159+
'The borderRadius argument is just a shorthand for '
160+
'"decoration: BoxDecoration(borderRadius: borderRadius)".\n'
161+
'To use both a radius and other decoration properties, set the radius in the BoxDecoration instead.',
160162
);
161163

162164
/// Controls the text being edited.

0 commit comments

Comments
 (0)