Browse Source

fix: 修改倒计时会抖动的问题

Destiny 6 months ago
parent
commit
02c953fb33

+ 1 - 1
lib/module/store/store_page.dart

@@ -433,7 +433,7 @@ class StorePage extends BasePage<StoreController> {
                 ),
                 SizedBox(width: 4.w),
                 Container(
-                  margin: EdgeInsets.only(top: 2.5.h),
+                  width: 57.w,
                   child: Obx(() {
                     return Text(
                       CountdownTimer.format(controller.goodsCountdown.value),

+ 27 - 9
lib/module/store/ticket/discount_ticket_dialog.dart

@@ -18,7 +18,7 @@ class DiscountTicketDialog {
 
   static void show({VoidCallback? clickConfirm, VoidCallback? clickCancel}) {
     EventHandler.report(EventId.event_02006);
-    if(SmartDialog.checkExist(tag: tag))return;
+    if (SmartDialog.checkExist(tag: tag)) return;
     SmartDialog.show(
       tag: tag,
       backType: SmartBackType.block,
@@ -185,7 +185,9 @@ class DiscountTicketDialog {
                                     SizedBox(height: 9.h),
                                     GestureDetector(
                                       onTap: () {
-                                        EventHandler.report(EventId.event_02007);
+                                        EventHandler.report(
+                                          EventId.event_02007,
+                                        );
                                         clickConfirm?.call();
                                         SmartDialog.dismiss(tag: tag);
                                       },
@@ -242,13 +244,29 @@ class DiscountTicketDialog {
                                             (totalMilliseconds ~/ 100) % 60;
                                         int milliseconds =
                                             (totalMilliseconds % 100); // 毫秒
-                                        return Text(
-                                          "${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}:${milliseconds.toString().padLeft(2, '0')} 后过期",
-                                          style: TextStyle(
-                                            color: Colors.white,
-                                            fontSize: 12.sp,
-                                            fontWeight: FontWeight.w500,
-                                          ),
+                                        return Row(
+                                          children: [
+                                            Container(
+                                              margin: EdgeInsets.only(left: 4.w),
+                                              width: 57.w,
+                                              child: Text(
+                                                "${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}:${milliseconds.toString().padLeft(2, '0')}",
+                                                style: TextStyle(
+                                                  color: Colors.white,
+                                                  fontSize: 12.sp,
+                                                  fontWeight: FontWeight.w500,
+                                                ),
+                                              ),
+                                            ),
+                                            Text(
+                                              "后过期",
+                                              style: TextStyle(
+                                                color: Colors.white,
+                                                fontSize: 12.sp,
+                                                fontWeight: FontWeight.w500,
+                                              ),
+                                            ),
+                                          ],
                                         );
                                       }),
                                     ),