Skip to content

Commit

Permalink
Merge pull request #349 from Tencent/release/0.1.7
Browse files Browse the repository at this point in the history
合并0.1.7版本代码
  • Loading branch information
Luozf12345 authored Oct 16, 2024
2 parents 56ab3c7 + eb5815e commit f813e86
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 30 deletions.
179 changes: 178 additions & 1 deletion tdesign-component/example/assets/theme.json
Original file line number Diff line number Diff line change
@@ -1 +1,178 @@
{"green":{"ref":{"brandLightColor":"brandColor1","brandFocusColor":"brandColor2","brandDisabledColor":"brandColor3","brandHoverColor":"brandColor3","brandNormalColor":"brandColor4","brandActiveColor":"brandColor5","warningNormalColor":"warningColor5","warningHoverColor":"warningColor4","warningFocusColor":"warningColor2","warningActiveColor":"warningColor6","warningDisabledColor":"warningColor3","warningLightColor":"warningColor1","errorNormalColor":"errorColor6","errorHoverColor":"errorColor5","errorFocusColor":"errorColor2","errorActiveColor":"errorColor7","errorDisabledColor":"errorColor3","errorLightColor":"errorColor1","successNormalColor":"successColor5","successHoverColor":"successColor4","successFocusColor":"successColor2","successActiveColor":"successColor6","successDisabledColor":"successColor3","successLightColor":"successColor1","brandColorLightHover":"brandColor2","warningColorLightHover":"warningColor2","errorColorLightHover":"errorColor2","successColorLightHover":"successColor2"},"color":{"brandColor1":"#e4f9e9","brandColor2":"#c8f2d7","brandColor3":"#94dab2","brandColor4":"#45c58b","brandColor5":"#33a371","brandColor6":"#008857","brandColor7":"#006c44","brandColor8":"#005333","brandColor9":"#003b23","brandColor10":"#002515","warningColor1":"#fef3e6","warningColor2":"#f9e0c7","warningColor3":"#f7c797","warningColor4":"#f2995f","warningColor5":"#ed7b2f","warningColor6":"#d35a21","warningColor7":"#ba431b","warningColor8":"#9e3610","warningColor9":"#842b0b","warningColor10":"#5a1907","errorColor1":"#fdecee","errorColor2":"#f9d7d9","errorColor3":"#f8b9be","errorColor4":"#f78d94","errorColor5":"#f36d78","errorColor6":"#e34d59","errorColor7":"#c9353f","errorColor8":"#b11f26","errorColor9":"#951114","errorColor10":"#680506","successColor1":"#e8f8f2","successColor2":"#bcebdc","successColor3":"#85dbbe","successColor4":"#48c79c","successColor5":"#00a870","successColor6":"#078d5c","successColor7":"#067945","successColor8":"#056334","successColor9":"#044f2a","successColor10":"#033017","grayColor1":"#f3f3f3","grayColor2":"#eee","grayColor3":"#e7e7e7","grayColor4":"#dcdcdc","grayColor5":"#c5c5c5","grayColor6":"#a6a6a6","grayColor7":"#8b8b8b","grayColor8":"#777","grayColor9":"#5e5e5e","grayColor10":"#4b4b4b","grayColor11":"#383838","grayColor12":"#2c2c2c","grayColor13":"#242424","grayColor14":"#181818"}},"red":{"ref":{"brandLightColor":"brandColor1","brandFocusColor":"brandColor2","brandDisabledColor":"brandColor3","brandHoverColor":"brandColor4","brandNormalColor":"brandColor5","brandActiveColor":"brandColor6","warningNormalColor":"warningColor5","warningHoverColor":"warningColor4","warningFocusColor":"warningColor2","warningActiveColor":"warningColor6","warningDisabledColor":"warningColor3","warningLightColor":"warningColor1","errorNormalColor":"errorColor6","errorHoverColor":"errorColor5","errorFocusColor":"errorColor2","errorActiveColor":"errorColor7","errorDisabledColor":"errorColor3","errorLightColor":"errorColor1","successNormalColor":"successColor5","successHoverColor":"successColor4","successFocusColor":"successColor2","successActiveColor":"successColor6","successDisabledColor":"successColor3","successLightColor":"successColor1","brandColorLightHover":"brandColor2","warningColorLightHover":"warningColor2","errorColorLightHover":"errorColor2","successColorLightHover":"successColor2"},"color":{"brandColor1":"#fff0f1","brandColor2":"#ffd8dd","brandColor3":"#ffb7c1","brandColor4":"#ff8fa2","brandColor5":"#ff5479","brandColor6":"#db3d62","brandColor7":"#b2294b","brandColor8":"#8d1135","brandColor9":"#690021","brandColor10":"#480014","warningColor1":"#fef3e6","warningColor2":"#f9e0c7","warningColor3":"#f7c797","warningColor4":"#f2995f","warningColor5":"#ed7b2f","warningColor6":"#d35a21","warningColor7":"#ba431b","warningColor8":"#9e3610","warningColor9":"#842b0b","warningColor10":"#5a1907","errorColor1":"#fdecee","errorColor2":"#f9d7d9","errorColor3":"#f8b9be","errorColor4":"#f78d94","errorColor5":"#f36d78","errorColor6":"#e34d59","errorColor7":"#c9353f","errorColor8":"#b11f26","errorColor9":"#951114","errorColor10":"#680506","successColor1":"#e8f8f2","successColor2":"#bcebdc","successColor3":"#85dbbe","successColor4":"#48c79c","successColor5":"#00a870","successColor6":"#078d5c","successColor7":"#067945","successColor8":"#056334","successColor9":"#044f2a","successColor10":"#033017","grayColor1":"#f3f3f3","grayColor2":"#eee","grayColor3":"#e7e7e7","grayColor4":"#dcdcdc","grayColor5":"#c5c5c5","grayColor6":"#a6a6a6","grayColor7":"#8b8b8b","grayColor8":"#777","grayColor9":"#5e5e5e","grayColor10":"#4b4b4b","grayColor11":"#383838","grayColor12":"#2c2c2c","grayColor13":"#242424","grayColor14":"#181818"}}}
{
"green": {
"ref": {
"brandLightColor": "brandColor1",
"brandFocusColor": "brandColor2",
"brandDisabledColor": "brandColor3",
"brandHoverColor": "brandColor3",
"brandNormalColor": "brandColor4",
"brandActiveColor": "brandColor5",
"warningNormalColor": "warningColor5",
"warningHoverColor": "warningColor4",
"warningFocusColor": "warningColor2",
"warningActiveColor": "warningColor6",
"warningDisabledColor": "warningColor3",
"warningLightColor": "warningColor1",
"errorNormalColor": "errorColor6",
"errorHoverColor": "errorColor5",
"errorFocusColor": "errorColor2",
"errorActiveColor": "errorColor7",
"errorDisabledColor": "errorColor3",
"errorLightColor": "errorColor1",
"successNormalColor": "successColor5",
"successHoverColor": "successColor4",
"successFocusColor": "successColor2",
"successActiveColor": "successColor6",
"successDisabledColor": "successColor3",
"successLightColor": "successColor1",
"brandColorLightHover": "brandColor2",
"warningColorLightHover": "warningColor2",
"errorColorLightHover": "errorColor2",
"successColorLightHover": "successColor2"
},
"color": {
"brandColor1": "#e4f9e9",
"brandColor2": "#c8f2d7",
"brandColor3": "#94dab2",
"brandColor4": "#45c58b",
"brandColor5": "#33a371",
"brandColor6": "#008857",
"brandColor7": "#006c44",
"brandColor8": "#005333",
"brandColor9": "#003b23",
"brandColor10": "#002515",
"warningColor1": "#fef3e6",
"warningColor2": "#f9e0c7",
"warningColor3": "#f7c797",
"warningColor4": "#f2995f",
"warningColor5": "#ed7b2f",
"warningColor6": "#d35a21",
"warningColor7": "#ba431b",
"warningColor8": "#9e3610",
"warningColor9": "#842b0b",
"warningColor10": "#5a1907",
"errorColor1": "#fdecee",
"errorColor2": "#f9d7d9",
"errorColor3": "#f8b9be",
"errorColor4": "#f78d94",
"errorColor5": "#f36d78",
"errorColor6": "#e34d59",
"errorColor7": "#c9353f",
"errorColor8": "#b11f26",
"errorColor9": "#951114",
"errorColor10": "#680506",
"successColor1": "#e8f8f2",
"successColor2": "#bcebdc",
"successColor3": "#85dbbe",
"successColor4": "#48c79c",
"successColor5": "#00a870",
"successColor6": "#078d5c",
"successColor7": "#067945",
"successColor8": "#056334",
"successColor9": "#044f2a",
"successColor10": "#033017",
"grayColor1": "#f3f3f3",
"grayColor2": "#eeeeee",
"grayColor3": "#e7e7e7",
"grayColor4": "#dcdcdc",
"grayColor5": "#c5c5c5",
"grayColor6": "#a6a6a6",
"grayColor7": "#8b8b8b",
"grayColor8": "#777777",
"grayColor9": "#5e5e5e",
"grayColor10": "#4b4b4b",
"grayColor11": "#383838",
"grayColor12": "#2c2c2c",
"grayColor13": "#242424",
"grayColor14": "#181818"
}
},
"red": {
"ref": {
"brandLightColor": "brandColor1",
"brandFocusColor": "brandColor2",
"brandDisabledColor": "brandColor3",
"brandHoverColor": "brandColor4",
"brandNormalColor": "brandColor5",
"brandActiveColor": "brandColor6",
"warningNormalColor": "warningColor5",
"warningHoverColor": "warningColor4",
"warningFocusColor": "warningColor2",
"warningActiveColor": "warningColor6",
"warningDisabledColor": "warningColor3",
"warningLightColor": "warningColor1",
"errorNormalColor": "errorColor6",
"errorHoverColor": "errorColor5",
"errorFocusColor": "errorColor2",
"errorActiveColor": "errorColor7",
"errorDisabledColor": "errorColor3",
"errorLightColor": "errorColor1",
"successNormalColor": "successColor5",
"successHoverColor": "successColor4",
"successFocusColor": "successColor2",
"successActiveColor": "successColor6",
"successDisabledColor": "successColor3",
"successLightColor": "successColor1",
"brandColorLightHover": "brandColor2",
"warningColorLightHover": "warningColor2",
"errorColorLightHover": "errorColor2",
"successColorLightHover": "successColor2"
},
"color": {
"brandColor1": "#fff0f1",
"brandColor2": "#ffd8dd",
"brandColor3": "#ffb7c1",
"brandColor4": "#ff8fa2",
"brandColor5": "#ff5479",
"brandColor6": "#db3d62",
"brandColor7": "#b2294b",
"brandColor8": "#8d1135",
"brandColor9": "#690021",
"brandColor10": "#480014",
"warningColor1": "#fef3e6",
"warningColor2": "#f9e0c7",
"warningColor3": "#f7c797",
"warningColor4": "#f2995f",
"warningColor5": "#ed7b2f",
"warningColor6": "#d35a21",
"warningColor7": "#ba431b",
"warningColor8": "#9e3610",
"warningColor9": "#842b0b",
"warningColor10": "#5a1907",
"errorColor1": "#fdecee",
"errorColor2": "#f9d7d9",
"errorColor3": "#f8b9be",
"errorColor4": "#f78d94",
"errorColor5": "#f36d78",
"errorColor6": "#e34d59",
"errorColor7": "#c9353f",
"errorColor8": "#b11f26",
"errorColor9": "#951114",
"errorColor10": "#680506",
"successColor1": "#e8f8f2",
"successColor2": "#bcebdc",
"successColor3": "#85dbbe",
"successColor4": "#48c79c",
"successColor5": "#00a870",
"successColor6": "#078d5c",
"successColor7": "#067945",
"successColor8": "#056334",
"successColor9": "#044f2a",
"successColor10": "#033017",
"grayColor1": "#f3f3f3",
"grayColor2": "#eeeeee",
"grayColor3": "#e7e7e7",
"grayColor4": "#dcdcdc",
"grayColor5": "#c5c5c5",
"grayColor6": "#a6a6a6",
"grayColor7": "#8b8b8b",
"grayColor8": "#777777",
"grayColor9": "#5e5e5e",
"grayColor10": "#4b4b4b",
"grayColor11": "#383838",
"grayColor12": "#2c2c2c",
"grayColor13": "#242424",
"grayColor14": "#181818"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@ class IntlResourceDelegate extends TDResourceDelegate {

@override
String get notRated => AppLocalizations.of(context)!.notRated;

@override
String get cascadeLabel => AppLocalizations.of(context)!.cascadeLabel;
}
3 changes: 2 additions & 1 deletion tdesign-component/example/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"time": "Time",
"start": "Start",
"end": "End",
"notRated": "Not rated"
"notRated": "Not rated",
"cascadeLabel": "Select Item"
}
3 changes: 2 additions & 1 deletion tdesign-component/example/lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"time": "时间",
"start": "开始",
"end": "结束",
"notRated": "未评分"
"notRated": "未评分",
"cascadeLabel": "选择选项"
}
2 changes: 1 addition & 1 deletion tdesign-component/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.6"
version: "0.1.7"
term_glyph:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../../../tdesign_flutter.dart';
import '../../util/context_extension.dart';

typedef MultiCascaderCallback = void Function(List<MultiCascaderListModel> selected);

Expand Down Expand Up @@ -91,7 +92,7 @@ class _TDMultiCascaderState extends State<TDMultiCascader> with TickerProviderSt
super.initState();
List.generate(widget.data.length, (index) {
MultiCascaderListModel item = MultiCascaderListModel(
label: widget.data[index]['label'],
labelFun: ()=>widget.data[index]['label'],
value: widget.data[index]['value'],
segmentValue: widget.data[index]['segmentValue'],
level: 0,
Expand All @@ -107,7 +108,7 @@ class _TDMultiCascaderState extends State<TDMultiCascader> with TickerProviderSt
}
_selectListData = _listData.where((element) => element.level == 0).toList();
_tabListData.add(MultiCascaderListModel(
label: '选择选项',
labelFun: ()=>context.resource.cascadeLabel,
));
if (widget.initialData != null) {
_tabListData.clear();
Expand Down Expand Up @@ -183,7 +184,7 @@ class _TDMultiCascaderState extends State<TDMultiCascader> with TickerProviderSt
void _buildRecursiveList(int depth, String parentValue, List<Map> data) {
List.generate(data.length, (index) {
MultiCascaderListModel item = MultiCascaderListModel(
label: data[index]['label'],
labelFun: ()=>data[index]['label'],
value: data[index]['value'],
parentValue: parentValue,
segmentValue: data[index]['segmentValue'],
Expand Down Expand Up @@ -308,7 +309,7 @@ class _TDMultiCascaderState extends State<TDMultiCascader> with TickerProviderSt
width: maxWidth,
child: TDCustomTab(
tabs: List.generate(_tabListData.length, (index) {
return _tabListData[index].label!;
return _tabListData[index].label ?? '';
}),
initialIndex: _currentTabIndex,
onTap: (int index) {
Expand Down Expand Up @@ -356,7 +357,7 @@ class _TDMultiCascaderState extends State<TDMultiCascader> with TickerProviderSt
if (_tabListData.length > 2 && _currentTabIndex == 0) {
_tabListData.clear();
_tabListData.add(MultiCascaderListModel(
label: '选择选项',
labelFun: ()=>context.resource.cascadeLabel,
));
}
if (item.level != null) {
Expand Down Expand Up @@ -447,7 +448,7 @@ class _TDMultiCascaderState extends State<TDMultiCascader> with TickerProviderSt
_selectListData = childList;
_currentTabIndex += 1;
} else {
var result = _tabListData.where((element) => element.label != '选择选项').toList();
var result = _tabListData.where((element) => element.label != context.resource.cascadeLabel).toList();
widget.onChange(result);
Navigator.of(context).pop();
}
Expand Down Expand Up @@ -500,7 +501,7 @@ class LeftLineWidget extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 16),
width: 16,
child: CustomPaint(
painter: LeftLinePainter(isShowTopLine: isShowTopLine, topLineColor: topLineColor, isCircleFill: isCircleFill),
painter: LeftLinePainter(isShowTopLine: isShowTopLine, topLineColor: topLineColor ?? TDTheme.of(context).brandNormalColor, isCircleFill: isCircleFill),
),
);
}
Expand All @@ -509,18 +510,18 @@ class LeftLineWidget extends StatelessWidget {
class LeftLinePainter extends CustomPainter {
static const double _topHeight = 16;

static const Color _lightColor = Color.fromRGBO(0, 82, 217, 1);
// static const Color _lightColor = Color.fromRGBO(0, 82, 217, 1);

/// 是否实心圆
final bool isCircleFill;

/// 线条颜色
final Color? topLineColor;
final Color topLineColor;

/// 是否显示圆圈上方线条
final bool isShowTopLine;

const LeftLinePainter({this.topLineColor, required this.isShowTopLine, required this.isCircleFill});
const LeftLinePainter({required this.topLineColor, required this.isShowTopLine, required this.isCircleFill});

@override
void paint(Canvas canvas, Size size) {
Expand All @@ -533,10 +534,10 @@ class LeftLinePainter extends CustomPainter {
linePain.strokeCap = StrokeCap.square;
canvas.drawLine(Offset(centerX, 0), Offset(centerX, topHeight), linePain);
Paint circlePaint = Paint();
circlePaint.color = _lightColor;
circlePaint.color = topLineColor;
circlePaint.strokeWidth = 1;
circlePaint.style = isCircleFill ? PaintingStyle.fill : PaintingStyle.stroke;
linePain.color = isShowTopLine ? (topLineColor ?? _lightColor) : Colors.transparent;
linePain.color = isShowTopLine ? (topLineColor) : Colors.transparent;
canvas.drawLine(Offset(centerX, -size.height), Offset(centerX, -size.height - _topHeight), linePain);
canvas.drawCircle(Offset(centerX, topHeight), centerX * 0.5, circlePaint);
}
Expand All @@ -548,7 +549,8 @@ class LeftLinePainter extends CustomPainter {
}

class MultiCascaderListModel {
String? label;
String? Function()? labelFun;
String? get label => labelFun?.call();

String? value;

Expand All @@ -559,5 +561,5 @@ class MultiCascaderListModel {
String? segmentValue;

int? level;
MultiCascaderListModel({this.label, this.value, this.parentValue, this.level, this.segmentValue});
MultiCascaderListModel({this.labelFun, this.value, this.parentValue, this.level, this.segmentValue});
}
6 changes: 6 additions & 0 deletions tdesign-component/lib/src/theme/resource_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ abstract class TDResourceDelegate {

/// [TDRate] 未评分
String get notRated;

/// [TDRate] 选择选项
String get cascadeLabel;
}

/// 如果用户要重写,就应该全部重写,不开放只重新部分资源
Expand Down Expand Up @@ -298,4 +301,7 @@ class _DefaultResourceDelegate extends TDResourceDelegate {

@override
String get notRated => '未评分';

@override
String get cascadeLabel => '选择选项';
}
2 changes: 1 addition & 1 deletion tdesign-component/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: tdesign_flutter
description: Tencent TDesign UI component library of Flutter, suitable for use in mobile projects.
version: 0.1.6
version: 0.1.7
homepage: https://github.com/Tencent/tdesign-flutter

environment:
Expand Down
2 changes: 1 addition & 1 deletion tdesign-site/site/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TDesign Flutter组件示例应用
<br/>
Android请扫码下载预览 ↓
<br/>
<img width="260" src="/flutter/assets/qrcode/td_apk_qrcode.png" />
<img width="260" src="/flutter/assets/qrcode/td_apk_qr_0_1_7.png" />
<br/>
iOS请运行项目预览 ↓
<br/>
Expand Down
4 changes: 2 additions & 2 deletions tdesign-site/site/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ spline: explain
<p class="name">Radio 单选框</p>
</a>
</div>
<!-- <div class="image-wrapper">
<div class="image-wrapper">
<a class="item" href="/flutter/components/rate">
<img class="__light__" src="https://tdesign.gtimg.com/site/mobile/doc-rate.png" />
<img class="__dark__" src="https://tdesign.gtimg.com/site/mobile/doc-rate-dark.png" />
<p class="name">Rate 评分</p>
</a>
</div> -->
</div>
<div class="image-wrapper">
<a class="item" href="/flutter/components/search">
<img class="__light__" src="https://tdesign.gtimg.com/site/mobile/doc-search.png" />
Expand Down
2 changes: 1 addition & 1 deletion tdesign-site/site/plugin-tdoc/component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default defineComponent({
const { path } = this.$route;
const name = path.slice(path.lastIndexOf('/') + 1);
// new URL(): https://cn.vitejs.dev/guide/assets.html#new-url-url-import-meta-url
return new URL(`../public/assets/qrcode/td_apk_qrcode.png`, import.meta.url).href;
return new URL(`../public/assets/qrcode/td_apk_qr_0_1_7.png`, import.meta.url).href;
},
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f813e86

Please sign in to comment.