[Solved] Cannot provide both a color and a decoration in Flutter

If you are seeing like this error color == null || decoration == null “Cannot provide both a color and a decoration\n To provide both, use \”decoration: BoxDecoration(color: color)\”.”

Here is way to solve it.

Oh, you got a mistake here, I surely said that you passed a color property inside the container and another color property on the decoration box of that container, and you are able to done framework confused enough. Sorry about that!

Fix Cannot provide both a color and a decoration

Remove one color property from the inside container, gentlemen (its your choice ). If you only pass color to Boxdecoration, you are using the decoration property if it is not passed inside the container.

Error containing code

Error Cannot provide both a color and a decoration in Flutter
Container(

  color: Colors.grey,

 decoration: const BoxDecoration(color: Colors.grey),

 child: Text(

   '$_counter',

   style: Theme.of(context).textTheme.headline4,

 ),

),

Solution

Cannot provide both a color and a decoration in Flutter Solved
Container(

 decoration: const BoxDecoration(color: Colors.grey),

 child: Text(

   '$_counter',

   style: Theme.of(context).textTheme.headline4,

 ),

), 
Share:
Ambika Dulal

Ambika Dulal is a Flutter Developer from Nepal who is passionate about building beautiful and user-friendly apps. She is always looking for new challenges and is eager to learn new things. She is also a strong believer in giving back to the community and is always willing to help others.

Leave a Comment

AO Logo

App Override is a leading mobile app development company based in Kathmandu, Nepal. Specializing in both Android and iOS app development, the company has established a strong reputation for delivering high-quality and innovative mobile solutions to clients across a range of industries.

Services

UI/UX Design

Custom App Development

Mobile Strategy Consulting

App Testing and Quality Assurance

App Maintenance and Support

App Marketing and Promotion

Contact

App Override

New Plaza, Kathmandu