Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - Smooth transition color for LinearGradient

Tags:

flutter

Hellow!

Is there a solution for creating a LinearGradient that has a smooth transition between start and ens color?

new Container(
        decoration: new BoxDecoration(
          gradient: new LinearGradient(
              colors: [
                Colors.black,
                Colors.grey,
              ],
            stops: [0.0, 1.0],
            begin: FractionalOffset.topCenter,
            end: FractionalOffset.bottomCenter,
            tileMode: TileMode.repeated
          )
        ),
)

Image showing gradient with poor color resolution

like image 600
Stoinescu Cosmin Avatar asked Mar 28 '18 20:03

Stoinescu Cosmin


People also ask

How do you add gradient color in AppBar Flutter?

you can use flexibleSpace property from AppBar to achieve gradient background.


1 Answers

In your main function set Paint.enableDithering = true; just like below:

void main() {
  Paint.enableDithering = true;
  runApp(DesignChallenge05());
}
like image 91
Sosu Alfred Avatar answered Sep 25 '22 22:09

Sosu Alfred