skip to Main Content

I have three text- named as News-Title, News-date, and News-description. I want News title alignment as left, below to news-title want news-date right aligned and below to news-date wants news-description with center alignment.

please suggest proper solution…..

4

Answers


  1. Use Align. You can choose alignment property value based on requirements.

    Align(
       alignment: Alignment.topLeft,
       child: Text(
              "News Title",
              style: TextStyle(
              color: Colors.black),
       )
    ),
    
    Login or Signup to reply.
  2. Have you try to use TextAlignment.center / left/ right? or you could wrap it in the Align class from here https://api.flutter.dev/flutter/widgets/Align-class.html

    Login or Signup to reply.
  3. Either –

    Align(
       alignment: Alignment.topLeft,
       child: Text(
              "News Title",
              style: TextStyle(
              color: Colors.black),
       )
    ),
    

    Or that –

    Text(
                  "News Title",
                  textAlign: TextAlign.center //example
                  style: TextStyle(
                  color: Colors.black),)
    
    Login or Signup to reply.
  4. Try below code hope its help to you. just set Alignment in your column refer layout and Align-class

    Column(
            crossAxisAlignment: CrossAxisAlignment.start,//add this line if you used column widget in your code
            children: [
              Text('News-Title'),
              Text('News-date'),
              Text('News-description'),
            ],
          ),
    

    Result-> image

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search