0

I'm trying to set gradient color to container's border line, here is the example i need.

enter image description here

here is my code.

Container(
                height: 50,
                width: 140,
                decoration: BoxDecoration(
                  border: Border.all(
                    color: Colors.black
                  ),
                  borderRadius: BorderRadius.circular(30),
                  color: Colors.white
                ),
                child: const Center(
                  child: Text(
                    'Sign in',
                    style: TextStyle(
                      fontSize: 20,
                      fontWeight: FontWeight.bold,
                      color: Colors.black,
                    ),
                  ),
                ),
              )

i couldn't find any solution to this, i tried chat gpt and all, still i couldn't find any solution,

mishalhaneef
  • 672
  • 8
  • 29

1 Answers1

1

This way you can achieve a gradient border.

Container(
                height: 50,
                width: 140,
                padding: const EdgeInsets.all(2),
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                  gradient: const LinearGradient(
                    colors: [Colors.red, Colors.blue],
                  )
                ),
                child: Container(
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(30),
                    color: Colors.white,
                  ),
                  child: const Text(
                    'Sign in',
                    style: TextStyle(
                      fontSize: 20,
                      fontWeight: FontWeight.bold,
                      color: Colors.black,
                    ),
                  ),
                ),
              ),
Rajni Gujarati
  • 2,709
  • 1
  • 10
  • 16