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

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