The container is a rectangular box with only a single child.
Properties
- width
- height
- color
- padding
- margin
- alignment
- child
- decoration
Example (code + Output)
import 'package:flutter/material.dart';
void main(List<String> args) {
runApp(MaterialApp(
home: Scaffold(
backgroundColor: Colors.amber,
appBar: AppBar(
backgroundColor: Colors.black,
title: const Text("First App"),
centerTitle: true,
),
body: Center(
child: Container(
// margin: EdgeInsets.all(20),
// padding: EdgeInsets.all(30),
color: Colors.red,
height: 200,
width: 250,
child: const Center(
child: Text(
"welcome",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
),
),
),
),
));
}
No comments:
Post a Comment