Wednesday, July 5, 2023

Column-MainAxisAlignment

 MainAxis VS CrossAxis




MainAxisAlignment Properties

  1. MainAxisAlignment.start: All widgets start from the top 
  1. MainAxisAlignment.end: All widgets start from the end
  1. MainAxisAlignment. centre:All widgets start from the centre
  1. MainAxisAlignment.spaceBetween: First & Last widget no space & space between inner widget
  1. MainAxisAlignment.spaceAround: first and last widget with half of the space of inner widgets
  1. MainAxisAlignment.spaceEvenly: All widgets wrapped with equal space

Coding Example

import 'package:flutter/material.dart';

void main(List<String> args) {
  runApp(MaterialApp(
    home: Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: [
            Container(
              color: Colors.red,
              width: 100,
              height: 100,
              child: const Center(child: Text("First Child")),
            ),
            Container(
              color: Colors.green,
              width: 100,
              height: 100,
              child: const Center(child: Text("Second Child")),
            ),
            Container(
              color: Colors.blue,
              width: 100,
              height: 100,
              child: const Center(child: Text("Third Child")),
            ),
          ],
        ),
      ),
    ),
  ));
}





No comments:

Post a Comment

Linked List Implementation using C++ Structure

3 Nodes Linked List Implementaion Single Linked list #include<iostream> using namespace std;   struct Node{ int data; Node* next; Node...