Flutter & Dart

本文详细介绍如何在MacOS上安装Flutter与Dart环境,包括下载SDK、配置环境变量及使用资源链接。此外,还提供了多个学习资源,如官方文档、教程和课程,帮助初学者快速掌握Flutter开发技巧。
摘要由CSDN通过智能技术生成

Flutter & Dart

https://www.dartlang.org/install

740516-20190316142022732-506358142.png

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

740516-20190316135711122-413002875.png

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

740516-20190316135635023-514041809.png

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

740516-20190316141721637-1835838213.png

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


https://flutter.dev/docs/get-started/install/macos#get-the-flutter-sdk
740516-20190316145138106-1456472776.png

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"

740516-20190316144955609-659005992.png

740516-20190316145026142-1760332026.png

740516-20190316144900488-1776652484.png

Flutter 1.2

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

740516-20190318154918283-1580849154.png

740516-20190318154752431-1310904813.png


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

image


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

https://github.com/sjtug

740516-20190316140706510-1866347433.png

740516-20190316140731508-2078573846.png

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);
}

转载于:https://www.cnblogs.com/xgqfrms/p/10542068.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值