Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
F
flutter_clx_base
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
flutter_clx_base
Commits
3873f400
提交
3873f400
authored
8月 19, 2022
作者:
guoqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改基础库警告
上级
b8b4d5ff
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
20 行增加
和
16 行删除
+20
-16
extension.dart
lib/common/extension.dart
+3
-2
common_utils.dart
lib/utils/common_utils.dart
+3
-2
string_util.dart
lib/utils/string_util.dart
+10
-8
my_scaffold.dart
lib/widget/my_scaffold.dart
+2
-2
my_scroll_view.dart
lib/widget/my_scroll_view.dart
+2
-2
没有找到文件。
lib/common/extension.dart
浏览文件 @
3873f400
import
'package:flutter/widgets.dart'
;
import
'package:flutter_clx_base/utils/log_utils.dart'
;
/// 扩展函数 Iterable
extension
IterableExt
<
E
>
on
Iterable
<
E
>?
{
...
...
@@ -84,7 +85,7 @@ extension DoubleExt on num? {
try
{
num
=
double
.
parse
(
toString
());
}
catch
(
e
)
{
print
(
"转换异常:
$e
"
);
loggerNoStack
.
i
(
"转换异常:
$e
"
);
return
nullTxt
;
}
if
((
num
.
toString
().
length
-
num
.
toString
().
lastIndexOf
(
"."
)
-
1
)
<
2
)
{
...
...
@@ -113,7 +114,7 @@ extension DoubleExt on num? {
try
{
num
=
int
.
parse
(
toString
());
}
catch
(
e
)
{
print
(
"转换异常:
$e
"
);
loggerNoStack
.
d
(
"转换异常:
$e
"
);
return
nullTxt
;
}
return
num
.
toString
();
...
...
lib/utils/common_utils.dart
浏览文件 @
3873f400
import
'package:flutter_clx_base/utils/log_utils.dart'
;
import
'package:get/get.dart'
;
...
...
@@ -32,7 +33,7 @@ String formatDouble(number, {nullTxt = "-"}) {
try
{
num
=
double
.
parse
(
number
.
toString
());
}
catch
(
e
)
{
print
(
"转换异常:
$e
"
);
loggerNoStack
.
d
(
"转换异常:
$e
"
);
return
nullTxt
;
}
if
((
num
.
toString
().
length
-
num
.
toString
().
lastIndexOf
(
"."
)
-
1
)
<
2
)
{
...
...
@@ -61,7 +62,7 @@ String formatInt(number, {nullTxt = "-"}) {
try
{
num
=
int
.
parse
(
number
.
toString
());
}
catch
(
e
)
{
print
(
"转换异常:
$e
"
);
loggerNoStack
.
i
(
"转换异常:
$e
"
);
return
nullTxt
;
}
return
num
.
toString
();
...
...
lib/utils/string_util.dart
浏览文件 @
3873f400
...
...
@@ -39,8 +39,6 @@ String txtLength(String? txt, {int? length, nullTxt = ""}) {
}
}
//时间去除.0
String
?
rightTime
(
String
?
time
)
{
String
?
rightTime
=
time
;
...
...
@@ -65,19 +63,23 @@ int getControllerStringLength(TextEditingController controller) {
return
getControllerString
(
controller
).
length
;
}
bool
checkEasyPwd
(
String
input
,
String
phone
)
{
bool
checkEasyPwd
(
String
input
,
String
phone
)
{
//1:不能出现连续的字母或者数字
var
allMatchLength
=
input
.
length
-
1
;
// 匹配全部
var
preMatchLength
=
input
.
length
-
2
;
// 匹配N-1位
RegExp
allSameChar
=
new
RegExp
(
"([0-9a-zA-Z])
\\
1{
$allMatchLength
}"
);
// 匹配全为连续字符
RegExp
preSameChar
=
new
RegExp
(
"([0-9a-zA-Z])
\\
1{
$preMatchLength
}"
);
// 匹配n-1位位连续字符
RegExp
allSameChar
=
RegExp
(
"([0-9a-zA-Z])
\\
1{
$allMatchLength
}"
);
// 匹配全为连续字符
RegExp
preSameChar
=
RegExp
(
"([0-9a-zA-Z])
\\
1{
$preMatchLength
}"
);
// 匹配n-1位位连续字符
//2:不能出现顺子(123456或654321一类) 连续的数字
// allSuccessiveNum 顺子
// startCharSuccessiveNum 第一位字母 后面顺子
// endCharSuccessiveNum 最后一位字母 前面顺子
RegExp
allSuccessiveNum
=
new
RegExp
(
"(?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)|9(?=0)){
$allMatchLength
}
\\
d|(?:9(?=8)|8(?=7)|7(?=6)|6(?=5)|5(?=4)|4(?=3)|3(?=2)|2(?=1)|1(?=0)){
$allMatchLength
}
\\
d"
);
RegExp
startCharSuccessiveNum
=
new
RegExp
(
"[A-Za-z](?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){
$preMatchLength
}
\\
d|[A-Za-z](?:9(?=8)|8(?=7)|7(?=6)|6(?=5)|5(?=4)|4(?=3)|3(?=2)|2(?=1)|1(?=0)){
$preMatchLength
}
\\
d"
);
RegExp
endCharSuccessiveNum
=
new
RegExp
(
"((?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){
$preMatchLength
}
\\
d)[A-Za-z]|((?:9(?=8)|8(?=7)|7(?=6)|6(?=5)|5(?=4)|4(?=3)|3(?=2)|2(?=1)|1(?=0)){
$preMatchLength
}
\\
d)[A-Za-z]"
);
RegExp
allSuccessiveNum
=
RegExp
(
"(?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)|9(?=0)){
$allMatchLength
}
\\
d|(?:9(?=8)|8(?=7)|7(?=6)|6(?=5)|5(?=4)|4(?=3)|3(?=2)|2(?=1)|1(?=0)){
$allMatchLength
}
\\
d"
);
RegExp
startCharSuccessiveNum
=
RegExp
(
"[A-Za-z](?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){
$preMatchLength
}
\\
d|[A-Za-z](?:9(?=8)|8(?=7)|7(?=6)|6(?=5)|5(?=4)|4(?=3)|3(?=2)|2(?=1)|1(?=0)){
$preMatchLength
}
\\
d"
);
RegExp
endCharSuccessiveNum
=
RegExp
(
"((?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){
$preMatchLength
}
\\
d)[A-Za-z]|((?:9(?=8)|8(?=7)|7(?=6)|6(?=5)|5(?=4)|4(?=3)|3(?=2)|2(?=1)|1(?=0)){
$preMatchLength
}
\\
d)[A-Za-z]"
);
// print('----- allSameChar: $allSameChar');
// print('----- preSameChar: $preSameChar');
...
...
lib/widget/my_scaffold.dart
浏览文件 @
3873f400
...
...
@@ -19,8 +19,8 @@ class MyScaffold extends StatelessWidget {
Key
?
key
,
this
.
appBar
,
this
.
backgroundColor
,
this
.
children
,
this
.
title
=
""
,
this
.
children
,
this
.
padding
,
this
.
body
,
this
.
bottomButton
,
...
...
@@ -35,11 +35,11 @@ class MyScaffold extends StatelessWidget {
backgroundColor:
backgroundColor
??
const
Color
(
0xFFf2f3f3
),
body:
body
??
MyScrollView
(
children:
children
,
padding:
padding
,
bottomButton:
bottomButton
,
crossAxisAlignment:
crossAxisAlignment
,
keyboardConfig:
keyboardConfig
,
children:
children
??
[],
),
);
}
...
...
lib/widget/my_scroll_view.dart
浏览文件 @
3873f400
...
...
@@ -20,7 +20,7 @@ class MyScrollView extends StatelessWidget {
this
.
overScroll
=
16.0
,
})
:
super
(
key:
key
);
final
List
<
Widget
>
?
children
;
final
List
<
Widget
>
children
;
final
EdgeInsetsGeometry
?
padding
;
final
ScrollPhysics
physics
;
final
CrossAxisAlignment
crossAxisAlignment
;
...
...
@@ -37,7 +37,7 @@ class MyScrollView extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
contents
=
Column
(
crossAxisAlignment:
crossAxisAlignment
,
children:
children
!
,
children:
children
,
);
if
(
defaultTargetPlatform
==
TargetPlatform
.
iOS
&&
keyboardConfig
!=
null
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论