我的第一个flutter程序

环境搭建好了之后,终于可以开始flutter的学习,废话少说先开始‘Hello World’。

 创建好flutter项目之后,打开设备模拟器

打开之后

准备ok,开始编码

------------------------------------------这是分割线--------------------------------------------

mian.dart

// Material Design设计风格的基础包
import 'package:flutter/material.dart';

// 入口程序
void main() => runApp(MyApp());

// main fun
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp (
      title: 'title',
      theme: new ThemeData(  //创建主题
        brightness: Brightness.light,  //整体亮度
        primaryColor: Colors.lightGreen[600],  //主要部分的背景色
        accentColor: Colors.orange, // 前景色
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text(
            'おはようございます',
            style: new TextStyle( // 样式
                color: Colors.purpleAccent, //color
                fontSize: 14  // size
            ),
          ),
        ),
        body: Center(
          child: Text(
            '今日はいい天気だよね',
            style: new TextStyle(
                color: Colors.orange,
                fontSize: 12
            ),
          ),
        ),
      ),
    );
  }
}

点击运行,运行成功之后

猜你喜欢

转载自www.cnblogs.com/shuangzikun/p/taotao_flutter_01.html