flutter 常备基础知识
- //数组包含某个值
listArr.contains(1)
- 溢出添加省略
Expanded(
flex: 1,
child: Text(
'$value',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: label == '状态:'
? ColorUtil.fromHex('#ff3300', 1)
: ColorUtil.fromHex('#2A313F', 1),
fontSize: 28.sp,
fontWeight: FontWeight.w500),
),
)
核心
maxLines: 2,
overflow: TextOverflow.ellipsis,
- // 过时API–
修改文件 build.gradle;主要注意版本号的搭配
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
- //遍历
_labels.map((e) => ColItem()).toList()) //ColItem 业务组件