i have a row in flutter which contains 2 text widget, i want to add one text widget to the beginning of the row and another to the end:
this is my code :
Row(
children: <Widget>[
Text(
"eshiett1995",
textAlign: TextAlign.left,
style: TextStyle(fontWeight: FontWeight.bold),
),
Padding(padding: EdgeInsets.only(right: 10.0),),
Text(
"4:33am",
textDirection: TextDirection.ltr,
textAlign: TextAlign.left,
style: TextStyle(fontWeight: FontWeight.bold),
)
],
),
and presently this is how my code looks visually :
i want the eshiett1995 to stay at the beginning, while the time which is 4:33am, to move to the end
You just have to add the Row property mainAxisAlignment: MainAxisAlignment.
you can add Spacer(), above the widget you want to put at the end. Save this answer.
Did you try the Spacer class? https://docs.flutter.io/flutter/widgets/Spacer-class.html
Add Spacer widget between the two text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With