3

i've created container(2) inside container(1). Can you please help how to add text to the container(1)? Here is my code down below

    return Scaffold(
  body: 
  Padding(
    padding: const EdgeInsets.only(top: 100, left: 30, right: 30, bottom: 25,),
    child: Container(
      height: 300,
      color: Colors.red,
      alignment: Alignment.bottomLeft,
      child: Container(
        width: 360,
        height: 230,
        color: Colors.blue,
        child: Align(
          alignment: Alignment.center,
          child: Text(
            'Car or sport car'
            maxLines: 3,
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 20,
            ),
          ),
        ),
      ),
    ),
  ),
1
  • 1
    you can use any multi-child layout widget according to your requirement and set Text into your container(1). Commented Apr 12, 2021 at 8:35

2 Answers 2

6

You just need to put a Column, Row or Stack inside the first Container. Here is an example for your understanding.

return Scaffold(
body: 
Padding(
  padding: const EdgeInsets.only(top: 100, left: 30, right: 30, bottom: 25,),
  child: Container(
    height: 300,
    color: Colors.red,
    alignment: Alignment.bottomLeft,
    child: Column(
      children: [
        Text("Put your Text Here!!!!"),
        Container(
        width: 360,
        height: 230,
        color: Colors.blue,
        child: Align(
          alignment: Alignment.center,
          child: Text(
            'Car or sport car'
            maxLines: 3,
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 20,
            ),
          ),
        ),
      ),]
    ),
  ),
),
Sign up to request clarification or add additional context in comments.

Comments

2
    return Scaffold(
  body: 
  Padding(
    padding: const EdgeInsets.only(top: 100, left: 30, right: 30, bottom: 25,),
    child: Container(
      height: 300,
      color: Colors.red,
      alignment: Alignment.bottomLeft,
      child: Column(children:[
        Text('test'),
        Container(
        width: 360,
        height: 230,
        color: Colors.blue,
        child: Align(
          alignment: Alignment.center,
          child: Text(
            'Car or sport car'
            maxLines: 3,
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 20,
            ),
          ),
        ),
      ),
        ],
      ),
    ),
  ),

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.