diff --git a/tdesign-component/example/assets/code/upload._uploadError.txt b/tdesign-component/example/assets/code/upload._uploadError.txt deleted file mode 100644 index e005583a7..000000000 --- a/tdesign-component/example/assets/code/upload._uploadError.txt +++ /dev/null @@ -1,49 +0,0 @@ - - final List files5 = [ - TDUploadFile( - key: 1, - status: TDUploadFileStatus.error, - errorText: '上传失败', - remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), - ]; - - void onVaueChanged(List fileList, List value, - TDUploadType event) { - switch (event) { - case TDUploadType.add: - setState(() { - fileList.addAll(value); - }); - break; - case TDUploadType.remove: - setState(() { - fileList.removeWhere((element) => element.key == value[0].key); - }); - break; - } - } - - void onClick(int key) { - print('点击 $key'); - } - - void onCancel() { - print('取消'); - } - - @Demo(group: 'upload') - Widget _uploadError(BuildContext context) { - return wrapDemoContainer('上传图片', - child: TDUpload( - files: files5, - multiple: true, - max: 9, - onClick: onClick, - onCancel: onCancel, - onError: print, - onValidate: print, - onChange: ((files, type) => onVaueChanged(files5, files, type)), - )); - } - \ No newline at end of file diff --git a/tdesign-component/example/assets/code/upload._uploadLoading.txt b/tdesign-component/example/assets/code/upload._uploadLoading.txt deleted file mode 100644 index 551e8194b..000000000 --- a/tdesign-component/example/assets/code/upload._uploadLoading.txt +++ /dev/null @@ -1,55 +0,0 @@ - - final List files3 = [ - TDUploadFile( - key: 1, - status: TDUploadFileStatus.loading, - loadingText: '上传中...', - remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example5.png'), - TDUploadFile( - key: 2, - status: TDUploadFileStatus.loading, - progress: 68, - remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), - ]; - - void onVaueChanged(List fileList, List value, - TDUploadType event) { - switch (event) { - case TDUploadType.add: - setState(() { - fileList.addAll(value); - }); - break; - case TDUploadType.remove: - setState(() { - fileList.removeWhere((element) => element.key == value[0].key); - }); - break; - } - } - - void onClick(int key) { - print('点击 $key'); - } - - void onCancel() { - print('取消'); - } - - @Demo(group: 'upload') - Widget _uploadLoading(BuildContext context) { - return wrapDemoContainer('上传图片', - child: TDUpload( - files: files3, - multiple: true, - max: 9, - onClick: onClick, - onCancel: onCancel, - onError: print, - onValidate: print, - onChange: ((files, type) => onVaueChanged(files3, files, type)), - )); - } - \ No newline at end of file diff --git a/tdesign-component/example/assets/code/upload._uploadMultiple.txt b/tdesign-component/example/assets/code/upload._uploadMultiple.txt deleted file mode 100644 index bb0103b8b..000000000 --- a/tdesign-component/example/assets/code/upload._uploadMultiple.txt +++ /dev/null @@ -1,55 +0,0 @@ - - final List files2 = [ - TDUploadFile( - key: 1, - remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), - TDUploadFile( - key: 2, - remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example6.png'), - TDUploadFile( - key: 3, - remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example5.png'), - ]; - - void onVaueChanged(List fileList, List value, - TDUploadType event) { - switch (event) { - case TDUploadType.add: - setState(() { - fileList.addAll(value); - }); - break; - case TDUploadType.remove: - setState(() { - fileList.removeWhere((element) => element.key == value[0].key); - }); - break; - } - } - - void onClick(int key) { - print('点击 $key'); - } - - void onCancel() { - print('取消'); - } - - @Demo(group: 'upload') - Widget _uploadMultiple(BuildContext context) { - return wrapDemoContainer('多选上传', - child: TDUpload( - files: files2, - multiple: true, - max: 9, - onClick: onClick, - onCancel: onCancel, - onError: print, - onValidate: print, - onChange: ((files, type) => onVaueChanged(files2, files, type)), - )); - } - \ No newline at end of file diff --git a/tdesign-component/example/assets/code/upload._uploadRetry.txt b/tdesign-component/example/assets/code/upload._uploadRetry.txt deleted file mode 100644 index 8da2c62f3..000000000 --- a/tdesign-component/example/assets/code/upload._uploadRetry.txt +++ /dev/null @@ -1,49 +0,0 @@ - - final List files4 = [ - TDUploadFile( - key: 1, - status: TDUploadFileStatus.retry, - retryText: '重新上传', - remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), - ]; - - void onVaueChanged(List fileList, List value, - TDUploadType event) { - switch (event) { - case TDUploadType.add: - setState(() { - fileList.addAll(value); - }); - break; - case TDUploadType.remove: - setState(() { - fileList.removeWhere((element) => element.key == value[0].key); - }); - break; - } - } - - void onClick(int key) { - print('点击 $key'); - } - - void onCancel() { - print('取消'); - } - - @Demo(group: 'upload') - Widget _uploadRetry(BuildContext context) { - return wrapDemoContainer('上传图片', - child: TDUpload( - files: files4, - multiple: true, - max: 9, - onClick: onClick, - onCancel: onCancel, - onError: print, - onValidate: print, - onChange: ((files, type) => onVaueChanged(files4, files, type)), - )); - } - \ No newline at end of file diff --git a/tdesign-component/example/assets/code/upload._uploadSingle.txt b/tdesign-component/example/assets/code/upload._uploadSingle.txt deleted file mode 100644 index 59a7f1296..000000000 --- a/tdesign-component/example/assets/code/upload._uploadSingle.txt +++ /dev/null @@ -1,39 +0,0 @@ - - final List files1 = []; - - void onVaueChanged(List fileList, List value, - TDUploadType event) { - switch (event) { - case TDUploadType.add: - setState(() { - fileList.addAll(value); - }); - break; - case TDUploadType.remove: - setState(() { - fileList.removeWhere((element) => element.key == value[0].key); - }); - break; - } - } - - void onClick(int key) { - print('点击 $key'); - } - - void onCancel() { - print('取消'); - } - - @Demo(group: 'upload') - Widget _uploadSingle(BuildContext context) { - return wrapDemoContainer('单选上传', - child: TDUpload( - files: files1, - onClick: onClick, - onCancel: onCancel, - onError: print, - onValidate: print, - onChange: ((files, type) => onVaueChanged(files1, files, type)), - )); - } diff --git a/tdesign-component/lib/src/components/cascader/td_multi_cascader.dart b/tdesign-component/lib/src/components/cascader/td_multi_cascader.dart index a9850faa9..5d77e19f7 100644 --- a/tdesign-component/lib/src/components/cascader/td_multi_cascader.dart +++ b/tdesign-component/lib/src/components/cascader/td_multi_cascader.dart @@ -361,7 +361,7 @@ class _TDMultiCascaderState extends State with TickerProviderSt _tabListData.insert(level, item); _selectTabValue = item.value; //下一级查询 - _getChildenListData(level + 1, item.value!); + _getChildrenListData(level + 1, item.value!); }); }, child: Container( @@ -422,18 +422,18 @@ class _TDMultiCascaderState extends State with TickerProviderSt setState(() {}); } - void _getChildenListData(int level, String value) { + void _getChildrenListData(int level, String value) { //查询层级数据 - List selectLevelData = _listData.where((element) => element.level == (level)).toList(); + var selectLevelData = _listData.where((element) => element.level == (level)).toList(); //判断下级是否存在 if (selectLevelData.isNotEmpty) { //获取下级数据 - List childList = + var childList = selectLevelData.where((element) => element.parentValue == value).toList(); _selectListData = childList; _currentTabIndex += 1; } else { - List result = _tabListData.where((element) => element.label != '选择选项').toList(); + var result = _tabListData.where((element) => element.label != '选择选项').toList(); widget.onChange(result); Navigator.of(context).pop(); }