Reputation: 21
I'm getting a parameter format error when I use const for gradient's colors.
Expanded(
child: OpenContainer(
closedElevation: 0,
transitionType: ContainerTransitionType.fade,
transitionDuration: const Duration(milliseconds: 1000),
closedColor: const Color(0xFFE9E9E9),
openBuilder: (context, _) {
return WorkoutScreen();
},
closedBuilder: (context, VoidCallback openContainer) {
return GestureDetector(
onTap: openContainer,
child: Container(
margin: const EdgeInsets.only(bottom: 10, left: 32, right: 32),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30)),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
**colors: [
const Color(0xFF20008B),
const Color(0xFF200087),
],**
),
),
Here's an error message: The named parameter 'colors' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'colors'.
Upvotes: 0
Views: 1857
Reputation: 66
You can try fixing this by doing a flutter clean
in the terminal window and then waiting for VSCode to re-analyze your file.
Upvotes: 1