简体   繁体   中英

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

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),
          ),
        ),
      ],
    ),

);
  }

}

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...

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)),
          ],
        ),
      ),
    );
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM