Skip to content

Commit 1b3f44b

Browse files
committed
Fix misleading error message for color/decoration conflict
The error message said 'To provide both' which contradicts 'Cannot provide both'. Updated to match the clearer wording used in Ink and AnimatedContainer widgets. Fixes flutter#119484
1 parent 10cfc00 commit 1b3f44b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ 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)".',
154154
),
155155
assert(
156156
!((decoration != null) && (borderRadius != null)),
157157
'Cannot provide both a border radius and a decoration\n'
158-
'To provide both, use "decoration: BoxDecoration(borderRadius: '
159-
'borderRadius)"',
158+
'The borderRadius argument is just a shorthand for '
159+
'"decoration: BoxDecoration(borderRadius: borderRadius)".',
160160
);
161161

162162
/// Controls the text being edited.

‎packages/flutter/lib/src/widgets/container.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class Container extends StatelessWidget {
276276
assert(
277277
color == null || decoration == null,
278278
'Cannot provide both a color and a decoration\n'
279-
'To provide both, use "decoration: BoxDecoration(color: color)".',
279+
'The color argument is just a shorthand for "decoration: BoxDecoration(color: color)".',
280280
),
281281
constraints = (width != null || height != null)
282282
? constraints?.tighten(width: width, height: height) ??

0 commit comments

Comments
 (0)