Skip to content

Commit 088d808

Browse files
author
v_szheshi
committed
样式走查
1 parent cf7137e commit 088d808

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

tdesign-component/example/lib/page/td_progress_page.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ class _TDProgressPageState extends State<TDProgressPage> {
155155
progressStatus: TDProgressStatus.warning,
156156
value: 0.8,
157157
strokeWidth: 6,
158-
progressLabelPosition: TDProgressLabelPosition.right);
158+
progressLabelPosition: TDProgressLabelPosition.right,
159+
);
159160
}
160161

161162
@Demo(group: 'progress')

tdesign-component/lib/src/components/footer/td_footer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class _TDFooterState extends State<TDFooter> {
114114
LinkObj link = widget.links[index];
115115
return Container(
116116
decoration:index<(widget.links.length-1)? BoxDecoration(border: Border(right: BorderSide(color: Color.fromRGBO(231, 231, 231, 1)))):null,
117-
padding: const EdgeInsets.symmetric(horizontal: 4),
117+
padding: const EdgeInsets.symmetric(horizontal:6),
118118
child: TDLink(
119119
type: widget.isWithUnderline ? TDLinkType.withUnderline : TDLinkType.basic,
120120
style: TDLinkStyle.primary,

tdesign-component/lib/src/components/message/td_message.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
383383
borderRadius: BorderRadius.circular(6),
384384
boxShadow: TDTheme.of(context).shadowsMiddle),
385385
child: Row(
386-
crossAxisAlignment: CrossAxisAlignment.end,
386+
crossAxisAlignment: CrossAxisAlignment.center,
387387
children: [
388388
if (widget.icon != false)
389389
Padding(

tdesign-component/lib/src/components/progress/td_progress.dart

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ class TDProgress extends StatelessWidget {
3636
this.linearBorderRadius,
3737
double? circleRadius,
3838
this.showLabel = true,
39+
this.customProgressLabel,
40+
this.labelWidgetWidth,
41+
this.labelWidgetAlignment,
3942
this.onTap,
4043
this.onLongPress,
4144
int animationDuration = 300,
@@ -78,6 +81,15 @@ class TDProgress extends StatelessWidget {
7881
/// 是否显示标签
7982
final bool showLabel;
8083

84+
/// 自定义标签
85+
final Widget? customProgressLabel;
86+
87+
/// 自定义标签宽度
88+
final double? labelWidgetWidth;
89+
90+
/// 自定义标签对齐方式
91+
final Alignment? labelWidgetAlignment;
92+
8193
/// 点击事件
8294
final VoidCallback? onTap;
8395

@@ -113,6 +125,9 @@ class TDProgress extends StatelessWidget {
113125
linearBorderRadius: linearBorderRadius ?? defaultValues.linearBorderRadius,
114126
circleRadius: circleRadius ?? defaultValues.circleRadius,
115127
showLabel: showLabel,
128+
customProgressLabel:customProgressLabel,
129+
labelWidgetWidth: labelWidgetWidth,
130+
labelWidgetAlignment: labelWidgetAlignment,
116131
onTap: onTap,
117132
onLongPress: onLongPress,
118133
type: type,
@@ -180,6 +195,9 @@ class ProgressIndicator extends StatefulWidget {
180195
final TDProgressType type;
181196
final TDProgressStatus progressStatus;
182197
final bool showLabel;
198+
final Widget? customProgressLabel;
199+
final double? labelWidgetWidth;
200+
final Alignment? labelWidgetAlignment;
183201
final VoidCallback? onTap;
184202
final VoidCallback? onLongPress;
185203
final int animationDuration;
@@ -198,6 +216,9 @@ class ProgressIndicator extends StatefulWidget {
198216
required this.type,
199217
this.progressStatus = TDProgressStatus.primary,
200218
this.showLabel = true,
219+
this.customProgressLabel,
220+
this.labelWidgetWidth,
221+
this.labelWidgetAlignment,
201222
this.onTap,
202223
this.onLongPress,
203224
this.animationDuration = 300,
@@ -371,9 +392,15 @@ class _ProgressIndicatorState extends State<ProgressIndicator>
371392
crossAxisAlignment: CrossAxisAlignment.center,
372393
children: [
373394
if (widget.progressLabelPosition == TDProgressLabelPosition.left)
374-
Padding(
395+
Container(
375396
padding: const EdgeInsets.only(right: 8.0),
376-
child: _buildLabelWidget(TDTheme.of(context).fontGyColor1),
397+
alignment:widget.labelWidgetAlignment??Alignment.centerRight,
398+
constraints: BoxConstraints(
399+
minWidth:widget.labelWidgetWidth??(maxWidth*0.1>70?maxWidth*0.04
400+
:maxWidth*0.1),
401+
),
402+
child:widget.customProgressLabel??
403+
_buildLabelWidget(TDTheme.of(context).fontGyColor1),
377404
),
378405
Expanded(
379406
child: Stack(
@@ -390,10 +417,16 @@ class _ProgressIndicatorState extends State<ProgressIndicator>
390417
],
391418
)),
392419
if (widget.progressLabelPosition == TDProgressLabelPosition.right)
393-
Padding(
394-
padding: const EdgeInsets.only(left: 8.0),
395-
child: _buildLabelWidget(TDTheme.of(context).fontGyColor1),
420+
Container(
421+
padding: const EdgeInsets.only(left: 8.0),
422+
alignment:widget.labelWidgetAlignment??Alignment.centerLeft,
423+
constraints: BoxConstraints(
424+
minWidth:widget.labelWidgetWidth??(maxWidth*0.1>70?maxWidth*0.04
425+
:maxWidth*0.1),
396426
),
427+
child:widget.customProgressLabel??
428+
_buildLabelWidget(TDTheme.of(context).fontGyColor1),
429+
)
397430
],
398431
);
399432
},

0 commit comments

Comments
 (0)