分类
Flutter

Flutter填坑

引入自定义库

Include of non-modular header inside framework module 

在要编译的工程的目标下将Allow Non-modular Includes In Framework Modules的No值改为Yes

framework module … 错误

Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator.

https://flutter.dev/docs/development/ios-project-migration

No Scaffold widget found.

使用showModalBottomSheet代替showBottomSheet

Android打包时出现:

Transform’s input file does not exist: /xxx/xxx/build/app/intermediates/flutter/profile/libs.jar. (See https://issuetracker.google.com/issues/158753935)

在app/build.gradle文件的lintOptions中添加如下代码

lintOptions {
    checkReleaseBuilds false
}

参考链接:https://github.com/flutter/flutter/issues/58247#issuecomment-636253593

分类
Flutter

flutter之发布过程中遇到的问题

1.ios编辑出现如下错误

这是因为Xcode10是默认选中的最新的New Build System(Default),在这个编译系统的环境下,打包的CI脚本一直会报错。

解决方案:

Xcode菜单栏选择File– Workspace Setting,把new build system(Defalt)切换到 Legacy Build System 在模拟器上运行就OK!

参考连接:

【Flutter】IOS打包

2.iOS提交时出现:Non-public API usage

需要先运行

flutter build ios

Include of non-modular header inside framework module

将Allow Non-modular Includes In Framework Modules的No值改为Yes

参考链接

Include of non-modular header inside framework module … 错误

分类
Flutter

flutter插件库开发

参考连接

开发Flutter插件

Flutter Plugin开发流程

开发Packages和插件

分类
Flutter

flutter macos

参考链接

Go Module实战测试

分类
Flutter

flutter之疑难杂症

iOS编译提示:Multiple commands produce

执行如下操作

1. In Xcode, go to File->Workspace settings.
2. Change the build system to Legacy Build system.

参考链接

Xcode 10 Error: Multiple commands produce

iOS因安装simple_permissions 插件运行报错

Showing Recent Messages
项目根目录/ios/Pods/Headers/Public/simple_permissions/SimplePermissionsPlugin.h:1:9: 'Flutter/Flutter.h' file not found

Could not build Objective-C module 'simple_permissions'

解决方式

platform :ios, '10.0' <- Uncomment this line

target 'Runner' do
use_frameworks! <- add this line

https://github.com/Ethras/flutter_simple_permissions/issues/22

Android dependency 'androidx.versionedparcelable:versionedparcelable' has different version for the compile (1.0.0-beta01) and runtime (1.0.0) classpath. You should manually set the same version via DependencyResolution

添加如下代码


rootProject.allprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.core') {
                details.useVersion "1.0.1"
            }
            if (details.requested.group == 'androidx.lifecycle') {
                details.useVersion "2.0.0"
            }
            if (details.requested.group == 'androidx.versionedparcelable') {
                details.useVersion "1.0.0"
            }
        }
    }
}

参考连接

Flutter upgrade and Android X – beware! (solution inside)

分类
Flutter

flutter之小技巧

隐藏软键盘

FocusScope.of(context).requestFocus(FocusNode());

StatelessWidgetStatefulWidgetflutter的基础组件,日常开发中自定义Widget都是选择继承这两者之一。

两者的区别在于状态的改变StatelessWidget面向那些始终不变的UI控件,比如标题栏中的标题;而StatefulWidget则是面向可能会改变UI状态的控件,比如有点击反馈的按钮。

分类
Flutter

flutter 生命周期

参考链接

flutter 生命周期

分类
Flutter

flutter之text

const Text(this.data//内容, {
Key key,
this.style//样式
this.textAlign//对齐方式,
this.textDirection//文本方向,
this.softWrap//是否换行显示,
this.overflow//超出文本的处理方式,
this.textScaleFactor//每个逻辑像素的字体像素数,控制字体大小,
this.maxLines//最大行数,
  })
const TextStyle({
this.inherit: true,
this.color//颜色,
this.fontSize//大小,默认10像素,
this.fontWeight,
this.fontStyle,
this.letterSpacing//字间距,
this.wordSpacing//字符间距,
this.textBaseline,
this.height,
this.decoration,
this.decorationColor,
this.decorationStyle,
this.debugLabel,
String fontFamily//字体,
String package,
  })

参考链接

Text&Image

分类
Flutter

flutter之drawer

打开

Scaffold.of(context).openDrawer();
Scaffold.of(context).openEndDrawer();

参考链接

Flutter之drawer详细分析(你要的操作都有)

分类
Flutter

flutter之Decoration

构造方法

 const BoxDecoration({
    this.color, // 底色
    this.image, // 图片
    this.border, 边色
    this.borderRadius, // 圆角度
    this.boxShadow, // 阴影
    this.gradient, // 渐变
    this.backgroundBlendMode, // 混合Mode
    this.shape = BoxShape.rectangle,  // 形状
  })

参考链接

Flutter Decoration背景设定(边框、圆角、阴影、形状、渐变、背景图像等)