flutter开发之helloWord

###2.flutter的helloWorld

import 'package:flutter/material.dart';

void main() {	//主程序入口
  runApp(new MyApp());	//固定格式	
    //new MyApp()定义的组件 必须是Widget,
    //所以必须继承一个如:StatelessWidget	
    //StatelessWidget无状态变更的
}
class MyApp extends StatelessWidget {
  //必须重写该方法
  @override
  Widget build(BuildContext context) {	
    // TODO: implement build
    return new MaterialApp(	//flutter定义好的主题页面
      home: new Scaffold(	//页面类容初始化
        appBar: new AppBar(		//头部导航栏
          title: new Text('hello world'),	//导航栏标题
        ),
        body: new Center(	//定义到页面中心的类
          child: new Text('hello world'),	//Text文本输入类
        ),
      ),
    );
  }
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43231352/article/details/86244176