Home > Software engineering >  Multiple Texts inside a container - how to add 'BTC' Text under the STORE OF VALUE section
Multiple Texts inside a container - how to add 'BTC' Text under the STORE OF VALUE section

Time:07-20

// ignore_for_file: sort_child_properties_last, prefer_const_constructors, prefer_const_literals_to_create_immutables

import 'package:flutter/material.dart';

class StockPage extends StatelessWidget {
  const StockPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        centerTitle: true,
        backgroundColor: Colors.green,
        elevation: 0,
        title: Text(
          'PiyaSync',
          style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
        ),
      ),
      body: GridView(
        gridDelegate:
            SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
        children: [
          Container(
            color: Colors.green,
            margin: EdgeInsets.all(10),
            child: Text(
              'STORE OF VALUE',
              style: TextStyle(fontSize: 19, fontWeight: FontWeight.w500),
            ),
          ),
          Container(
              color: Colors.green,
              margin: EdgeInsets.all(10),
              child: Text(
                'SMART CONTRACTS',
                style: TextStyle(fontSize: 19, fontWeight: FontWeight.w500),
              )),
          Container(
            color: Colors.green,
            margin: EdgeInsets.all(10),
            child: Text(
              'DEFI',
              style: TextStyle(fontSize: 19, fontWeight: FontWeight.w500),
            ),
          ),
          Container(
              color: Colors.green,
              margin: EdgeInsets.all(10),
              child: Text(
                'MEMES',
                style: TextStyle(fontSize: 19, fontWeight: FontWeight.w500),
              )),
          Container(
              color: Colors.green,
              margin: EdgeInsets.all(10),
              child: Text(
                'CENTRALIZED EXCHANGE TOKENS',
                style: TextStyle(fontSize: 19, fontWeight: FontWeight.w500),
              )),
          Container(
              color: Colors.green,
              margin: EdgeInsets.all(10),
              child: Text(
                'NFTS',
                style: TextStyle(fontSize: 19, fontWeight: FontWeight.w500),
              )),
        ],
      ),
    );
  }
}

/*ListView(
        children: <Widget>[
          Container(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.start,
              children: <Widget>[
                Text(
                  'STORE OF VALUE',
                  style: TextStyle(
                      color: Colors.black,
                      fontSize: 17,
                      fontWeight: FontWeight.w900),
                ),
                Text(
                  'SOFTWARE - INFRASTRUCTURE',
                  style: TextStyle(
                      color: Colors.black,
                      fontSize: 13,
                      fontWeight: FontWeight.w900),
                )
              ],
            ),
          )
        ],
      )*/


/*Column(
        children: <Widget>[
          Expanded(
            child: ListView(
              children: [
                Text(
                  'STORE OF VALUE',
                  style: TextStyle(fontSize: 21, fontWeight: FontWeight.bold),
                ),
                Expanded(
                  child: Container(
                    child: Text(
                      'BTC',
                      style:
                          TextStyle(fontSize: 25, fontWeight: FontWeight.w500),
                    ),
                    color: Colors.green,
                    padding: EdgeInsets.only(left: 1),
                    margin: EdgeInsets.all(1),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),*/

        /* Container(
              width: 210, //360
              height: 100, //230
              color: Colors.green,
              child: Align(
                alignment: Alignment.center,
                child: Text(
                  'ETH',
                  style: TextStyle(
                    height: -1,
                    fontWeight: FontWeight.w500,
                    fontSize: 25,
                  ),
                ),
              ),
            ),*/

            /*Padding(
        padding: const EdgeInsets.only(right: 260),
        child: Container(
          height: 265,
          color: Colors.white,
          alignment: Alignment.topLeft,
          child: Column(children: [
            Text(
              "STORE OF VALUE",
              style: TextStyle(
                fontSize: 19,
                fontWeight: FontWeight.bold,
              ),
            ),
            Container(
              width: 210, //360
              height: 130, //230
              color: Colors.green,
              child: Align(
                alignment: Alignment.center,
                child: Text(
                  'BTC',
                  style: TextStyle(
                    height: -1,
                    fontWeight: FontWeight.w500,
                    fontSize: 25,
                  ),
                ),
              ),
            ),
            Stack(
              children: [
                Positioned(
                  left: 20,
                  top: 20,
                  child: Container(
                    height: 200,
                    width: 200,
                    color: Colors.black,
                    child: Text('ETH'),
                  ),
                ),
              ],
            )
          ]),
        ),
      ),*/

CodePudding user response:

You can use \n for new line and btc will be diaplayed below the other text

Container(
            color: Colors.green,
            margin: EdgeInsets.all(10),
            child: Text(
              'STORE OF VALUE\nBTC',
              style: TextStyle(fontSize: 19, fontWeight: FontWeight.w500),
            ),
          ),
  • Related