@@ -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 (
0 commit comments