mhannani
mhannani

Reputation: 502

Flutter - mainAxisAlignment doesn't work for a Row within a Column

I'm familiar with Row and Column widget .but i'm getting stuck trying to 'float' the content of the Row on the very right size of the parent Row within a Column but doesn't work

Row(
  //      mainAxisSize: MainAxisSize.min,
  mainAxisAlignment:
      isMine ? MainAxisAlignment.end : MainAxisAlignment.start,
  children: <Widget>[
    Container(
      margin: isMine
          ? EdgeInsets.only(right: 10.0, bottom: 20.0)
          : EdgeInsets.only(
              left: 10.0,
              bottom: 20.0,
            ),
      constraints: BoxConstraints(maxWidth: deviceSize.width * 0.85),
      decoration: BoxDecoration(
          color: isMine ? Colors.green[200] : Colors.grey[300],
          borderRadius: BorderRadius.circular(10.0)),
      padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text(message),
          Row(
            // Horizontally
            mainAxisAlignment: MainAxisAlignment.end,
            // Vertically
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Text(sentAtToSting(sentAt)),
              SizedBox(width: 10.0),
              Icon(Icons.done_all)
            ],
          ),
        ],
      ),
    ),
  ],
);

enter image description here

So can someone help me moving the Row that contains the time and the icon to the right side of the highlighted area ?

I will really appreciate your help guys ! Thanks !

Upvotes: 0

Views: 1455

Answers (1)

s.am.i
s.am.i

Reputation: 758

Its because your using

mainAxisSize: MainAxisSize.min

Try removing main axisSize and see

Upvotes: 1

Related Questions