Home > OS >  Flutter color half container in a triangle shape
Flutter color half container in a triangle shape

Time:07-21

enter image description here

I want to half color the container green like this

What is the best way to go about this?

CodePudding user response:

There are many ways of doing,You can use LinearGradient .

Container(
  height: 200,
  width: 200,
  decoration: BoxDecoration(
    gradient: LinearGradient(
      stops: [.5, .5],
      begin: Alignment.bottomLeft,
      end: Alignment.topRight,
      colors: [
        Colors.green,
        Colors.transparent, // top Right part
      ],
    ),
  ),
),

enter image description here

Decorate the way you want. More about Container

  • Related