From f422d71df39e316e3c309c4939fad34eaca0a640 Mon Sep 17 00:00:00 2001 From: Luozf12345 <2515187986@qq.com> Date: Thu, 30 Nov 2023 12:28:56 +0800 Subject: [PATCH] delete test shell --- .../aop/3.10.0/aop_flutter_sdk.patch | 1 - .../demo_tool/aop/flutter_aop.sh | 4 +- .../example/shell/color_util/color_util.dart | 233 ------------------ .../example/shell/rename_file.dart | 24 -- .../example/shell/td_icons/icon_file_new.dart | 39 --- 5 files changed, 2 insertions(+), 299 deletions(-) delete mode 100644 tdesign-component/example/shell/color_util/color_util.dart delete mode 100644 tdesign-component/example/shell/rename_file.dart delete mode 100644 tdesign-component/example/shell/td_icons/icon_file_new.dart diff --git a/tdesign-component/demo_tool/aop/3.10.0/aop_flutter_sdk.patch b/tdesign-component/demo_tool/aop/3.10.0/aop_flutter_sdk.patch index 6fd163180..020fda253 100644 --- a/tdesign-component/demo_tool/aop/3.10.0/aop_flutter_sdk.patch +++ b/tdesign-component/demo_tool/aop/3.10.0/aop_flutter_sdk.patch @@ -1,5 +1,4 @@ From 7755353821d23dd4b3d851c6ad6e437c46b56d9b Mon Sep 17 00:00:00 2001 -From: zflyluo Date: Tue, 5 Sep 2023 15:08:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20aop=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 diff --git a/tdesign-component/demo_tool/aop/flutter_aop.sh b/tdesign-component/demo_tool/aop/flutter_aop.sh index 8341c30f3..caa50ed14 100644 --- a/tdesign-component/demo_tool/aop/flutter_aop.sh +++ b/tdesign-component/demo_tool/aop/flutter_aop.sh @@ -1,8 +1,8 @@ # flutter AOP 补丁 # TODO: 指定自己的flutter目录,并且切换到3.10.0版本 -flutterDir=/Users/zflyluo/tools/flutter1 +flutterDir=$1 # TODO:指定当前example的目录,后面不带"/" -projectDir=/Users/zflyluo/WorkSpace/flutter/tdesign_group/demo/tdesign-flutter/tdesign-component +projectDir=$2 # 指定aop运行版本 version=3.10.0 diff --git a/tdesign-component/example/shell/color_util/color_util.dart b/tdesign-component/example/shell/color_util/color_util.dart deleted file mode 100644 index 0605b052d..000000000 --- a/tdesign-component/example/shell/color_util/color_util.dart +++ /dev/null @@ -1,233 +0,0 @@ - -import 'dart:convert'; -import 'dart:io'; - -/// 用来批处理主题颜色变更的工具类 -void main(){ - var path = '/Users/zflyluo/WorkSpace/flutter/tdesign_group/tdesign-flutter/example/shell/color_util/color.txt'; - var dartPath = '/Users/zflyluo/WorkSpace/flutter/tdesign_group/tdesign-flutter/lib/src/theme/td_colors.dart'; - var file = File(path); - if(!file.existsSync()){ - print('dir not exist, exit'); - return; - } - - var lines = file.readAsLinesSync(); - print('file exist, lines:${lines.length}'); - - var colorMap = {}; - var keys = {}; - var color = ''; - var invalid = false; - var record = false; - lines.forEach((element) { - if(element.startsWith('/* Example */')){ - invalid = true; - } - if(!invalid){ - return; - } - if(record){ - color = element.replaceFirst('background: ', '') - .replaceAll(';', ''); - if (color.isNotEmpty && color.startsWith('#')) { - keys.forEach((element) { - colorMap[element] = color; - }); - keys.clear(); - } - record = false; - } - if(element.startsWith('/* Brand') - || element.startsWith('/* Error') - || element.startsWith('/* Warning') - || element.startsWith('/* Success') - ){ - element = element.replaceAll('/* ', '').replaceAll(' */', ''); - var strings = element.split('/'); - if(strings.length > 1){ - var validKey = strings[1]; - // var aliasKey; - if(validKey.contains('-')){ - var vks = validKey.split('-'); - validKey = vks[0]; - // aliasKey = vks[1]; - } - var numLength = validKey.endsWith('0') ? 2 : 1; - var number = validKey.substring(validKey.length - numLength,validKey.length); - var key = validKey.substring(0,validKey.length - numLength); - var finalKey = '${key.toLowerCase()}Color${number}'; - // print('finalKey ${finalKey}, element:$element'); - keys.add(finalKey); - // TODO:特殊标识的可能和之前的不一样,需要修改 - // if(aliasKey != null){ - // finalKey = '${key.toLowerCase()}${aliasKey}Color'; - // // print('finalKey2 ${finalKey}, element:$element'); - // keys.add(finalKey); - // } - } - record = true; - } else if( - // element.startsWith('/* Text&Icon') || - element.startsWith('/* Gray')){ - - element = element.replaceAll('/* ', '').replaceAll(' */', ''); - var strings = element.split('/'); - if(strings.length > 1){ - var validKey = strings[1]; - if (validKey.startsWith('Gray')) { - var numLength = validKey.length == 6 ? 2 : 1; - var number = validKey.substring(validKey.length - numLength,validKey.length); - var key = validKey.substring(0,validKey.length - numLength); - var finalKey = '${key.toLowerCase()}Color${number}'; - // print('finalKey ${finalKey}, element:$element'); - keys.add(finalKey); - record = true; - } - } - } - - }); - - print('parse Map size:${colorMap.length}, map:${colorMap}'); - - Map jsonMap = jsonDecode(oldColor); - - print('parse jsonMap size:${jsonMap.length}'); - - var dartFile = File(dartPath); - if(dartFile.existsSync()){ - - var dartContentLines = dartFile.readAsLinesSync(); - var tempLines = List.filled(dartContentLines.length, null, growable: false); - colorMap.forEach((key, value) { - String oldColor = jsonMap[key]; - oldColor = oldColor.substring(1, oldColor.length); - value = value.substring(1, value.length); - if(value != oldColor){ - print('key $key, old:$oldColor, new:$value'); - // 前后颜色不一致 - // dartContent = dartContent.replaceAll(oldColor, value); - for(var i = 0; i < dartContentLines.length; i++){ - var line = dartContentLines[i]; - if(line.contains(oldColor)){ - // if(tempLines[i] == null){ - // tempLines[i] = line.replaceAll(oldColor, value); - // } - tempLines[i] = line.replaceAll(oldColor, value); - print('count : $i, line:$line, tempLines:${tempLines[i]}'); - } - } - } - }); - - var sb = StringBuffer(); - for(var i = 0; i < dartContentLines.length; i++){ - if(tempLines[i] == null){ - sb.writeln(dartContentLines[i]); - } else { - sb.writeln(tempLines[i]); - } - } - dartFile.writeAsStringSync(sb.toString()); - print('update dart file success'); - } - - - - - // print('parse jsonMap after size:${jsonMap.length}, jsonMap:${jsonEncode(jsonMap)}'); - // print('${jsonEncode(jsonMap)}'); -} - -var oldColor = ''' -{ - "brandColor1": "#ECF2FE", - "brandColor2": "#D4E3FC", - "brandColor3": "#BBD3FB", - "brandColor4": "#96BBF8", - "brandColor5": "#699EF5", - "brandColor6": "#4787F0", - "brandColor7": "#266FE8", - "brandColor8": "#0052D9", - "brandColor9": "#0034B5", - "brandColor10": "#001F97", - "brandLightColor": "#ECF2FE", - "brandFocusColor": "#D4E3FC", - "brandDisabledColor": "#BBD3FB", - "brandHoverColor": "#266FE8", - "brandNormalColor": "#0052D9", - "brandClickColor": "#0034B5", - "errorColor1": "#FDECEE", - "errorColor2": "#F9D7D9", - "errorColor3": "#F8B9BE", - "errorColor4": "#F78D94", - "errorColor5": "#F36D78", - "errorColor6": "#E34D59", - "errorColor7": "#C9353F", - "errorColor8": "#B11F26", - "errorColor9": "#951114", - "errorColor10": "#680506", - "errorLightColor": "#FDECEE", - "errorFocusColor": "#F9D7D9", - "errorDisabledColor": "#F8B9BE", - "errorHoverColor": "#F36D78", - "errorNormalColor": "#E34D59", - "errorClickColor": "#C9353F", - "warningColor1": "#FEF3E6", - "warningColor2": "#F9E0C7", - "warningColor3": "#F7C797", - "warningColor4": "#F2995F", - "warningColor5": "#ED7B2F", - "warningColor6": "#D35A21", - "warningColor7": "#BA431B", - "warningColor8": "#9E3610", - "warningColor9": "#842B0B", - "warningColor10": "#5A1907", - "warningLightColor": "#FEF3E6", - "warningFocusColor": "#F9E0C7", - "warningDisabledColor": "#F7C797", - "warningHoverColor": "#F2995F", - "warningNormalColor": "#ED7B2F", - "warningClickColor": "#D35A21", - "successColor1": "#E8F8F2", - "successColor2": "#BCEBDC", - "successColor3": "#85DBBE", - "successColor4": "#48C79C", - "successColor5": "#00A870", - "successColor6": "#078D5C", - "successColor7": "#067945", - "successColor8": "#056334", - "successColor9": "#044F2A", - "successColor10": "#033017", - "successLightColor": "#E8F8F2", - "successFocusColor": "#BCEBDC", - "successDisabledColor": "#85DBBE", - "successHoverColor": "#48C79C", - "successNormalColor": "#00A870", - "successClickColor": "#078D5C", - "fontGyColor1": "#E6000000", - "fontGyColor2": "#99000000", - "fontGyColor3": "#66000000", - "fontGyColor4": "#42000000", - "fontWhColor1": "#FFFFFFFF", - "fontWhColor2": "#8CFFFFFF", - "fontWhColor3": "#59FFFFFF", - "fontWhColor4": "#38FFFFFF", - "whiteColor1": "#FFFFFF", - "grayColor1": "#F3F3F3", - "grayColor2": "#EEEEEE", - "grayColor3": "#E7E7E7", - "grayColor4": "#DCDCDC", - "grayColor5": "#C5C5C5", - "grayColor6": "#A6A6A6", - "grayColor7": "#8B8B8B", - "grayColor8": "#777777", - "grayColor9": "#5E5E5E", - "grayColor10": "#4B4B4B", - "grayColor11": "#383838", - "grayColor12": "#2C2C2C", - "grayColor13": "#242424", - "grayColor14": "#181818" - } -'''; \ No newline at end of file diff --git a/tdesign-component/example/shell/rename_file.dart b/tdesign-component/example/shell/rename_file.dart deleted file mode 100644 index 62dff85cb..000000000 --- a/tdesign-component/example/shell/rename_file.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'dart:io'; - -void main(){ - var dirPath = '/Users/zflyluo/Downloads/icons/'; - var dir = Directory(dirPath); - if(!dir.existsSync()){ - print('dir not exist, exit'); - return; - } - - print('dir exist'); - dir.listSync().forEach((element) { - var fileName = element.path.replaceFirst(dirPath, ''); - if(fileName.contains('-')){ - print('fileName $fileName contains -,rename _'); - var newName = fileName.replaceAll('-', '_'); - var newPath = '$dirPath$newName'; - print('newPath: $newPath'); - element.renameSync(newPath); - } else { - print('fileName $fileName not contains -'); - } - }); -} \ No newline at end of file diff --git a/tdesign-component/example/shell/td_icons/icon_file_new.dart b/tdesign-component/example/shell/td_icons/icon_file_new.dart deleted file mode 100644 index 63faac4c3..000000000 --- a/tdesign-component/example/shell/td_icons/icon_file_new.dart +++ /dev/null @@ -1,39 +0,0 @@ - -import 'dart:convert'; -import 'dart:io'; - -/// 用来批处理主题颜色变更的工具类 -void main(){ - var path = '/Users/zflyluo/WorkSpace/flutter/tdesign_group/tdesign-flutter/example/shell/td_icons/index.json'; - // var dartPath = '/Users/zflyluo/WorkSpace/flutter/tdesign_group/tdesign-flutter/lib/src/components/icon/td_icons_new.dart'; - var file = File(path); - if(!file.existsSync()){ - print('file not exist, exit'); - return; - } - - var config = file.readAsStringSync(); - var json = jsonDecode(config); - List list = json['icons']; - - print('list lenght: ${list.length}'); - list.forEach((element) { - String code = element['codepoint']; - String name = element['name']; - // name = name.replaceAll('.', '_'); - // _TDIconsData(0xf101, 'add_circle') - name = name.replaceAll('-', '_'); - // print(' static const ${name.replaceAll('-', '_')} = IconData(0x${code.replaceFirst('\\', '')}, fontFamily: _kFontFam, fontPackage: _kFontPkg);'); - print(' static const ${name} = _TDIconsData(0x${code.replaceFirst('\\', '')}, \'$name\');'); - }); - - list.forEach((element) { - var name = element['name'].replaceAll('-', '_'); - print('\'$name\': $name,'); - }); - - - - // print('parse jsonMap after size:${jsonMap.length}, jsonMap:${jsonEncode(jsonMap)}'); - // print('${jsonEncode(jsonMap)}'); -}