Articles → FLUTTER AND DART → Container widgets in flutter

Container widgets in flutter






Purpose





When container does not have any child element





Click to Enlarge

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
    home: Scaffold(
    appBar: AppBar(), body: Container(
    color: Colors.green, child: Text("Test"), )));
  }
}



When container have child element


import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
    home: Scaffold(
    appBar: AppBar(), body: Container(
    color: Colors.green, child: Text("Test"), )));
  }
}



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, August 23, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250