Flutter入门学习--(6)容器组件Container

  在flutter中,我们想在一个页面中放置多个组件,就要使用Container容器组件,Container可以放置内置组件,并设置样式

padding:内边距

margin:外边距

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter',
        home: Scaffold(
          appBar: AppBar(
            title: Text("Hello World"),
          ),
          body: Center(
              child: Container(
            child: Text(
              "Hello Flutterr", 
            ),
            color: Colors.yellow,
            padding:const EdgeInsets.all(19),
            margin: EdgeInsets.fromLTRB(20, 40, 60, 180),
           
          )),
        ));
  }
}

 

    原文作者:游响云停
    原文地址: https://blog.csdn.net/zx13525079024/article/details/86546018
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞