我的第一个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[], //主要部分的背景色
accentColor: Colors.orange, // 前景色
),
home: Scaffold(
appBar: AppBar(
title: Text(
'おはようございます',
style: new TextStyle( // 样式
color: Colors.purpleAccent, //color
fontSize: // size
),
),
),
body: Center(
child: Text(
'今日はいい天気だよね',
style: new TextStyle(
color: Colors.orange,
fontSize:
),
),
),
),
);
}
}
点击运行,运行成功之后
------------------------------------------这是分割线--------------------------------------------
// Material Design设计风格的基础包
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
// 入口程序
void main() => runApp(MyApp()); // main fun
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
final appName = 'TOKYO-HOT';
return new MaterialApp(
title: appName,
theme: new ThemeData(
brightness: Brightness.light,
primaryColor: Colors.purpleAccent,
accentColor: Colors.red,
),
home: new MyHomePage(
title: appName
)
);
}
} class MyHomePage extends StatelessWidget { final String title;
MyHomePage({Key key, @required this.title}) : super(key: key); @override
Widget build(BuildContext context) {
// TODO: implement build return new Scaffold(
appBar: new AppBar(
title: new Text(title),
),
body: new Center(
child: new Container(
// 获取主题的accentColor
color: Theme.of(context).accentColor,
child: new Text(
"I'm red",
// style: Theme.of(context).textTheme.title,
style: new TextStyle(
color: Colors.white
)
),
)
),
floatingActionButton: new Theme(
data: Theme.of(context).copyWith(accentColor: Colors.grey),
child: new FloatingActionButton(
onPressed: printa,
child: new Icon(Icons.computer),
) ), );
}
} void printa() {
print();
print('xxxxx');
}
我的第一个flutter程序的更多相关文章
- 开发第一个flutter程序 hello world
上一篇咱们配置了flutter的基本环境之后,那么本篇就来讲一下如何开发第一个小应用hello world 双击打开 android studio 选择plugins 找到 fultter 并且下载安 ...
- 创建你的第一个Flutter应用程序
前言 Flutter,Google推出的跨平台开发框架.就在前几天,Flutter的首个发布预览版(Release Preview 1)正式发布! 即将迎来Flutter 正式版(1.0).本篇将带你 ...
- flutter,跟着官网一步一步创建第一个flutter应用
创建第一个flutter 编辑器: vscode 一.创建flutter项目 1.启动vscode 2.按ctrl+shift+p打开命令面板 3.输入flutter 选择Flutter: New P ...
- Flutter入门教程(四)第一个flutter项目解析
一.创建一个Flutter工程 1.1 命令行创建 首先我们找一个空目录用来专门存放flutter项目,然后在路径中直接输入cmd: 使用 flutter create <projectname ...
- DirectX游戏编程(一):创建一个Direct3D程序
一.环境 Visual Studio 2012,DirectX SDK (June 2010) 二.准备 1.环境变量(如没有配置请添加) 变量名:DXSDK_DIR 变量值:D:\Software\ ...
- 第一个python程序
一个python程序的两种执行方式: 1.第一种方式是通过python解释器: cmd->python->进入python解释器->编写python代码->回车. 2.第二种方 ...
- 编写第一个MapReduce程序—— 统计气温
摘要:hadoop安装完成后,像学习其他语言一样,要开始写一个“hello world!” ,看了一些学习资料,模仿写了个程序.对于一个C#程序员来说,写个java程序,并调用hadoop的包,并跑在 ...
- 1.3 第一个C#程序
几乎没一门编程语言的第一个程序都叫“你好,世界”,所以先在visual studio 中创建一个Helloworld程序. 各部分的详细内容: Main方法是程序运行的起点,最重要的代码就写在Main ...
- 一个.net程序员的安卓之旅-Eclipse设置代码智能提示功能
一个.net程序员的安卓之旅-代码智能提示功能 过完年回来就决心开始学安卓开发,就网上买了个内存条加在笔记本上(因为笔记本原来2G内存太卡了,装了vs2010.SQL Server 2008.orac ...
随机推荐
- Number.toLocalString() js
地址链接:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocal ...
- 图的深度优先遍历(DFS)—递归算法
实验环境:win10, DEV C++5.11 实验要求: 实现图的深度优先遍历 实验代码: #include <iostream> #define maxSize 255 #includ ...
- es6去重
// set是一种新的数据结构,它可以接收一个数组或者是类数组对象,自动去重其中的重复项目. var arr=[9,9,"丸子","丸子",undefined, ...
- ideal的maven工程启动时老是报错,提示web.xml里面的监听器找不到,但是实际又是存在的
-X clean compile package -Dmaven.repo.local=D:\repository-pss -Dmaven.test.skip=true maven仓库地址
- Far manager界面混乱问题解决
刚装完,win7和XP上运行,都是界面混乱,看到网上说是属性里改字体,改编码,我试了半天不行: 最后发现,需要far.exe创建快捷方式,在快捷方式的属性里设置字体,编码,窗口大小,废话不多说,上图: ...
- hibernate二级缓存整合
<?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http:// ...
- IPFS 探索
IPFS 探索 比特币当前是用于存金融交易数据,有leveldb 存关键小的交易数据.那么我们的文件,譬如一个网站里面的static file 怎么办? IPFS(InterPlanetary Fil ...
- Django之 静态模板渲染
既可以简单的 django.http.HttpResponse 来把内容显示到网页上,也可以使用渲染模板的方法来显示内容. 说明:代码是基于 Django 1.8,但 Django 1.4 - Dja ...
- el-popover 的显示或隐藏,要在拿到真实dom之后再做控制
el-popover 的显示或隐藏,要在拿到真实dom之后再做控制
- [转]vnpy乱乱谈 02架构
vnpy乱乱谈 02架构 转自:http://101.132.65.227/?p=51 听到架构这个词先不要害怕. 其实这部分内容还是挺简单的. 一般而言, 一个交易系统我们可以简单的分成输入, (系 ...