Flutter問題收集

歡迎大家留言遇到的問題

fvm 版本管理

Install:

brew tap leoafarias/fvm
brew install fvm

Uninstall

brew uninstall fvm
brew untap leoafarias/fvm

下載 stable 版本的 flutter :

fvm install stable

設置全局,此時會在 fvm 文件夾裏創建一個 default 目錄:

fvm global {version}

環境變量:

export FLUTTER_HOME=~/fvm/default
export PATH=$FLUTTER_HOME/bin/cache/dart-sdk/bin:$FLUTTER_HOME/bin:$PATH

刷新環境變量:
source ~/.bash_profile
在項目裏使用:
編輯器選擇剛纔配置的路徑。

查看python路徑

which -a python

python 環境切換

使用brew 下載 對應python 版本:
brew install [email protected]
配置環境變量:
open ~/.bash_profile
添加下面兩句,保存:

export PATH=/usr/local/opt/[email protected]/bin:$PATH
alias python="/usr/local/opt/[email protected]/bin/python3"

刷新環境變量:
source ~/.bash_profile

ListView默認有 Padding

一行數據的時候高度超出 Item 的高度,把 Padding 設置爲0.

系統報錯

Null check operator used on a null value #68
#0 ScrollPosition.minScrollExtent (package:flutter/src/widgets/scroll_position.dart:136:49) 

把image替換成icon或者背景,如果是網絡圖片添加placeholder

# fatal: unable to access 'https://github.com/xxx': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

$ git config --global http.proxy 

如果沒有輸出,輸入代理:

$ git config --global http.proxy proxyaddress:port

然後執行:

$ git config --global http.proxy 

flutter run

取消代理的時候執行:

$ git config --global --unset http.proxy 

TabBar 和 TabBarView的使用,一般都是使用 Scaffold 返回的, appbar + body 沒有問題,但是在body裏面同時放置 TabBar 和 TabBarView需要注意,TabBarView 的父 Widget 必須知道寬高才能佈局,否則,會報錯:BoxConstraints forces an infinite height.使用 Column + Expanded 即可:

Column(
    children: <Widget>[
        TabBar(tabs: tabs),
        Expanded(
            flex: 1,
            child: TabBarView(...),
        ),
 
    ],
)

fatal error: module 'xxxxxx' not found

rm ios/Podfile && flutter build ios
github

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章