Search code examples
flutterbackground-image

how to position background image in futter


enter image description here

I want to achieve desired UI as shown in above Screen shot, in it there is a gradient background color which is no problem but there are background pics like cresent, I have cresent pic in png but i can't figure how to display it at bottom left, this has to be a background image as there will be text that might be over it.


Solution

  • Here is your Card with Gradiant and your Background Image Alignment in bottomLeft don't forget to change asset

                 Container(
                    height: 200,
                    decoration: BoxDecoration(
                      borderRadius: 
                      BorderRadius.circular(10),
                      image: const DecorationImage(
                          alignment: 
                          Alignment.bottomLeft,
                          image: 
                         AssetImage(AppAssets.logo)),
                      gradient: RadialGradient(
                        center: 
                        Alignment.bottomRight,
                        radius: 1.5,
                        colors: [
                          Colors.pink.withAlpha(100),
                          Colors.pink.withAlpha(200),
                        ],
                      ),
                    ),
                  ),