Flutter & Dart

Flutter & Dart

https://www.dartlang.org/install

Flutter & Dart

https://flutter.dev/

https://flutter.dev/docs/get-started/install/macos

Flutter & Dart

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

Flutter & Dart

https://flutter-io.cn/

https://codelabs.flutter-io.cn/

https://codelabs.flutter-io.cn/codelabs/first-flutter-app-pt1-cn/index.html#0

Flutter & Dart

https://classroom.udacity.com/courses/ud905


https://flutter.dev/docs/get-started/install/macos#get-the-flutter-sdk

Flutter & Dart

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 & Dart

Flutter & Dart

Flutter & Dart

Flutter 1.2

https://flutter-io.cn/posts/launching-flutter-12-at-mobile-world.html

Flutter & Dart

Flutter & Dart


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

Flutter & Dart

.zshrc path

current user path

Flutter & Dart


https://mirrors.sjtug.sjtu.edu.cn/#/

https://github.com/sjtug

Flutter & Dart

Flutter & Dart

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);
}
上一篇:解决Download interrupted: Connection to https://dl-ssl.google.com refused的问题


下一篇:04 Zabbix4.0系统配置触发器trigger