2

Could you please help me to align one element in column to extreme right.

enter image description here

Please help me

fazilSizzlers
  • 195
  • 10

2 Answers2

4

Wrap that icon with Align and set alignment to centerRight , like this:

 IntrinsicHeight(
        child: Row(
          children: [
            Expanded(
              child: Column(
                children: [
                  Align(
                    alignment: Alignment.centerRight,
                    child: Icon(
                      Icons.info,
                      size: 20,
                    ),
                  ),
                  Icon(Icons.lock_clock),
                  Text('item 1'),
                ],
              ),
            ),
            VerticalDivider(
              color: Colors.black,
            ),
            Expanded(
              child: Column(
                children: [
                  Align(
                    alignment: Alignment.centerRight,
                    child: Icon(
                      Icons.info,
                      size: 20,
                    ),
                  ),
                  Icon(Icons.lock_clock),
                  Text('item 1'),
                ],
              ),
            ),
            VerticalDivider(
              color: Colors.black,
            ),
            Expanded(
              child: Column(
                children: [
                  Align(
                    alignment: Alignment.centerRight,
                    child: Icon(
                      Icons.info,
                      size: 20,
                    ),
                  ),
                  Icon(Icons.lock_clock),
                  Text('item 1'),
                ],
              ),
            ),
          ],
        ),
      )

enter image description here

Or If you want that icon attach to top right of column in overlay, you can wrap the column wit stack widget and set that icon in it, like this:

IntrinsicHeight(
            child: Row(
              children: [
                Expanded(
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      Padding(
                        padding: const EdgeInsets.all(12.0),
                        child: Column(
                          children: [
                            Icon(Icons.lock_clock),
                            Text('item 1'),
                          ],
                        ),
                      ),
                      Positioned(
                        child: Icon(
                          Icons.info,
                          size: 20,
                        ),
                        top: 0,
                        right: 0,
                      )
                    ],
                  ),
                ),
                VerticalDivider(
                  color: Colors.black,
                ),
                Expanded(
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      Padding(
                        padding: const EdgeInsets.all(12.0),
                        child: Column(
                          children: [
                            Icon(Icons.lock_clock),
                            Text('item 1'),
                          ],
                        ),
                      ),
                      Positioned(
                        child: Icon(
                          Icons.info,
                          size: 20,
                        ),
                        top: 0,
                        right: 0,
                      )
                    ],
                  ),
                ),
                VerticalDivider(
                  color: Colors.black,
                ),
                Expanded(
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      Padding(
                        padding: const EdgeInsets.all(12.0),
                        child: Column(
                          children: [
                            Icon(Icons.lock_clock),
                            Text('item 1'),
                          ],
                        ),
                      ),
                      Positioned(
                        child: Icon(
                          Icons.info,
                          size: 20,
                        ),
                        top: 0,
                        right: 0,
                      )
                    ],
                  ),
                )
              ],
            ),
          )

enter image description here

This make icon closer to column.

eamirho3ein
  • 16,619
  • 2
  • 12
  • 23
  • Many thanks for you response. Unfortunately I don’t have my laptop with me now. That’s why I couldn’t post my code. In the column i want to add another icon on top and align to extreme right. That’s where i am struggling with. Thanks – fazilSizzlers Sep 06 '22 at 10:43
  • o I see now, I updated my answer, check it out – eamirho3ein Sep 06 '22 at 10:49
1

Use

Expanded(child: SizedBox());

Before the wudget that you want to move in the most right

Gwhyyy
  • 7,554
  • 3
  • 8
  • 35