diff --git a/tdesign-component/CHANGELOG.md b/tdesign-component/CHANGELOG.md index 2193faa1e..ac8a38eb3 100644 --- a/tdesign-component/CHANGELOG.md +++ b/tdesign-component/CHANGELOG.md @@ -1,3 +1,44 @@ +## 🌈 0.1.8 `2024-12-26` +### 🚀 Features +- `TDUpload`: Added Upload component @Luozf12345 ([#405](https://github.com/Tencent/tdesign-flutter/pull/405)) +- `SearchBar`: Added keyboard action type @ccXxx1aoBai ([#366](https://github.com/Tencent/tdesign-flutter/pull/366)) +- `Cell`: CellGroup added style control parameters: cardBorderRadius (card mode border radius), cardPadding (card mode padding), titlePadding (title padding) @hkaikai ([#409](https://github.com/Tencent/tdesign-flutter/pull/409)) +- `DropdownMenu`: Added decorator configuration: decoration, which can customize menu color and border @hkaikai ([#408](https://github.com/Tencent/tdesign-flutter/pull/408)) +- `ImageViewer`: Supports displaying image titles @ccXxx1aoBai ([#411](https://github.com/Tencent/tdesign-flutter/pull/411)) +- `Calendar`: Added monthTitleBuilder parameter @hkaikai ([#419](https://github.com/Tencent/tdesign-flutter/pull/419)) +- `Calendar`: Added pickerHeight, pickerItemCount parameters to control the height of the time selection component @hkaikai ([#421](https://github.com/Tencent/tdesign-flutter/pull/421)) +- `Toast`: Supports customizing the overlay background color @ccXxx1aoBai ([#423](https://github.com/Tencent/tdesign-flutter/pull/423)) +- `Rate`: Supports disabled parameter @hkaikai ([#357](https://github.com/Tencent/tdesign-flutter/pull/357)) +- `Calendar`: Modified CalendarBuilder return value to Widget @Luozf12345 ([#396](https://github.com/Tencent/tdesign-flutter/pull/396)) +- `SearchBar`: Added read-only attribute and click event @shizhe2018 ([#393](https://github.com/Tencent/tdesign-flutter/pull/393)) +- `Dialog`: TDDialogButtonOptions added font size attribute @shizhe2018 ([#381](https://github.com/Tencent/tdesign-flutter/pull/381)) +- `DateTimePicker`: Added time unit display attribute @shizhe2018 ([#383](https://github.com/Tencent/tdesign-flutter/pull/383)) +- `Input`: Added additionInfo left and right display position @shizhe2018 ([#401](https://github.com/Tencent/tdesign-flutter/pull/401)) + +### 🐞 Bug Fixes +- `NoticeBar`: Fixed the issue of abnormal text display on the web @ccXxx1aoBai ([#351](https://github.com/Tencent/tdesign-flutter/pull/351)) +- `Rate`: Fixed the issue where the onChange event was not triggered when clicking the tooltip in half selection @hkaikai ([#361](https://github.com/Tencent/tdesign-flutter/pull/361)) +- `Calendar`: Fixed the issue of inaccurate scroll position due to inconsistent number of rows in the month date @hkaikai ([#363](https://github.com/Tencent/tdesign-flutter/pull/363)) +- `Calendar`: Optimized the issue of rendering lag caused by too large min and max @hkaikai ([#363](https://github.com/Tencent/tdesign-flutter/pull/363)) +- `Input`: Fixed the issue where the dividing line and content were not aligned when setting contentPadding @epoll-j ([#365](https://github.com/Tencent/tdesign-flutter/pull/365)) +- `Table`: Fixed the issue of overflow when setting the width of fixed columns @ccXxx1aoBai ([#370](https://github.com/Tencent/tdesign-flutter/pull/370)) +- `Popup`: Fixed the issue of delay in closing when clicking on the overlay @hkaikai ([#380](https://github.com/Tencent/tdesign-flutter/pull/380)) +- `Cascader`: Added the function of clicking to select the first layer @shizhe2018 ([#355](https://github.com/Tencent/tdesign-flutter/pull/355)) +- `DateTimePicker`: Added restrictions on hours, minutes, and seconds @shizhe2018 ([#362](https://github.com/Tencent/tdesign-flutter/pull/362)) +- `Textarea`: Optimized the update of word limit changes @shizhe2018 ([#385](https://github.com/Tencent/tdesign-flutter/pull/385)) +- `TabBar`: Fixed the issue where labelStyle and unselectedLabelStyle did not take effect @shizhe2018 ([#399](https://github.com/Tencent/tdesign-flutter/pull/399)) +- `Picker`: Fixed the issue of unable to select color when sliding in multi-layer pop-up @shizhe2018 ([#413](https://github.com/Tencent/tdesign-flutter/pull/413)) +- `SearchBar`: Fixed the issue of SearchBar jittering at the default position when focusing, and the cursor not being centered @Luozf12345 ([#417](https://github.com/Tencent/tdesign-flutter/pull/417)) +- `Dialog`: Modified Dialog to only pass contentWidget, no need to pass title and content @Luozf12345 ([#418](https://github.com/Tencent/tdesign-flutter/pull/418)) +- `TDBottomTabBar`: Fixed the issue of bottom overflow by 2.5 pixels in iconText mode @epoll-j ([#422](https://github.com/Tencent/tdesign-flutter/pull/422)) + +### 🚧 Others +- Adapted to FlutterSdk3.25, the minimum supported version has been adjusted to 3.16.0 @shizhe2018 ([#378](https://github.com/Tencent/tdesign-flutter/pull/378)) +- Modified Example English version copy @shizhe2018 ([#382](https://github.com/Tencent/tdesign-flutter/pull/382)) +- Upgraded flutter_slidable version @Luozf12345 ([#407](https://github.com/Tencent/tdesign-flutter/pull/407)) +- Added component search function to demo @Luozf12345 ([#410](https://github.com/Tencent/tdesign-flutter/pull/410)) +- Updated Icons @Luozf12345 ([#420](https://github.com/Tencent/tdesign-flutter/pull/420)) + ## 🌈 0.1.7 `2024-10-16` ### 🚀 Features - `TDNoticeBar`: Added noticeBar component @ccXxx1aoBai ([#162](https://github.com/Tencent/tdesign-flutter/pull/162)) diff --git a/tdesign-component/README.md b/tdesign-component/README.md index 69875af7c..cd0b6219b 100644 --- a/tdesign-component/README.md +++ b/tdesign-component/README.md @@ -63,4 +63,8 @@ TDesign Flutter depends on the following component libraries. We appreciate the [flutter_easyrefresh](https://pub-web.flutter-io.cn/packages/easy_refresh) -[flutter_swiper](https://pub-web.flutter-io.cn/packages/flutter_swiper) \ No newline at end of file +[flutter_swiper](https://pub-web.flutter-io.cn/packages/flutter_swiper) + +[flutter_slidable](https://pub-web.flutter-io.cn/packages/flutter_slidable) + +[image_picker](https://pub-web.flutter-io.cn/packages/image_picker) \ No newline at end of file diff --git a/tdesign-component/example/assets/api/calendar_api.md b/tdesign-component/example/assets/api/calendar_api.md index 1b027660f..6e65ed621 100644 --- a/tdesign-component/example/assets/api/calendar_api.md +++ b/tdesign-component/example/assets/api/calendar_api.md @@ -48,9 +48,14 @@ | onChange | void Function(List value)? | - | 选中值变化时触发 | | onCellClick | void Function(int value, DateSelectType type, TDate tdate)? | - | 点击日期时触发 | | onCellLongPress | void Function(int value, DateSelectType type, TDate tdate)? | - | 长安日期时触发 | -| onHeanderClick | void Function(int index, String week)? | - | 点击周时触发 | +| onHeaderClick | void Function(int index, String week)? | - | 点击周时触发 | | useTimePicker | bool? | false | 是否显示时间选择器 | | timePickerModel | List? | - | 自定义时间选择器 | +| monthTitleHeight | double? | 22 | 月标题高度 | +| monthTitleBuilder | Widget Function(BuildContext context, DateTime monthDate)? | - | 月标题构建器 | +| pickerHeight | double? | 178 | 时间选择器List的视窗高度 | +| pickerItemCount | int? | 3 | 选择器List视窗中item个数,pickerHeight / pickerItemCount即item高度 | +| isTimeUnit | bool? | true | 是否显示时间单位 | ``` ``` diff --git a/tdesign-component/example/assets/api/image-viewer_api.md b/tdesign-component/example/assets/api/image-viewer_api.md index 553cfcd9b..6000440df 100644 --- a/tdesign-component/example/assets/api/image-viewer_api.md +++ b/tdesign-component/example/assets/api/image-viewer_api.md @@ -8,6 +8,7 @@ | closeBtn | bool? | - | 是否展示关闭按钮 | | deleteBtn | bool? | - | 是否显示删除操作 | | images | List | - | 图片数组 | +| labels | List? | - | 图片描述 | | showIndex | bool? | - | 是否显示页码 | | defaultIndex | int? | - | 默认预览图片所在的下标 | | onIndexChange | OnIndexChange? | - | 预览图片切换回调 | @@ -25,4 +26,4 @@ | 名称 | 返回类型 | 参数 | 说明 | | --- | --- | --- | --- | -| showImageViewer | | required BuildContext context, required List images, bool? closeBtn, bool? deleteBtn, bool? showIndex, int? defaultIndex, double? width, double? height, OnIndexChange? onIndexChange, OnClose? onClose, OnDelete? onDelete, OnLongPress? onLongPress, | 显示图片预览 | +| showImageViewer | | required BuildContext context, required List images, List? labels, bool? closeBtn, bool? deleteBtn, bool? showIndex, int? defaultIndex, double? width, double? height, OnIndexChange? onIndexChange, OnClose? onClose, OnDelete? onDelete, OnLongPress? onLongPress, | 显示图片预览 | diff --git a/tdesign-component/example/assets/api/side-bar_api.md b/tdesign-component/example/assets/api/side-bar_api.md index a7741fb57..b3334dcb3 100644 --- a/tdesign-component/example/assets/api/side-bar_api.md +++ b/tdesign-component/example/assets/api/side-bar_api.md @@ -33,3 +33,5 @@ | style | TDSideBarStyle | TDSideBarStyle.normal | 样式 | | loading | bool? | - | 加载效果 | | loadingWidget | Widget? | - | 自定义加载动画 | +| selectedBgColor | Color? | - | 选择的背景颜色 | +| unSelectedBgColor | Color? | - | 未选择的背景颜色 | diff --git a/tdesign-component/example/assets/api/tabs_api.md b/tdesign-component/example/assets/api/tabs_api.md index f3f2f3bf6..f12e8d2a0 100644 --- a/tdesign-component/example/assets/api/tabs_api.md +++ b/tdesign-component/example/assets/api/tabs_api.md @@ -50,6 +50,7 @@ | dividerHeight | double | 0.5 | 分割线高度,小于等于0则不展示分割线 | | selectedBgColor | Color? | - | 被选中背景色,只有outlineType为capsule时有效 | | unSelectedBgColor | Color? | - | 未选中背景色,只有outlineType为capsule时有效 | +| tabAlignment | | - | | ``` ``` diff --git a/tdesign-component/example/assets/api/toast_api.md b/tdesign-component/example/assets/api/toast_api.md index e67cbaa30..b7078f363 100644 --- a/tdesign-component/example/assets/api/toast_api.md +++ b/tdesign-component/example/assets/api/toast_api.md @@ -5,11 +5,11 @@ | 名称 | 返回类型 | 参数 | 说明 | | --- | --- | --- | --- | -| showText | | required String? text, required BuildContext context, Duration duration, int? maxLines, BoxConstraints? constraints, bool? preventTap, | 普通文本Toast | -| showIconText | | required String? text, IconData? icon, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 带图标的Toast | -| showSuccess | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 成功提示Toast | -| showWarning | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 警告Toast | -| showFail | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 失败提示Toast | -| showLoading | | required BuildContext context, String? text, Duration duration, bool? preventTap, | 带文案的加载Toast | -| showLoadingWithoutText | | required BuildContext context, String? text, Duration duration, bool? preventTap, | 不带文案的加载Toast | +| showText | | required String? text, required BuildContext context, Duration duration, int? maxLines, BoxConstraints? constraints, bool? preventTap, Color? backgroundColor, | 普通文本Toast | +| showIconText | | required String? text, IconData? icon, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 带图标的Toast | +| showSuccess | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 成功提示Toast | +| showWarning | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 警告Toast | +| showFail | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 失败提示Toast | +| showLoading | | required BuildContext context, String? text, Duration duration, bool? preventTap, Color? backgroundColor, | 带文案的加载Toast | +| showLoadingWithoutText | | required BuildContext context, String? text, Duration duration, bool? preventTap, Color? backgroundColor, | 不带文案的加载Toast | | dismissLoading | | | 关闭加载Toast | diff --git a/tdesign-component/example/assets/code/bottomTabBar._iconTextTypeTabBarOverflow.txt b/tdesign-component/example/assets/code/bottomTabBar._iconTextTypeTabBarOverflow.txt new file mode 100644 index 000000000..fc7f5675e --- /dev/null +++ b/tdesign-component/example/assets/code/bottomTabBar._iconTextTypeTabBarOverflow.txt @@ -0,0 +1,37 @@ + + Widget _iconTextTypeTabBarOverflow(BuildContext context) { + final selectedIcon = Icon( + TDIcons.app, + color: TDTheme.of(context).brandNormalColor, + ); + final unSelectedIcon = Icon( + TDIcons.app, + color: TDTheme.of(context).brandNormalColor, + ); + return TDBottomTabBar(TDBottomTabBarBasicType.iconText, useVerticalDivider: false, navigationTabs: [ + TDBottomTabBarTabConfig( + tabText: '标签', + selectedIcon: selectedIcon, + unselectedIcon: unSelectedIcon, + onTap: () { + onTapTab(context, '标签1'); + }, + ), + TDBottomTabBarTabConfig( + tabText: '标签', + selectedIcon: selectedIcon, + unselectedIcon: unSelectedIcon, + onTap: () { + onTapTab(context, '标签2'); + }, + ), + TDBottomTabBarTabConfig( + tabText: '标签', + selectedIcon: selectedIcon, + unselectedIcon: unSelectedIcon, + onTap: () { + onTapTab(context, '标签3'); + }, + ), + ]); + } \ No newline at end of file diff --git a/tdesign-component/example/assets/code/calendar._buildSimple.txt b/tdesign-component/example/assets/code/calendar._buildSimple.txt index bf0fd4916..e77a92521 100644 --- a/tdesign-component/example/assets/code/calendar._buildSimple.txt +++ b/tdesign-component/example/assets/code/calendar._buildSimple.txt @@ -98,6 +98,8 @@ Widget _buildSimple(BuildContext context) { value: value, height: size.height * 0.92, useTimePicker: true, + // pickerHeight: 100, + // pickerItemCount: 2, onCellClick: (value, type, tdate) { print('onCellClick:$value'); }, diff --git a/tdesign-component/example/assets/code/icon._showAllIcons.txt b/tdesign-component/example/assets/code/icon._showAllIcons.txt index 9ba3ef4a5..26d2727b5 100644 --- a/tdesign-component/example/assets/code/icon._showAllIcons.txt +++ b/tdesign-component/example/assets/code/icon._showAllIcons.txt @@ -3,32 +3,110 @@ return Container( color: Colors.white, alignment: Alignment.center, - child: Wrap( + child: Column( children: [ Container( - child: TDButton(text: showBorder? '隐藏边框':'显示边框', + padding: const EdgeInsets.only(left: 16), + alignment: Alignment.topLeft, + child: const Wrap( + children: [ + TDText('筛选Icon请前往TDesign官网(长按网址可复制):'), + SelectableText('https://tdesign.tencent.com/vue/components/icon') + ], + ), + ), + TDSearchBar( + action: '搜索', + onActionClick: (text) { + setState(() { + iconList = []; + isLoading = true; + }); + Future.delayed(const Duration(milliseconds: 30), () { + var list = []; + TDIcons.all.forEach((key, value) { + if (value.name.contains(text)) { + list.add(value); + } + }); + setState(() { + iconList = list; + isLoading = false; + }); + }); + }, + onClearClick: (_) { + setState(() { + iconList = TDIcons.all.values; + }); + }, + ), + Container( + child: TDButton( + text: showBorder ? '隐藏边框' : '显示边框', shape: TDButtonShape.filled, - onTap: (){ + onTap: () { setState(() { showBorder = !showBorder; }); - },), + }, + ), margin: const EdgeInsets.only(bottom: 16), ), - for (var iconData in TDIcons.all.values) SizedBox( - height: 100, - width: 175, - - child: Column( - children: [ - Container( - color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent, - child: Icon(iconData), - ), - TDText(iconData.name) - ], - ), - ) + Builder(builder: (context) { + if (iconList.isEmpty) { + return Container( + height: 300, + alignment: Alignment.center, + child: isLoading ? const TDText('加载中...') : const TDText('暂无内容'), + ); + } + return SizedBox( + height: MediaQuery.of(context).size.height - 150, + child: ListView.builder( + itemCount: (iconList.length + 1) ~/ 2, + itemBuilder: (context,index){ + var index1 = index ~/ 2; + var index2 = index1 + 1; + var iconData1 = iconList.elementAt(index1); + var iconData2; + if(iconList.length > index2){ + iconData2 = iconList.elementAt(index2); + } + return Row( + children: [ + SizedBox( + height: 100, + width: 175, + child: Column( + children: [ + Container( + color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent, + child: Icon(iconData1), + ), + TDText(iconData1.name) + ], + ), + ), + if (iconData2 != null) + SizedBox( + height: 100, + width: 175, + child: Column( + children: [ + Container( + color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent, + child: Icon(iconData2), + ), + TDText(iconData2.name) + ], + ), + ) + ], + ); + }), + ); + }) ], ), ); diff --git a/tdesign-component/example/assets/code/loading._buildCustomSpeedLoading.txt b/tdesign-component/example/assets/code/loading._buildCustomSpeedLoading.txt index c750bc6ba..5bafd6456 100644 --- a/tdesign-component/example/assets/code/loading._buildCustomSpeedLoading.txt +++ b/tdesign-component/example/assets/code/loading._buildCustomSpeedLoading.txt @@ -14,18 +14,20 @@ text: '加载中…', duration: _currentSliderValue.round(), ), - Slider( - value: _currentSliderValue, - max: 2000, - min: -20, - divisions: 100, - label: _currentSliderValue.round().toString(), + TDSlider(value: _currentSliderValue, + sliderThemeData: TDSliderThemeData( + context: context, + max: 2000, + min: -20, + divisions: 100, + showThumbValue: true, + scaleFormatter: (value) => value.toInt().toString(), + ), onChanged: (double value) { setState(() { _currentSliderValue = value; }); - }, - ), + },) ], ), ); diff --git a/tdesign-component/example/assets/code/sideBar._buildCustomSideBar.txt b/tdesign-component/example/assets/code/sideBar._buildCustomSideBar.txt index f73baf7b8..cf7ec593c 100644 --- a/tdesign-component/example/assets/code/sideBar._buildCustomSideBar.txt +++ b/tdesign-component/example/assets/code/sideBar._buildCustomSideBar.txt @@ -49,6 +49,8 @@ selectedTextStyle:TextStyle(color: Colors.red), onSelected: setCurrentValue, contentPadding:EdgeInsets.only(left: 16, top: 16,bottom: 16), + selectedBgColor: Colors.blue, + unSelectedBgColor: Colors.yellow, ), ), Expanded( diff --git a/tdesign-component/example/assets/code/slider._buildCapsule.txt b/tdesign-component/example/assets/code/slider._buildCapsule.txt index da45503ac..635df2d7b 100644 --- a/tdesign-component/example/assets/code/slider._buildCapsule.txt +++ b/tdesign-component/example/assets/code/slider._buildCapsule.txt @@ -4,6 +4,7 @@ children: [ TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showThumbValue: true, min: 0, max: 100, @@ -18,6 +19,7 @@ ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), @@ -31,6 +33,7 @@ ), TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), @@ -46,6 +49,7 @@ ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, showThumbValue: true, @@ -62,6 +66,7 @@ ), TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -80,6 +85,7 @@ ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showScaleValue: true, divisions: 5, min: 0, diff --git a/tdesign-component/example/assets/code/slider._buildCustomDecoration.txt b/tdesign-component/example/assets/code/slider._buildCustomDecoration.txt index d94e788d1..5fc59a55b 100644 --- a/tdesign-component/example/assets/code/slider._buildCustomDecoration.txt +++ b/tdesign-component/example/assets/code/slider._buildCustomDecoration.txt @@ -4,11 +4,12 @@ children: [ TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), value: 40, - boxDecoration: BoxDecoration( + boxDecoration: const BoxDecoration( color: Colors.amber ), // divisions: 5, @@ -19,11 +20,12 @@ ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), ), - boxDecoration: BoxDecoration( + boxDecoration: const BoxDecoration( color: Colors.deepOrangeAccent ), value: const RangeValues(20, 60), diff --git a/tdesign-component/example/assets/code/slider._buildDisable.txt b/tdesign-component/example/assets/code/slider._buildDisable.txt index 39d259234..51d09d0ed 100644 --- a/tdesign-component/example/assets/code/slider._buildDisable.txt +++ b/tdesign-component/example/assets/code/slider._buildDisable.txt @@ -4,6 +4,7 @@ children: [ TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), @@ -16,6 +17,7 @@ ), TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, showThumbValue: true, @@ -30,6 +32,7 @@ ), TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, diff --git a/tdesign-component/example/assets/code/slider._buildDoubleHandle.txt b/tdesign-component/example/assets/code/slider._buildDoubleHandle.txt index 16c1b26eb..95d4fffda 100644 --- a/tdesign-component/example/assets/code/slider._buildDoubleHandle.txt +++ b/tdesign-component/example/assets/code/slider._buildDoubleHandle.txt @@ -2,6 +2,7 @@ Widget _buildDoubleHandle(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), diff --git a/tdesign-component/example/assets/code/slider._buildDoubleHandleWithNumber.txt b/tdesign-component/example/assets/code/slider._buildDoubleHandleWithNumber.txt index a41668cb7..bffa8cada 100644 --- a/tdesign-component/example/assets/code/slider._buildDoubleHandleWithNumber.txt +++ b/tdesign-component/example/assets/code/slider._buildDoubleHandleWithNumber.txt @@ -2,6 +2,7 @@ Widget _buildDoubleHandleWithNumber(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showThumbValue: true, min: 0, max: 100, diff --git a/tdesign-component/example/assets/code/slider._buildDoubleHandleWithScale.txt b/tdesign-component/example/assets/code/slider._buildDoubleHandleWithScale.txt index f8dbfd960..0d948f3b6 100644 --- a/tdesign-component/example/assets/code/slider._buildDoubleHandleWithScale.txt +++ b/tdesign-component/example/assets/code/slider._buildDoubleHandleWithScale.txt @@ -2,6 +2,7 @@ Widget _buildDoubleHandleWithScale(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, diff --git a/tdesign-component/example/assets/code/slider._buildSingleHandle.txt b/tdesign-component/example/assets/code/slider._buildSingleHandle.txt index 519f70a3a..c95daa446 100644 --- a/tdesign-component/example/assets/code/slider._buildSingleHandle.txt +++ b/tdesign-component/example/assets/code/slider._buildSingleHandle.txt @@ -2,6 +2,7 @@ Widget _buildSingleHandle(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), diff --git a/tdesign-component/example/assets/code/slider._buildSingleHandleWithNumber.txt b/tdesign-component/example/assets/code/slider._buildSingleHandleWithNumber.txt index f44f76611..60dde983b 100644 --- a/tdesign-component/example/assets/code/slider._buildSingleHandleWithNumber.txt +++ b/tdesign-component/example/assets/code/slider._buildSingleHandleWithNumber.txt @@ -2,6 +2,7 @@ Widget _buildSingleHandleWithNumber(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, showThumbValue: true, scaleFormatter: (value) => value.toInt().toString(), min: 0, diff --git a/tdesign-component/example/assets/code/slider._buildSingleHandleWithScale.txt b/tdesign-component/example/assets/code/slider._buildSingleHandleWithScale.txt index 92fced37f..8bc12ee62 100644 --- a/tdesign-component/example/assets/code/slider._buildSingleHandleWithScale.txt +++ b/tdesign-component/example/assets/code/slider._buildSingleHandleWithScale.txt @@ -2,6 +2,7 @@ Widget _buildSingleHandleWithScale(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, diff --git a/tdesign-component/example/assets/code/toast._preventTapToast.txt b/tdesign-component/example/assets/code/toast._preventTapToast.txt index 755b3ccae..ec34e51f7 100644 --- a/tdesign-component/example/assets/code/toast._preventTapToast.txt +++ b/tdesign-component/example/assets/code/toast._preventTapToast.txt @@ -3,7 +3,9 @@ return TDButton( onTap: () { TDToast.showText('轻提示文字内容', - context: context, preventTap: true); + context: context, + preventTap: true, + backgroundColor: Colors.black.withOpacity(0.7)); }, size: TDButtonSize.large, type: TDButtonType.outline, diff --git a/tdesign-component/example/lib/home.dart b/tdesign-component/example/lib/home.dart index 258f7a0dc..857378447 100644 --- a/tdesign-component/example/lib/home.dart +++ b/tdesign-component/example/lib/home.dart @@ -36,6 +36,7 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { bool useConch = false; String searchText = ''; + FocusNode focusNode = FocusNode(); @override void initState() { @@ -95,6 +96,7 @@ class _MyHomePageState extends State { ), ), onTap: () { + focusNode.unfocus(); Navigator.pushNamed(context, TDExampleRoute.aboutPath); }, ) @@ -164,6 +166,7 @@ class _MyHomePageState extends State { children.add(TDSearchBar( placeHolder: '请输入组件名称', + focusNode: focusNode, onTextChanged: (value){ setState(() { searchText = value; @@ -215,6 +218,7 @@ class _MyHomePageState extends State { shape: TDButtonShape.filled, theme: TDButtonTheme.primary, onTap: () { + focusNode.unfocus(); Navigator.pushNamed(context, '${model.name}?showAction=1'); }, text: model.text), diff --git a/tdesign-component/example/lib/l10n/app_en.arb b/tdesign-component/example/lib/l10n/app_en.arb index 15590492d..64021d786 100644 --- a/tdesign-component/example/lib/l10n/app_en.arb +++ b/tdesign-component/example/lib/l10n/app_en.arb @@ -4,17 +4,17 @@ "defaultTheme": "defaultTheme", "greenTheme": "greenTheme", "redTheme": "redTheme", - "cancel": "cancel", - "confirm": "confirm", + "cancel": "Cancel", + "confirm": "Confirm", "switchClose": "C", "switchOpen": "O", - "knew": "knew", - "loading": "loading", - "loadingWithPoint": "loading...", - "other": "other", - "refreshing": "refreshing", - "releaseRefresh": "releaseRefresh", - "reset": "reset", + "knew": "Knew", + "loading": "Loading", + "loadingWithPoint": "Loading...", + "other": "Other", + "refreshing": "Refreshing", + "releaseRefresh": "ReleaseRefresh", + "reset": "Reset", "days": "days", "hours": "hours", "minutes": "minutes", diff --git a/tdesign-component/example/lib/page/sidebar/td_sidebar_page_custom.dart b/tdesign-component/example/lib/page/sidebar/td_sidebar_page_custom.dart index e1eb55523..df01f0b8e 100644 --- a/tdesign-component/example/lib/page/sidebar/td_sidebar_page_custom.dart +++ b/tdesign-component/example/lib/page/sidebar/td_sidebar_page_custom.dart @@ -89,6 +89,8 @@ class TDSideBarCustomPageState extends State { selectedTextStyle:TextStyle(color: Colors.red), onSelected: setCurrentValue, contentPadding:EdgeInsets.only(left: 16, top: 16,bottom: 16), + selectedBgColor: Colors.blue, + unSelectedBgColor: Colors.yellow, ), ), Expanded( diff --git a/tdesign-component/example/lib/page/td_icon_page.dart b/tdesign-component/example/lib/page/td_icon_page.dart index a7b0918fd..dc92ecd77 100644 --- a/tdesign-component/example/lib/page/td_icon_page.dart +++ b/tdesign-component/example/lib/page/td_icon_page.dart @@ -14,20 +14,15 @@ class TDIconPage extends StatefulWidget { class _TDIconPageState extends State { bool showBorder = false; - var iconList = []; + dynamic iconList = []; - var isLoading = true; + var isLoading = false; @override void initState() { super.initState(); - Future.delayed(const Duration(milliseconds: 500), () { - setState(() { - iconList.addAll(TDIcons.all.values); - isLoading = false; - }); - }); + iconList = TDIcons.all.values; } @override @@ -63,20 +58,25 @@ class _TDIconPageState extends State { action: '搜索', onActionClick: (text) { setState(() { - iconList.clear(); + iconList = []; + isLoading = true; }); Future.delayed(const Duration(milliseconds: 30), () { + var list = []; TDIcons.all.forEach((key, value) { if (value.name.contains(text)) { - iconList.add(value); + list.add(value); } }); - setState(() {}); + setState(() { + iconList = list; + isLoading = false; + }); }); }, onClearClick: (_) { setState(() { - iconList.addAll(TDIcons.all.values); + iconList = TDIcons.all.values; }); }, ), @@ -97,26 +97,53 @@ class _TDIconPageState extends State { return Container( height: 300, alignment: Alignment.center, - child: isLoading ? const TDLoading(size: TDLoadingSize.medium) : const TDText("暂无内容"), + child: isLoading ? const TDText('加载中...') : const TDText('暂无内容'), ); } - return Wrap( - children: [ - for (var iconData in iconList) - SizedBox( - height: 100, - width: 175, - child: Column( + return SizedBox( + height: MediaQuery.of(context).size.height - 150, + child: ListView.builder( + itemCount: (iconList.length + 1) ~/ 2, + itemBuilder: (context,index){ + var index1 = index ~/ 2; + var index2 = index1 + 1; + var iconData1 = iconList.elementAt(index1); + var iconData2; + if(iconList.length > index2){ + iconData2 = iconList.elementAt(index2); + } + return Row( children: [ - Container( - color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent, - child: Icon(iconData), + SizedBox( + height: 100, + width: 175, + child: Column( + children: [ + Container( + color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent, + child: Icon(iconData1), + ), + TDText(iconData1.name) + ], + ), ), - TDText(iconData.name) + if (iconData2 != null) + SizedBox( + height: 100, + width: 175, + child: Column( + children: [ + Container( + color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent, + child: Icon(iconData2), + ), + TDText(iconData2.name) + ], + ), + ) ], - ), - ) - ], + ); + }), ); }) ], diff --git a/tdesign-component/example/lib/page/td_loading_page.dart b/tdesign-component/example/lib/page/td_loading_page.dart index 4933a05bc..b04fa1ed7 100644 --- a/tdesign-component/example/lib/page/td_loading_page.dart +++ b/tdesign-component/example/lib/page/td_loading_page.dart @@ -303,18 +303,20 @@ class _TDLoadingPageState extends State { text: '加载中…', duration: _currentSliderValue.round(), ), - Slider( - value: _currentSliderValue, - max: 2000, - min: -20, - divisions: 100, - label: _currentSliderValue.round().toString(), + TDSlider(value: _currentSliderValue, + sliderThemeData: TDSliderThemeData( + context: context, + max: 2000, + min: -20, + divisions: 100, + showThumbValue: true, + scaleFormatter: (value) => value.toInt().toString(), + ), onChanged: (double value) { setState(() { _currentSliderValue = value; }); - }, - ), + },) ], ), ); diff --git a/tdesign-component/example/lib/page/td_slider_page.dart b/tdesign-component/example/lib/page/td_slider_page.dart index 0f580ed2e..cddb3959f 100644 --- a/tdesign-component/example/lib/page/td_slider_page.dart +++ b/tdesign-component/example/lib/page/td_slider_page.dart @@ -45,6 +45,7 @@ class _TDSliderPageState extends State { Widget _buildSingleHandle(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), @@ -58,6 +59,7 @@ class _TDSliderPageState extends State { Widget _buildDoubleHandle(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), @@ -71,6 +73,7 @@ class _TDSliderPageState extends State { Widget _buildSingleHandleWithNumber(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, showThumbValue: true, scaleFormatter: (value) => value.toInt().toString(), min: 0, @@ -88,6 +91,7 @@ class _TDSliderPageState extends State { Widget _buildDoubleHandleWithNumber(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showThumbValue: true, min: 0, max: 100, @@ -105,6 +109,7 @@ class _TDSliderPageState extends State { Widget _buildSingleHandleWithScale(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -121,6 +126,7 @@ class _TDSliderPageState extends State { Widget _buildDoubleHandleWithScale(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -139,6 +145,7 @@ class _TDSliderPageState extends State { children: [ TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), @@ -151,6 +158,7 @@ class _TDSliderPageState extends State { ), TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, showThumbValue: true, @@ -165,6 +173,7 @@ class _TDSliderPageState extends State { ), TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -183,6 +192,7 @@ class _TDSliderPageState extends State { children: [ TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showThumbValue: true, min: 0, max: 100, @@ -197,6 +207,7 @@ class _TDSliderPageState extends State { ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), @@ -210,6 +221,7 @@ class _TDSliderPageState extends State { ), TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), @@ -225,6 +237,7 @@ class _TDSliderPageState extends State { ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, showThumbValue: true, @@ -241,6 +254,7 @@ class _TDSliderPageState extends State { ), TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -259,6 +273,7 @@ class _TDSliderPageState extends State { ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -284,11 +299,12 @@ class _TDSliderPageState extends State { children: [ TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), value: 40, - boxDecoration: BoxDecoration( + boxDecoration: const BoxDecoration( color: Colors.amber ), // divisions: 5, @@ -299,11 +315,12 @@ class _TDSliderPageState extends State { ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), ), - boxDecoration: BoxDecoration( + boxDecoration: const BoxDecoration( color: Colors.deepOrangeAccent ), value: const RangeValues(20, 60), diff --git a/tdesign-component/example/lib/page/td_upload_page.dart b/tdesign-component/example/lib/page/td_upload_page.dart index e60f948f8..3c8693a73 100644 --- a/tdesign-component/example/lib/page/td_upload_page.dart +++ b/tdesign-component/example/lib/page/td_upload_page.dart @@ -17,15 +17,15 @@ class TDUploadState extends State { TDUploadFile( key: 1, remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), + 'https://tdesign.gtimg.com/demo/images/example1.png'), TDUploadFile( key: 2, remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example6.png'), + 'https://tdesign.gtimg.com/demo/images/example2.png'), TDUploadFile( key: 3, remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example5.png'), + 'https://tdesign.gtimg.com/demo/images/example3.png'), ]; final List files3 = [ TDUploadFile( @@ -33,13 +33,13 @@ class TDUploadState extends State { status: TDUploadFileStatus.loading, loadingText: '上传中...', remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example5.png'), + 'https://tdesign.gtimg.com/demo/images/example1.png'), TDUploadFile( key: 2, status: TDUploadFileStatus.loading, progress: 68, remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), + 'https://tdesign.gtimg.com/demo/images/example1.png'), ]; final List files4 = [ TDUploadFile( @@ -47,7 +47,7 @@ class TDUploadState extends State { status: TDUploadFileStatus.retry, retryText: '重新上传', remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), + 'https://tdesign.gtimg.com/demo/images/example1.png'), ]; final List files5 = [ TDUploadFile( @@ -55,7 +55,7 @@ class TDUploadState extends State { status: TDUploadFileStatus.error, errorText: '上传失败', remotePath: - 'https://tdesign.gtimg.com/miniprogram/images/example4.png'), + 'https://tdesign.gtimg.com/demo/images/example4.png'), ]; void onValueChanged(List fileList, List value, @@ -87,7 +87,7 @@ class TDUploadState extends State { return ExamplePage( title: tdTitle(), exampleCodeGroup: 'upload', - desc: '上传组件', + desc: '用于相册读取或拉起拍照的图片上传功能。${PlatformUtil.isWeb ? "Web端不支持读取本地图片,请前往移动端体验。" : ""}', children: [ ExampleModule( title: '组件类型', diff --git a/tdesign-component/example/pubspec.lock b/tdesign-component/example/pubspec.lock index 6f26bd54d..335dc17cd 100644 --- a/tdesign-component/example/pubspec.lock +++ b/tdesign-component/example/pubspec.lock @@ -434,5 +434,5 @@ packages: source: hosted version: "0.3.0" sdks: - dart: ">=3.2.3 <4.0.0" + dart: ">=3.2.6 <4.0.0" flutter: ">=3.16.6" diff --git a/tdesign-component/example/pubspec.yaml b/tdesign-component/example/pubspec.yaml index 29352033d..f794b07eb 100644 --- a/tdesign-component/example/pubspec.yaml +++ b/tdesign-component/example/pubspec.yaml @@ -18,7 +18,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.19.0 <4.0.0" + sdk: ">=3.2.6 <4.0.0" + flutter: ">=3.16.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/tdesign-component/example/test/widget_test.dart b/tdesign-component/example/test/widget_test.dart index 577557407..7e347f283 100644 --- a/tdesign-component/example/test/widget_test.dart +++ b/tdesign-component/example/test/widget_test.dart @@ -17,38 +17,42 @@ import 'package:tdesign_flutter_example/main.dart'; void main() async { - testWidgets('Counter increments smoke testeee', (WidgetTester tester) async { - - WebMdTool.needGenerateWebMd = true; - - await tester.pumpWidget(const MyApp()); - for(var i =0 ;i < exampleMap.length; i++){ - var value = exampleMap.values.elementAt(i); - for(var j =0 ;j < value.length; j++){ - var model = value.elementAt(j); - if (!model.isTodo) { - if(model.text == '颜色'){ - // 测试结束 - throw Exception('<===============执行完成!!!!=================>'); - } - await _testComponent(tester, model.text); - } + testWidgets('Counter increments smoke testeee', (WidgetTester tester) async { + + WebMdTool.needGenerateWebMd = true; + + await tester.pumpWidget(const MyApp()); + exampleMap.forEach((key, value) { + value.forEach((model) { + if (!model.isTodo) { + examplePageList.add(model); } - count++; + }); + }); + for(var element in examplePageList){ + // Build our app and trigger a frame. + if(element.text == '颜色'){ + // 测试结束 + break; } + await _testComponent(tester, element.text); + } + // throw Exception('<===============执行完成!!!!=================>'); - }); + }); } +var changeList = ['BackTop 返回顶部','Steps 步骤条','Calendar 日历','Radio 单选框','Switch 开关','Upload 上传','Empty 空状态','Result 结果','DropdownMenu 下拉菜单','Swipecell 滑动操作']; Finder? lastFinder; int count = 0; Future _testComponent(WidgetTester tester, String name) async { - print('\n\n当前组件==============>:$name'); - count++; - if(count % 5 == 0 && lastFinder != null){ + print('\n\n当前组件==============>:$name, 滑动count:$count'); + + if(changeList.contains(name) && lastFinder != null){ + count++; await tester.fling(lastFinder!, const Offset(0, -300), 2); try { await tester.pumpAndSettle(); @@ -59,16 +63,16 @@ Future _testComponent(WidgetTester tester, String name) async { var button = find.text(name); - expect(button, findsOneWidget); - lastFinder = button; + expect(button, findsOneWidget); + lastFinder = button; - await tester.tap(button); - await tester.pump(); - await tester.pump(); - await tester.pump(); - await tester.pump(); - await tester.pump(); - var page = find.text('WebGenTag'); + await tester.tap(button); + await tester.pump(); + await tester.pump(); + await tester.pump(); + await tester.pump(); + await tester.pump(); + var page = find.text('WebGenTag'); try { expect(page, findsOneWidget); @@ -76,10 +80,10 @@ Future _testComponent(WidgetTester tester, String name) async { await tester.fling(page, const Offset(0, -20000), 2); try { - await tester.pumpAndSettle(); - } catch (e) { - print('pumpAndSettle 2 error:$e'); - } + await tester.pumpAndSettle(); + } catch (e) { + print('pumpAndSettle 2 error:$e'); + } } catch (e) { print("没有找到'WebGenTag',不用滑动,直接点击"); } diff --git a/tdesign-component/lib/src/components/calendar/td_calendar.dart b/tdesign-component/lib/src/components/calendar/td_calendar.dart index e49cd94cc..054cdf25d 100644 --- a/tdesign-component/lib/src/components/calendar/td_calendar.dart +++ b/tdesign-component/lib/src/components/calendar/td_calendar.dart @@ -124,7 +124,9 @@ class TDCalendar extends StatefulWidget { return DateTime(date.year, date.month, date.day); }).toList(); - List? get _valueTime => value?.map(DateTime.fromMillisecondsSinceEpoch).toList(); + List? get _valueTime => value?.map((item) { + return DateTime.fromMillisecondsSinceEpoch(item); + }).toList(); @override _TDCalendarState createState() => _TDCalendarState(); @@ -323,7 +325,7 @@ class _TDCalendarState extends State { } List _getValue(List value) { - final dateValue = value.map((e) { + var dateValue = value.map((e) { final date = DateTime.fromMillisecondsSinceEpoch(e); return DateTime(date.year, date.month, date.day).millisecondsSinceEpoch; }).toList(); @@ -336,6 +338,9 @@ class _TDCalendarState extends State { final second = model.useSecond ? model.secondFixedExtentScrollController.selectedItem : 0; return (hour * 60 * 60 + minute * 60 + second) * 1000; }).toList(); + if (widget.type == CalendarType.range && dateValue.length == 1) { + dateValue.add(dateValue.first); + } return dateValue.mapWidthIndex((e, index) { if (widget.type != CalendarType.range) { return e + (milliseconds.getOrNull(0) ?? 0); diff --git a/tdesign-component/lib/src/components/sidebar/td_sidebar.dart b/tdesign-component/lib/src/components/sidebar/td_sidebar.dart index 50fc67355..ac3128104 100644 --- a/tdesign-component/lib/src/components/sidebar/td_sidebar.dart +++ b/tdesign-component/lib/src/components/sidebar/td_sidebar.dart @@ -43,6 +43,8 @@ class TDSideBar extends StatefulWidget { this.style = TDSideBarStyle.normal, this.loading, this.loadingWidget, + this.selectedBgColor, + this.unSelectedBgColor, }) : super(key: key); /// 选项值 @@ -84,6 +86,12 @@ class TDSideBar extends StatefulWidget { /// 自定义加载动画 final Widget? loadingWidget; + /// 选择的背景颜色 + final Color? selectedBgColor; + + /// 未选择的背景颜色 + final Color? unSelectedBgColor; + @override State createState() => _TDSideBarState(); } @@ -280,6 +288,8 @@ class _TDSideBarState extends State { currentIndex! + 1 == ele.index, bottomAdjacent: currentIndex != null && currentIndex! - 1 == ele.index, + selectedBgColor: widget.selectedBgColor, + unSelectedBgColor: widget.unSelectedBgColor, onTap: () { if (!(ele.disabled ?? false)) { onSelect(ele, isController: false); diff --git a/tdesign-component/lib/src/components/sidebar/td_wrap_sidebar_item.dart b/tdesign-component/lib/src/components/sidebar/td_wrap_sidebar_item.dart index bf5b46072..2277aabe0 100644 --- a/tdesign-component/lib/src/components/sidebar/td_wrap_sidebar_item.dart +++ b/tdesign-component/lib/src/components/sidebar/td_wrap_sidebar_item.dart @@ -21,6 +21,8 @@ class TDWrapSideBarItem extends StatelessWidget { this.topAdjacent = false, this.bottomAdjacent = false, this.onTap, + this.selectedBgColor, + this.unSelectedBgColor, required this.style, }) : super(key: key); @@ -34,6 +36,8 @@ class TDWrapSideBarItem extends StatelessWidget { final int value; final bool selected; final Color? selectedColor; + final Color? selectedBgColor; + final Color? unSelectedBgColor; final bool topAdjacent; final bool bottomAdjacent; final VoidCallback? onTap; @@ -51,18 +55,20 @@ class TDWrapSideBarItem extends StatelessWidget { Widget renderNormalItem(BuildContext context) { return Container( decoration: BoxDecoration( - color: Colors.white, + color: selectedBgColor ?? Colors.white, ), - child:Container( - decoration: BoxDecoration( - color: selected ? Colors.white : const Color.fromRGBO(243, 243, 243, 1), - borderRadius: bottomAdjacent || topAdjacent - ? bottomAdjacent - ? const BorderRadius.only(bottomRight: Radius.circular(9)) - : const BorderRadius.only(topRight: Radius.circular(9)) - : null), - child: Row( - children: [ + child: Container( + decoration: BoxDecoration( + color: selected + ? (selectedBgColor ?? Colors.white) + : (unSelectedBgColor ?? const Color.fromRGBO(243, 243, 243, 1)), + borderRadius: bottomAdjacent || topAdjacent + ? bottomAdjacent + ? const BorderRadius.only(bottomRight: Radius.circular(9)) + : const BorderRadius.only(topRight: Radius.circular(9)) + : null), + child: Row( + children: [ renderPreLine(context), Expanded( child: Padding( diff --git a/tdesign-component/lib/src/components/slider/td_slider.dart b/tdesign-component/lib/src/components/slider/td_slider.dart index bac7c899d..25a2f70b3 100644 --- a/tdesign-component/lib/src/components/slider/td_slider.dart +++ b/tdesign-component/lib/src/components/slider/td_slider.dart @@ -91,7 +91,7 @@ class TDSliderState extends State { bottom: 8, ), decoration: widget.boxDecoration ?? - BoxDecoration( + const BoxDecoration( color: Colors.white, ), child: Row( @@ -217,7 +217,7 @@ class _TDRangeSliderState extends State { bottom: 8, ), decoration: widget.boxDecoration ?? - BoxDecoration( + const BoxDecoration( color: Colors.white, ), child: Row( diff --git a/tdesign-component/lib/src/components/tree/td_tree_select.dart b/tdesign-component/lib/src/components/tree/td_tree_select.dart index 4489ae5ac..62dd18db8 100644 --- a/tdesign-component/lib/src/components/tree/td_tree_select.dart +++ b/tdesign-component/lib/src/components/tree/td_tree_select.dart @@ -281,7 +281,7 @@ class _TDTreeSelectState extends State { child: TDText( displayOptions[index].label, textColor: (!lastColumn && selected) - ? const Color.fromRGBO(0, 82, 217, 1) + ? TDTheme.of(context).brandNormalColor : const Color.fromRGBO(0, 0, 0, 0.9), style: TextStyle( fontSize: 16, @@ -292,14 +292,14 @@ class _TDTreeSelectState extends State { ), Visibility( visible: lastColumn && selected, - child: const SizedBox( + child: SizedBox( width: 56, height: 56, child: Padding( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Icon( TDIcons.check, - color: Color.fromRGBO(0, 82, 217, 1), + color: TDTheme.of(context).brandNormalColor, ), ), )) diff --git a/tdesign-component/lib/src/components/upload/td_upload.dart b/tdesign-component/lib/src/components/upload/td_upload.dart index fbd489989..6c5368c77 100644 --- a/tdesign-component/lib/src/components/upload/td_upload.dart +++ b/tdesign-component/lib/src/components/upload/td_upload.dart @@ -277,7 +277,8 @@ class _TDUploadState extends State { width: 80, height: 80, imgUrl: file.remotePath, - assetUrl: file.assetPath, + // assetUrl: file.assetPath, + imageFile: file.file, ), Visibility(visible: file.status != TDUploadFileStatus.success, child: _buildShadowBox(file)), Visibility( diff --git a/tdesign-component/lib/src/theme/td_theme.dart b/tdesign-component/lib/src/theme/td_theme.dart index 135bb852a..9747088b9 100644 --- a/tdesign-component/lib/src/theme/td_theme.dart +++ b/tdesign-component/lib/src/theme/td_theme.dart @@ -1,6 +1,6 @@ -import 'dart:collection'; import 'dart:convert'; +import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import '../../tdesign_flutter.dart'; @@ -354,11 +354,10 @@ abstract class TDExtraThemeData { typedef DefaultMapFactory = TDMap? Function(); /// 自定义Map -class TDMap extends SplayTreeMap{ - - TDMap({this.factory, this.refs}); -DefaultMapFactory? factory; -TDMap? refs; +class TDMap extends DelegatingMap{ + TDMap({this.factory, this.refs}) : super({}); + DefaultMapFactory? factory; + TDMap? refs; @override V? operator [](Object? key) { diff --git a/tdesign-component/pubspec.lock b/tdesign-component/pubspec.lock index 941359bce..02743ed95 100644 --- a/tdesign-component/pubspec.lock +++ b/tdesign-component/pubspec.lock @@ -358,5 +358,5 @@ packages: source: hosted version: "0.3.0" sdks: - dart: ">=3.2.3 <4.0.0" + dart: ">=3.2.6 <4.0.0" flutter: ">=3.16.6" diff --git a/tdesign-component/pubspec.yaml b/tdesign-component/pubspec.yaml index f815b942d..7c96ea876 100644 --- a/tdesign-component/pubspec.yaml +++ b/tdesign-component/pubspec.yaml @@ -1,11 +1,11 @@ name: tdesign_flutter description: Tencent TDesign UI component library of Flutter, suitable for use in mobile projects. -version: 0.1.7 +version: 0.1.8 homepage: https://github.com/Tencent/tdesign-flutter environment: - sdk: ">=2.19.0 <4.0.0" - flutter: ">=3.7.0" + sdk: ">=3.2.6 <4.0.0" + flutter: ">=3.16.0" dependencies: flutter: diff --git a/tdesign-site/CHANGELOG.md b/tdesign-site/CHANGELOG.md index 5a2b8faa8..7ced0bdad 100644 --- a/tdesign-site/CHANGELOG.md +++ b/tdesign-site/CHANGELOG.md @@ -6,6 +6,46 @@ docClass: timeline --- +## 🌈 0.1.8 `2024-12-26` +### 🚀 Features +- `TDUpload`: 新增Upload组件 @Luozf12345 ([#405](https://github.com/Tencent/tdesign-flutter/pull/405)) +- `SearchBar`: 增加键盘动作类型 @ccXxx1aoBai ([#366](https://github.com/Tencent/tdesign-flutter/pull/366)) +- `Cell`: CellGroup 新增样式控制参数:cardBorderRadius(卡片模式边框圆角)、cardPadding(卡片模式内边距)、titlePadding(标题内边距) @hkaikai ([#409](https://github.com/Tencent/tdesign-flutter/pull/409)) +- `DropdownMenu`: 新增装饰器配置:decoration,可自定义菜单颜色和边框 @hkaikai ([#408](https://github.com/Tencent/tdesign-flutter/pull/408)) +- `ImageViewer`: 支持显示图片标题 @ccXxx1aoBai ([#411](https://github.com/Tencent/tdesign-flutter/pull/411)) +- `Calendar`: 新增monthTitleBuilder参数 @hkaikai ([#419](https://github.com/Tencent/tdesign-flutter/pull/419)) +- `Calendar`: 新增pickerHeight、pickerItemCount参数,用于控制时间选择组件高度 @hkaikai ([#421](https://github.com/Tencent/tdesign-flutter/pull/421)) +- `Toast`: 支持自定义蒙层背景色 @ccXxx1aoBai ([#423](https://github.com/Tencent/tdesign-flutter/pull/423)) +- `Rate`: 支持disabeld 参数 @hkaikai ([#357](https://github.com/Tencent/tdesign-flutter/pull/357)) +- `Calendar`: 修改CalendarBuilder返回值为Widget @Luozf12345 ([#396](https://github.com/Tencent/tdesign-flutter/pull/396)) +- `SearchBar`: 新增只读属性与点击事件 @shizhe2018 ([#393](https://github.com/Tencent/tdesign-flutter/pull/393)) +- `Dialog`: TDDialogButtonOptions新增属性字体大小 @shizhe2018 ([#381](https://github.com/Tencent/tdesign-flutter/pull/381)) +- `DateTimePicker`: 新增时间单位显示属性 @shizhe2018 ([#383](https://github.com/Tencent/tdesign-flutter/pull/383)) +- `Input`: 新增additionInfo 左右显示位置 @shizhe2018 ([#401](https://github.com/Tencent/tdesign-flutter/pull/401)) +### 🐞 Bug Fixes +- `NoticeBar`: 解决web端文字显示异常问题 @ccXxx1aoBai ([#351](https://github.com/Tencent/tdesign-flutter/pull/351)) +- `Rate`: 修复半选时,点击提示框没有触发onChange事件的问题 @hkaikai ([#361](https://github.com/Tencent/tdesign-flutter/pull/361)) +- `Calendar`: 修复因月份日期行数不一致导致回显滚动位置不准确问题 @hkaikai ([#363](https://github.com/Tencent/tdesign-flutter/pull/363)) +- `Calendar`: 优化min、max过大导致渲染卡顿问题 @hkaikai ([#363](https://github.com/Tencent/tdesign-flutter/pull/363)) +- `Input`: 修复设置contentPadding时分割线与内容没对齐问题 @epoll-j ([#365](https://github.com/Tencent/tdesign-flutter/pull/365)) +- `Table`: 解决固定列设置宽度溢出问题 @ccXxx1aoBai ([#370](https://github.com/Tencent/tdesign-flutter/pull/370)) +- `Popup`: 修复点击蒙层关闭延迟问题 @hkaikai ([#380](https://github.com/Tencent/tdesign-flutter/pull/380)) +- `Cascader`: 新增第一层点击选择功能 @shizhe2018 ([#355](https://github.com/Tencent/tdesign-flutter/pull/355)) +- `DateTimePicker`: 新增限制时分秒 @shizhe2018 ([#362](https://github.com/Tencent/tdesign-flutter/pull/362)) +- `Textarea`: 优化字数限制变化更新 @shizhe2018 ([#385](https://github.com/Tencent/tdesign-flutter/pull/385)) +- `TabBar`: 修复labelStyle和unselectedLabelStyle 不生效的问题 @shizhe2018 ([#399](https://github.com/Tencent/tdesign-flutter/pull/399)) +- `Picker`: 修改多层弹框,滑动无法选择颜色问题 @shizhe2018 ([#413](https://github.com/Tencent/tdesign-flutter/pull/413)) +- `SearchBar`: 修复SearchBar聚集时默认位置抖动,以及光标未居中的问题 @Luozf12345 ([#417](https://github.com/Tencent/tdesign-flutter/pull/417)) +- `Dialog`: 修改Dialog可以只传contentWidget,不用传title和content @Luozf12345 ([#418](https://github.com/Tencent/tdesign-flutter/pull/418)) +- `TDBottomTabBar`: 修复iconText模式,底部溢出2.5像素 @epoll-j ([#422](https://github.com/Tencent/tdesign-flutter/pull/422)) +### 🚧 Others +- 适配FlutterSdk3.25,最低支持版本调整为3.16.0 @shizhe2018 ([#378](https://github.com/Tencent/tdesign-flutter/pull/378)) +- 修改Example英文版文案 @shizhe2018 ([#382](https://github.com/Tencent/tdesign-flutter/pull/382)) +- 升级flutter_slidable版本 @Luozf12345 ([#407](https://github.com/Tencent/tdesign-flutter/pull/407)) +- demo增加组件搜索功能 @Luozf12345 ([#410](https://github.com/Tencent/tdesign-flutter/pull/410)) +- 更新Icons @Luozf12345 ([#420](https://github.com/Tencent/tdesign-flutter/pull/420)) + + ## 🌈 0.1.7 `2024-10-16` ### 🚀 Features - `TDNoticeBar`: 新增noticeBar组件 @ccXxx1aoBai ([#162](https://github.com/Tencent/tdesign-flutter/pull/162)) diff --git a/tdesign-site/CONTRIBUTING.md b/tdesign-site/CONTRIBUTING.md index c0fbf40f2..18dbf8efe 100644 --- a/tdesign-site/CONTRIBUTING.md +++ b/tdesign-site/CONTRIBUTING.md @@ -25,7 +25,7 @@ spline: explain - 实现组件:组件中的属性请尽量使用TDTheme提供的公共属性,使用方法参考'主题-颜色'页面 - 编写示例页:示例页请尽量使用ExamplePage+ExampleModule+ExampleItem组合,参考示例稿布局实现。 - 演示代码:每个组件示例,尽量将原子性代码提取成独立方法,并添加@Demo注解,方便生成演示代码。其中,@Demo注解的'group'参数需与ExamplePage的'exampleCodeGroup'参数一致。写法请参考'圆角-基础'页。 -- flutterAOP: 如果可以,建议切换到flutter 3.10.0分支,并添加AOP补丁,生成演示代码。 +- flutter SDK: 如果可以,建议切换到flutter 3.16.9分支开发。 - API文档:API文档由工具统一生成,请尽量添加字段的详细注释,并将构造方法作为类名下的第一个方法,字段放在构造方法之下,具体写法请参考TDText。 - 代码规范:开发完成后,请检查'Dart Analysis'下的提示,尽量符合代码规范。 - 单元测试:添加未在示例稿中体现,但有必要验证的组件样式,请添加到ExamplePage的'test'参数中。 @@ -37,8 +37,14 @@ spline: explain - 代码规范(兼容指定的最低版本SDK) - API验收 +### Flutter基础知识 +- Flutter基础介绍:https://book.flutterchina.club/chapter1/flutter_intro.html +- Dart语言介绍:https://book.flutterchina.club/chapter1/dart.html +- 搭建Flutter开发环境:https://book.flutterchina.club/chapter1/install_flutter.html +- 计数器应用示例:https://book.flutterchina.club/chapter2/first_flutter_app.html + ## SDK依赖版本 -dart: ">=2.19.0 <4.0.0" +dart: ">=3.2.6 <4.0.0" -flutter: ">=3.7.0" +flutter: ">=3.16.0" diff --git a/tdesign-site/site/docs/getting-started.md b/tdesign-site/site/docs/getting-started.md index b8a1fdabc..b3f1698a0 100644 --- a/tdesign-site/site/docs/getting-started.md +++ b/tdesign-site/site/docs/getting-started.md @@ -10,7 +10,7 @@ TDesign Flutter组件示例应用
Android请扫码下载预览 ↓
- +
iOS请运行项目预览 ↓
@@ -159,7 +159,7 @@ class IntlResourceDelegate extends TDResourceDelegate { - 开发中组件: ActionSheet,Progress,Footer,Message,Form -- 待开发组件: Upload,Popover +- 待开发组件: Popover - 其他事项: API优化,单元测试,多端适配,深色模式 @@ -169,9 +169,9 @@ class IntlResourceDelegate extends TDResourceDelegate { ## SDK依赖版本 -dart: ">=2.19.0 <4.0.0" +dart: ">=3.2.6 <4.0.0" -flutter: ">=3.7.0" +flutter: ">=3.16.0" ## 交流反馈
@@ -186,3 +186,5 @@ TDesign Flutter 依赖以下组件库,感谢作者的开源贡献: [flutter_swiper](https://pub-web.flutter-io.cn/packages/flutter_swiper) [flutter_slidable](https://pub-web.flutter-io.cn/packages/flutter_slidable) + +[image_picker](https://pub-web.flutter-io.cn/packages/image_picker) diff --git a/tdesign-site/site/docs/overview.md b/tdesign-site/site/docs/overview.md index e7f62f504..4f97ab4ee 100644 --- a/tdesign-site/site/docs/overview.md +++ b/tdesign-site/site/docs/overview.md @@ -226,13 +226,13 @@ spline: explain - +

数据展示12

diff --git a/tdesign-site/site/public/assets/qrcode/td_apk_qr_0_1_8.png b/tdesign-site/site/public/assets/qrcode/td_apk_qr_0_1_8.png new file mode 100644 index 000000000..35af7ccfa Binary files /dev/null and b/tdesign-site/site/public/assets/qrcode/td_apk_qr_0_1_8.png differ diff --git a/tdesign-site/site/site.config.mjs b/tdesign-site/site/site.config.mjs index 28b655aaf..f6db684c5 100644 --- a/tdesign-site/site/site.config.mjs +++ b/tdesign-site/site/site.config.mjs @@ -267,13 +267,13 @@ export default { path: '/flutter/components/tree-select', component: () => import('@/tree-select/README.md'), }, - // { - // title: 'Upload 上传', - // name: 'upload', - // meta: { docType: 'form' }, - // path: '/flutter/components/upload', - // component: () => import('@/upload/README.md'), - // }, + { + title: 'Upload 上传', + name: 'upload', + meta: { docType: 'form' }, + path: '/flutter/components/upload', + component: () => import('@/upload/README.md'), + }, ], }, { diff --git a/tdesign-site/src/calendar/README.md b/tdesign-site/src/calendar/README.md index a6e4cd590..c186a1c40 100644 --- a/tdesign-site/src/calendar/README.md +++ b/tdesign-site/src/calendar/README.md @@ -28,7 +28,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 Widget _buildSimple(BuildContext context) {
   final size = MediaQuery.of(context).size;
-  final selected = ValueNotifier>([DateTime.now().millisecondsSinceEpoch]);
+  final selected = ValueNotifier>([DateTime.now().millisecondsSinceEpoch + 30 * 24 * 60 * 60 * 1000]);
   return ValueListenableBuilder(
     valueListenable: selected,
     builder: (context, value, child) {
@@ -60,8 +60,8 @@ Widget _buildSimple(BuildContext context) {
                   onCellLongPress: (value, type, tdate) {
                     print('onCellLongPress:$value');
                   },
-                  onHeanderClick: (index, week) {
-                    print('onHeanderClick:$week');
+                  onHeaderClick: (index, week) {
+                    print('onHeaderClick:$week');
                   },
                   onChange: (value) {
                     print('onChange:$value');
@@ -125,14 +125,16 @@ Widget _buildSimple(BuildContext context) {
                   value: value,
                   height: size.height * 0.92,
                   useTimePicker: true,
+                  // pickerHeight: 100,
+                  // pickerItemCount: 2,
                   onCellClick: (value, type, tdate) {
                     print('onCellClick:$value');
                   },
                   onCellLongPress: (value, type, tdate) {
                     print('onCellLongPress:$value');
                   },
-                  onHeanderClick: (index, week) {
-                    print('onHeanderClick:$week');
+                  onHeaderClick: (index, week) {
+                    print('onHeaderClick:$week');
                   },
                   onChange: (value) {
                     print('onChange:$value');
@@ -169,8 +171,8 @@ Widget _buildSimple(BuildContext context) {
                   onCellLongPress: (value, type, tdate) {
                     print('onCellLongPress:$value');
                   },
-                  onHeanderClick: (index, week) {
-                    print('onHeanderClick:$week');
+                  onHeaderClick: (index, week) {
+                    print('onHeaderClick:$week');
                   },
                   onChange: (value) {
                     print('onChange:$value');
@@ -280,9 +282,9 @@ Widget _buildStyle(BuildContext context) {
             visible: true,
             child: TDCalendar(
               title: '请选择日期',
-              minDate: DateTime(2022, 1, 1).millisecondsSinceEpoch,
-              maxDate: DateTime(2022, 1, 31).millisecondsSinceEpoch,
-              value: [DateTime(2022, 1, 15).millisecondsSinceEpoch],
+              minDate: DateTime(2000, 1, 1).millisecondsSinceEpoch,
+              maxDate: DateTime(3000, 1, 1).millisecondsSinceEpoch,
+              value: [DateTime(2024, 10, 1).millisecondsSinceEpoch],
               height: size.height * 0.6 + 176,
             ),
           );
@@ -384,9 +386,9 @@ Widget _buildStyle(BuildContext context) {
             visible: true,
             child: TDCalendar(
               title: '请选择日期',
-              minDate: DateTime(2022, 1, 1).millisecondsSinceEpoch,
-              maxDate: DateTime(2022, 1, 31).millisecondsSinceEpoch,
-              value: [DateTime(2022, 1, 15).millisecondsSinceEpoch],
+              minDate: DateTime(2000, 1, 1).millisecondsSinceEpoch,
+              maxDate: DateTime(3000, 1, 1).millisecondsSinceEpoch,
+              value: [DateTime(2024, 10, 1).millisecondsSinceEpoch],
               height: size.height * 0.6 + 176,
             ),
           );
@@ -484,9 +486,14 @@ Widget _buildBlock(BuildContext context) {
 | onChange | void Function(List value)? | - | 选中值变化时触发 |
 | onCellClick | void Function(int value, DateSelectType type, TDate tdate)? | - | 点击日期时触发 |
 | onCellLongPress | void Function(int value, DateSelectType type, TDate tdate)? | - | 长安日期时触发 |
-| onHeanderClick | void Function(int index, String week)? | - | 点击周时触发 |
+| onHeaderClick | void Function(int index, String week)? | - | 点击周时触发 |
 | useTimePicker | bool? | false | 是否显示时间选择器 |
 | timePickerModel | List? | - | 自定义时间选择器 |
+| monthTitleHeight | double? | 22 | 月标题高度 |
+| monthTitleBuilder | Widget Function(BuildContext context, DateTime monthDate)? | - | 月标题构建器 |
+| pickerHeight | double? | 178 | 时间选择器List的视窗高度 |
+| pickerItemCount | int? | 3 | 选择器List视窗中item个数,pickerHeight / pickerItemCount即item高度 |
+| isTimeUnit | bool? | true | 是否显示时间单位 |
 
 ```
 ```
diff --git a/tdesign-site/src/cell/README.md b/tdesign-site/src/cell/README.md
index ae079f56c..c202cbb5f 100644
--- a/tdesign-site/src/cell/README.md
+++ b/tdesign-site/src/cell/README.md
@@ -189,6 +189,7 @@ Widget _buildCard(BuildContext context) {
 | 参数 | 类型 | 默认值 | 说明 |
 | --- | --- | --- | --- |
 | leftIconColor | Color? | - | 左侧图标颜色 |
+| rightIconColor | Color? | - | 右侧图标颜色 |
 | titleStyle | TextStyle? | - | 标题文字样式 |
 | requiredStyle | TextStyle? | - | 必填星号文字样式 |
 | descriptionStyle | TextStyle? | - | 内容描述文字样式 |
@@ -198,6 +199,9 @@ Widget _buildCard(BuildContext context) {
 | groupBorderedColor | Color? | - | 单元格组边框颜色 |
 | backgroundColor | Color? | - | 默认状态背景颜色 |
 | padding | EdgeInsets? | - | 单元格内边距 |
+| cardBorderRadius | BorderRadius? | - | 卡片模式边框圆角 |
+| cardPadding | EdgeInsets? | - | 卡片模式内边距 |
+| titlePadding | EdgeInsets? | - | 单元格组标题内边距 |
 
 
 #### 工厂构造方法
diff --git a/tdesign-site/src/date-time-picker/README.md b/tdesign-site/src/date-time-picker/README.md
index d9c545145..ae1458533 100644
--- a/tdesign-site/src/date-time-picker/README.md
+++ b/tdesign-site/src/date-time-picker/README.md
@@ -126,8 +126,8 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
             useMinute: true,
             useSecond: true,
             dateStart: [1999, 01, 01],
-            dateEnd: [2023, 12, 31],
-            initialDate: [2012, 1, 1]);
+            dateEnd: [2023, 12, 31,4,12,20],
+            initialDate: [2023, 12, 31]);
       },
       child: buildSelectRow(context, selected_4, '选择时间'),
     );
@@ -285,7 +285,8 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 | showTitle | bool | true | 是否展示标题 |
 | pickerHeight | double | 200 | 选择器List的视窗高度,默认200 |
 | pickerItemCount | int | - | 选择器List视窗中item个数,pickerHeight / pickerItemCount即item高度 |
-| onSelectedItemChanged | void Function(int index)? | - | 选择器选中项改变回调 |
+| isTimeUnit | bool? | - | 是否时间显示 |
+| onSelectedItemChanged | void Function(int wheelIndex, int index)? | - | 选择器选中项改变回调 |
 | key |  | - |  |
 
 ```
@@ -296,7 +297,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 
 | 名称 | 返回类型 | 参数 | 说明 |
 | --- | --- | --- | --- |
-| showDatePicker |  |   required null context,  required String title,  required DatePickerCallback? onConfirm,  DatePickerCallback? onCancel,  bool useYear,  bool useMonth,  bool useDay,  bool useHour,  bool useMinute,  bool useSecond,  bool useWeekDay,  Color? barrierColor,  List dateStart,  List? dateEnd,  List? initialDate,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  Color? titleDividerColor,  Duration duration,  double pickerHeight,  int pickerItemCount, | 显示时间选择器 |
+| showDatePicker |  |   required null context,  required String title,  required DatePickerCallback? onConfirm,  DatePickerCallback? onCancel,  bool useYear,  bool useMonth,  bool useDay,  bool useHour,  bool useMinute,  bool useSecond,  bool useWeekDay,  Color? barrierColor,  List dateStart,  List? dateEnd,  List? initialDate,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  Color? titleDividerColor,  Duration duration,  double pickerHeight,  bool isTimeUnit,   Function(int wheelIndex, int index)? onSelectedItemChanged,  int pickerItemCount, | 显示时间选择器 |
 | showMultiPicker |  |   required null context,  String? title,  required MultiPickerCallback? onConfirm,  MultiPickerCallback? onCancel,  required List> data,  List? initialIndexes,  Duration duration,  Color? barrierColor,  double pickerHeight,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  Color? titleDividerColor,  double? topPadding,  int pickerItemCount, | 显示多级选择器 |
 | showMultiLinkedPicker |  |   required null context,  String? title,  required MultiPickerCallback? onConfirm,  MultiPickerCallback? onCancel,  required Map data,  required int columnNum,  required List initialData,  Duration duration,  Color? barrierColor,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  double pickerHeight,  Color? titleDividerColor,  double? topPadding,  int pickerItemCount, | 显示多级联动选择器 |
 
diff --git a/tdesign-site/src/dialog/README.md b/tdesign-site/src/dialog/README.md
index e4dfb8a3f..1987a7971 100644
--- a/tdesign-site/src/dialog/README.md
+++ b/tdesign-site/src/dialog/README.md
@@ -735,6 +735,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 | title | String | - | 标题内容 |
 | action |  Function()? | - | 点击操作 |
 | titleColor | Color? | - | 标题颜色 |
+| titleSize | double? | - | 字体大小 |
 | style | TDButtonStyle? | - | 按钮样式 |
 | type | TDButtonType? | - | 按钮类型 |
 | theme | TDButtonTheme? | - | 按钮类型 |
@@ -910,6 +911,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 | key |  | - |  |
 | buttonText | String? | - | 按钮文字 |
 | buttonTextColor | Color? | - | 按钮文字颜色 |
+| buttonTextSize | double? | - | 按钮文字大小 |
 | buttonTextFontWeight | FontWeight? | FontWeight.w600 | 按钮文字粗细 |
 | buttonStyle | TDButtonStyle? | - | 按钮样式 |
 | buttonType | TDButtonType? | - | 按钮类型 |
diff --git a/tdesign-site/src/dropdown-menu/README.md b/tdesign-site/src/dropdown-menu/README.md
index dfe800067..daf8b2cab 100644
--- a/tdesign-site/src/dropdown-menu/README.md
+++ b/tdesign-site/src/dropdown-menu/README.md
@@ -326,7 +326,7 @@ TDDropdownMenu _buildGroup(BuildContext context) {
 | direction | TDDropdownMenuDirection? | TDDropdownMenuDirection.auto | 菜单展开方向(down、up、auto) |
 | duration | double? | 200.0 | 动画时长,毫秒 |
 | showOverlay | bool? | true | 是否显示遮罩层 |
-| isScrollable | bool | false | 是否开启滚动列表 |
+| isScrollable | bool? | false | 是否开启滚动列表 |
 | arrowIcon | IconData? | - | 自定义箭头图标 |
 | labelBuilder | LabelBuilder? | - | 自定义标签内容 |
 | onMenuOpened | ValueChanged? | - | 展开菜单事件 |
@@ -334,6 +334,7 @@ TDDropdownMenu _buildGroup(BuildContext context) {
 | width | double? | - | menu的宽度 |
 | height | double? | 48 | menu的高度 |
 | tabBarAlign | MainAxisAlignment? | MainAxisAlignment.center | [TDDropdownItem.label]和[arrowIcon]/[TDDropdownItem.arrowIcon]的对齐方式 |
+| decoration | Decoration? | - | 下拉菜单的装饰器 |
 
 ```
 ```
diff --git a/tdesign-site/src/icon/README.md b/tdesign-site/src/icon/README.md
index ab646f75a..1fe4c960b 100644
--- a/tdesign-site/src/icon/README.md
+++ b/tdesign-site/src/icon/README.md
@@ -1,6 +1,6 @@
 ---
 title: Icon 图标
-description: 
+description: Icon 作为UI构成中重要的元素,一定程度上影响UI界面整体呈现出的风格。
 spline: base
 isComponent: true
 ---
@@ -20,7 +20,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 
 ### 1 icon示例
 
-icon数量: 244
+icon数量: 2114
             
 
 
@@ -29,32 +29,110 @@ icon数量: 244
     return Container(
       color: Colors.white,
       alignment: Alignment.center,
-      child: Wrap(
+      child: Column(
         children: [
           Container(
-            child: TDButton(text: showBorder? '隐藏边框':'显示边框',
+            padding: const EdgeInsets.only(left: 16),
+            alignment: Alignment.topLeft,
+            child: const Wrap(
+              children: [
+                TDText('筛选Icon请前往TDesign官网(长按网址可复制):'),
+                SelectableText('https://tdesign.tencent.com/vue/components/icon')
+              ],
+            ),
+          ),
+          TDSearchBar(
+            action: '搜索',
+            onActionClick: (text) {
+              setState(() {
+                iconList = [];
+                isLoading = true;
+              });
+              Future.delayed(const Duration(milliseconds: 30), () {
+                var list = [];
+                TDIcons.all.forEach((key, value) {
+                  if (value.name.contains(text)) {
+                    list.add(value);
+                  }
+                });
+                setState(() {
+                  iconList = list;
+                  isLoading = false;
+                });
+              });
+            },
+            onClearClick: (_) {
+              setState(() {
+                iconList = TDIcons.all.values;
+              });
+            },
+          ),
+          Container(
+            child: TDButton(
+              text: showBorder ? '隐藏边框' : '显示边框',
               shape: TDButtonShape.filled,
-              onTap: (){
+              onTap: () {
                 setState(() {
                   showBorder = !showBorder;
                 });
-              },),
+              },
+            ),
             margin: const EdgeInsets.only(bottom: 16),
           ),
-          for (var iconData in TDIcons.all.values) SizedBox(
-            height: 100,
-            width: 175,
-
-            child: Column(
-              children: [
-                Container(
-                  color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent,
-                  child: Icon(iconData),
-                ),
-                TDText(iconData.name)
-              ],
-            ),
-          )
+          Builder(builder: (context) {
+            if (iconList.isEmpty) {
+              return Container(
+                height: 300,
+                alignment: Alignment.center,
+                child: isLoading ? const TDText('加载中...') : const TDText('暂无内容'),
+              );
+            }
+            return SizedBox(
+              height: MediaQuery.of(context).size.height - 150,
+              child: ListView.builder(
+                  itemCount: (iconList.length + 1) ~/ 2,
+                  itemBuilder: (context,index){
+                    var index1 = index ~/ 2;
+                    var index2 = index1 + 1;
+                    var iconData1 =  iconList.elementAt(index1);
+                    var iconData2;
+                    if(iconList.length > index2){
+                      iconData2 =  iconList.elementAt(index2);
+                    }
+                    return Row(
+                      children: [
+                        SizedBox(
+                          height: 100,
+                          width: 175,
+                          child: Column(
+                            children: [
+                              Container(
+                                color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent,
+                                child: Icon(iconData1),
+                              ),
+                              TDText(iconData1.name)
+                            ],
+                          ),
+                        ),
+                        if (iconData2 != null)
+                          SizedBox(
+                            height: 100,
+                            width: 175,
+                            child: Column(
+                              children: [
+                                Container(
+                                  color: showBorder ? TDTheme.of(context).brandDisabledColor : Colors.transparent,
+                                  child: Icon(iconData2),
+                                ),
+                                TDText(iconData2.name)
+                              ],
+                            ),
+                          )
+                      ],
+                    );
+                  }),
+            );
+          })
         ],
       ),
     );
diff --git a/tdesign-site/src/image-viewer/README.md b/tdesign-site/src/image-viewer/README.md
index dfabdfd90..fe409fbe4 100644
--- a/tdesign-site/src/image-viewer/README.md
+++ b/tdesign-site/src/image-viewer/README.md
@@ -82,6 +82,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 | closeBtn | bool? | - | 是否展示关闭按钮 |
 | deleteBtn | bool? | - | 是否显示删除操作 |
 | images | List | - | 图片数组 |
+| labels | List? | - | 图片描述 |
 | showIndex | bool? | - | 是否显示页码 |
 | defaultIndex | int? | - | 默认预览图片所在的下标 |
 | onIndexChange | OnIndexChange? | - | 预览图片切换回调 |
@@ -99,7 +100,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 
 | 名称 | 返回类型 | 参数 | 说明 |
 | --- | --- | --- | --- |
-| showImageViewer |  |   required BuildContext context,  required List images,  bool? closeBtn,  bool? deleteBtn,  bool? showIndex,  int? defaultIndex,  double? width,  double? height,  OnIndexChange? onIndexChange,  OnClose? onClose,  OnDelete? onDelete,  OnLongPress? onLongPress, | 显示图片预览 |
+| showImageViewer |  |   required BuildContext context,  required List images,  List? labels,  bool? closeBtn,  bool? deleteBtn,  bool? showIndex,  int? defaultIndex,  double? width,  double? height,  OnIndexChange? onIndexChange,  OnClose? onClose,  OnDelete? onDelete,  OnLongPress? onLongPress, | 显示图片预览 |
 
 
   
\ No newline at end of file
diff --git a/tdesign-site/src/loading/README.md b/tdesign-site/src/loading/README.md
index 40d0a28ee..e213b599c 100644
--- a/tdesign-site/src/loading/README.md
+++ b/tdesign-site/src/loading/README.md
@@ -211,18 +211,20 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
             text: '加载中…',
             duration: _currentSliderValue.round(),
           ),
-          Slider(
-            value: _currentSliderValue,
-            max: 2000,
-            min: -20,
-            divisions: 100,
-            label: _currentSliderValue.round().toString(),
+          TDSlider(value: _currentSliderValue,
+            sliderThemeData: TDSliderThemeData(
+              context: context,
+              max: 2000,
+              min: -20,
+              divisions: 100,
+              showThumbValue: true,
+              scaleFormatter: (value) => value.toInt().toString(),
+            ),
             onChanged: (double value) {
               setState(() {
                 _currentSliderValue = value;
               });
-            },
-          ),
+            },)
         ],
       ),
     );
diff --git a/tdesign-site/src/picker/README.md b/tdesign-site/src/picker/README.md
index e6ffcdd33..36e27490a 100644
--- a/tdesign-site/src/picker/README.md
+++ b/tdesign-site/src/picker/README.md
@@ -221,7 +221,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 
 | 名称 | 返回类型 | 参数 | 说明 |
 | --- | --- | --- | --- |
-| showDatePicker |  |   required null context,  required String title,  required DatePickerCallback? onConfirm,  DatePickerCallback? onCancel,  bool useYear,  bool useMonth,  bool useDay,  bool useHour,  bool useMinute,  bool useSecond,  bool useWeekDay,  Color? barrierColor,  List dateStart,  List? dateEnd,  List? initialDate,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  Color? titleDividerColor,  Duration duration,  double pickerHeight,  int pickerItemCount, | 显示时间选择器 |
+| showDatePicker |  |   required null context,  required String title,  required DatePickerCallback? onConfirm,  DatePickerCallback? onCancel,  bool useYear,  bool useMonth,  bool useDay,  bool useHour,  bool useMinute,  bool useSecond,  bool useWeekDay,  Color? barrierColor,  List dateStart,  List? dateEnd,  List? initialDate,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  Color? titleDividerColor,  Duration duration,  double pickerHeight,  bool isTimeUnit,   Function(int wheelIndex, int index)? onSelectedItemChanged,  int pickerItemCount, | 显示时间选择器 |
 | showMultiPicker |  |   required null context,  String? title,  required MultiPickerCallback? onConfirm,  MultiPickerCallback? onCancel,  required List> data,  List? initialIndexes,  Duration duration,  Color? barrierColor,  double pickerHeight,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  Color? titleDividerColor,  double? topPadding,  int pickerItemCount, | 显示多级选择器 |
 | showMultiLinkedPicker |  |   required null context,  String? title,  required MultiPickerCallback? onConfirm,  MultiPickerCallback? onCancel,  required Map data,  required int columnNum,  required List initialData,  Duration duration,  Color? barrierColor,  String? rightText,  String? leftText,  TextStyle? leftTextStyle,  TextStyle? centerTextStyle,  TextStyle? rightTextStyle,  double pickerHeight,  Color? titleDividerColor,  double? topPadding,  int pickerItemCount, | 显示多级联动选择器 |
 
diff --git a/tdesign-site/src/popup/README.md b/tdesign-site/src/popup/README.md
index b945664ef..8f19f545c 100644
--- a/tdesign-site/src/popup/README.md
+++ b/tdesign-site/src/popup/README.md
@@ -479,6 +479,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 | opened | VoidCallback? | - | 打开后事件 |
 | close | VoidCallback? | - | 关闭前事件 |
 | barrierClick | VoidCallback? | - | 蒙层点击事件,仅在[modalBarrierFull]为false时触发 |
+| focusMove | bool | false | 是否有输入框获取焦点时整体平移避免输入框被遮挡 |
 
 ```
 ```
diff --git a/tdesign-site/src/rate/README.md b/tdesign-site/src/rate/README.md
index 857245a9b..b29be9335 100644
--- a/tdesign-site/src/rate/README.md
+++ b/tdesign-site/src/rate/README.md
@@ -114,7 +114,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart';
 
   
   Widget _buildHalfRate(BuildContext context) {
-    return const TDCell(title: '点击活滑动', noteWidget: TDRate(value: 3, allowHalf: true));
+    return const TDCell(title: '点击活滑动', noteWidget: TDRate(value: 3, allowHalf: true, onChange: print,));
   }
diff --git a/tdesign-site/src/search/README.md b/tdesign-site/src/search/README.md index ff5fe5e29..4ce6fc8d6 100644 --- a/tdesign-site/src/search/README.md +++ b/tdesign-site/src/search/README.md @@ -131,6 +131,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; | onTextChanged | TDSearchBarEvent? | - | 文字改变回调 | | onSubmitted | TDSearchBarEvent? | - | 提交回调 | | onEditComplete | TDSearchBarCallBack? | - | 编辑完成回调 | +| onInputClick | GestureTapCallback? | - | 输入框点击事件 | | autoHeight | bool | false | 是否自动计算高度 | | padding | EdgeInsets | const EdgeInsets.fromLTRB(16, 8, 16, 8) | 内部填充 | | autoFocus | bool | false | 是否自动获取焦点 | @@ -143,6 +144,9 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; | onActionClick | TDSearchBarEvent? | - | 自定义操作回调 | | onClearClick | TDSearchBarClearEvent? | - | 自定义操作回调 | | focusNode | FocusNode? | - | 自定义焦点 | +| inputAction | TextInputAction? | - | 键盘动作类型 | +| enabled | bool? | - | 是否禁用 | +| readOnly | bool? | - | 是否只读 | \ No newline at end of file diff --git a/tdesign-site/src/side-bar/README.md b/tdesign-site/src/side-bar/README.md index 98e348685..dd3511ac4 100644 --- a/tdesign-site/src/side-bar/README.md +++ b/tdesign-site/src/side-bar/README.md @@ -496,6 +496,8 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; selectedTextStyle:TextStyle(color: Colors.red), onSelected: setCurrentValue, contentPadding:EdgeInsets.only(left: 16, top: 16,bottom: 16), + selectedBgColor: Colors.blue, + unSelectedBgColor: Colors.yellow, ), ), Expanded( @@ -637,6 +639,8 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; selectedTextStyle:TextStyle(color: Colors.red), onSelected: setCurrentValue, contentPadding:EdgeInsets.only(left: 16, top: 16,bottom: 16), + selectedBgColor: Colors.blue, + unSelectedBgColor: Colors.yellow, ), ), Expanded( @@ -692,6 +696,8 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; | style | TDSideBarStyle | TDSideBarStyle.normal | 样式 | | loading | bool? | - | 加载效果 | | loadingWidget | Widget? | - | 自定义加载动画 | +| selectedBgColor | Color? | - | 选择的背景颜色 | +| unSelectedBgColor | Color? | - | 未选择的背景颜色 | \ No newline at end of file diff --git a/tdesign-site/src/slider/README.md b/tdesign-site/src/slider/README.md index 476cdd4fb..ad7920fef 100644 --- a/tdesign-site/src/slider/README.md +++ b/tdesign-site/src/slider/README.md @@ -28,6 +28,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; Widget _buildSingleHandle(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), @@ -48,6 +49,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; Widget _buildDoubleHandle(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), @@ -68,6 +70,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; Widget _buildSingleHandleWithNumber(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, showThumbValue: true, scaleFormatter: (value) => value.toInt().toString(), min: 0, @@ -92,6 +95,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; Widget _buildDoubleHandleWithNumber(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showThumbValue: true, min: 0, max: 100, @@ -116,6 +120,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; Widget _buildSingleHandleWithScale(BuildContext context) { return TDSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -139,6 +144,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; Widget _buildDoubleHandleWithScale(BuildContext context) { return TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -165,6 +171,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; children: [ TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), @@ -177,6 +184,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, showThumbValue: true, @@ -191,6 +199,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDRangeSlider( sliderThemeData: TDSliderThemeData( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -217,6 +226,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; children: [ TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showThumbValue: true, min: 0, max: 100, @@ -231,6 +241,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), @@ -244,6 +255,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), @@ -259,6 +271,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, showThumbValue: true, @@ -275,6 +288,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -293,6 +307,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, showScaleValue: true, divisions: 5, min: 0, @@ -325,11 +340,12 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; children: [ TDSlider( sliderThemeData: TDSliderThemeData( + context: context, min: 0, max: 100, ), value: 40, - boxDecoration: BoxDecoration( + boxDecoration: const BoxDecoration( color: Colors.amber ), // divisions: 5, @@ -340,11 +356,12 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), TDRangeSlider( sliderThemeData: TDSliderThemeData.capsule( + context: context, min: 0, max: 100, scaleFormatter: (value) => value.toInt().toString(), ), - boxDecoration: BoxDecoration( + boxDecoration: const BoxDecoration( color: Colors.deepOrangeAccent ), value: const RangeValues(20, 60), diff --git a/tdesign-site/src/tabs/README.md b/tdesign-site/src/tabs/README.md index c4551628d..645435bb7 100644 --- a/tdesign-site/src/tabs/README.md +++ b/tdesign-site/src/tabs/README.md @@ -429,6 +429,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; | dividerHeight | double | 0.5 | 分割线高度,小于等于0则不展示分割线 | | selectedBgColor | Color? | - | 被选中背景色,只有outlineType为capsule时有效 | | unSelectedBgColor | Color? | - | 未选中背景色,只有outlineType为capsule时有效 | +| tabAlignment | | - | | ``` ``` diff --git a/tdesign-site/src/textarea/README.md b/tdesign-site/src/textarea/README.md index 9b8639da6..da9320b3f 100644 --- a/tdesign-site/src/textarea/README.md +++ b/tdesign-site/src/textarea/README.md @@ -53,7 +53,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; maxLines: 4, minLines: 4, onChanged: (value) { - setState(() {}); }, ); }
@@ -72,7 +71,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; hintText: '请输入文字', minLines: 1, onChanged: (value) { - setState(() {}); }, ); } @@ -95,7 +93,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; maxLength: 500, indicator: true, onChanged: (value) { - setState(() {}); }, ); } @@ -118,7 +115,7 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; minLines: 4, readOnly: true, onChanged: (value) { - setState(() {}); + }, ); } @@ -143,7 +140,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; indicator: true, layout: TDTextareaLayout.vertical, onChanged: (value) { - setState(() {}); }, ); } @@ -171,7 +167,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; ), margin: EdgeInsets.only(right: TDTheme.of(context).spacer16, left: TDTheme.of(context).spacer16), onChanged: (value) { - setState(() {}); }, ); } @@ -197,7 +192,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; layout: TDTextareaLayout.vertical, bordered: true, onChanged: (value) { - setState(() {}); }, ); } @@ -226,7 +220,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; maxLength: 500, indicator: true, onChanged: (value) { - setState(() {}); }, ); } @@ -252,7 +245,6 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; required: true, additionInfo: '辅助说明', onChanged: (value) { - setState(() {}); }, ); } diff --git a/tdesign-site/src/toast/README.md b/tdesign-site/src/toast/README.md index 4d36098d0..6b6a37ae0 100644 --- a/tdesign-site/src/toast/README.md +++ b/tdesign-site/src/toast/README.md @@ -309,13 +309,13 @@ import 'package:tdesign_flutter/tdesign_flutter.dart'; | 名称 | 返回类型 | 参数 | 说明 | | --- | --- | --- | --- | -| showText | | required String? text, required BuildContext context, Duration duration, int? maxLines, BoxConstraints? constraints, bool? preventTap, | 普通文本Toast | -| showIconText | | required String? text, IconData? icon, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 带图标的Toast | -| showSuccess | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 成功提示Toast | -| showWarning | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 警告Toast | -| showFail | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, | 失败提示Toast | -| showLoading | | required BuildContext context, String? text, Duration duration, bool? preventTap, | 带文案的加载Toast | -| showLoadingWithoutText | | required BuildContext context, String? text, Duration duration, bool? preventTap, | 不带文案的加载Toast | +| showText | | required String? text, required BuildContext context, Duration duration, int? maxLines, BoxConstraints? constraints, bool? preventTap, Color? backgroundColor, | 普通文本Toast | +| showIconText | | required String? text, IconData? icon, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 带图标的Toast | +| showSuccess | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 成功提示Toast | +| showWarning | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 警告Toast | +| showFail | | required String? text, IconTextDirection direction, required BuildContext context, Duration duration, bool? preventTap, Color? backgroundColor, | 失败提示Toast | +| showLoading | | required BuildContext context, String? text, Duration duration, bool? preventTap, Color? backgroundColor, | 带文案的加载Toast | +| showLoadingWithoutText | | required BuildContext context, String? text, Duration duration, bool? preventTap, Color? backgroundColor, | 不带文案的加载Toast | | dismissLoading | | | 关闭加载Toast | diff --git a/tdesign-site/src/upload/README.md b/tdesign-site/src/upload/README.md new file mode 100644 index 000000000..4482770d2 --- /dev/null +++ b/tdesign-site/src/upload/README.md @@ -0,0 +1,152 @@ +--- +title: Upload 上传 +description: 用于相册读取或拉起拍照的图片上传功能。 +spline: base +isComponent: true +--- + + +## 引入 + +在tdesign_flutter/tdesign_flutter.dart中有所有组件的路径。 + +```dart +import 'package:tdesign_flutter/tdesign_flutter.dart'; +``` + +## 代码演示 + +[td_upload_page.dart](https://github.com/Tencent/tdesign-flutter/blob/main/tdesign-component/example/lib/page/td_upload_page.dart) + +### 1 组件类型 + +单选上传 + + + +
+  Widget _uploadSingle(BuildContext context) {
+    return wrapDemoContainer('单选上传',
+        child: TDUpload(
+          files: files1,
+          onClick: onClick,
+          onCancel: onCancel,
+          onError: print,
+          onValidate: print,
+          onChange: ((files, type) => onValueChanged(files1, files, type)),
+        ));
+  }
+ +
+ + +多选上传 + + + +
+  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) => onValueChanged(files2, files, type)),
+        ));
+  }
+ +
+ +### 1 组件状态 + +加载状态 + + + +
+  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) => onValueChanged(files3, files, type)),
+        ));
+  }
+ +
+ + +重新上传 + + + +
+  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) => onValueChanged(files4, files, type)),
+        ));
+  }
+ +
+ + +上传失败 + + + +
+  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) => onValueChanged(files5, files, type)),
+        ));
+  }
+ +
+ + + +## API +### TDUpload +#### 默认构造方法 + +| 参数 | 类型 | 默认值 | 说明 | +| --- | --- | --- | --- | +| key | | - | | +| max | int | 0 | 用于控制文件上传数量,0为不限制,仅在multiple为true时有效 | +| mediaType | List | const [TDUploadMediaType.image, TDUploadMediaType.video] | 支持上传的文件类型,图片或视频 | +| sizeLimit | double? | - | 图片大小限制,单位为KB | +| onCancel | VoidCallback? | - | 监听取消上传 | +| onError | TDUploadErrorEvent? | - | 监听获取资源错误 | +| onValidate | TDUploadValidatorEvent? | - | 监听文件校验出错 | +| onClick | TDUploadClickEvent? | - | 监听点击图片位 | +| files | List | - | 控制展示的文件列表 | +| onChange | TDUploadValueChangedEvent? | - | 监听添加或删除照片 | +| multiple | bool | false | 是否多选上传,默认false | + + + \ No newline at end of file