-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Similar to #36161, but that issue was closed with the incorrect error message in place.
Steps to Reproduce
- Create a
Containerwith any validcolorproperty. - Add the
decorationproperty to the container. - Give
decorationaBoxDecorationwith a validcolorproperty. - An exception is caught and an error message is printed.
Expected results:
An error message that clearly defines the issue and optionally provides a way to fix the error.
Actual results:
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Themes(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#50d61]]):
Cannot provide both a color and a decoration
To provide both, use "decoration: BoxDecoration(color: color)".
The error message clearly defines the issue, however the suggested fix reads: To provide both, use "decoration: BoxDecoration(color: color)".
This is an incorrect suggestion because Container has checks to verify it was NOT provided both. The error message should clearly communicate the proper condition--which is passing Container.color OR Container.decoration, not both like the error message is suggesting.
Example:
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
home: new HomePage(),
));
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => new _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: 50.0,
height: 50.0,
color: Colors.blue,
decoration: BoxDecoration(
color: Colors.blue,
),
);
}
}
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team