How To Use Column Widget Using Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 27-11-2020

The Column widget does not scroll (and in general it is considered an error to have more children in a Column than will fit in the available room). If you have a line of widgets and want them to be able to scroll if there is insufficient room, consider using a ListView.

How To Use Column Widget Using Flutter Android App

Column Widget 
Complete Code For Column Widget  In Flutter
main.dart

import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}
class MyHomePage extends StatefulWidget {
  final String title;
  MyHomePage({this.title});
  @override
  _MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
      appBar: AppBar(
          title: Text("Column Widget")),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Container(
              height: 50.0,
              width: 50.0,
              color: Colors.green,
            ),
            Container(
              height: 50.0,
              width: 50.0,
              color: Colors.pink,
            ),
            Container(
              height: 50.0,
              width: 50.0,
              color: Colors.yellow,
            )
          ],
        ),
      ),
    );
  }
}

Related Post