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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zx13525079024/article/details/86546018

  在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),
           
          )),
        ));
  }
}

猜你喜欢

转载自blog.csdn.net/zx13525079024/article/details/86546018