提交 3873f400 authored 作者: guoqing's avatar guoqing

修改基础库警告

上级 b8b4d5ff
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_clx_base/utils/log_utils.dart';
/// 扩展函数 Iterable /// 扩展函数 Iterable
extension IterableExt<E> on Iterable<E>? { extension IterableExt<E> on Iterable<E>? {
...@@ -84,7 +85,7 @@ extension DoubleExt on num? { ...@@ -84,7 +85,7 @@ extension DoubleExt on num? {
try { try {
num = double.parse(toString()); num = double.parse(toString());
} catch (e) { } catch (e) {
print("转换异常:$e"); loggerNoStack.i("转换异常:$e");
return nullTxt; return nullTxt;
} }
if ((num.toString().length - num.toString().lastIndexOf(".") - 1) < 2) { if ((num.toString().length - num.toString().lastIndexOf(".") - 1) < 2) {
...@@ -113,7 +114,7 @@ extension DoubleExt on num? { ...@@ -113,7 +114,7 @@ extension DoubleExt on num? {
try { try {
num = int.parse(toString()); num = int.parse(toString());
} catch (e) { } catch (e) {
print("转换异常:$e"); loggerNoStack.d("转换异常:$e");
return nullTxt; return nullTxt;
} }
return num.toString(); return num.toString();
......
import 'package:flutter_clx_base/utils/log_utils.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
...@@ -32,7 +33,7 @@ String formatDouble(number, {nullTxt = "-"}) { ...@@ -32,7 +33,7 @@ String formatDouble(number, {nullTxt = "-"}) {
try { try {
num = double.parse(number.toString()); num = double.parse(number.toString());
} catch (e) { } catch (e) {
print("转换异常:$e"); loggerNoStack.d("转换异常:$e");
return nullTxt; return nullTxt;
} }
if ((num.toString().length - num.toString().lastIndexOf(".") - 1) < 2) { if ((num.toString().length - num.toString().lastIndexOf(".") - 1) < 2) {
...@@ -61,7 +62,7 @@ String formatInt(number, {nullTxt = "-"}) { ...@@ -61,7 +62,7 @@ String formatInt(number, {nullTxt = "-"}) {
try { try {
num = int.parse(number.toString()); num = int.parse(number.toString());
} catch (e) { } catch (e) {
print("转换异常:$e"); loggerNoStack.i("转换异常:$e");
return nullTxt; return nullTxt;
} }
return num.toString(); return num.toString();
......
...@@ -39,8 +39,6 @@ String txtLength(String? txt, {int? length, nullTxt = ""}) { ...@@ -39,8 +39,6 @@ String txtLength(String? txt, {int? length, nullTxt = ""}) {
} }
} }
//时间去除.0 //时间去除.0
String? rightTime(String? time) { String? rightTime(String? time) {
String? rightTime = time; String? rightTime = time;
...@@ -65,19 +63,23 @@ int getControllerStringLength(TextEditingController controller) { ...@@ -65,19 +63,23 @@ int getControllerStringLength(TextEditingController controller) {
return getControllerString(controller).length; return getControllerString(controller).length;
} }
bool checkEasyPwd(String input,String phone) { bool checkEasyPwd(String input, String phone) {
//1:不能出现连续的字母或者数字 //1:不能出现连续的字母或者数字
var allMatchLength = input.length - 1; // 匹配全部 var allMatchLength = input.length - 1; // 匹配全部
var preMatchLength = input.length - 2; // 匹配N-1位 var preMatchLength = input.length - 2; // 匹配N-1位
RegExp allSameChar = new RegExp("([0-9a-zA-Z])\\1{$allMatchLength}"); // 匹配全为连续字符 RegExp allSameChar = RegExp("([0-9a-zA-Z])\\1{$allMatchLength}"); // 匹配全为连续字符
RegExp preSameChar = new RegExp("([0-9a-zA-Z])\\1{$preMatchLength}"); // 匹配n-1位位连续字符 RegExp preSameChar =
RegExp("([0-9a-zA-Z])\\1{$preMatchLength}"); // 匹配n-1位位连续字符
//2:不能出现顺子(123456或654321一类) 连续的数字 //2:不能出现顺子(123456或654321一类) 连续的数字
// allSuccessiveNum 顺子 // allSuccessiveNum 顺子
// startCharSuccessiveNum 第一位字母 后面顺子 // startCharSuccessiveNum 第一位字母 后面顺子
// endCharSuccessiveNum 最后一位字母 前面顺子 // 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 allSuccessiveNum = RegExp(
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"); "(?: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 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 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('----- allSameChar: $allSameChar');
// print('----- preSameChar: $preSameChar'); // print('----- preSameChar: $preSameChar');
......
...@@ -19,8 +19,8 @@ class MyScaffold extends StatelessWidget { ...@@ -19,8 +19,8 @@ class MyScaffold extends StatelessWidget {
Key? key, Key? key,
this.appBar, this.appBar,
this.backgroundColor, this.backgroundColor,
this.children,
this.title = "", this.title = "",
this.children,
this.padding, this.padding,
this.body, this.body,
this.bottomButton, this.bottomButton,
...@@ -35,11 +35,11 @@ class MyScaffold extends StatelessWidget { ...@@ -35,11 +35,11 @@ class MyScaffold extends StatelessWidget {
backgroundColor: backgroundColor ?? const Color(0xFFf2f3f3), backgroundColor: backgroundColor ?? const Color(0xFFf2f3f3),
body: body ?? body: body ??
MyScrollView( MyScrollView(
children: children,
padding: padding, padding: padding,
bottomButton: bottomButton, bottomButton: bottomButton,
crossAxisAlignment: crossAxisAlignment, crossAxisAlignment: crossAxisAlignment,
keyboardConfig: keyboardConfig, keyboardConfig: keyboardConfig,
children: children ?? [],
), ),
); );
} }
......
...@@ -20,7 +20,7 @@ class MyScrollView extends StatelessWidget { ...@@ -20,7 +20,7 @@ class MyScrollView extends StatelessWidget {
this.overScroll = 16.0, this.overScroll = 16.0,
}) : super(key: key); }) : super(key: key);
final List<Widget>? children; final List<Widget> children;
final EdgeInsetsGeometry? padding; final EdgeInsetsGeometry? padding;
final ScrollPhysics physics; final ScrollPhysics physics;
final CrossAxisAlignment crossAxisAlignment; final CrossAxisAlignment crossAxisAlignment;
...@@ -37,7 +37,7 @@ class MyScrollView extends StatelessWidget { ...@@ -37,7 +37,7 @@ class MyScrollView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget contents = Column( Widget contents = Column(
crossAxisAlignment: crossAxisAlignment, crossAxisAlignment: crossAxisAlignment,
children: children!, children: children,
); );
if (defaultTargetPlatform == TargetPlatform.iOS && keyboardConfig != null) { if (defaultTargetPlatform == TargetPlatform.iOS && keyboardConfig != null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论