0

I need to move part form Image outside the container in flutter I tried many times and failed this is the final photo and also the number between the icons I need to center it and I tried align , text align and failed to one more thing the elevation of the container how can I do it I will convert this design into Grid View but I need to learn it so this the last step that I will do

enter image description here

const SizedBox(
                height: 32,
              ),
              Container(
                width: 176,
                height: 220,
                decoration: BoxDecoration(
                  color: HexColor('#FFFFFF'),
                  borderRadius: BorderRadius.circular(10),
                ),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    const Padding(
                      padding: EdgeInsets.only(
                        left: 30,
                      ),
                    ),
                    //image and Icons
                    Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Image(
                          image: photo1,
                          alignment: Alignment.topLeft,
                        ),
                        Expanded(
                          child: IconButton(
                            onPressed: () {
                              number--;
                              print(number);
                            },
                            icon: const Icon(
                              Icons.remove,
                            ),
                            alignment: Alignment.topRight,
                          ),
                        ),
                        const SizedBox(
                          width: 7,
                        ),
                        Text(
                          '$number',
                          style: const TextStyle(
                            fontSize: 16,
                            fontWeight: FontWeight.w600,
                            fontFamily: 'robotto',
                          ),
                          //textAlign: TextAlign.center,
                        ),
                        const SizedBox(
                          width: 7,
                        ),
                        Expanded(
                          child: IconButton(
                            onPressed: () {
                              number++;
                              print(number);
                            },
                            icon: const Icon(
                              Icons.add,
                            ),
                            alignment: Alignment.topRight,
                          ),
                        ),
                      ],
                    ),
                    const SizedBox(
                      height: 20,
                    ),
                    const Text(
                      'GARDENIA PLANT',
                      style: TextStyle(
                        fontSize: 16,
                        fontFamily: 'robotto',
                        fontWeight: FontWeight.w500,
                        color: Colors.black,
                      ),
                    ),
                  ],
                ),
2
  • What is the parent widget of this ? Aug 19, 2022 at 23:09
  • of all the screen Column but for the design which is image text ..etc is Container with width 176 and height 220 Aug 19, 2022 at 23:11

1 Answer 1

2

You can wrap your Image with Transform to render the ui a little left or the position you want .

Transform.translate(
  offset: Offset(-22,0),
  child: Image(
    image: photo1,
    alignment: Alignment.topLeft,
  ),
),

And use mainAxisAlignment: MainAxisAlignment.center, on Row.

To align text use textAlign: TextAlign.center,

Also if need more placement UI, you can use Stack widget.

2
  • It did not work the photo moves to the left not up and i need it to move up for 58 Aug 19, 2022 at 23:22
  • using transform only render the item, you might go for stack widget Aug 20, 2022 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.