GN Vageesh
GN Vageesh

Reputation: 370

Flutter - Linear Gradient not taking colors as a array of colors

I was actually preparing a login screen and decided to use a linear gradient as a background. I actually upgraded my Flutter SDK from 1.20 to 1.22 in the stable channel. Please click on the below links to check the problem

The code

The error shown

Show what should I do.

Thank you.

Upvotes: 0

Views: 2043

Answers (2)

Karedem
Karedem

Reputation: 21

use flutter clean and flutter pub cache repair in command line , then restart the ide

Upvotes: 1

Atiq Ur Rehman
Atiq Ur Rehman

Reputation: 1235

you can try this one probably there could be some version mismatch.


Container(
        decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.topRight,
              end: Alignment.bottomLeft,
              colors: [Colors.blue, Colors.red])),
        child: Center(
          child: Text(
            'Hello Gradient!',
            style: TextStyle(
              fontSize: 48.0,
              fontWeight: FontWeight.bold,
              color: Colors.white),
          ),
        ),
      )

Upvotes: 0

Related Questions