Max
Max

Reputation: 674

Padding inside Expanded also effect outside it (Flutter)

I have top & bottom text.

I want to add padding for top text, but Padding applied for bottom text too.

Why does it happen?

enter image description here

return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            Expanded(
              child: Padding(
                padding: const EdgeInsets.symmetric(
                  vertical: 30.0,
                  horizontal: 80.0,
                ),
                child: Column(
                  children: [
                    Text('Top text'),
                  ],
                ),
              ),
            ),
            Text('Footer text'),
          ],
        ),
      ),
    );

Upvotes: 0

Views: 522

Answers (1)

Kaushik Chandru
Kaushik Chandru

Reputation: 17732

add crossAxisAlignment : CrossAxisAlignment.start for the column widget. By default it aligns to the center.

Upvotes: 1

Related Questions