flutter 學習總結android
1.flutter簡介:
flutte 谷歌的跨平臺(IOS,android)原生開發框架工具(框架,SDK)
框架:用於編譯dart語言和widget庫;
sdk: 用於將dart代碼編譯爲原生ios,android)代碼;ios
DART:由谷歌開發的用於WEB,服務器,移動應用,物聯網等領域的開發編程語言。面向對象;
widget:庫git
2.flutter 安裝
flutter.dev
flutterchina.club
MACOS
pwd
vim .bash_profile
flutter doctor
open -a simulator
macos 需安裝組件:
1. flutter;
2.android toolchain develop for android devices
3.xcode -for ios and macos
4.ios tools
5.android studiox
6.vs code
brew.cn
WINDOW需安裝組件:
1. git;
2. flutter sdk:flutter_windows_v1
3.配置環境變量:bin
4.flutter doctor 檢查安裝狀況
5.安裝adnroid studio
6.git 建立第一個項目 flutter create first_app
7.open android studio,install pul
8.flutter doctor
9.vscode install,
flutter install,
dart install
github
開發語法介紹:
. lib,main.dart
void main(){
print("hello world");
//單行註釋
/**
* 多行註釋
*/
}
變量和數據類型:
//number :int /double
//String:String
//Bollean:bool
//String 轉義 String s1='i\'m henry';
String s2="i'm henry";
//String 拼接
String myname=" denny " + " is my name";
//$變量:
int a =20;
int b=20;
print('this sum of $a and $ is ${a+b}‘);
express
//分支
var salery=2000;
if(salery > 2000){
print("$salery 大於2000「);
}else {
print("$salery
}
// ?: 三元表達式
// ??表達式 if name is null then print age 32,
String name=" mi mu";
String nametoprint=name ?? "age 32";
//switch
String grade="a";
switch(grade){
case "a":
print("very good");
beak;
case "b":
}
//for loop
for(int i=0;i<=10;i++){
if(i % 2==0){
print(i);
}
}
// for in
for(String person in pelople){
print(person);
}
//while loop
int i=0;
while(i < plople.length)
{
print(pelople[i]);
i++;
}
//do while
int i =0;
do{
print(peple[i]);
i++;
}while(i<pelople.length);
//break 中止循環,退出當前全部循環
for(int i=0;i<10;i++)
{
if(i==5){
break;
}
}
//指定中止循環,給內外循環命名:
//continue 中止本次循環
//函數:具備必定功能的代碼段
//定義函數,傳參,返回值,默認返回值,箭頭函數,函數參數,默認參數macos
//箭頭函數 void sumValue(int a,int b) => print("a+b= :${a + b}");
//箭頭函數有返回值 sumValue(int a,int b) =>a+b;
//函數可選參數[]
void sumvaue(int a,[int b,int c]){
}
try catch on finally
try{
int result =12 ~/0;
}catch(e){
}finally{
}
try{
int result =12 ~/0;
}on onintExtion{
}
//自定義鋪貨異常
class DepositException implements Exception{
String errorMessage(){
return "金額不能少於0元「;
}
}
void depositMoney(int amount){
if((amount < 0){
throw new DepositException();
}
}
try{
depositMoney(-200)
}catch(e)
{
print(e.errorMessage());
}
//定義class
void main(){
var st=Student();
st.id=10;
st.name="a";
}
class Student{
int int;
String name;
void study()
{
print("${this.name} is now studing");
}
}
//構造函數
Student(){
print("這個就是構造函數「);
}
Student(int id,String name){
}
Student(this.id,this.name)
//setter,getter
//類的繼承
class Anima{
String name;
}
class Dog extends Anima{
}
class Cat extends Anima{
}
flutter100.net
女裝商城 實例知識點:
1.Dio:http請求庫;
2.swiper:滑動插件使用,首頁輪播圖
3.路由fluro:企業級路由
4.屏幕適配:一次開發匹配全部屏幕
5.狀態管理provide:組件間狀態管理inheritwidget
scoped model
redux
bloc
state
provide:google
6.本地存儲:
7.複雜頁面的佈局:
8.Node:
9.express:框架 編程
首頁 :
1.輪播圖banner slides
2.商品分類列表數據
3.商品推薦上部
4.廣告圖
5.圖片商品推薦底部
6.火爆推薦,上拉刷新wrap
github/flutterchina/dio
redux