美文网首页
Flutter 日常

Flutter 日常

作者: 读书人heart | 来源:发表于2020-03-07 10:31 被阅读0次

    1、接入高德地图
    要去看官方库!!!!!
    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!
    关键是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里面弹出软键盘导致界面异常
    加载这个属性 resizeToAvoidBottomPadding: false,

    5、指定数值变化(例如在2秒内从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接入支付宝登录
    导入 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
    https://www.jianshu.com/p/2ad9ea97303a
    https://github.com/webmproject/libwebp.git

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

    8、Flutter优化,外接纹理(使用原生View,主工程是flutter)
    9、Flutter优化,无侵入的外接纹理(主工程是android或者是IOS,已插件的形式导入原生工程)
    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内核)

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

    12、问题:ios包提示重复,xcode选择传统模式就运行,androidstudio 每次编译自动选择严格模式

    答案: image.png

    相关文章

      网友评论

          本文标题:Flutter 日常

          本文链接:https://www.haomeiwen.com/subject/ggnfdhtx.html