Emre
Emre

Reputation: 45

Adding two column of text on Flutter

i want add two line of different type text in my homepage. But when i add another Text widget nothing happen. Here is my code;

class Body extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Center(
          child: Text(
            "Hello",
            style: TextStyle(fontSize: 28, color: Colors.white),
          ),
        ),
      ],
    );
  }
}

i want to get this output in picture exactly. Thanks a lot!

see input

Upvotes: 1

Views: 618

Answers (3)

Ashraful Haque
Ashraful Haque

Reputation: 1698

I hope this answers your question

class Body extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.blue,
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
           // first text
            Text('Hello', style: TextStyle(fontSize: 15, color: Colors.white)),
           // second text
            Text('Izabella',
                style: TextStyle(fontSize: 25, color: Colors.white)),
          ],
        ),
      ),
    );
  }
}

Upvotes: 0

chetan suri
chetan suri

Reputation: 399

You need to use container to give blue background and then use Column and Text widget. You are using Text color as white with background color also white, how will that show...

class Body extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.blue,
      child: Column(
      children: <Widget>[
        Center(
          child: Text(
            "Hello",
            style: TextStyle(fontSize: 28, color: Colors.white),
          ),
        ),
       Center(
          child: Text(
            "Izabella",
            style: TextStyle(fontSize: 38, color: Colors.white),
          ),
        ),
      ],
    ),

);
  }

}

Upvotes: 1

Sajjad
Sajjad

Reputation: 3218

this is like your Image ...

class Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
  children: <Widget>[
    Center(
      child: Text(
        "Hello",
        style: TextStyle(fontSize: 14, color: Colors.white),
      ),
    ),
    
    Center(
      child: Text(
        "Izabella",
        style: TextStyle(fontSize: 38, color: Colors.white),
      ),
    ),
  ],
);
}
}

I hope this help you...

Upvotes: 0

Related Questions