Flutter 日常

1、接入高德地圖
要去看官方庫?。。。。?br> flutter,引入simple_permissions依賴后,ios編譯報錯simple_permissions-Swift.h' file not found
報錯:

=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===

/Users/liyan/software/flutter/.pub-cache/hosted/pub.flutter-io.cn/simple_permissions-0.1.9/ios/Classes/SimplePermissionsPlugin.m:2:9: fatal error: 'simple_permissions/simple_permissions-Swift.h' file not found

#import <simple_permissions/simple_permissions-Swift.h>

        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.

解決方法:

進入flutter_project/ios/,編輯Podfile,將

platform :ios, '9.0'

替換為:

platform :ios, '10.0'
use_frameworks!
關(guān)鍵是use_frameworks!

2、使用dart2.7新特性(擴展語法)


WechatIMG22.png

3、flutter build ios --release 報錯

 Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
  .....

改Podfile文件
platform :ios, '10.0' 庫支持的低版本,看具體什么庫
報443的
在文件里面加上
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

4、Scaffold里面彈出軟鍵盤導(dǎo)致界面異常
加載這個屬性 resizeToAvoidBottomPadding: false,

5、指定數(shù)值變化(例如在2秒內(nèi)從0升到255)

  @override
  void initState() {
    super.initState();

    AnimationController animatedContainer = AnimationController(duration: Duration(milliseconds: 150),vsync: this);
    Animation<int> alpha = IntTween(begin: 180, end: 370).animate(animatedContainer);
    alpha.addListener(() {
      setState(() {
        meunHeight = alpha.value;
      });
    });
  }

  void startAnim(){
    if(isShow){
      animatedContainer.forward();
      isShow = false;
    }else{
      animatedContainer.reverse();
      isShow = true;
    }
  }


2、flutter接入支付寶登錄
導(dǎo)入 fake_alipay: ^0.2.3
這個有bug需要改源碼:
1、Alipay->211行的(RsaSigner)類
2、在這個文件里面找到(RsaKeyParser)類
3、修改RsaKeyParser類的parsePrivate方法
修改前

class RsaKeyParser{
  ...
  RSAPrivateKey parsePrivate(String key) {
    List<String> rows = key.split('\n');
    String header = rows.first;
    if (header == '-----BEGIN RSA PRIVATE KEY-----') {
      return _parsePrivate(_parseSequence(rows));
    }
    if (header == '-----BEGIN PRIVATE KEY-----') {
      return _parsePrivate(_pkcs8PrivateSequence(_parseSequence(rows)));
    }

    throw UnsupportedError('PEMKey($key) is unsupported');
  }
}

修后

class RsaKeyParser{
  ...
   RSAPrivateKey parsePrivate(String key) {
    List<String> rows = key.split('\n');
    String header = rows.first;
//    if (header == '-----BEGIN RSA PRIVATE KEY-----') {
//      return _parsePrivate(_parseSequence(rows));
//    }
//    if (header == '-----BEGIN PRIVATE KEY-----') {
      return _parsePrivate(_pkcs8PrivateSequence(_parseSequence(rows)));
//    }

    throw UnsupportedError('PEMKey($key) is unsupported');
  }
}

6、[!] Error installing libwebp [!] /usr/local/bin/git clone
http://www.itdecent.cn/p/2ad9ea97303a
https://github.com/webmproject/libwebp.git

7、xcode 打包后閃退
other links 添加 -all_load

8、Flutter優(yōu)化,外接紋理(使用原生View,主工程是flutter)
9、Flutter優(yōu)化,無侵入的外接紋理(主工程是android或者是IOS,已插件的形式導(dǎo)入原生工程)
10、清除緩存
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec

11、flutter 打包安卓瘦包(知道arm-v7a內(nèi)核)

flutter build apk --release  --target-platform android-arm

12、問題:ios包提示重復(fù),xcode選擇傳統(tǒng)模式就運行,androidstudio 每次編譯自動選擇嚴格模式

答案:
image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容