Skip to content

Commit cf7137e

Browse files
author
v_szheshi
committed
样式走查完成
1 parent c7f7a85 commit cf7137e

File tree

5 files changed

+100
-125
lines changed

5 files changed

+100
-125
lines changed
-2.02 KB
Loading

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,16 @@ class _TDSkeletonPageState extends State<TDSkeletonPage> {
180180
objects: [
181181
[
182182
TDSkeletonRowColObj(
183-
width: constraints.maxWidth,
183+
width: constraints.maxWidth*0.96,
184184
height: constraints.maxWidth,
185185
flex: null,
186186
style: TDSkeletonRowColObjStyle(
187187
borderRadius: (context) =>
188188
TDTheme.of(context).radiusExtraLarge))
189189
],
190-
const [TDSkeletonRowColObj.text()],
190+
[TDSkeletonRowColObj.text(
191+
width: constraints.maxWidth*0.96,
192+
)],
191193
const [
192194
TDSkeletonRowColObj.text(),
193195
TDSkeletonRowColObj.spacer(flex: 1),

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

Lines changed: 45 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ enum TDFooterType {
1111

1212
/// 品牌样式
1313
brand,
14-
1514
}
1615

1716
class TDFooter extends StatefulWidget {
18-
const TDFooter( this.type,
19-
{Key? key,
17+
const TDFooter(
18+
this.type, {
19+
Key? key,
2020
this.logo,
2121
this.text = '',
2222
this.links = const [],
23+
this.isWithUnderline = false,
2324
this.width,
2425
this.height,
2526
}) : super(key: key);
@@ -42,6 +43,8 @@ class TDFooter extends StatefulWidget {
4243
/// 链接
4344
final List<LinkObj> links;
4445

46+
/// 是否显示下滑线
47+
final bool isWithUnderline;
4548
@override
4649
State<TDFooter> createState() => _TDFooterState();
4750
}
@@ -60,55 +63,43 @@ class _TDFooterState extends State<TDFooter> {
6063
],
6164
),
6265
);
63-
case TDFooterType.link:
64-
return Container(
65-
alignment: Alignment.center,
66-
child: Column(
67-
mainAxisAlignment: MainAxisAlignment.center,
68-
children: [
69-
if (widget.links.isNotEmpty)
70-
_renderLinks()
71-
else
72-
_renderText(),
73-
],
74-
),
75-
);
76-
case TDFooterType.brand:
77-
return Container(
78-
alignment: Alignment.center,
79-
child: Column(
80-
mainAxisAlignment: MainAxisAlignment.center,
81-
children: [
82-
if (widget.logo != null)
83-
_renderLogo()
84-
else
85-
_renderText(),
86-
],
87-
),
88-
);
66+
case TDFooterType.link:
67+
return Container(
68+
alignment: Alignment.center,
69+
child: Column(
70+
mainAxisAlignment: MainAxisAlignment.center,
71+
children: [
72+
if (widget.links.isNotEmpty) _renderLinks() else _renderText(),
73+
],
74+
),
75+
);
76+
case TDFooterType.brand:
77+
return Container(
78+
alignment: Alignment.center,
79+
child: Column(
80+
mainAxisAlignment: MainAxisAlignment.center,
81+
children: [
82+
if (widget.logo != null) _renderLogo() else _renderText(),
83+
],
84+
),
85+
);
8986
}
9087
}
9188

9289
Widget _renderLogo() {
93-
return Row(
94-
mainAxisAlignment: MainAxisAlignment.center,
95-
children: [
96-
Padding(
97-
padding: const EdgeInsets.only(top: 4, bottom: 4),
98-
child: Row(
99-
mainAxisAlignment: MainAxisAlignment.center,
100-
children: [
101-
TDImage(
102-
assetUrl: widget.logo,
103-
type: TDImageType.clip,
104-
width: widget.width,
105-
height: widget.height,
106-
),
107-
]
90+
return Row(mainAxisAlignment: MainAxisAlignment.center, children: [
91+
Padding(
92+
padding: const EdgeInsets.only(top: 4, bottom: 4),
93+
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
94+
TDImage(
95+
assetUrl: widget.logo,
96+
type: TDImageType.fitWidth,
97+
width: widget.width,
98+
height: widget.height,
10899
),
109-
)
110-
]
111-
);
100+
]),
101+
)
102+
]);
112103
}
113104

114105
Widget _renderLinks() {
@@ -119,26 +110,23 @@ class _TDFooterState extends State<TDFooter> {
119110
padding: const EdgeInsets.only(top: 4, bottom: 4),
120111
child: Row(
121112
mainAxisAlignment: MainAxisAlignment.center,
122-
children: widget.links.map((link) {
123-
return Padding(
113+
children: List.generate(widget.links.length, (index) {
114+
LinkObj link = widget.links[index];
115+
return Container(
116+
decoration:index<(widget.links.length-1)? BoxDecoration(border: Border(right: BorderSide(color: Color.fromRGBO(231, 231, 231, 1)))):null,
124117
padding: const EdgeInsets.symmetric(horizontal: 4),
125118
child: TDLink(
126-
type: TDLinkType.withUnderline,
119+
type: widget.isWithUnderline ? TDLinkType.withUnderline : TDLinkType.basic,
127120
style: TDLinkStyle.primary,
128121
label: link.name,
129-
uri: link.uri)
122+
uri: link.uri),
130123
);
131124
}).toList(),
132125
),
133126
),
134127
Padding(
135128
padding: const EdgeInsets.only(bottom: 4),
136-
child: Row(
137-
mainAxisAlignment: MainAxisAlignment.center,
138-
children: [
139-
_renderText()
140-
]
141-
),
129+
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [_renderText()]),
142130
),
143131
],
144132
);

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

Lines changed: 50 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -217,37 +217,30 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
217217
if (widget.visible == false) {
218218
return const SizedBox.shrink();
219219
}
220-
var _leftOffset = widget.offset?[0] ??
221-
(MediaQuery.of(context).size.width - totalWidth) / 2;
220+
var _leftOffset = widget.offset?[0] ?? (MediaQuery.of(context).size.width - totalWidth) / 2;
222221

223222
Widget getText(BuildContext context) {
224223
if (widget.marquee == null) {
225224
return Align(
226-
alignment: Alignment.center,
227-
child: SizedBox(
228-
width: calculateTextWidth(),
229-
child: Text(
230-
widget.content ?? '',
231-
style: const TextStyle(color: Colors.black),
232-
maxLines: 1,
233-
overflow: TextOverflow.ellipsis,
234-
),
225+
alignment: Alignment.centerLeft,
226+
child: Text(
227+
widget.content ?? '',
228+
style: const TextStyle(color: Colors.black),
229+
maxLines: 1,
230+
overflow: TextOverflow.ellipsis,
235231
),
236232
);
237233
} else {
238234
final textPainter = TextPainter(
239-
text: TextSpan(
240-
text: widget.content ?? '',
241-
style: const TextStyle(color: Colors.black)),
235+
text: TextSpan(text: widget.content ?? '', style: const TextStyle(color: Colors.black)),
242236
maxLines: 1,
243237
textDirection: TextDirection.ltr,
244238
)..layout(minWidth: 0, maxWidth: double.infinity);
245239
final textWidth = textPainter.width;
246240

247241
final containerWidth = calculateTextWidth();
248242

249-
final animationDuration =
250-
Duration(milliseconds: (widget.marquee!.speed ?? 10000));
243+
final animationDuration = Duration(milliseconds: (widget.marquee!.speed ?? 10000));
251244
animationController!.duration = animationDuration;
252245

253246
final tween = Tween<Offset>(
@@ -256,45 +249,39 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
256249
);
257250

258251
if (widget.marquee!.delay != null && widget.marquee!.delay! > 0) {
259-
Future.delayed(
260-
Duration(milliseconds: widget.marquee!.delay!), startAnimation);
252+
Future.delayed(Duration(milliseconds: widget.marquee!.delay!), startAnimation);
261253
} else {
262254
startAnimation();
263255
}
264256

265257
return Align(
266-
alignment: Alignment.center,
267-
child: SizedBox(
268-
width: calculateTextWidth(),
269-
child: ClipRect(
270-
child: SizedBox(
271-
width: containerWidth,
272-
child: AnimatedBuilder(
273-
animation:
274-
animationController ?? const AlwaysStoppedAnimation(0),
275-
builder: (context, child) {
276-
final offset = tween.evaluate(animationController ??
277-
const AlwaysStoppedAnimation(0));
278-
return OverflowBox(
279-
minWidth: 0,
280-
maxWidth: double.infinity,
281-
alignment: Alignment.centerLeft,
282-
child: Transform.translate(
283-
offset: offset,
284-
child: SizedBox(
285-
child: Text(
286-
widget.content ?? '',
287-
style: const TextStyle(color: Colors.black),
288-
maxLines: 1,
289-
),
258+
alignment: Alignment.center,
259+
child: ClipRect(
260+
child: SizedBox(
261+
width: containerWidth,
262+
child: AnimatedBuilder(
263+
animation: animationController ?? const AlwaysStoppedAnimation(0),
264+
builder: (context, child) {
265+
final offset = tween.evaluate(animationController ?? const AlwaysStoppedAnimation(0));
266+
return OverflowBox(
267+
minWidth: 0,
268+
maxWidth: double.infinity,
269+
alignment: Alignment.centerLeft,
270+
child: Transform.translate(
271+
offset: offset,
272+
child: SizedBox(
273+
child: Text(
274+
widget.content ?? '',
275+
style: const TextStyle(color: Colors.black),
276+
maxLines: 1,
290277
),
291278
),
292-
);
293-
},
294-
),
279+
),
280+
);
281+
},
295282
),
296-
)),
297-
);
283+
),
284+
));
298285
}
299286
}
300287

@@ -304,17 +291,13 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
304291
} else {
305292
switch (widget.theme) {
306293
case MessageTheme.info:
307-
return Icon(TDIcons.error_circle_filled,
308-
color: TDTheme.of(context).brandColor7);
294+
return Icon(TDIcons.error_circle_filled, color: TDTheme.of(context).brandColor7);
309295
case MessageTheme.success:
310-
return Icon(TDIcons.error_circle_filled,
311-
color: TDTheme.of(context).successColor5);
296+
return Icon(TDIcons.check_circle_filled, color: TDTheme.of(context).successColor5);
312297
case MessageTheme.warning:
313-
return Icon(TDIcons.error_circle_filled,
314-
color: TDTheme.of(context).warningColor5);
298+
return Icon(TDIcons.error_circle_filled, color: TDTheme.of(context).warningColor5);
315299
case MessageTheme.error:
316-
return Icon(TDIcons.error_circle_filled,
317-
color: TDTheme.of(context).errorColor6);
300+
return Icon(TDIcons.error_circle_filled, color: TDTheme.of(context).errorColor6);
318301
case null:
319302
return const SizedBox.shrink();
320303
}
@@ -335,7 +318,7 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
335318
} else if (widget.closeBtn == true) {
336319
return GestureDetector(
337320
onTap: clickCloseButton,
338-
child: Icon(TDIcons.close),
321+
child: Icon(TDIcons.close,color:Color.fromRGBO(0, 0, 0, 0.4),),
339322
);
340323
} else if (widget.closeBtn is String) {
341324
return GestureDetector(
@@ -361,7 +344,7 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
361344
type: TDLinkType.basic,
362345
uri: widget.link.uri ?? Uri.parse('https://example.com'),
363346
size: TDLinkSize.small,
364-
color: widget.link.color ?? TDTheme.of(context).brandNormalColor,
347+
color:TDTheme.of(context).brandColor7,
365348
));
366349
} else if (widget.link is String) {
367350
return Align(
@@ -371,7 +354,7 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
371354
child: Text(
372355
widget.link ?? '',
373356
style: TextStyle(
374-
color: TDTheme.of(context).brandNormalColor,
357+
color: TDTheme.of(context).brandColor7,
375358
fontSize: 14,
376359
),
377360
maxLines: 1,
@@ -418,15 +401,17 @@ class _TDMessageState extends State<TDMessage> with TickerProviderStateMixin {
418401
child: Row(
419402
crossAxisAlignment: CrossAxisAlignment.center,
420403
children: [
421-
getText(context),
404+
Expanded(
405+
child: getText(context),
406+
flex: 3,
407+
),
422408
if (widget.link != null)
423-
Padding(
424-
padding: const EdgeInsets.only(left: 8),
425-
child: SizedBox(
426-
width: 28,
409+
Container(
410+
margin: const EdgeInsets.only(left: 8),
411+
width: 40,
427412
height: 22,
428-
child: getLink(context),
429-
),
413+
child:getLink(context)
414+
//
430415
),
431416
if (widget.closeBtn != null)
432417
Padding(

tdesign-component/lib/src/components/skeleton/td_skeleton.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class _TDSkeletonState extends State<TDSkeleton>
131131
LinearGradient(
132132
colors: [
133133
Colors.transparent,
134-
TDTheme.of(context).fontGyColor3,
134+
TDTheme.of(context).grayColor4,
135135
Colors.transparent,
136136
],
137137
// 15 deg

0 commit comments

Comments
 (0)