Home > Mobile >  how to align image top right to the screen in flutter
how to align image top right to the screen in flutter

Time:03-22

I tried align top right the image, but that dosen't work, also I tried to do the positioned widget that also didn't work

Column(
          children: [
            Image.asset(
              'assets/design_el_1.png',
              alignment: Alignment.topRight
            ),
           
               other elements
               other elements
               other elements
            ]
          );

how can I align the image to top right of the screen?

enter image description here

i want to align the lite purple element

CodePudding user response:

Column(
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    Image.asset(
                        'assets/images/onboard.jpeg',
                        width: 200,
                        height: 100,
                    ),
                  ],
                ),
               ],
            )

Output:

enter image description here

CodePudding user response:

you have to use Align Widget like the code given below

Align(
    alignment: Alignment.topRight,
      child: Image.asset("Assets/user.png"))

CodePudding user response:

Wrap your Image.asset with Align widget and use it's alignment: Alignment.centerRight property. Your image will surely align right side.

 Align(
        alignment: Alignment.centerRight,
          child: Image.asset("Assets/user.png"))

P.S :- You may use your asset image instead of my image :)

Output

  • Related