update idController when create new connection

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-08-08 17:22:25 +08:00
parent 4d3f5373d4
commit 21cf2a01c7
4 changed files with 17 additions and 1 deletions

View File

@@ -35,6 +35,11 @@ class IDTextInputFormatter extends TextInputFormatter {
String formatID(String id) {
String id2 = id.replaceAll(' ', '');
String suffix = '';
if (id2.endsWith(r'\r') || id2.endsWith(r'/r')) {
suffix = id2.substring(id2.length - 2, id2.length);
id2 = id2.substring(0, id2.length - 2);
}
if (int.tryParse(id2) == null) return id;
String newID = '';
if (id2.length <= 3) {
@@ -47,7 +52,7 @@ String formatID(String id) {
newID += " ${id2.substring(i, i + 3)}";
}
}
return newID;
return newID + suffix;
}
String trimID(String id) {