skip to Main Content

This is how the columns are aligned.

enter image description here

The weight textfield needs to move up to align with the green column. It should maintain the same width.

Flutter code:

    Row(
        children: [
          Expanded(
              flex: 1,
              child: Container(
                color: Colors.indigo,
                height: 50,
                child: const TextField(
                  decoration: InputDecoration(
                    labelText: 'Weight',
                    border: OutlineInputBorder(),
                  ),
                ),
              )),
          Expanded(
              flex: 3, child: Container(color: Colors.teal, height: 100)),
          Expanded(
            child: Container(
              height: 100,
              child: Column(
                children: [
                  Row(children: [
                    Text("test1", style: TextStyle(fontSize: 25)),
                    Text("test1")
                  ]),
                  Row(children: [Text("test2"), Text("test2")])
                ],
              ),
            ),
          ),
        ],
      ),

2

Answers


  1. In the top-level Row Widget, add crossAxisAlignment.start

    Login or Signup to reply.
  2. You need to use this parameter (Row):

    crossAxisAlignment: CrossAxisAlignment.start,
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search