Flutter & Dart
Flutter & Dart
https://www.dartlang.org/install
https://flutter.dev/
https://flutter.dev/docs/get-started/install/macos
flutter_macos_v1.2.1-stable.zip & 464 MB
https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_v1.2.1-stable.zip
https://flutter.dev/docs/development/tools/sdk/archive
https://flutter.dev/community/china
https://flutter-io.cn/
https://codelabs.flutter-io.cn/
https://codelabs.flutter-io.cn/codelabs/first-flutter-app-pt1-cn/index.html#0
https://classroom.udacity.com/courses/ud905
https://flutter.dev/docs/get-started/install/macos#get-the-flutter-sdk
https://flutter.dev/docs/get-started/install/macos#update-your-path
# pwd
export PATH="$PATH:`pwd`/flutter/bin"
# export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"
# pwd === /Users/xgqfrms-mbp
export PATH="$PATH:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin"
Flutter 1.2
https://flutter-io.cn/posts/launching-flutter-12-at-mobile-world.html
zsh bug
https://github.com/flutter/flutter/issues/29539#issuecomment-473825598
zsh !== native terminal
.zshrc
!==.bash_profile
$ cat .zshrc
$ vim .zshrc
# flutter PATH & zsh
export PATH="$PATH:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin"
$ source $HOME/.zshrc
.zshrc
path
current user path
https://mirrors.sjtug.sjtu.edu.cn/#/
rss-parser
import axios from 'axios'
import Parser from 'rss-parser'
import _ from 'lodash'
// The type of the return value of getFeeds()
// for documenting purpose only
// eslint-disable-next-line
function getFeedsResult () {
this.title = 'title of feed'
this.pubDate = new Date()
this.url = 'https://test.com'
}
/**
* @param {string} url
* @fulfill {getFeedsResult[]}
* @reject {Error}
* @return {Promise.<getFeedsResult[]>}
*/
async function getFeeds (url) {
const parser = new Parser()
return parser.parseURL(url)
.then(({items}) => _.map(items, rssItem => ({
title: rssItem.title,
url: rssItem.link,
pubDate: new Date(rssItem.pubDate)
})))
}
/**
*
* @param {string} url
* @return {Promise.<Object.<string, string>>} an object: name => desciption HTML
*/
async function getHelps (url) {
const parser = new Parser()
return parser.parseURL(url)
.then(({items}) => _.fromPairs(_.map(items, item => [item.title, item.content])))
}
// eslint-disable-next-line
function getBackendSummarySingleResult () {
this.name = 'name of this repo'
this.idle = false
this.result = true
this.lastFinished = new Date()
}
/**
* @param {string} url
* @return {Promise.<getBackendSummarySingleResult[]>}
*/
async function getBackendSummary (url) {
return axios.get(url)
.then(({data}) => _.map(data.WorkerStatus, (val, key) => ({
name: key,
idle: val.Idle,
result: val.Result,
lastFinished: new Date(val.LastFinished)
})))
.then(data => _.sortBy(data, 'name'))
}
export {
getFeeds,
getBackendSummary,
getHelps
}
// WEBPACK FOOTER //
// ./src/api/index.js
https://sjtug.org/js/rocket.js
https://github.com/sjtug/sjtug-mirror-frontend
https://github.com/sjtug/lug
var scene, camera, renderer, rocket, fire, mx, my;
var firescale = 1;
var rot_axis = new THREE.Vector3(0, 0, 1);
var trans_axis = new THREE.Vector3(-0.5, 0, 0.8);
var rot_lean = new THREE.Vector3(0, 1, 0);
var axis_c = new THREE.Vector3(0,0,0);
var axis_s = new THREE.Vector3(0,0,0);
var axis_h = (new THREE.Vector3(0,1,0)).applyAxisAngle(rot_axis, -0.02);
var axis_w = (new THREE.Vector3(1,0,0)).applyAxisAngle(rot_axis, -0.02);
var camera_pos = new THREE.Vector3(0, 0, 30);
var current_pos = new THREE.Vector3(0,0,0);
var delta = new THREE.Vector3(0,0,0);
var speedX = 0;
var speedY = 0;
var firel = 0.4;
var firer = 0.2;
var mx = 0;
var my = 0;
var xs = 0;
init();
function init(){
//scene = new THREE.Scene();
var WIDTH = 240;
var HEIGHT = 240;
renderer = new THREE.WebGLRenderer({'antialias':true});
renderer.setSize(WIDTH, HEIGHT);
camera = new THREE.PerspectiveCamera(45, WIDTH/HEIGHT, 0.1, 20000);
camera.position = camera_pos;
camera.lookAt(axis_c);
var loader = new THREE.SceneLoader();
loader.load("/js/rocket.json", function(s){
scene = s.scene;
rocket = s.objects['Rocket'];
fire = s.objects['Fire'];
rocket.rotateOnAxis(rot_axis, 1.508);
rocket.translateOnAxis(trans_axis, -2)
rocket.rotateOnAxis(rot_lean, -0.63);
fire.rotateOnAxis(rot_axis, 1.508);
fire.translateOnAxis(trans_axis, -2)
fire.rotateOnAxis(rot_lean, -0.63);
scene.add(camera);
document.body.onmousemove = function(e){
var w = document.body.clientWidth/2;
mx = w-e.pageX;
if(firel<0.7) my = 300-e.pageY;
else {
mx=mx*0.2+xs;
my=300;
}
}
if (window.DeviceMotionEvent) {
deviceMotionHandler = function(e) {
document.body.onmousemove = null;
var ax = event.accelerationIncludingGravity.x;
var ay = event.accelerationIncludingGravity.y;
var orient = window.orientation;
if (orient==0) {
mx = -ax * 80;
my = -ay * 80;
}
else if (orient==90) {
mx = ay * 80;
my = -ax * 80;
}
else if (orient==-90) {
mx = -ay * 80;
my = -ax * 80;
}
else if (orient==180) {
mx = -ax * 80;
my = ay * 80;
}
}
window.ondevicemotion = function(e) {
var acc = e.acceleration;
if (acc.x != null || acc.y != null || acc.z != null) {
document.body.onmousemove = null;
window.ondevicemotion = deviceMotionHandler;
} else {
window.ondevicemotion = null;
}
}
}
var logo = document.getElementById('logo');
logo.classList.add('ani');
logo.appendChild(renderer.domElement);
var joinLink = document.getElementById('join');
if (joinLink) {
joinLink.onmouseover = function(e){
firel = 0.8;
firer = 0.1;
var w = document.body.clientWidth/2;
xs = w - e.pageX;
if (xs>80) xs=160;
else if (xs<-80) xs=-160;
else xs = 0;
}
joinLink.onmouseout = function(e){
firel = 0.4;
firer = 0.2;
}
} else { // support pages with no join link
firel = 0.4;
firer = 0.2;
}
animate();
});
}
function step(camera) {
if (mx > 1000) mx = 1000;
else if (mx < -1000) mx = -1000;
if (my > 1000) my = 1000
else if (my < -1000) my = -1000;
delta.set(-mx, my, 0).applyAxisAngle(rot_axis, -0.02).sub(current_pos);
if (delta.x>20) delta.x=20;
else if (delta.x<-20) delta.x=-20;
if (delta.y>50) delta.y=50;
else if (delta.y<-50) delta.y=-50;
speedX += delta.x/2000;
speedY += delta.y/8000;
speedX *= 0.95;
speedY *= 0.80;
rocket.rotateOnAxis(rot_axis, speedX);
camera.position.applyAxisAngle(axis_w, speedY);
delta.x *= 0.5;
current_pos.add(delta);
if(firescale>=1) firescale = firel - firer*Math.random();
else firescale = firel + firer*Math.random();
fire.scale.z = firescale;
if (firel>0.7) {
axis_s.set(-Math.random(), -Math.random(), 0);
axis_s.multiplyScalar(0.4);
camera.lookAt(axis_s);
}
else camera.lookAt(axis_c);
}
function animate() {
requestAnimationFrame(animate);
step(camera);
renderer.render(scene, camera);
}
Flutter & Dart的更多相关文章
- [flutter+dart] windows7下开发环境的安装与配置
前言 博主是做嵌入式的,参加工作时间也不久,而且是非科班出身,之前从未接触过移动开发.最近了解到了flutter框架和dart语言,想作为第二语言学习一下,因此会从最基础的环节开始,以此博客作为记录, ...
- Android Gradle Issue - Flutter / Dart
解决 "Minimum supported Gradle version is 4.6. Current version is 3.3." I have a problem wit ...
- 【Flutter 1-2】在 Windows 10下安装Flutter+Dart+Android Studio 配置Flutter开发环境
在 Windows 10下安装Flutter+Dart+Android Studio 配置Flutter开发环境 文章首发地址 配置环境变量 由于部分网站被墙的原因,我们需要先配置Flutter国内镜 ...
- flutter & dart & vs code & bug
flutter & dart & vs code & bug Waiting for another flutter command to release the startu ...
- Flutter & Dart 安装在window系统
一.系统环境 flutter最低要求 1,windows7 SP1 64位版本以上,我的系统就是windows 7 sp1 64bit 2,git for windows ,没有安装的需要到这里下载 ...
- Flutter Dart中的异步
以下内容从官网得到: https://webdev.dartlang.org/articles/performance/event-loop Even-Looper Dart是单线程模型,也就没有了所 ...
- Flutter dart:convert
引用 mport 'dart:convert'; JSON 解码(JSON String->Object) // NOTE: Be sure to use double quotes (&quo ...
- Flutter——Dart Extension扩展方法的使用
dart的extension方法可以给已经存在的类添加新的函数,通过extension我们可以封装一些常用方法,提高开发效率. 例一:扩展String 给string添加一个log打印方法 exten ...
- Flutter Dart List.map() 获取下标
class HomePageState extends State{ final topTitles = ['审批单', '机票列表', '客服']; final topIcons = ['asset ...
随机推荐
- labellmg使用方法
https://www.cnblogs.com/Terrypython/p/9577657.html
- AI 最小二乘法
最小二乘法 参考链接: https://zhuanlan.zhihu.com/p/27204466
- Android学习之基础知识九 — 数据存储(持久化技术)之使用LitePal操作数据库
上一节学习了使用SQLiteDatabase来操作SQLite数据库的方法,接下来我们开始接触第一个开源库:LitePal.LitePal是一款开源的Android数据库框架,它采用了对象关系映射(O ...
- 人人都是产品经理<2.0>
之前有看过<人人都是产品经理1.0>,还认真的做了笔记,看完后不久,得知作者在第一版的内容基础上,升华性的出了第二版,即<人人都是产品经理2.0>.注:第一版和第二版跨度有6年 ...
- 包含 PHP和nginx的镜像 supervisord.conf Dockerfile 案例
参考:https://github.com/romeOz/docker-nginx-php 1.命令: docker run --name app -d -p 8080:80 \ --net pg_n ...
- (推荐)用C++来开发Skyline应用
原文地址:http://www.hailongchang.org/index.php/archives/category/terraexplorer 供大家学习参考.
- 【转】浅谈JavaScript中forEach与each
forEach是ES5中操作数组的一种方法,主要功能是遍历数组,例如: var arr = [1,2,3,4]; arr.forEach(alert); 等价于: var arr = [1, 2, 3 ...
- 基于uFUN开发板的RGB调色板
前言 使用uFUN开发板配合Qt上位机,实现任意颜色的混合,Qt上位机下发RGB数值,范围0-255,uFUN开发板进行解析,然后输出不同占空比的PWM,从而实现通过RGB三原色调制出任意颜色. Qt ...
- KVM虚拟机管理——虚拟机克隆
1. 概述2. 部署基本操作系统虚拟机3. 配置虚拟机3.1 修改/etc/sysconfig/network3.2 删除/etc/sysconfig/network-scripts/ifcfg-et ...
- EF_DataFrist遇到的问题
正在 Code First 模式下将此上下文与从 EDMX 文件生成的用于 Database First 或 Model First 开发的代码一起使用.这将无法正常工作.若要解决此问题,请不要删除引 ...