Commit 1078da2b8aa5ebe67b8a43af8d99d594d9901b91

Authored by 常守达
1 parent 13d89eb0

fix(today):首页等待数据loading

@@ -12,6 +12,7 @@ import 'package:doublefeel_flutter/l10n/l10n_extensions.dart'; @@ -12,6 +12,7 @@ import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
12 import 'package:flutter/material.dart'; 12 import 'package:flutter/material.dart';
13 import 'package:get/get.dart'; 13 import 'package:get/get.dart';
14 import 'package:intl/intl.dart'; 14 import 'package:intl/intl.dart';
  15 +import 'package:lottie/lottie.dart';
15 import 'package:table_calendar/table_calendar.dart'; 16 import 'package:table_calendar/table_calendar.dart';
16 17
17 import '../../controllers/today_controller.dart'; 18 import '../../controllers/today_controller.dart';
@@ -196,17 +197,28 @@ class TodayTabBody extends StatelessWidget { @@ -196,17 +197,28 @@ class TodayTabBody extends StatelessWidget {
196 ), 197 ),
197 ), 198 ),
198 Obx( 199 Obx(
199 - () => Text(  
200 - controller.v2StressScore.value?.stateString() ?? '',  
201 - textAlign: TextAlign.center,  
202 - style: TextStyle(  
203 - color: context.colors.textPrimary,  
204 - fontSize: 28,  
205 - fontWeight: FontWeight.w500,  
206 - ),  
207 - ), 200 + () => controller.isLoadingToday.value
  201 + ? Lottie.asset(
  202 + 'assets/lottie/loading.json',
  203 + width: 65,
  204 + height: 45,
  205 + repeat: true,
  206 + animate: true,
  207 + )
  208 + : Padding(
  209 + padding: const EdgeInsets.only(bottom: 12),
  210 + child: Text(
  211 + controller.v2StressScore.value?.stateString() ??
  212 + '',
  213 + textAlign: TextAlign.center,
  214 + style: TextStyle(
  215 + color: context.colors.textPrimary,
  216 + fontSize: 28,
  217 + fontWeight: FontWeight.w500,
  218 + ),
  219 + ),
  220 + ),
208 ), 221 ),
209 - const SizedBox(height: 12),  
210 Obx( 222 Obx(
211 () => StressProgressBar( 223 () => StressProgressBar(
212 score: controller.v2StressScore.value?.state == 0 224 score: controller.v2StressScore.value?.state == 0