skip to Main Content

How do i add spacing between the text and the edge of the screen and make both the name and email aligned

my current code

This is my current code and it shows the information left justified with the line
‘crossAxisAlignment: CrossAxisAlignment.start,’ but i want to align the words name and email in the middle of the page how do I do that?enter image description here

3

Answers


  1. Use row please like this

    Row(
    mainAxisAlignment: MainAxisAlignment.start,///Play with this or any other
    children:[
       Text('Your text'),
       const SizedBox(width:40.0),//You can change this value to whatever you like
       Text('Your text'),
      ]
    ),
    

    Please prefer pasting a real code instead of a screenshot it makes answering easier

    Login or Signup to reply.
  2. You can user Sizebox or use Align widget

    Login or Signup to reply.
  3. You can use Row widget to display widgets in horizontal view.

    Example:

    Row(
    children:[
       Text('Hello:'),
       const SizedBox(width:20),
       Expanded(child: Text('World')),
      ]
    ),
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search