Showing
29 changed files
with
1455 additions
and
1866 deletions
| 1 | PODS: | 1 | PODS: |
| 2 | - Flutter (1.0.0) | 2 | - Flutter (1.0.0) |
| 3 | + - fluttertoast (0.0.2): | ||
| 4 | + - Flutter | ||
| 3 | - image_cropper (0.0.4): | 5 | - image_cropper (0.0.4): |
| 4 | - Flutter | 6 | - Flutter |
| 5 | - TOCropViewController (~> 2.7.4) | 7 | - TOCropViewController (~> 2.7.4) |
| @@ -23,6 +25,7 @@ PODS: | @@ -23,6 +25,7 @@ PODS: | ||
| 23 | 25 | ||
| 24 | DEPENDENCIES: | 26 | DEPENDENCIES: |
| 25 | - Flutter (from `Flutter`) | 27 | - Flutter (from `Flutter`) |
| 28 | + - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) | ||
| 26 | - image_cropper (from `.symlinks/plugins/image_cropper/ios`) | 29 | - image_cropper (from `.symlinks/plugins/image_cropper/ios`) |
| 27 | - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) | 30 | - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) |
| 28 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) | 31 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) |
| @@ -38,6 +41,8 @@ SPEC REPOS: | @@ -38,6 +41,8 @@ SPEC REPOS: | ||
| 38 | EXTERNAL SOURCES: | 41 | EXTERNAL SOURCES: |
| 39 | Flutter: | 42 | Flutter: |
| 40 | :path: Flutter | 43 | :path: Flutter |
| 44 | + fluttertoast: | ||
| 45 | + :path: ".symlinks/plugins/fluttertoast/ios" | ||
| 41 | image_cropper: | 46 | image_cropper: |
| 42 | :path: ".symlinks/plugins/image_cropper/ios" | 47 | :path: ".symlinks/plugins/image_cropper/ios" |
| 43 | image_picker_ios: | 48 | image_picker_ios: |
| @@ -54,7 +59,8 @@ EXTERNAL SOURCES: | @@ -54,7 +59,8 @@ EXTERNAL SOURCES: | ||
| 54 | :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin" | 59 | :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin" |
| 55 | 60 | ||
| 56 | SPEC CHECKSUMS: | 61 | SPEC CHECKSUMS: |
| 57 | - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 | 62 | + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 |
| 63 | + fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1 | ||
| 58 | image_cropper: c4326ea50132b1e1564499e5d32a84f01fb03537 | 64 | image_cropper: c4326ea50132b1e1564499e5d32a84f01fb03537 |
| 59 | image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a | 65 | image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a |
| 60 | path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 | 66 | path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 |
| @@ -7,22 +7,7 @@ class HomeController extends GetxController { | @@ -7,22 +7,7 @@ class HomeController extends GetxController { | ||
| 7 | /// 当前选中的底部 tab 索引 | 7 | /// 当前选中的底部 tab 索引 |
| 8 | final selectedIndex = 0.obs; | 8 | final selectedIndex = 0.obs; |
| 9 | 9 | ||
| 10 | - /// 当前选中的日期(Today tab 使用) | ||
| 11 | - final selectedDate = _dateOnly(DateTime.now()).obs; | ||
| 12 | - | ||
| 13 | void changeTab(int index) { | 10 | void changeTab(int index) { |
| 14 | selectedIndex.value = index; | 11 | selectedIndex.value = index; |
| 15 | } | 12 | } |
| 16 | - | ||
| 17 | - void changeDate(DateTime date) { | ||
| 18 | - final normalizedDate = _dateOnly(date); | ||
| 19 | - final currentDate = selectedDate.value; | ||
| 20 | - if (currentDate == normalizedDate) return; | ||
| 21 | - | ||
| 22 | - selectedDate.value = normalizedDate; | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - static DateTime _dateOnly(DateTime date) { | ||
| 26 | - return DateTime(date.year, date.month, date.day); | ||
| 27 | - } | ||
| 28 | } | 13 | } |
| @@ -4,13 +4,14 @@ import 'package:doublefeel_flutter/core/logging/app_logger.dart'; | @@ -4,13 +4,14 @@ import 'package:doublefeel_flutter/core/logging/app_logger.dart'; | ||
| 4 | import 'package:doublefeel_flutter/core/network/api/health_api.dart'; | 4 | import 'package:doublefeel_flutter/core/network/api/health_api.dart'; |
| 5 | import 'package:doublefeel_flutter/core/network/api/user_api.dart'; | 5 | import 'package:doublefeel_flutter/core/network/api/user_api.dart'; |
| 6 | import 'package:doublefeel_flutter/core/result/app_result.dart'; | 6 | import 'package:doublefeel_flutter/core/result/app_result.dart'; |
| 7 | +import 'package:doublefeel_flutter/core/error/app_error.dart'; | ||
| 7 | import 'package:doublefeel_flutter/core/services/health_kit_upload_service.dart'; | 8 | import 'package:doublefeel_flutter/core/services/health_kit_upload_service.dart'; |
| 8 | import 'package:doublefeel_flutter/core/services/user_state_service.dart'; | 9 | import 'package:doublefeel_flutter/core/services/user_state_service.dart'; |
| 9 | import 'package:doublefeel_flutter/data/models/enums/app_enums.dart'; | 10 | import 'package:doublefeel_flutter/data/models/enums/app_enums.dart'; |
| 10 | import 'package:doublefeel_flutter/data/models/health/health_models.dart'; | 11 | import 'package:doublefeel_flutter/data/models/health/health_models.dart'; |
| 11 | import 'package:doublefeel_flutter/data/models/health/health_upload_models.dart'; | 12 | import 'package:doublefeel_flutter/data/models/health/health_upload_models.dart'; |
| 12 | import 'package:doublefeel_flutter/data/models/user/user_models.dart'; | 13 | import 'package:doublefeel_flutter/data/models/user/user_models.dart'; |
| 13 | -import 'package:flutter/foundation.dart'; | 14 | +import 'package:flutter/material.dart'; |
| 14 | import 'package:get/get.dart'; | 15 | import 'package:get/get.dart'; |
| 15 | 16 | ||
| 16 | /// HRV 趋势数据点 | 17 | /// HRV 趋势数据点 |
| @@ -51,6 +52,12 @@ class TodayController extends GetxController { | @@ -51,6 +52,12 @@ class TodayController extends GetxController { | ||
| 51 | 52 | ||
| 52 | UserStateService get userStateService => _userStateService; | 53 | UserStateService get userStateService => _userStateService; |
| 53 | 54 | ||
| 55 | + late final DateTime firstSelectableDay; | ||
| 56 | + late final DateTime lastSelectableDay; | ||
| 57 | + final selectedDate = DateTime.now().obs; | ||
| 58 | + final focusedDay = DateTime.now().obs; | ||
| 59 | + final scrollOffset = 0.0.obs; | ||
| 60 | + | ||
| 54 | final isLoadingToday = false.obs; | 61 | final isLoadingToday = false.obs; |
| 55 | final showHealthDataAuthCard = true.obs; | 62 | final showHealthDataAuthCard = true.obs; |
| 56 | final stressSubtitle = 'Hi, 你今日的综合压力状态'.obs; | 63 | final stressSubtitle = 'Hi, 你今日的综合压力状态'.obs; |
| @@ -105,22 +112,48 @@ class TodayController extends GetxController { | @@ -105,22 +112,48 @@ class TodayController extends GetxController { | ||
| 105 | @override | 112 | @override |
| 106 | void onInit() { | 113 | void onInit() { |
| 107 | super.onInit(); | 114 | super.onInit(); |
| 108 | - unawaited(loadTodayData()); | 115 | + final today = DateUtils.dateOnly(DateTime.now()); |
| 116 | + firstSelectableDay = DateTime(today.year - 1); | ||
| 117 | + lastSelectableDay = today; | ||
| 118 | + selectedDate.value = today; | ||
| 119 | + focusedDay.value = today; | ||
| 120 | + | ||
| 121 | + ever<DateTime>(selectedDate, (date) { | ||
| 122 | + unawaited(loadDataForDate(date)); | ||
| 123 | + }); | ||
| 124 | + | ||
| 125 | + unawaited(loadDataForDate(today)); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + Future<void> loadTodayData() => loadDataForDate(lastSelectableDay); | ||
| 129 | + | ||
| 130 | + void changeDate(DateTime date, {DateTime? focused}) { | ||
| 131 | + final normalizedDate = _clampDate(date); | ||
| 132 | + selectedDate.value = normalizedDate; | ||
| 133 | + focusedDay.value = _clampDate(focused ?? normalizedDate); | ||
| 109 | } | 134 | } |
| 110 | 135 | ||
| 111 | - Future<void> loadTodayData() async { | ||
| 112 | - if (isLoadingToday.value) return; | 136 | + DateTime _clampDate(DateTime date) { |
| 137 | + final normalizedDate = DateUtils.dateOnly(date); | ||
| 138 | + if (normalizedDate.isBefore(firstSelectableDay)) return firstSelectableDay; | ||
| 139 | + if (normalizedDate.isAfter(lastSelectableDay)) return lastSelectableDay; | ||
| 140 | + return normalizedDate; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + Future<void> loadDataForDate(DateTime date) async { | ||
| 113 | isLoadingToday.value = true; | 144 | isLoadingToday.value = true; |
| 114 | try { | 145 | try { |
| 115 | await Future.wait([ | 146 | await Future.wait([ |
| 116 | _refreshUserGreeting(), | 147 | _refreshUserGreeting(), |
| 117 | // _refreshHealthAuthorizationState(), | 148 | // _refreshHealthAuthorizationState(), |
| 118 | - _refreshTodayHealthData(), | 149 | + _refreshHealthDataForDate(date), |
| 119 | ]); | 150 | ]); |
| 120 | } catch (error, stackTrace) { | 151 | } catch (error, stackTrace) { |
| 121 | - AppLogger.e('TodayController.loadTodayData failed', error, stackTrace); | 152 | + AppLogger.e('TodayController.loadDataForDate failed', error, stackTrace); |
| 122 | } finally { | 153 | } finally { |
| 123 | - isLoadingToday.value = false; | 154 | + if (selectedDate.value == date) { |
| 155 | + isLoadingToday.value = false; | ||
| 156 | + } | ||
| 124 | } | 157 | } |
| 125 | } | 158 | } |
| 126 | 159 | ||
| @@ -153,17 +186,27 @@ class TodayController extends GetxController { | @@ -153,17 +186,27 @@ class TodayController extends GetxController { | ||
| 153 | showHealthDataAuthCard.value = !(hasServerAuth || hasClientAuth); | 186 | showHealthDataAuthCard.value = !(hasServerAuth || hasClientAuth); |
| 154 | } | 187 | } |
| 155 | 188 | ||
| 156 | - Future<void> _refreshTodayHealthData() async { | ||
| 157 | - final startDate = _todayDateKey(); | 189 | + Future<void> _refreshHealthDataForDate(DateTime date) async { |
| 190 | + final startYear = date.year; | ||
| 191 | + final startMonth = date.month; | ||
| 192 | + final startDate = startYear * 10000 + startMonth * 100 + 1; // e.g. 20260601 | ||
| 158 | const dateRangeType = 1; | 193 | const dateRangeType = 1; |
| 159 | 194 | ||
| 160 | - final todayResultFuture = _healthApi.getTodayData( | ||
| 161 | - isOther: false, | ||
| 162 | - errorHandlingPolicy: null, | ||
| 163 | - ); | ||
| 164 | - final latestHrvResultFuture = _healthApi.getLatestHrvData( | ||
| 165 | - errorHandlingPolicy: null, | ||
| 166 | - ); | 195 | + final isToday = DateUtils.isSameDay(date, lastSelectableDay); |
| 196 | + | ||
| 197 | + final todayResultFuture = isToday | ||
| 198 | + ? _healthApi.getTodayData( | ||
| 199 | + isOther: false, | ||
| 200 | + errorHandlingPolicy: null, | ||
| 201 | + ) | ||
| 202 | + : Future.value(AppFailure<TodayStatusData>(AppUnknownError('Not today'))); | ||
| 203 | + | ||
| 204 | + final latestHrvResultFuture = isToday | ||
| 205 | + ? _healthApi.getLatestHrvData( | ||
| 206 | + errorHandlingPolicy: null, | ||
| 207 | + ) | ||
| 208 | + : Future.value(AppFailure<LatestHrvData>(AppUnknownError('Not today'))); | ||
| 209 | + | ||
| 167 | final hrvStatisticsResultFuture = _healthApi.getHrvStatistics( | 210 | final hrvStatisticsResultFuture = _healthApi.getHrvStatistics( |
| 168 | isOther: false, | 211 | isOther: false, |
| 169 | dateRangeType: dateRangeType, | 212 | dateRangeType: dateRangeType, |
| @@ -189,10 +232,18 @@ class TodayController extends GetxController { | @@ -189,10 +232,18 @@ class TodayController extends GetxController { | ||
| 189 | final sleepStatisticsResult = await sleepStatisticsResultFuture; | 232 | final sleepStatisticsResult = await sleepStatisticsResultFuture; |
| 190 | final activityStatisticsResult = await activityStatisticsResultFuture; | 233 | final activityStatisticsResult = await activityStatisticsResultFuture; |
| 191 | 234 | ||
| 235 | + if (selectedDate.value != date) return; | ||
| 236 | + | ||
| 237 | + if (!isToday) { | ||
| 238 | + _clearRealTimeData(); | ||
| 239 | + } | ||
| 240 | + | ||
| 192 | if (todayResult case AppSuccess<TodayStatusData>(data: final today)) { | 241 | if (todayResult case AppSuccess<TodayStatusData>(data: final today)) { |
| 193 | _applyTodayData(today); | 242 | _applyTodayData(today); |
| 194 | } else if (todayResult case AppFailure(error: final error)) { | 243 | } else if (todayResult case AppFailure(error: final error)) { |
| 195 | - AppLogger.w('HealthApi.getTodayData failed: $error'); | 244 | + if (isToday) { |
| 245 | + AppLogger.w('HealthApi.getTodayData failed: $error'); | ||
| 246 | + } | ||
| 196 | } | 247 | } |
| 197 | 248 | ||
| 198 | if (latestHrvResult case AppSuccess<LatestHrvData>(data: final latestHrv)) { | 249 | if (latestHrvResult case AppSuccess<LatestHrvData>(data: final latestHrv)) { |
| @@ -201,22 +252,42 @@ class TodayController extends GetxController { | @@ -201,22 +252,42 @@ class TodayController extends GetxController { | ||
| 201 | 252 | ||
| 202 | if (hrvStatisticsResult | 253 | if (hrvStatisticsResult |
| 203 | case AppSuccess<HrvStatisticsData>(data: final hrvStatistics)) { | 254 | case AppSuccess<HrvStatisticsData>(data: final hrvStatistics)) { |
| 204 | - _applyHrvStatistics(hrvStatistics); | 255 | + _applyHrvStatistics(hrvStatistics, date); |
| 205 | } | 256 | } |
| 206 | 257 | ||
| 207 | if (sleepStatisticsResult | 258 | if (sleepStatisticsResult |
| 208 | case AppSuccess<SleepStatisticsData>(data: final sleepStatistics)) { | 259 | case AppSuccess<SleepStatisticsData>(data: final sleepStatistics)) { |
| 209 | - _applySleepStatistics(sleepStatistics); | 260 | + _applySleepStatistics(sleepStatistics, date); |
| 210 | } | 261 | } |
| 211 | 262 | ||
| 212 | if (activityStatisticsResult | 263 | if (activityStatisticsResult |
| 213 | case AppSuccess<ActivityBurnStatisticsData>( | 264 | case AppSuccess<ActivityBurnStatisticsData>( |
| 214 | data: final activityStatistics | 265 | data: final activityStatistics |
| 215 | )) { | 266 | )) { |
| 216 | - _applyActivityStatistics(activityStatistics); | 267 | + _applyActivityStatistics(activityStatistics, date); |
| 217 | } | 268 | } |
| 218 | } | 269 | } |
| 219 | 270 | ||
| 271 | + void _clearRealTimeData() { | ||
| 272 | + restingHeartRate.value = '--'; | ||
| 273 | + sleepAverageHeartRate.value = '--'; | ||
| 274 | + sleepHours.value = '--'; | ||
| 275 | + sleepMinutes.value = '--'; | ||
| 276 | + sleepQuality.value = '--'; | ||
| 277 | + sleepProgress.value = 0.0; | ||
| 278 | + activityCalories.value = '--'; | ||
| 279 | + activityExerciseMinutes.value = '--'; | ||
| 280 | + activityStandHours.value = '--'; | ||
| 281 | + activityMoveProgress.value = 0.0; | ||
| 282 | + activityExerciseProgress.value = 0.0; | ||
| 283 | + activityStandProgress.value = 0.0; | ||
| 284 | + hrvChartData.clear(); | ||
| 285 | + stressChartData.clear(); | ||
| 286 | + hrvAnnotations.clear(); | ||
| 287 | + avgHrv.value = '--'; | ||
| 288 | + stressLabel.value = '状态正常'; | ||
| 289 | + } | ||
| 290 | + | ||
| 220 | void _applyTodayData(TodayStatusData today) { | 291 | void _applyTodayData(TodayStatusData today) { |
| 221 | final recent = today.recentData; | 292 | final recent = today.recentData; |
| 222 | if (recent?.heartRate != null) { | 293 | if (recent?.heartRate != null) { |
| @@ -268,10 +339,27 @@ class TodayController extends GetxController { | @@ -268,10 +339,27 @@ class TodayController extends GetxController { | ||
| 268 | } | 339 | } |
| 269 | } | 340 | } |
| 270 | 341 | ||
| 271 | - void _applyHrvStatistics(HrvStatisticsData data) { | ||
| 272 | - if (avgHrv.value == '--' && data.avgHrv != null) { | ||
| 273 | - avgHrv.value = _formatMetric(data.avgHrv); | 342 | + void _applyHrvStatistics(HrvStatisticsData data, DateTime date) { |
| 343 | + final dateKey = date.day; | ||
| 344 | + final isToday = DateUtils.isSameDay(date, lastSelectableDay); | ||
| 345 | + | ||
| 346 | + if (isToday) { | ||
| 347 | + if (avgHrv.value == '--' && data.avgHrv != null) { | ||
| 348 | + avgHrv.value = _formatMetric(data.avgHrv); | ||
| 349 | + } | ||
| 350 | + } else { | ||
| 351 | + double? dailyHrv; | ||
| 352 | + if (data.hrvTrendList != null) { | ||
| 353 | + for (final trend in data.hrvTrendList!) { | ||
| 354 | + if (trend.timeKey == dateKey) { | ||
| 355 | + dailyHrv = trend.average; | ||
| 356 | + break; | ||
| 357 | + } | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + avgHrv.value = _formatMetric(dailyHrv); | ||
| 274 | } | 361 | } |
| 362 | + | ||
| 275 | if (data.avgRestingHeartRate != null) { | 363 | if (data.avgRestingHeartRate != null) { |
| 276 | restingHeartRate.value = _formatMetric(data.avgRestingHeartRate); | 364 | restingHeartRate.value = _formatMetric(data.avgRestingHeartRate); |
| 277 | } | 365 | } |
| @@ -280,41 +368,102 @@ class TodayController extends GetxController { | @@ -280,41 +368,102 @@ class TodayController extends GetxController { | ||
| 280 | } | 368 | } |
| 281 | } | 369 | } |
| 282 | 370 | ||
| 283 | - void _applySleepStatistics(SleepStatisticsData data) { | ||
| 284 | - if (sleepHours.value == '--' && data.avgSleepDuration != null) { | ||
| 285 | - _applySleepDuration(data.avgSleepDuration); | 371 | + void _applySleepStatistics(SleepStatisticsData data, DateTime date) { |
| 372 | + final dateKey = date.day; | ||
| 373 | + final isToday = DateUtils.isSameDay(date, lastSelectableDay); | ||
| 374 | + | ||
| 375 | + if (isToday) { | ||
| 376 | + if (sleepHours.value == '--' && data.avgSleepDuration != null) { | ||
| 377 | + _applySleepDuration(data.avgSleepDuration); | ||
| 378 | + } | ||
| 379 | + } else { | ||
| 380 | + int? dailySleep; | ||
| 381 | + if (data.sleepTrendList != null) { | ||
| 382 | + for (final trend in data.sleepTrendList!) { | ||
| 383 | + if (trend.timeKey == dateKey) { | ||
| 384 | + dailySleep = trend.average; | ||
| 385 | + break; | ||
| 386 | + } | ||
| 387 | + } | ||
| 388 | + } | ||
| 389 | + _applySleepDuration(dailySleep); | ||
| 286 | } | 390 | } |
| 391 | + | ||
| 287 | final deepPercentage = data.deepPercentage; | 392 | final deepPercentage = data.deepPercentage; |
| 288 | if (deepPercentage != null) { | 393 | if (deepPercentage != null) { |
| 289 | sleepQuality.value = _sleepQualityFromDeepPercentage(deepPercentage); | 394 | sleepQuality.value = _sleepQualityFromDeepPercentage(deepPercentage); |
| 290 | } | 395 | } |
| 291 | } | 396 | } |
| 292 | 397 | ||
| 293 | - void _applyActivityStatistics(ActivityBurnStatisticsData data) { | 398 | + void _applyActivityStatistics(ActivityBurnStatisticsData data, DateTime date) { |
| 294 | _activityMoveTarget = data.activityTargetInfo?.move ?? _activityMoveTarget; | 399 | _activityMoveTarget = data.activityTargetInfo?.move ?? _activityMoveTarget; |
| 295 | _activityStandTarget = | 400 | _activityStandTarget = |
| 296 | data.activityTargetInfo?.stand ?? _activityStandTarget; | 401 | data.activityTargetInfo?.stand ?? _activityStandTarget; |
| 297 | 402 | ||
| 298 | - if (activityCalories.value == '--' && data.totalCaloriesBurned != null) { | ||
| 299 | - activityCalories.value = _formatMetric(data.totalCaloriesBurned); | ||
| 300 | - } | ||
| 301 | - if (activityStandHours.value == '--' && data.totalStand != null) { | ||
| 302 | - activityStandHours.value = _formatMetric(data.totalStand); | 403 | + final dateKey = date.day; |
| 404 | + final isToday = DateUtils.isSameDay(date, lastSelectableDay); | ||
| 405 | + | ||
| 406 | + if (isToday) { | ||
| 407 | + if (activityCalories.value == '--' && data.totalCaloriesBurned != null) { | ||
| 408 | + activityCalories.value = _formatMetric(data.totalCaloriesBurned); | ||
| 409 | + } | ||
| 410 | + if (activityStandHours.value == '--' && data.totalStand != null) { | ||
| 411 | + activityStandHours.value = _formatMetric(data.totalStand); | ||
| 412 | + } | ||
| 413 | + } else { | ||
| 414 | + int? dailyMove; | ||
| 415 | + if (data.caloriesBurnedTrendList != null) { | ||
| 416 | + for (final trend in data.caloriesBurnedTrendList!) { | ||
| 417 | + if (trend.timeKey == dateKey) { | ||
| 418 | + dailyMove = trend.value; | ||
| 419 | + break; | ||
| 420 | + } | ||
| 421 | + } | ||
| 422 | + } | ||
| 423 | + activityCalories.value = _formatMetric(dailyMove); | ||
| 424 | + | ||
| 425 | + int? dailyExercise; | ||
| 426 | + if (data.exerciseTimeTrendList != null) { | ||
| 427 | + for (final trend in data.exerciseTimeTrendList!) { | ||
| 428 | + if (trend.timeKey == dateKey) { | ||
| 429 | + dailyExercise = trend.value; | ||
| 430 | + break; | ||
| 431 | + } | ||
| 432 | + } | ||
| 433 | + } | ||
| 434 | + activityExerciseMinutes.value = _formatMetric(dailyExercise); | ||
| 435 | + activityStandHours.value = '--'; | ||
| 303 | } | 436 | } |
| 304 | 437 | ||
| 305 | final moveValue = _parseMetric(activityCalories.value); | 438 | final moveValue = _parseMetric(activityCalories.value); |
| 439 | + final exerciseValue = _parseMetric(activityExerciseMinutes.value); | ||
| 306 | final standValue = _parseMetric(activityStandHours.value); | 440 | final standValue = _parseMetric(activityStandHours.value); |
| 441 | + | ||
| 307 | if (moveValue != null) { | 442 | if (moveValue != null) { |
| 308 | activityMoveProgress.value = _progress( | 443 | activityMoveProgress.value = _progress( |
| 309 | moveValue, | 444 | moveValue, |
| 310 | (_activityMoveTarget ?? 400).toDouble(), | 445 | (_activityMoveTarget ?? 400).toDouble(), |
| 311 | ); | 446 | ); |
| 447 | + } else { | ||
| 448 | + activityMoveProgress.value = 0.0; | ||
| 312 | } | 449 | } |
| 450 | + | ||
| 451 | + if (exerciseValue != null) { | ||
| 452 | + activityExerciseProgress.value = _progress( | ||
| 453 | + exerciseValue, | ||
| 454 | + 30.0, | ||
| 455 | + ); | ||
| 456 | + } else { | ||
| 457 | + activityExerciseProgress.value = 0.0; | ||
| 458 | + } | ||
| 459 | + | ||
| 313 | if (standValue != null) { | 460 | if (standValue != null) { |
| 314 | activityStandProgress.value = _progress( | 461 | activityStandProgress.value = _progress( |
| 315 | standValue, | 462 | standValue, |
| 316 | (_activityStandTarget ?? 12).toDouble(), | 463 | (_activityStandTarget ?? 12).toDouble(), |
| 317 | ); | 464 | ); |
| 465 | + } else { | ||
| 466 | + activityStandProgress.value = 0.0; | ||
| 318 | } | 467 | } |
| 319 | } | 468 | } |
| 320 | 469 | ||
| @@ -474,9 +623,4 @@ class TodayController extends GetxController { | @@ -474,9 +623,4 @@ class TodayController extends GetxController { | ||
| 474 | final m = (totalMinutes % 60).toString().padLeft(2, '0'); | 623 | final m = (totalMinutes % 60).toString().padLeft(2, '0'); |
| 475 | return '$h:$m'; | 624 | return '$h:$m'; |
| 476 | } | 625 | } |
| 477 | - | ||
| 478 | - int _todayDateKey() { | ||
| 479 | - final now = DateTime.now(); | ||
| 480 | - return now.year * 10000 + now.month * 100 + now.day - 2; | ||
| 481 | - } | ||
| 482 | } | 626 | } |
| @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; | @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; | ||
| 4 | import 'package:get/get.dart'; | 4 | import 'package:get/get.dart'; |
| 5 | import 'package:table_calendar/table_calendar.dart'; | 5 | import 'package:table_calendar/table_calendar.dart'; |
| 6 | 6 | ||
| 7 | -import '../../controllers/home_controller.dart'; | ||
| 8 | import '../../controllers/today_controller.dart'; | 7 | import '../../controllers/today_controller.dart'; |
| 9 | import '../../widgets/today/today_health_data_auth_card.dart'; | 8 | import '../../widgets/today/today_health_data_auth_card.dart'; |
| 10 | import '../../widgets/today/today_hrv_ad_banner.dart'; | 9 | import '../../widgets/today/today_hrv_ad_banner.dart'; |
| @@ -14,14 +13,9 @@ import '../../widgets/today/today_sleep_activity_cards.dart'; | @@ -14,14 +13,9 @@ import '../../widgets/today/today_sleep_activity_cards.dart'; | ||
| 14 | 13 | ||
| 15 | import '../../widgets/today/premium_card.dart'; | 14 | import '../../widgets/today/premium_card.dart'; |
| 16 | 15 | ||
| 17 | -class TodayTab extends StatefulWidget { | 16 | +class TodayTab extends GetView<TodayController> { |
| 18 | const TodayTab({super.key}); | 17 | const TodayTab({super.key}); |
| 19 | 18 | ||
| 20 | - @override | ||
| 21 | - State<TodayTab> createState() => _TodayTabState(); | ||
| 22 | -} | ||
| 23 | - | ||
| 24 | -class _TodayTabState extends State<TodayTab> { | ||
| 25 | static const _bgColor = Color(0xFFF2F2F7); | 19 | static const _bgColor = Color(0xFFF2F2F7); |
| 26 | static const _topBarHeight = 48.0; | 20 | static const _topBarHeight = 48.0; |
| 27 | static const _weekCalendarHeight = 58.0; | 21 | static const _weekCalendarHeight = 58.0; |
| @@ -29,46 +23,6 @@ class _TodayTabState extends State<TodayTab> { | @@ -29,46 +23,6 @@ class _TodayTabState extends State<TodayTab> { | ||
| 29 | static const _weekRowsHeight = 50.0; | 23 | static const _weekRowsHeight = 50.0; |
| 30 | static const _selectedDayWidth = 32.0; | 24 | static const _selectedDayWidth = 32.0; |
| 31 | 25 | ||
| 32 | - final TodayController controller = Get.find<TodayController>(); | ||
| 33 | - final HomeController homeController = Get.find<HomeController>(); | ||
| 34 | - late final DateTime _firstSelectableDay; | ||
| 35 | - late final DateTime _lastSelectableDay; | ||
| 36 | - late final int _dayPageCount; | ||
| 37 | - late final PageController _pageController; | ||
| 38 | - late final Worker _selectedDateWorker; | ||
| 39 | - late DateTime _focusedDay; | ||
| 40 | - final ValueNotifier<double> _scrollOffset = ValueNotifier<double>(0); | ||
| 41 | - | ||
| 42 | - @override | ||
| 43 | - void initState() { | ||
| 44 | - super.initState(); | ||
| 45 | - final today = DateUtils.dateOnly(DateTime.now()); | ||
| 46 | - _firstSelectableDay = DateTime(today.year - 1); | ||
| 47 | - _lastSelectableDay = today; | ||
| 48 | - _dayPageCount = | ||
| 49 | - _lastSelectableDay.difference(_firstSelectableDay).inDays + 1; | ||
| 50 | - | ||
| 51 | - final initialSelectedDay = | ||
| 52 | - _clampSelectableDay(homeController.selectedDate.value); | ||
| 53 | - _focusedDay = initialSelectedDay; | ||
| 54 | - homeController.changeDate(initialSelectedDay); | ||
| 55 | - _pageController = PageController( | ||
| 56 | - initialPage: _pageIndexForDay(initialSelectedDay), | ||
| 57 | - ); | ||
| 58 | - _selectedDateWorker = ever<DateTime>( | ||
| 59 | - homeController.selectedDate, | ||
| 60 | - _handleSelectedDateChanged, | ||
| 61 | - ); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - @override | ||
| 65 | - void dispose() { | ||
| 66 | - _selectedDateWorker.dispose(); | ||
| 67 | - _pageController.dispose(); | ||
| 68 | - _scrollOffset.dispose(); | ||
| 69 | - super.dispose(); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | @override | 26 | @override |
| 73 | Widget build(BuildContext context) { | 27 | Widget build(BuildContext context) { |
| 74 | final topPadding = MediaQuery.paddingOf(context).top; | 28 | final topPadding = MediaQuery.paddingOf(context).top; |
| @@ -79,32 +33,30 @@ class _TodayTabState extends State<TodayTab> { | @@ -79,32 +33,30 @@ class _TodayTabState extends State<TodayTab> { | ||
| 79 | child: Stack( | 33 | child: Stack( |
| 80 | children: [ | 34 | children: [ |
| 81 | NotificationListener<ScrollNotification>( | 35 | NotificationListener<ScrollNotification>( |
| 82 | - onNotification: _handleScrollNotification, | ||
| 83 | - child: PageView.builder( | ||
| 84 | - controller: _pageController, | ||
| 85 | - itemCount: _dayPageCount, | ||
| 86 | - onPageChanged: _onDayPageChanged, | ||
| 87 | - itemBuilder: (context, index) { | ||
| 88 | - return _buildDayScrollView(context, pinnedHeaderHeight); | ||
| 89 | - }, | ||
| 90 | - ), | 36 | + onNotification: (notification) { |
| 37 | + if (notification.metrics.axis == Axis.vertical) { | ||
| 38 | + controller.scrollOffset.value = | ||
| 39 | + notification.metrics.pixels.clamp(0.0, double.infinity); | ||
| 40 | + } | ||
| 41 | + return false; | ||
| 42 | + }, | ||
| 43 | + child: _buildDayScrollView(context, pinnedHeaderHeight), | ||
| 91 | ), | 44 | ), |
| 92 | Positioned( | 45 | Positioned( |
| 93 | top: 0, | 46 | top: 0, |
| 94 | left: 0, | 47 | left: 0, |
| 95 | right: 0, | 48 | right: 0, |
| 96 | height: pinnedHeaderHeight, | 49 | height: pinnedHeaderHeight, |
| 97 | - child: ValueListenableBuilder<double>( | ||
| 98 | - valueListenable: _scrollOffset, | ||
| 99 | - builder: (context, offset, child) { | ||
| 100 | - final opacity = | ||
| 101 | - (offset / _topContentHeight).clamp(0.0, 1).toDouble(); | ||
| 102 | - | ||
| 103 | - return Container( | ||
| 104 | - color: const Color(0xFFDDD2FF).withValues(alpha: opacity), | ||
| 105 | - ); | ||
| 106 | - }, | ||
| 107 | - ), | 50 | + child: Obx(() { |
| 51 | + final opacity = | ||
| 52 | + (controller.scrollOffset.value / _topContentHeight) | ||
| 53 | + .clamp(0.0, 1.0) | ||
| 54 | + .toDouble(); | ||
| 55 | + | ||
| 56 | + return Container( | ||
| 57 | + color: const Color(0xFFDDD2FF).withValues(alpha: opacity), | ||
| 58 | + ); | ||
| 59 | + }), | ||
| 108 | ), | 60 | ), |
| 109 | Positioned( | 61 | Positioned( |
| 110 | top: topPadding, | 62 | top: topPadding, |
| @@ -115,11 +67,14 @@ class _TodayTabState extends State<TodayTab> { | @@ -115,11 +67,14 @@ class _TodayTabState extends State<TodayTab> { | ||
| 115 | mainAxisSize: MainAxisSize.min, | 67 | mainAxisSize: MainAxisSize.min, |
| 116 | children: [ | 68 | children: [ |
| 117 | _TopDateBar( | 69 | _TopDateBar( |
| 118 | - title: _dateTitle, | ||
| 119 | - showBackToToday: !_isSelectedToday, | 70 | + title: _dateTitle(controller.selectedDate.value), |
| 71 | + showBackToToday: !isSameDay( | ||
| 72 | + controller.selectedDate.value, | ||
| 73 | + controller.lastSelectableDay, | ||
| 74 | + ), | ||
| 120 | onBackToToday: _backToToday, | 75 | onBackToToday: _backToToday, |
| 121 | ), | 76 | ), |
| 122 | - _buildWeekCalendar(), | 77 | + _buildWeekCalendar(context), |
| 123 | ], | 78 | ], |
| 124 | ), | 79 | ), |
| 125 | ), | 80 | ), |
| @@ -134,7 +89,6 @@ class _TodayTabState extends State<TodayTab> { | @@ -134,7 +89,6 @@ class _TodayTabState extends State<TodayTab> { | ||
| 134 | double pinnedHeaderHeight, | 89 | double pinnedHeaderHeight, |
| 135 | ) { | 90 | ) { |
| 136 | return CustomScrollView( | 91 | return CustomScrollView( |
| 137 | - primary: false, | ||
| 138 | physics: const ClampingScrollPhysics(), | 92 | physics: const ClampingScrollPhysics(), |
| 139 | slivers: [ | 93 | slivers: [ |
| 140 | SliverToBoxAdapter( | 94 | SliverToBoxAdapter( |
| @@ -241,7 +195,7 @@ class _TodayTabState extends State<TodayTab> { | @@ -241,7 +195,7 @@ class _TodayTabState extends State<TodayTab> { | ||
| 241 | ); | 195 | ); |
| 242 | } | 196 | } |
| 243 | 197 | ||
| 244 | - Widget _buildWeekCalendar() { | 198 | + Widget _buildWeekCalendar(BuildContext context) { |
| 245 | return SizedBox( | 199 | return SizedBox( |
| 246 | height: _weekCalendarHeight, | 200 | height: _weekCalendarHeight, |
| 247 | child: Padding( | 201 | child: Padding( |
| @@ -257,17 +211,18 @@ class _TodayTabState extends State<TodayTab> { | @@ -257,17 +211,18 @@ class _TodayTabState extends State<TodayTab> { | ||
| 257 | headerVisible: false, | 211 | headerVisible: false, |
| 258 | daysOfWeekHeight: _weekRowsHeight / 2, | 212 | daysOfWeekHeight: _weekRowsHeight / 2, |
| 259 | rowHeight: _weekRowsHeight / 2, | 213 | rowHeight: _weekRowsHeight / 2, |
| 260 | - focusedDay: _focusedDay, | ||
| 261 | - firstDay: _firstSelectableDay, | ||
| 262 | - lastDay: _lastSelectableDay, | ||
| 263 | - currentDay: _lastSelectableDay, | 214 | + focusedDay: controller.focusedDay.value, |
| 215 | + firstDay: controller.firstSelectableDay, | ||
| 216 | + lastDay: controller.lastSelectableDay, | ||
| 217 | + currentDay: controller.lastSelectableDay, | ||
| 264 | startingDayOfWeek: StartingDayOfWeek.monday, | 218 | startingDayOfWeek: StartingDayOfWeek.monday, |
| 265 | availableCalendarFormats: const { | 219 | availableCalendarFormats: const { |
| 266 | CalendarFormat.week: '', | 220 | CalendarFormat.week: '', |
| 267 | }, | 221 | }, |
| 268 | availableGestures: AvailableGestures.horizontalSwipe, | 222 | availableGestures: AvailableGestures.horizontalSwipe, |
| 269 | enabledDayPredicate: (day) => !_isAfterToday(day), | 223 | enabledDayPredicate: (day) => !_isAfterToday(day), |
| 270 | - selectedDayPredicate: (day) => isSameDay(_selectedDay, day), | 224 | + selectedDayPredicate: (day) => |
| 225 | + isSameDay(controller.selectedDate.value, day), | ||
| 271 | onDaySelected: _onDaySelected, | 226 | onDaySelected: _onDaySelected, |
| 272 | onPageChanged: _onCalendarPageChanged, | 227 | onPageChanged: _onCalendarPageChanged, |
| 273 | calendarStyle: const CalendarStyle( | 228 | calendarStyle: const CalendarStyle( |
| @@ -280,15 +235,15 @@ class _TodayTabState extends State<TodayTab> { | @@ -280,15 +235,15 @@ class _TodayTabState extends State<TodayTab> { | ||
| 280 | decoration: BoxDecoration(), | 235 | decoration: BoxDecoration(), |
| 281 | ), | 236 | ), |
| 282 | calendarBuilders: CalendarBuilders( | 237 | calendarBuilders: CalendarBuilders( |
| 283 | - dowBuilder: (context, day) => _buildWeekdayCell(day), | 238 | + dowBuilder: (context, day) => _buildWeekdayCell(context, day), |
| 284 | defaultBuilder: (context, day, focusedDay) => | 239 | defaultBuilder: (context, day, focusedDay) => |
| 285 | - _buildDateCell(day), | 240 | + _buildDateCell(context, day), |
| 286 | disabledBuilder: (context, day, focusedDay) => | 241 | disabledBuilder: (context, day, focusedDay) => |
| 287 | - _buildDateCell(day), | 242 | + _buildDateCell(context, day), |
| 288 | outsideBuilder: (context, day, focusedDay) => | 243 | outsideBuilder: (context, day, focusedDay) => |
| 289 | - _buildDateCell(day), | 244 | + _buildDateCell(context, day), |
| 290 | selectedBuilder: (context, day, focusedDay) => | 245 | selectedBuilder: (context, day, focusedDay) => |
| 291 | - _buildDateCell(day, selected: true), | 246 | + _buildDateCell(context, day, selected: true), |
| 292 | ), | 247 | ), |
| 293 | ), | 248 | ), |
| 294 | ), | 249 | ), |
| @@ -316,18 +271,8 @@ class _TodayTabState extends State<TodayTab> { | @@ -316,18 +271,8 @@ class _TodayTabState extends State<TodayTab> { | ||
| 316 | ); | 271 | ); |
| 317 | } | 272 | } |
| 318 | 273 | ||
| 319 | - bool _handleScrollNotification(ScrollNotification notification) { | ||
| 320 | - if (notification.metrics.axis != Axis.vertical) return false; | ||
| 321 | - | ||
| 322 | - final offset = notification.metrics.pixels.clamp(0.0, double.infinity); | ||
| 323 | - if (_scrollOffset.value != offset) { | ||
| 324 | - _scrollOffset.value = offset.toDouble(); | ||
| 325 | - } | ||
| 326 | - return false; | ||
| 327 | - } | ||
| 328 | - | ||
| 329 | - Widget _buildWeekdayCell(DateTime day) { | ||
| 330 | - final selected = isSameDay(_selectedDay, day); | 274 | + Widget _buildWeekdayCell(BuildContext context, DateTime day) { |
| 275 | + final selected = isSameDay(controller.selectedDate.value, day); | ||
| 331 | 276 | ||
| 332 | return Center( | 277 | return Center( |
| 333 | child: Container( | 278 | child: Container( |
| @@ -343,9 +288,9 @@ class _TodayTabState extends State<TodayTab> { | @@ -343,9 +288,9 @@ class _TodayTabState extends State<TodayTab> { | ||
| 343 | ) | 288 | ) |
| 344 | : null, | 289 | : null, |
| 345 | child: Text( | 290 | child: Text( |
| 346 | - isSameDay(day, _lastSelectableDay) ? '今' : _weekdayText(day), | 291 | + isSameDay(day, controller.lastSelectableDay) ? '今' : _weekdayText(day), |
| 347 | style: TextStyle( | 292 | style: TextStyle( |
| 348 | - color: _calendarTextColor(day, selected: selected), | 293 | + color: _calendarTextColor(context, day, selected: selected), |
| 349 | fontSize: 12, | 294 | fontSize: 12, |
| 350 | fontWeight: FontWeight.w500, | 295 | fontWeight: FontWeight.w500, |
| 351 | ), | 296 | ), |
| @@ -354,7 +299,11 @@ class _TodayTabState extends State<TodayTab> { | @@ -354,7 +299,11 @@ class _TodayTabState extends State<TodayTab> { | ||
| 354 | ); | 299 | ); |
| 355 | } | 300 | } |
| 356 | 301 | ||
| 357 | - Widget _buildDateCell(DateTime day, {bool selected = false}) { | 302 | + Widget _buildDateCell( |
| 303 | + BuildContext context, | ||
| 304 | + DateTime day, { | ||
| 305 | + bool selected = false, | ||
| 306 | + }) { | ||
| 358 | return Center( | 307 | return Center( |
| 359 | child: Container( | 308 | child: Container( |
| 360 | width: _selectedDayWidth, | 309 | width: _selectedDayWidth, |
| @@ -363,7 +312,7 @@ class _TodayTabState extends State<TodayTab> { | @@ -363,7 +312,7 @@ class _TodayTabState extends State<TodayTab> { | ||
| 363 | decoration: selected | 312 | decoration: selected |
| 364 | ? BoxDecoration( | 313 | ? BoxDecoration( |
| 365 | color: context.colors.primary, | 314 | color: context.colors.primary, |
| 366 | - borderRadius: BorderRadius.vertical( | 315 | + borderRadius: const BorderRadius.vertical( |
| 367 | bottom: Radius.circular(22), | 316 | bottom: Radius.circular(22), |
| 368 | ), | 317 | ), |
| 369 | ) | 318 | ) |
| @@ -371,7 +320,7 @@ class _TodayTabState extends State<TodayTab> { | @@ -371,7 +320,7 @@ class _TodayTabState extends State<TodayTab> { | ||
| 371 | child: Text( | 320 | child: Text( |
| 372 | '${day.day}', | 321 | '${day.day}', |
| 373 | style: TextStyle( | 322 | style: TextStyle( |
| 374 | - color: _calendarTextColor(day, selected: selected), | 323 | + color: _calendarTextColor(context, day, selected: selected), |
| 375 | fontSize: 12, | 324 | fontSize: 12, |
| 376 | fontWeight: FontWeight.w500, | 325 | fontWeight: FontWeight.w500, |
| 377 | ), | 326 | ), |
| @@ -380,89 +329,20 @@ class _TodayTabState extends State<TodayTab> { | @@ -380,89 +329,20 @@ class _TodayTabState extends State<TodayTab> { | ||
| 380 | ); | 329 | ); |
| 381 | } | 330 | } |
| 382 | 331 | ||
| 383 | - void _handleSelectedDateChanged(DateTime selectedDate) { | ||
| 384 | - final normalizedDay = _clampSelectableDay(selectedDate); | ||
| 385 | - if (selectedDate != normalizedDay) { | ||
| 386 | - homeController.changeDate(normalizedDay); | ||
| 387 | - return; | ||
| 388 | - } | ||
| 389 | - | ||
| 390 | - if (mounted) { | ||
| 391 | - setState(() { | ||
| 392 | - _focusedDay = normalizedDay; | ||
| 393 | - }); | ||
| 394 | - } | ||
| 395 | - _syncPagerToSelectedDay(normalizedDay); | ||
| 396 | - } | ||
| 397 | - | ||
| 398 | - void _onDayPageChanged(int page) { | ||
| 399 | - _selectDate(_dateForPage(page)); | ||
| 400 | - } | ||
| 401 | - | ||
| 402 | void _onDaySelected(DateTime selectedDay, DateTime focusedDay) { | 332 | void _onDaySelected(DateTime selectedDay, DateTime focusedDay) { |
| 403 | - _selectDate(selectedDay, focusedDay: focusedDay); | 333 | + controller.changeDate(selectedDay, focused: focusedDay); |
| 404 | } | 334 | } |
| 405 | 335 | ||
| 406 | void _onCalendarPageChanged(DateTime focusedDay) { | 336 | void _onCalendarPageChanged(DateTime focusedDay) { |
| 407 | - final selectedWeekdayOffset = _selectedDay.weekday - DateTime.monday; | ||
| 408 | - final nextSelectedDay = _weekStart(focusedDay).add( | ||
| 409 | - Duration(days: selectedWeekdayOffset), | ||
| 410 | - ); | ||
| 411 | - _selectDate(nextSelectedDay, focusedDay: focusedDay); | 337 | + final selectedWeekdayOffset = |
| 338 | + controller.selectedDate.value.weekday - DateTime.monday; | ||
| 339 | + final nextSelectedDay = | ||
| 340 | + _weekStart(focusedDay).add(Duration(days: selectedWeekdayOffset)); | ||
| 341 | + controller.changeDate(nextSelectedDay, focused: focusedDay); | ||
| 412 | } | 342 | } |
| 413 | 343 | ||
| 414 | void _backToToday() { | 344 | void _backToToday() { |
| 415 | - _selectDate(_lastSelectableDay); | ||
| 416 | - } | ||
| 417 | - | ||
| 418 | - void _selectDate(DateTime selectedDay, {DateTime? focusedDay}) { | ||
| 419 | - final normalizedSelectedDay = _clampSelectableDay(selectedDay); | ||
| 420 | - final normalizedFocusedDay = _clampSelectableDay( | ||
| 421 | - focusedDay ?? normalizedSelectedDay, | ||
| 422 | - ); | ||
| 423 | - | ||
| 424 | - setState(() { | ||
| 425 | - _focusedDay = normalizedFocusedDay; | ||
| 426 | - }); | ||
| 427 | - homeController.changeDate(normalizedSelectedDay); | ||
| 428 | - } | ||
| 429 | - | ||
| 430 | - void _syncPagerToSelectedDay(DateTime selectedDay) { | ||
| 431 | - final targetPage = _pageIndexForDay(selectedDay); | ||
| 432 | - if (!_pageController.hasClients) { | ||
| 433 | - WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 434 | - if (!mounted) return; | ||
| 435 | - _syncPagerToSelectedDay(selectedDay); | ||
| 436 | - }); | ||
| 437 | - return; | ||
| 438 | - } | ||
| 439 | - | ||
| 440 | - final currentPage = | ||
| 441 | - _pageController.page?.round() ?? _pageController.initialPage; | ||
| 442 | - if (currentPage == targetPage) return; | ||
| 443 | - | ||
| 444 | - _pageController.animateToPage( | ||
| 445 | - targetPage, | ||
| 446 | - duration: const Duration(milliseconds: 220), | ||
| 447 | - curve: Curves.easeOut, | ||
| 448 | - ); | ||
| 449 | - } | ||
| 450 | - | ||
| 451 | - DateTime _dateForPage(int page) { | ||
| 452 | - return _firstSelectableDay.add(Duration(days: page)); | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | - int _pageIndexForDay(DateTime day) { | ||
| 456 | - final dayIndex = | ||
| 457 | - _clampSelectableDay(day).difference(_firstSelectableDay).inDays; | ||
| 458 | - return dayIndex.clamp(0, _dayPageCount - 1).toInt(); | ||
| 459 | - } | ||
| 460 | - | ||
| 461 | - DateTime _clampSelectableDay(DateTime day) { | ||
| 462 | - final normalizedDay = DateUtils.dateOnly(day); | ||
| 463 | - if (normalizedDay.isBefore(_firstSelectableDay)) return _firstSelectableDay; | ||
| 464 | - if (normalizedDay.isAfter(_lastSelectableDay)) return _lastSelectableDay; | ||
| 465 | - return normalizedDay; | 345 | + controller.changeDate(controller.lastSelectableDay); |
| 466 | } | 346 | } |
| 467 | 347 | ||
| 468 | DateTime _weekStart(DateTime day) { | 348 | DateTime _weekStart(DateTime day) { |
| @@ -470,29 +350,28 @@ class _TodayTabState extends State<TodayTab> { | @@ -470,29 +350,28 @@ class _TodayTabState extends State<TodayTab> { | ||
| 470 | return normalizedDay.subtract(Duration(days: normalizedDay.weekday - 1)); | 350 | return normalizedDay.subtract(Duration(days: normalizedDay.weekday - 1)); |
| 471 | } | 351 | } |
| 472 | 352 | ||
| 473 | - DateTime get _selectedDay => | ||
| 474 | - _clampSelectableDay(homeController.selectedDate.value); | ||
| 475 | - | ||
| 476 | - String get _dateTitle { | ||
| 477 | - final today = _lastSelectableDay; | ||
| 478 | - if (isSameDay(_selectedDay, today)) return '今日'; | ||
| 479 | - if (isSameDay(_selectedDay, today.subtract(const Duration(days: 1)))) { | 353 | + String _dateTitle(DateTime selectedDay) { |
| 354 | + final today = controller.lastSelectableDay; | ||
| 355 | + if (isSameDay(selectedDay, today)) return '今日'; | ||
| 356 | + if (isSameDay(selectedDay, today.subtract(const Duration(days: 1)))) { | ||
| 480 | return '昨日'; | 357 | return '昨日'; |
| 481 | } | 358 | } |
| 482 | - if (isSameDay(_selectedDay, today.add(const Duration(days: 1)))) { | 359 | + if (isSameDay(selectedDay, today.add(const Duration(days: 1)))) { |
| 483 | return '明日'; | 360 | return '明日'; |
| 484 | } | 361 | } |
| 485 | - return '${_selectedDay.month}月${_selectedDay.day}日'; | 362 | + return '${selectedDay.month}月${selectedDay.day}日'; |
| 486 | } | 363 | } |
| 487 | 364 | ||
| 488 | - bool get _isSelectedToday => isSameDay(_selectedDay, _lastSelectableDay); | ||
| 489 | - | ||
| 490 | bool _isAfterToday(DateTime day) { | 365 | bool _isAfterToday(DateTime day) { |
| 491 | final normalizedDay = DateUtils.dateOnly(day); | 366 | final normalizedDay = DateUtils.dateOnly(day); |
| 492 | - return normalizedDay.isAfter(_lastSelectableDay); | 367 | + return normalizedDay.isAfter(controller.lastSelectableDay); |
| 493 | } | 368 | } |
| 494 | 369 | ||
| 495 | - Color _calendarTextColor(DateTime day, {required bool selected}) { | 370 | + Color _calendarTextColor( |
| 371 | + BuildContext context, | ||
| 372 | + DateTime day, { | ||
| 373 | + required bool selected, | ||
| 374 | + }) { | ||
| 496 | if (selected) return Colors.white; | 375 | if (selected) return Colors.white; |
| 497 | return context.colors.textPrimary | 376 | return context.colors.textPrimary |
| 498 | .withValues(alpha: _isAfterToday(day) ? 0.2 : 0.6); | 377 | .withValues(alpha: _isAfterToday(day) ? 0.2 : 0.6); |
| @@ -533,7 +412,7 @@ class _TopDateBar extends StatelessWidget { | @@ -533,7 +412,7 @@ class _TopDateBar extends StatelessWidget { | ||
| 533 | @override | 412 | @override |
| 534 | Widget build(BuildContext context) { | 413 | Widget build(BuildContext context) { |
| 535 | return SizedBox( | 414 | return SizedBox( |
| 536 | - height: _TodayTabState._topBarHeight, | 415 | + height: TodayTab._topBarHeight, |
| 537 | child: Padding( | 416 | child: Padding( |
| 538 | padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), | 417 | padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), |
| 539 | child: Row( | 418 | child: Row( |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:get/get.dart'; | 2 | import 'package:get/get.dart'; |
| 3 | - | ||
| 4 | -import '../../controllers/home_controller.dart'; | 3 | +import '../../controllers/today_controller.dart'; |
| 5 | 4 | ||
| 6 | /// Figma: 横向 7 日日期条,当前选中日高亮品牌色圆角背景 | 5 | /// Figma: 横向 7 日日期条,当前选中日高亮品牌色圆角背景 |
| 7 | /// 支持左右滑动切换周次(PageView) | 6 | /// 支持左右滑动切换周次(PageView) |
| 8 | -class TodayDateStrip extends GetView<HomeController> { | 7 | +class TodayDateStrip extends GetView<TodayController> { |
| 9 | const TodayDateStrip({super.key}); | 8 | const TodayDateStrip({super.key}); |
| 10 | 9 | ||
| 11 | static const _brandColor = Color(0xFF845EEE); | 10 | static const _brandColor = Color(0xFF845EEE); |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | -part 'config_models.g.dart'; | ||
| 4 | - | ||
| 5 | -@JsonSerializable() | ||
| 6 | class ConfigDataListResponse { | 1 | class ConfigDataListResponse { |
| 7 | const ConfigDataListResponse({this.configDataList}); | 2 | const ConfigDataListResponse({this.configDataList}); |
| 8 | 3 | ||
| 9 | - @JsonKey(name: 'config_list') | ||
| 10 | final List<ConfigData>? configDataList; | 4 | final List<ConfigData>? configDataList; |
| 11 | 5 | ||
| 12 | - factory ConfigDataListResponse.fromJson(Map<String, dynamic> json) => | ||
| 13 | - _$ConfigDataListResponseFromJson(json); | ||
| 14 | - Map<String, dynamic> toJson() => _$ConfigDataListResponseToJson(this); | 6 | + factory ConfigDataListResponse.fromJson(Map<String, dynamic> json) { |
| 7 | + return ConfigDataListResponse( | ||
| 8 | + configDataList: (json['config_list'] as List<dynamic>?) | ||
| 9 | + ?.map((e) => ConfigData.fromJson(e as Map<String, dynamic>)) | ||
| 10 | + .toList(), | ||
| 11 | + ); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + Map<String, dynamic> toJson() { | ||
| 15 | + final val = <String, dynamic>{}; | ||
| 16 | + if (configDataList != null) { | ||
| 17 | + val['config_list'] = configDataList!.map((e) => e.toJson()).toList(); | ||
| 18 | + } | ||
| 19 | + return val; | ||
| 20 | + } | ||
| 15 | } | 21 | } |
| 16 | 22 | ||
| 17 | -@JsonSerializable() | ||
| 18 | class ConfigData { | 23 | class ConfigData { |
| 19 | const ConfigData({ | 24 | const ConfigData({ |
| 20 | this.id, | 25 | this.id, |
| @@ -25,12 +30,24 @@ class ConfigData { | @@ -25,12 +30,24 @@ class ConfigData { | ||
| 25 | 30 | ||
| 26 | final int? id; | 31 | final int? id; |
| 27 | final String? scene; | 32 | final String? scene; |
| 28 | - @JsonKey(name: 'image_1') | ||
| 29 | final String? image1; | 33 | final String? image1; |
| 30 | - @JsonKey(name: 'text_1') | ||
| 31 | final String? text1; | 34 | final String? text1; |
| 32 | 35 | ||
| 33 | - factory ConfigData.fromJson(Map<String, dynamic> json) => | ||
| 34 | - _$ConfigDataFromJson(json); | ||
| 35 | - Map<String, dynamic> toJson() => _$ConfigDataToJson(this); | 36 | + factory ConfigData.fromJson(Map<String, dynamic> json) { |
| 37 | + return ConfigData( | ||
| 38 | + id: json['id'] as int?, | ||
| 39 | + scene: json['scene'] as String?, | ||
| 40 | + image1: json['image_1'] as String?, | ||
| 41 | + text1: json['text_1'] as String?, | ||
| 42 | + ); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + Map<String, dynamic> toJson() { | ||
| 46 | + final val = <String, dynamic>{}; | ||
| 47 | + if (id != null) val['id'] = id; | ||
| 48 | + if (scene != null) val['scene'] = scene; | ||
| 49 | + if (image1 != null) val['image_1'] = image1; | ||
| 50 | + if (text1 != null) val['text_1'] = text1; | ||
| 51 | + return val; | ||
| 52 | + } | ||
| 36 | } | 53 | } |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'config_models.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -ConfigDataListResponse _$ConfigDataListResponseFromJson( | ||
| 10 | - Map<String, dynamic> json) => | ||
| 11 | - ConfigDataListResponse( | ||
| 12 | - configDataList: (json['config_list'] as List<dynamic>?) | ||
| 13 | - ?.map((e) => ConfigData.fromJson(e as Map<String, dynamic>)) | ||
| 14 | - .toList(), | ||
| 15 | - ); | ||
| 16 | - | ||
| 17 | -Map<String, dynamic> _$ConfigDataListResponseToJson( | ||
| 18 | - ConfigDataListResponse instance) => | ||
| 19 | - <String, dynamic>{ | ||
| 20 | - if (instance.configDataList?.map((e) => e.toJson()).toList() | ||
| 21 | - case final value?) | ||
| 22 | - 'config_list': value, | ||
| 23 | - }; | ||
| 24 | - | ||
| 25 | -ConfigData _$ConfigDataFromJson(Map<String, dynamic> json) => ConfigData( | ||
| 26 | - id: (json['id'] as num?)?.toInt(), | ||
| 27 | - scene: json['scene'] as String?, | ||
| 28 | - image1: json['image_1'] as String?, | ||
| 29 | - text1: json['text_1'] as String?, | ||
| 30 | - ); | ||
| 31 | - | ||
| 32 | -Map<String, dynamic> _$ConfigDataToJson(ConfigData instance) => | ||
| 33 | - <String, dynamic>{ | ||
| 34 | - if (instance.id case final value?) 'id': value, | ||
| 35 | - if (instance.scene case final value?) 'scene': value, | ||
| 36 | - if (instance.image1 case final value?) 'image_1': value, | ||
| 37 | - if (instance.text1 case final value?) 'text_1': value, | ||
| 38 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | import '../enums/app_enums.dart'; | 1 | import '../enums/app_enums.dart'; |
| 4 | 2 | ||
| 5 | -part 'health_models.g.dart'; | 3 | +int? _parseInt(dynamic value) { |
| 4 | + if (value == null) return null; | ||
| 5 | + if (value is int) return value; | ||
| 6 | + if (value is double) return value.toInt(); | ||
| 7 | + if (value is String) { | ||
| 8 | + return int.tryParse(value); | ||
| 9 | + } | ||
| 10 | + return null; | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +double? _parseDouble(dynamic value) { | ||
| 14 | + if (value == null) return null; | ||
| 15 | + if (value is num) return value.toDouble(); | ||
| 16 | + if (value is String) { | ||
| 17 | + if (value == 'NaN') return double.nan; | ||
| 18 | + if (value == 'Infinity') return double.infinity; | ||
| 19 | + if (value == '-Infinity') return double.negativeInfinity; | ||
| 20 | + return double.tryParse(value); | ||
| 21 | + } | ||
| 22 | + return null; | ||
| 23 | +} | ||
| 6 | 24 | ||
| 7 | -@JsonSerializable() | ||
| 8 | class TodayStatusData { | 25 | class TodayStatusData { |
| 9 | const TodayStatusData({ | 26 | const TodayStatusData({ |
| 10 | this.recentData, | 27 | this.recentData, |
| @@ -14,23 +31,50 @@ class TodayStatusData { | @@ -14,23 +31,50 @@ class TodayStatusData { | ||
| 14 | this.sleepDuration, | 31 | this.sleepDuration, |
| 15 | }); | 32 | }); |
| 16 | 33 | ||
| 17 | - @JsonKey(name: 'recent_data') | ||
| 18 | final TodayStatusRecentData? recentData; | 34 | final TodayStatusRecentData? recentData; |
| 19 | - @JsonKey(name: 'hrv_data_list') | ||
| 20 | final List<TodayHrvData>? hrvDataList; | 35 | final List<TodayHrvData>? hrvDataList; |
| 21 | - @JsonKey(name: 'heart_rate_data_list') | ||
| 22 | final List<TodayHeartRateData>? heartRateDataList; | 36 | final List<TodayHeartRateData>? heartRateDataList; |
| 23 | - @JsonKey(name: 'oxygen_saturation_data_list') | ||
| 24 | final List<TodaySpo2Data>? spo2DataList; | 37 | final List<TodaySpo2Data>? spo2DataList; |
| 25 | - @JsonKey(name: 'sleep_duration') | ||
| 26 | final int? sleepDuration; | 38 | final int? sleepDuration; |
| 27 | 39 | ||
| 28 | - factory TodayStatusData.fromJson(Map<String, dynamic> json) => | ||
| 29 | - _$TodayStatusDataFromJson(json); | ||
| 30 | - Map<String, dynamic> toJson() => _$TodayStatusDataToJson(this); | 40 | + factory TodayStatusData.fromJson(Map<String, dynamic> json) { |
| 41 | + return TodayStatusData( | ||
| 42 | + recentData: json['recent_data'] == null | ||
| 43 | + ? null | ||
| 44 | + : TodayStatusRecentData.fromJson( | ||
| 45 | + json['recent_data'] as Map<String, dynamic>), | ||
| 46 | + hrvDataList: (json['hrv_data_list'] as List<dynamic>?) | ||
| 47 | + ?.map((e) => TodayHrvData.fromJson(e as Map<String, dynamic>)) | ||
| 48 | + .toList(), | ||
| 49 | + heartRateDataList: (json['heart_rate_data_list'] as List<dynamic>?) | ||
| 50 | + ?.map((e) => TodayHeartRateData.fromJson(e as Map<String, dynamic>)) | ||
| 51 | + .toList(), | ||
| 52 | + spo2DataList: (json['oxygen_saturation_data_list'] as List<dynamic>?) | ||
| 53 | + ?.map((e) => TodaySpo2Data.fromJson(e as Map<String, dynamic>)) | ||
| 54 | + .toList(), | ||
| 55 | + sleepDuration: _parseInt(json['sleep_duration']), | ||
| 56 | + ); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + Map<String, dynamic> toJson() { | ||
| 60 | + final val = <String, dynamic>{}; | ||
| 61 | + if (recentData != null) val['recent_data'] = recentData!.toJson(); | ||
| 62 | + if (hrvDataList != null) { | ||
| 63 | + val['hrv_data_list'] = hrvDataList!.map((e) => e.toJson()).toList(); | ||
| 64 | + } | ||
| 65 | + if (heartRateDataList != null) { | ||
| 66 | + val['heart_rate_data_list'] = | ||
| 67 | + heartRateDataList!.map((e) => e.toJson()).toList(); | ||
| 68 | + } | ||
| 69 | + if (spo2DataList != null) { | ||
| 70 | + val['oxygen_saturation_data_list'] = | ||
| 71 | + spo2DataList!.map((e) => e.toJson()).toList(); | ||
| 72 | + } | ||
| 73 | + if (sleepDuration != null) val['sleep_duration'] = sleepDuration; | ||
| 74 | + return val; | ||
| 75 | + } | ||
| 31 | } | 76 | } |
| 32 | 77 | ||
| 33 | -@JsonSerializable() | ||
| 34 | class TodayStatusRecentData { | 78 | class TodayStatusRecentData { |
| 35 | const TodayStatusRecentData({ | 79 | const TodayStatusRecentData({ |
| 36 | this.heartRate, | 80 | this.heartRate, |
| @@ -41,27 +85,41 @@ class TodayStatusRecentData { | @@ -41,27 +85,41 @@ class TodayStatusRecentData { | ||
| 41 | this.steps, | 85 | this.steps, |
| 42 | }); | 86 | }); |
| 43 | 87 | ||
| 44 | - @JsonKey(name: 'heart_rate') | ||
| 45 | final int? heartRate; | 88 | final int? heartRate; |
| 46 | - @JsonKey(name: 'oxygen_saturation') | ||
| 47 | final double? spo2; | 89 | final double? spo2; |
| 48 | final int? move; | 90 | final int? move; |
| 49 | final int? exercise; | 91 | final int? exercise; |
| 50 | final int? stand; | 92 | final int? stand; |
| 51 | final int? steps; | 93 | final int? steps; |
| 52 | 94 | ||
| 53 | - factory TodayStatusRecentData.fromJson(Map<String, dynamic> json) => | ||
| 54 | - _$TodayStatusRecentDataFromJson(json); | ||
| 55 | - Map<String, dynamic> toJson() => _$TodayStatusRecentDataToJson(this); | 95 | + factory TodayStatusRecentData.fromJson(Map<String, dynamic> json) { |
| 96 | + return TodayStatusRecentData( | ||
| 97 | + heartRate: _parseInt(json['heart_rate']), | ||
| 98 | + spo2: _parseDouble(json['oxygen_saturation']), | ||
| 99 | + move: _parseInt(json['move']), | ||
| 100 | + exercise: _parseInt(json['exercise']), | ||
| 101 | + stand: _parseInt(json['stand']), | ||
| 102 | + steps: _parseInt(json['steps']), | ||
| 103 | + ); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + Map<String, dynamic> toJson() { | ||
| 107 | + final val = <String, dynamic>{}; | ||
| 108 | + if (heartRate != null) val['heart_rate'] = heartRate; | ||
| 109 | + if (spo2 != null) val['oxygen_saturation'] = spo2; | ||
| 110 | + if (move != null) val['move'] = move; | ||
| 111 | + if (exercise != null) val['exercise'] = exercise; | ||
| 112 | + if (stand != null) val['stand'] = stand; | ||
| 113 | + if (steps != null) val['steps'] = steps; | ||
| 114 | + return val; | ||
| 115 | + } | ||
| 56 | } | 116 | } |
| 57 | 117 | ||
| 58 | -@JsonSerializable() | ||
| 59 | class TodayHrvData { | 118 | class TodayHrvData { |
| 60 | const TodayHrvData({this.time, this.value, this.hrvBaseline}); | 119 | const TodayHrvData({this.time, this.value, this.hrvBaseline}); |
| 61 | 120 | ||
| 62 | final int? time; | 121 | final int? time; |
| 63 | final double? value; | 122 | final double? value; |
| 64 | - @JsonKey(name: 'hrv_baseline') | ||
| 65 | final double? hrvBaseline; | 123 | final double? hrvBaseline; |
| 66 | 124 | ||
| 67 | HrvStatus? get hrvStatus { | 125 | HrvStatus? get hrvStatus { |
| @@ -78,39 +136,68 @@ class TodayHrvData { | @@ -78,39 +136,68 @@ class TodayHrvData { | ||
| 78 | return HrvStatus.normal; | 136 | return HrvStatus.normal; |
| 79 | } | 137 | } |
| 80 | 138 | ||
| 81 | - factory TodayHrvData.fromJson(Map<String, dynamic> json) => | ||
| 82 | - _$TodayHrvDataFromJson(json); | ||
| 83 | - Map<String, dynamic> toJson() => _$TodayHrvDataToJson(this); | 139 | + factory TodayHrvData.fromJson(Map<String, dynamic> json) { |
| 140 | + return TodayHrvData( | ||
| 141 | + time: _parseInt(json['time']), | ||
| 142 | + value: _parseDouble(json['value']), | ||
| 143 | + hrvBaseline: _parseDouble(json['hrv_baseline']), | ||
| 144 | + ); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + Map<String, dynamic> toJson() { | ||
| 148 | + final val = <String, dynamic>{}; | ||
| 149 | + if (time != null) val['time'] = time; | ||
| 150 | + if (value != null) val['value'] = value; | ||
| 151 | + if (hrvBaseline != null) val['hrv_baseline'] = hrvBaseline; | ||
| 152 | + return val; | ||
| 153 | + } | ||
| 84 | } | 154 | } |
| 85 | 155 | ||
| 86 | -@JsonSerializable() | ||
| 87 | class TodayHeartRateData { | 156 | class TodayHeartRateData { |
| 88 | const TodayHeartRateData({this.index, this.minimum, this.maximum}); | 157 | const TodayHeartRateData({this.index, this.minimum, this.maximum}); |
| 89 | 158 | ||
| 90 | - @JsonKey(name: 'bi_hour_index') | ||
| 91 | final int? index; | 159 | final int? index; |
| 92 | final int? minimum; | 160 | final int? minimum; |
| 93 | final int? maximum; | 161 | final int? maximum; |
| 94 | 162 | ||
| 95 | - factory TodayHeartRateData.fromJson(Map<String, dynamic> json) => | ||
| 96 | - _$TodayHeartRateDataFromJson(json); | ||
| 97 | - Map<String, dynamic> toJson() => _$TodayHeartRateDataToJson(this); | 163 | + factory TodayHeartRateData.fromJson(Map<String, dynamic> json) { |
| 164 | + return TodayHeartRateData( | ||
| 165 | + index: _parseInt(json['bi_hour_index']), | ||
| 166 | + minimum: _parseInt(json['minimum']), | ||
| 167 | + maximum: _parseInt(json['maximum']), | ||
| 168 | + ); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + Map<String, dynamic> toJson() { | ||
| 172 | + final val = <String, dynamic>{}; | ||
| 173 | + if (index != null) val['bi_hour_index'] = index; | ||
| 174 | + if (minimum != null) val['minimum'] = minimum; | ||
| 175 | + if (maximum != null) val['maximum'] = maximum; | ||
| 176 | + return val; | ||
| 177 | + } | ||
| 98 | } | 178 | } |
| 99 | 179 | ||
| 100 | -@JsonSerializable() | ||
| 101 | class TodaySpo2Data { | 180 | class TodaySpo2Data { |
| 102 | const TodaySpo2Data({this.index, this.average}); | 181 | const TodaySpo2Data({this.index, this.average}); |
| 103 | 182 | ||
| 104 | - @JsonKey(name: 'bi_hour_index') | ||
| 105 | final int? index; | 183 | final int? index; |
| 106 | final double? average; | 184 | final double? average; |
| 107 | 185 | ||
| 108 | - factory TodaySpo2Data.fromJson(Map<String, dynamic> json) => | ||
| 109 | - _$TodaySpo2DataFromJson(json); | ||
| 110 | - Map<String, dynamic> toJson() => _$TodaySpo2DataToJson(this); | 186 | + factory TodaySpo2Data.fromJson(Map<String, dynamic> json) { |
| 187 | + return TodaySpo2Data( | ||
| 188 | + index: _parseInt(json['bi_hour_index']), | ||
| 189 | + average: _parseDouble(json['average']), | ||
| 190 | + ); | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + Map<String, dynamic> toJson() { | ||
| 194 | + final val = <String, dynamic>{}; | ||
| 195 | + if (index != null) val['bi_hour_index'] = index; | ||
| 196 | + if (average != null) val['average'] = average; | ||
| 197 | + return val; | ||
| 198 | + } | ||
| 111 | } | 199 | } |
| 112 | 200 | ||
| 113 | -@JsonSerializable() | ||
| 114 | class PkCurrentMonthData { | 201 | class PkCurrentMonthData { |
| 115 | const PkCurrentMonthData({ | 202 | const PkCurrentMonthData({ |
| 116 | this.userWinAmount, | 203 | this.userWinAmount, |
| @@ -119,21 +206,36 @@ class PkCurrentMonthData { | @@ -119,21 +206,36 @@ class PkCurrentMonthData { | ||
| 119 | this.monthRecordList, | 206 | this.monthRecordList, |
| 120 | }); | 207 | }); |
| 121 | 208 | ||
| 122 | - @JsonKey(name: 'user_win') | ||
| 123 | final int? userWinAmount; | 209 | final int? userWinAmount; |
| 124 | - @JsonKey(name: 'pair_user_win') | ||
| 125 | final int? partnerWinAmount; | 210 | final int? partnerWinAmount; |
| 126 | - @JsonKey(name: 'data_today') | ||
| 127 | final PkRecord? todayRecord; | 211 | final PkRecord? todayRecord; |
| 128 | - @JsonKey(name: 'month_data_list') | ||
| 129 | final List<PkRecord>? monthRecordList; | 212 | final List<PkRecord>? monthRecordList; |
| 130 | 213 | ||
| 131 | - factory PkCurrentMonthData.fromJson(Map<String, dynamic> json) => | ||
| 132 | - _$PkCurrentMonthDataFromJson(json); | ||
| 133 | - Map<String, dynamic> toJson() => _$PkCurrentMonthDataToJson(this); | 214 | + factory PkCurrentMonthData.fromJson(Map<String, dynamic> json) { |
| 215 | + return PkCurrentMonthData( | ||
| 216 | + userWinAmount: _parseInt(json['user_win']), | ||
| 217 | + partnerWinAmount: _parseInt(json['pair_user_win']), | ||
| 218 | + todayRecord: json['data_today'] == null | ||
| 219 | + ? null | ||
| 220 | + : PkRecord.fromJson(json['data_today'] as Map<String, dynamic>), | ||
| 221 | + monthRecordList: (json['month_data_list'] as List<dynamic>?) | ||
| 222 | + ?.map((e) => PkRecord.fromJson(e as Map<String, dynamic>)) | ||
| 223 | + .toList(), | ||
| 224 | + ); | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + Map<String, dynamic> toJson() { | ||
| 228 | + final val = <String, dynamic>{}; | ||
| 229 | + if (userWinAmount != null) val['user_win'] = userWinAmount; | ||
| 230 | + if (partnerWinAmount != null) val['pair_user_win'] = partnerWinAmount; | ||
| 231 | + if (todayRecord != null) val['data_today'] = todayRecord!.toJson(); | ||
| 232 | + if (monthRecordList != null) { | ||
| 233 | + val['month_data_list'] = monthRecordList!.map((e) => e.toJson()).toList(); | ||
| 234 | + } | ||
| 235 | + return val; | ||
| 236 | + } | ||
| 134 | } | 237 | } |
| 135 | 238 | ||
| 136 | -@JsonSerializable() | ||
| 137 | class PkRecord { | 239 | class PkRecord { |
| 138 | const PkRecord({ | 240 | const PkRecord({ |
| 139 | this.date, | 241 | this.date, |
| @@ -148,29 +250,44 @@ class PkRecord { | @@ -148,29 +250,44 @@ class PkRecord { | ||
| 148 | }); | 250 | }); |
| 149 | 251 | ||
| 150 | final int? date; | 252 | final int? date; |
| 151 | - @JsonKey(name: 'user_score') | ||
| 152 | final int? userScore; | 253 | final int? userScore; |
| 153 | - @JsonKey(name: 'user_move') | ||
| 154 | final int? userMove; | 254 | final int? userMove; |
| 155 | - @JsonKey(name: 'user_stand') | ||
| 156 | final int? userStand; | 255 | final int? userStand; |
| 157 | - @JsonKey(name: 'user_steps') | ||
| 158 | final int? userSteps; | 256 | final int? userSteps; |
| 159 | - @JsonKey(name: 'pair_user_score') | ||
| 160 | final int? partnerScore; | 257 | final int? partnerScore; |
| 161 | - @JsonKey(name: 'pair_user_move') | ||
| 162 | final int? partnerMove; | 258 | final int? partnerMove; |
| 163 | - @JsonKey(name: 'pair_user_stand') | ||
| 164 | final int? partnerStand; | 259 | final int? partnerStand; |
| 165 | - @JsonKey(name: 'pair_user_steps') | ||
| 166 | final int? partnerSteps; | 260 | final int? partnerSteps; |
| 167 | 261 | ||
| 168 | - factory PkRecord.fromJson(Map<String, dynamic> json) => | ||
| 169 | - _$PkRecordFromJson(json); | ||
| 170 | - Map<String, dynamic> toJson() => _$PkRecordToJson(this); | 262 | + factory PkRecord.fromJson(Map<String, dynamic> json) { |
| 263 | + return PkRecord( | ||
| 264 | + date: _parseInt(json['date']), | ||
| 265 | + userScore: _parseInt(json['user_score']), | ||
| 266 | + userMove: _parseInt(json['user_move']), | ||
| 267 | + userStand: _parseInt(json['user_stand']), | ||
| 268 | + userSteps: _parseInt(json['user_steps']), | ||
| 269 | + partnerScore: _parseInt(json['pair_user_score']), | ||
| 270 | + partnerMove: _parseInt(json['pair_user_move']), | ||
| 271 | + partnerStand: _parseInt(json['pair_user_stand']), | ||
| 272 | + partnerSteps: _parseInt(json['pair_user_steps']), | ||
| 273 | + ); | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + Map<String, dynamic> toJson() { | ||
| 277 | + final val = <String, dynamic>{}; | ||
| 278 | + if (date != null) val['date'] = date; | ||
| 279 | + if (userScore != null) val['user_score'] = userScore; | ||
| 280 | + if (userMove != null) val['user_move'] = userMove; | ||
| 281 | + if (userStand != null) val['user_stand'] = userStand; | ||
| 282 | + if (userSteps != null) val['user_steps'] = userSteps; | ||
| 283 | + if (partnerScore != null) val['pair_user_score'] = partnerScore; | ||
| 284 | + if (partnerMove != null) val['pair_user_move'] = partnerMove; | ||
| 285 | + if (partnerStand != null) val['pair_user_stand'] = partnerStand; | ||
| 286 | + if (partnerSteps != null) val['pair_user_steps'] = partnerSteps; | ||
| 287 | + return val; | ||
| 288 | + } | ||
| 171 | } | 289 | } |
| 172 | 290 | ||
| 173 | -@JsonSerializable() | ||
| 174 | class SleepStatisticsData { | 291 | class SleepStatisticsData { |
| 175 | const SleepStatisticsData({ | 292 | const SleepStatisticsData({ |
| 176 | this.avgSleepDuration, | 293 | this.avgSleepDuration, |
| @@ -182,53 +299,90 @@ class SleepStatisticsData { | @@ -182,53 +299,90 @@ class SleepStatisticsData { | ||
| 182 | this.asleepTimeDistributionList, | 299 | this.asleepTimeDistributionList, |
| 183 | }); | 300 | }); |
| 184 | 301 | ||
| 185 | - @JsonKey(name: 'avg_sleep_duration') | ||
| 186 | final int? avgSleepDuration; | 302 | final int? avgSleepDuration; |
| 187 | - @JsonKey(name: 'awake_percentage') | ||
| 188 | final double? awakePercentage; | 303 | final double? awakePercentage; |
| 189 | - @JsonKey(name: 'core_percentage') | ||
| 190 | final double? corePercentage; | 304 | final double? corePercentage; |
| 191 | - @JsonKey(name: 'deep_percentage') | ||
| 192 | final double? deepPercentage; | 305 | final double? deepPercentage; |
| 193 | - @JsonKey(name: 'rem_percentage') | ||
| 194 | final double? remPercentage; | 306 | final double? remPercentage; |
| 195 | - @JsonKey(name: 'sleep_trend_list') | ||
| 196 | final List<SleepTrend>? sleepTrendList; | 307 | final List<SleepTrend>? sleepTrendList; |
| 197 | - @JsonKey(name: 'asleep_time_trend_list') | ||
| 198 | final List<AsleepTimeDistribution>? asleepTimeDistributionList; | 308 | final List<AsleepTimeDistribution>? asleepTimeDistributionList; |
| 199 | 309 | ||
| 200 | - factory SleepStatisticsData.fromJson(Map<String, dynamic> json) => | ||
| 201 | - _$SleepStatisticsDataFromJson(json); | ||
| 202 | - Map<String, dynamic> toJson() => _$SleepStatisticsDataToJson(this); | 310 | + factory SleepStatisticsData.fromJson(Map<String, dynamic> json) { |
| 311 | + return SleepStatisticsData( | ||
| 312 | + avgSleepDuration: _parseInt(json['avg_sleep_duration']), | ||
| 313 | + awakePercentage: _parseDouble(json['awake_percentage']), | ||
| 314 | + corePercentage: _parseDouble(json['core_percentage']), | ||
| 315 | + deepPercentage: _parseDouble(json['deep_percentage']), | ||
| 316 | + remPercentage: _parseDouble(json['rem_percentage']), | ||
| 317 | + sleepTrendList: (json['sleep_trend_list'] as List<dynamic>?) | ||
| 318 | + ?.map((e) => SleepTrend.fromJson(e as Map<String, dynamic>)) | ||
| 319 | + .toList(), | ||
| 320 | + asleepTimeDistributionList: (json['asleep_time_trend_list'] as List<dynamic>?) | ||
| 321 | + ?.map((e) => AsleepTimeDistribution.fromJson(e as Map<String, dynamic>)) | ||
| 322 | + .toList(), | ||
| 323 | + ); | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + Map<String, dynamic> toJson() { | ||
| 327 | + final val = <String, dynamic>{}; | ||
| 328 | + if (avgSleepDuration != null) val['avg_sleep_duration'] = avgSleepDuration; | ||
| 329 | + if (awakePercentage != null) val['awake_percentage'] = awakePercentage; | ||
| 330 | + if (corePercentage != null) val['core_percentage'] = corePercentage; | ||
| 331 | + if (deepPercentage != null) val['deep_percentage'] = deepPercentage; | ||
| 332 | + if (remPercentage != null) val['rem_percentage'] = remPercentage; | ||
| 333 | + if (sleepTrendList != null) { | ||
| 334 | + val['sleep_trend_list'] = sleepTrendList!.map((e) => e.toJson()).toList(); | ||
| 335 | + } | ||
| 336 | + if (asleepTimeDistributionList != null) { | ||
| 337 | + val['asleep_time_trend_list'] = | ||
| 338 | + asleepTimeDistributionList!.map((e) => e.toJson()).toList(); | ||
| 339 | + } | ||
| 340 | + return val; | ||
| 341 | + } | ||
| 203 | } | 342 | } |
| 204 | 343 | ||
| 205 | -@JsonSerializable() | ||
| 206 | class SleepTrend { | 344 | class SleepTrend { |
| 207 | const SleepTrend({this.timeKey, this.average}); | 345 | const SleepTrend({this.timeKey, this.average}); |
| 208 | 346 | ||
| 209 | - @JsonKey(name: 'time_key') | ||
| 210 | final int? timeKey; | 347 | final int? timeKey; |
| 211 | final int? average; | 348 | final int? average; |
| 212 | 349 | ||
| 213 | - factory SleepTrend.fromJson(Map<String, dynamic> json) => | ||
| 214 | - _$SleepTrendFromJson(json); | ||
| 215 | - Map<String, dynamic> toJson() => _$SleepTrendToJson(this); | 350 | + factory SleepTrend.fromJson(Map<String, dynamic> json) { |
| 351 | + return SleepTrend( | ||
| 352 | + timeKey: _parseInt(json['time_key']), | ||
| 353 | + average: _parseInt(json['average']), | ||
| 354 | + ); | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + Map<String, dynamic> toJson() { | ||
| 358 | + final val = <String, dynamic>{}; | ||
| 359 | + if (timeKey != null) val['time_key'] = timeKey; | ||
| 360 | + if (average != null) val['average'] = average; | ||
| 361 | + return val; | ||
| 362 | + } | ||
| 216 | } | 363 | } |
| 217 | 364 | ||
| 218 | -@JsonSerializable() | ||
| 219 | class AsleepTimeDistribution { | 365 | class AsleepTimeDistribution { |
| 220 | const AsleepTimeDistribution({this.timeKey, this.average}); | 366 | const AsleepTimeDistribution({this.timeKey, this.average}); |
| 221 | 367 | ||
| 222 | - @JsonKey(name: 'time_key') | ||
| 223 | final int? timeKey; | 368 | final int? timeKey; |
| 224 | final String? average; | 369 | final String? average; |
| 225 | 370 | ||
| 226 | - factory AsleepTimeDistribution.fromJson(Map<String, dynamic> json) => | ||
| 227 | - _$AsleepTimeDistributionFromJson(json); | ||
| 228 | - Map<String, dynamic> toJson() => _$AsleepTimeDistributionToJson(this); | 371 | + factory AsleepTimeDistribution.fromJson(Map<String, dynamic> json) { |
| 372 | + return AsleepTimeDistribution( | ||
| 373 | + timeKey: _parseInt(json['time_key']), | ||
| 374 | + average: json['average'] as String?, | ||
| 375 | + ); | ||
| 376 | + } | ||
| 377 | + | ||
| 378 | + Map<String, dynamic> toJson() { | ||
| 379 | + final val = <String, dynamic>{}; | ||
| 380 | + if (timeKey != null) val['time_key'] = timeKey; | ||
| 381 | + if (average != null) val['average'] = average; | ||
| 382 | + return val; | ||
| 383 | + } | ||
| 229 | } | 384 | } |
| 230 | 385 | ||
| 231 | -@JsonSerializable() | ||
| 232 | class ActivityBurnStatisticsData { | 386 | class ActivityBurnStatisticsData { |
| 233 | const ActivityBurnStatisticsData({ | 387 | const ActivityBurnStatisticsData({ |
| 234 | this.totalCaloriesBurned, | 388 | this.totalCaloriesBurned, |
| @@ -242,69 +396,127 @@ class ActivityBurnStatisticsData { | @@ -242,69 +396,127 @@ class ActivityBurnStatisticsData { | ||
| 242 | this.activityTargetInfo, | 396 | this.activityTargetInfo, |
| 243 | }); | 397 | }); |
| 244 | 398 | ||
| 245 | - @JsonKey(name: 'total_move') | ||
| 246 | final int? totalCaloriesBurned; | 399 | final int? totalCaloriesBurned; |
| 247 | - @JsonKey(name: 'avg_move') | ||
| 248 | final double? avgCaloriesBurned; | 400 | final double? avgCaloriesBurned; |
| 249 | - @JsonKey(name: 'max_move') | ||
| 250 | final CaloriesBurnedValue? maxCaloriesBurned; | 401 | final CaloriesBurnedValue? maxCaloriesBurned; |
| 251 | - @JsonKey(name: 'min_move') | ||
| 252 | final CaloriesBurnedValue? minCaloriesBurned; | 402 | final CaloriesBurnedValue? minCaloriesBurned; |
| 253 | - @JsonKey(name: 'total_steps') | ||
| 254 | final int? totalSteps; | 403 | final int? totalSteps; |
| 255 | - @JsonKey(name: 'total_stand') | ||
| 256 | final int? totalStand; | 404 | final int? totalStand; |
| 257 | - @JsonKey(name: 'move_trend_list') | ||
| 258 | final List<CaloriesBurnedTrend>? caloriesBurnedTrendList; | 405 | final List<CaloriesBurnedTrend>? caloriesBurnedTrendList; |
| 259 | - @JsonKey(name: 'excercise_trend_list') | ||
| 260 | final List<ExerciseTimeTrend>? exerciseTimeTrendList; | 406 | final List<ExerciseTimeTrend>? exerciseTimeTrendList; |
| 261 | - @JsonKey(name: 'activity_target_info') | ||
| 262 | final ActivityTargetInfo? activityTargetInfo; | 407 | final ActivityTargetInfo? activityTargetInfo; |
| 263 | 408 | ||
| 264 | - factory ActivityBurnStatisticsData.fromJson(Map<String, dynamic> json) => | ||
| 265 | - _$ActivityBurnStatisticsDataFromJson(json); | ||
| 266 | - Map<String, dynamic> toJson() => _$ActivityBurnStatisticsDataToJson(this); | 409 | + factory ActivityBurnStatisticsData.fromJson(Map<String, dynamic> json) { |
| 410 | + return ActivityBurnStatisticsData( | ||
| 411 | + totalCaloriesBurned: _parseInt(json['total_move']), | ||
| 412 | + avgCaloriesBurned: _parseDouble(json['avg_move']), | ||
| 413 | + maxCaloriesBurned: json['max_move'] == null | ||
| 414 | + ? null | ||
| 415 | + : CaloriesBurnedValue.fromJson(json['max_move'] as Map<String, dynamic>), | ||
| 416 | + minCaloriesBurned: json['min_move'] == null | ||
| 417 | + ? null | ||
| 418 | + : CaloriesBurnedValue.fromJson(json['min_move'] as Map<String, dynamic>), | ||
| 419 | + totalSteps: _parseInt(json['total_steps']), | ||
| 420 | + totalStand: _parseInt(json['total_stand']), | ||
| 421 | + caloriesBurnedTrendList: (json['move_trend_list'] as List<dynamic>?) | ||
| 422 | + ?.map((e) => CaloriesBurnedTrend.fromJson(e as Map<String, dynamic>)) | ||
| 423 | + .toList(), | ||
| 424 | + exerciseTimeTrendList: (json['excercise_trend_list'] as List<dynamic>?) | ||
| 425 | + ?.map((e) => ExerciseTimeTrend.fromJson(e as Map<String, dynamic>)) | ||
| 426 | + .toList(), | ||
| 427 | + activityTargetInfo: json['activity_target_info'] == null | ||
| 428 | + ? null | ||
| 429 | + : ActivityTargetInfo.fromJson( | ||
| 430 | + json['activity_target_info'] as Map<String, dynamic>), | ||
| 431 | + ); | ||
| 432 | + } | ||
| 433 | + | ||
| 434 | + Map<String, dynamic> toJson() { | ||
| 435 | + final val = <String, dynamic>{}; | ||
| 436 | + if (totalCaloriesBurned != null) val['total_move'] = totalCaloriesBurned; | ||
| 437 | + if (avgCaloriesBurned != null) val['avg_move'] = avgCaloriesBurned; | ||
| 438 | + if (maxCaloriesBurned != null) val['max_move'] = maxCaloriesBurned!.toJson(); | ||
| 439 | + if (minCaloriesBurned != null) val['min_move'] = minCaloriesBurned!.toJson(); | ||
| 440 | + if (totalSteps != null) val['total_steps'] = totalSteps; | ||
| 441 | + if (totalStand != null) val['total_stand'] = totalStand; | ||
| 442 | + if (caloriesBurnedTrendList != null) { | ||
| 443 | + val['move_trend_list'] = | ||
| 444 | + caloriesBurnedTrendList!.map((e) => e.toJson()).toList(); | ||
| 445 | + } | ||
| 446 | + if (exerciseTimeTrendList != null) { | ||
| 447 | + val['excercise_trend_list'] = | ||
| 448 | + exerciseTimeTrendList!.map((e) => e.toJson()).toList(); | ||
| 449 | + } | ||
| 450 | + if (activityTargetInfo != null) { | ||
| 451 | + val['activity_target_info'] = activityTargetInfo!.toJson(); | ||
| 452 | + } | ||
| 453 | + return val; | ||
| 454 | + } | ||
| 267 | } | 455 | } |
| 268 | 456 | ||
| 269 | -@JsonSerializable() | ||
| 270 | class CaloriesBurnedValue { | 457 | class CaloriesBurnedValue { |
| 271 | const CaloriesBurnedValue({this.date, this.value}); | 458 | const CaloriesBurnedValue({this.date, this.value}); |
| 272 | 459 | ||
| 273 | final int? date; | 460 | final int? date; |
| 274 | final int? value; | 461 | final int? value; |
| 275 | 462 | ||
| 276 | - factory CaloriesBurnedValue.fromJson(Map<String, dynamic> json) => | ||
| 277 | - _$CaloriesBurnedValueFromJson(json); | ||
| 278 | - Map<String, dynamic> toJson() => _$CaloriesBurnedValueToJson(this); | 463 | + factory CaloriesBurnedValue.fromJson(Map<String, dynamic> json) { |
| 464 | + return CaloriesBurnedValue( | ||
| 465 | + date: _parseInt(json['date']), | ||
| 466 | + value: _parseInt(json['value']), | ||
| 467 | + ); | ||
| 468 | + } | ||
| 469 | + | ||
| 470 | + Map<String, dynamic> toJson() { | ||
| 471 | + final val = <String, dynamic>{}; | ||
| 472 | + if (date != null) val['date'] = date; | ||
| 473 | + if (value != null) val['value'] = value; | ||
| 474 | + return val; | ||
| 475 | + } | ||
| 279 | } | 476 | } |
| 280 | 477 | ||
| 281 | -@JsonSerializable() | ||
| 282 | class CaloriesBurnedTrend { | 478 | class CaloriesBurnedTrend { |
| 283 | const CaloriesBurnedTrend({this.timeKey, this.value}); | 479 | const CaloriesBurnedTrend({this.timeKey, this.value}); |
| 284 | 480 | ||
| 285 | - @JsonKey(name: 'time_key') | ||
| 286 | final int? timeKey; | 481 | final int? timeKey; |
| 287 | final int? value; | 482 | final int? value; |
| 288 | 483 | ||
| 289 | - factory CaloriesBurnedTrend.fromJson(Map<String, dynamic> json) => | ||
| 290 | - _$CaloriesBurnedTrendFromJson(json); | ||
| 291 | - Map<String, dynamic> toJson() => _$CaloriesBurnedTrendToJson(this); | 484 | + factory CaloriesBurnedTrend.fromJson(Map<String, dynamic> json) { |
| 485 | + return CaloriesBurnedTrend( | ||
| 486 | + timeKey: _parseInt(json['time_key']), | ||
| 487 | + value: _parseInt(json['value']), | ||
| 488 | + ); | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + Map<String, dynamic> toJson() { | ||
| 492 | + final val = <String, dynamic>{}; | ||
| 493 | + if (timeKey != null) val['time_key'] = timeKey; | ||
| 494 | + if (value != null) val['value'] = value; | ||
| 495 | + return val; | ||
| 496 | + } | ||
| 292 | } | 497 | } |
| 293 | 498 | ||
| 294 | -@JsonSerializable() | ||
| 295 | class ExerciseTimeTrend { | 499 | class ExerciseTimeTrend { |
| 296 | const ExerciseTimeTrend({this.timeKey, this.value}); | 500 | const ExerciseTimeTrend({this.timeKey, this.value}); |
| 297 | 501 | ||
| 298 | - @JsonKey(name: 'time_key') | ||
| 299 | final int? timeKey; | 502 | final int? timeKey; |
| 300 | final int? value; | 503 | final int? value; |
| 301 | 504 | ||
| 302 | - factory ExerciseTimeTrend.fromJson(Map<String, dynamic> json) => | ||
| 303 | - _$ExerciseTimeTrendFromJson(json); | ||
| 304 | - Map<String, dynamic> toJson() => _$ExerciseTimeTrendToJson(this); | 505 | + factory ExerciseTimeTrend.fromJson(Map<String, dynamic> json) { |
| 506 | + return ExerciseTimeTrend( | ||
| 507 | + timeKey: _parseInt(json['time_key']), | ||
| 508 | + value: _parseInt(json['value']), | ||
| 509 | + ); | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | + Map<String, dynamic> toJson() { | ||
| 513 | + final val = <String, dynamic>{}; | ||
| 514 | + if (timeKey != null) val['time_key'] = timeKey; | ||
| 515 | + if (value != null) val['value'] = value; | ||
| 516 | + return val; | ||
| 517 | + } | ||
| 305 | } | 518 | } |
| 306 | 519 | ||
| 307 | -@JsonSerializable() | ||
| 308 | class ActivityTargetInfo { | 520 | class ActivityTargetInfo { |
| 309 | const ActivityTargetInfo({this.move, this.step, this.stand}); | 521 | const ActivityTargetInfo({this.move, this.step, this.stand}); |
| 310 | 522 | ||
| @@ -312,12 +524,23 @@ class ActivityTargetInfo { | @@ -312,12 +524,23 @@ class ActivityTargetInfo { | ||
| 312 | final int? step; | 524 | final int? step; |
| 313 | final int? stand; | 525 | final int? stand; |
| 314 | 526 | ||
| 315 | - factory ActivityTargetInfo.fromJson(Map<String, dynamic> json) => | ||
| 316 | - _$ActivityTargetInfoFromJson(json); | ||
| 317 | - Map<String, dynamic> toJson() => _$ActivityTargetInfoToJson(this); | 527 | + factory ActivityTargetInfo.fromJson(Map<String, dynamic> json) { |
| 528 | + return ActivityTargetInfo( | ||
| 529 | + move: _parseInt(json['move']), | ||
| 530 | + step: _parseInt(json['step']), | ||
| 531 | + stand: _parseInt(json['stand']), | ||
| 532 | + ); | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + Map<String, dynamic> toJson() { | ||
| 536 | + final val = <String, dynamic>{}; | ||
| 537 | + if (move != null) val['move'] = move; | ||
| 538 | + if (step != null) val['step'] = step; | ||
| 539 | + if (stand != null) val['stand'] = stand; | ||
| 540 | + return val; | ||
| 541 | + } | ||
| 318 | } | 542 | } |
| 319 | 543 | ||
| 320 | -@JsonSerializable() | ||
| 321 | class HrvStatisticsData { | 544 | class HrvStatisticsData { |
| 322 | const HrvStatisticsData({ | 545 | const HrvStatisticsData({ |
| 323 | this.avgHrv, | 546 | this.avgHrv, |
| @@ -329,54 +552,99 @@ class HrvStatisticsData { | @@ -329,54 +552,99 @@ class HrvStatisticsData { | ||
| 329 | this.hrvDistributionList, | 552 | this.hrvDistributionList, |
| 330 | }); | 553 | }); |
| 331 | 554 | ||
| 332 | - @JsonKey(name: 'avg_hrv') | ||
| 333 | final double? avgHrv; | 555 | final double? avgHrv; |
| 334 | - @JsonKey(name: 'avg_hrv_baseline') | ||
| 335 | final double? avgHrvBaseline; | 556 | final double? avgHrvBaseline; |
| 336 | - @JsonKey(name: 'avg_walking_heart_rate') | ||
| 337 | final double? avgWalkingHeartRate; | 557 | final double? avgWalkingHeartRate; |
| 338 | - @JsonKey(name: 'avg_resting_heart_rate') | ||
| 339 | final double? avgRestingHeartRate; | 558 | final double? avgRestingHeartRate; |
| 340 | - @JsonKey(name: 'avg_sleeping_heart_rate') | ||
| 341 | final double? avgSleepingHeartRate; | 559 | final double? avgSleepingHeartRate; |
| 342 | - @JsonKey(name: 'hrv_trend_list') | ||
| 343 | final List<HrvTrend>? hrvTrendList; | 560 | final List<HrvTrend>? hrvTrendList; |
| 344 | - @JsonKey(name: 'hrv_distribution_list') | ||
| 345 | final List<HrvDistribution>? hrvDistributionList; | 561 | final List<HrvDistribution>? hrvDistributionList; |
| 346 | 562 | ||
| 347 | - factory HrvStatisticsData.fromJson(Map<String, dynamic> json) => | ||
| 348 | - _$HrvStatisticsDataFromJson(json); | ||
| 349 | - Map<String, dynamic> toJson() => _$HrvStatisticsDataToJson(this); | 563 | + factory HrvStatisticsData.fromJson(Map<String, dynamic> json) { |
| 564 | + return HrvStatisticsData( | ||
| 565 | + avgHrv: _parseDouble(json['avg_hrv']), | ||
| 566 | + avgHrvBaseline: _parseDouble(json['avg_hrv_baseline']), | ||
| 567 | + avgWalkingHeartRate: _parseDouble(json['avg_walking_heart_rate']), | ||
| 568 | + avgRestingHeartRate: _parseDouble(json['avg_resting_heart_rate']), | ||
| 569 | + avgSleepingHeartRate: _parseDouble(json['avg_sleeping_heart_rate']), | ||
| 570 | + hrvTrendList: (json['hrv_trend_list'] as List<dynamic>?) | ||
| 571 | + ?.map((e) => HrvTrend.fromJson(e as Map<String, dynamic>)) | ||
| 572 | + .toList(), | ||
| 573 | + hrvDistributionList: (json['hrv_distribution_list'] as List<dynamic>?) | ||
| 574 | + ?.map((e) => HrvDistribution.fromJson(e as Map<String, dynamic>)) | ||
| 575 | + .toList(), | ||
| 576 | + ); | ||
| 577 | + } | ||
| 578 | + | ||
| 579 | + Map<String, dynamic> toJson() { | ||
| 580 | + final val = <String, dynamic>{}; | ||
| 581 | + if (avgHrv != null) val['avg_hrv'] = avgHrv; | ||
| 582 | + if (avgHrvBaseline != null) val['avg_hrv_baseline'] = avgHrvBaseline; | ||
| 583 | + if (avgWalkingHeartRate != null) { | ||
| 584 | + val['avg_walking_heart_rate'] = avgWalkingHeartRate; | ||
| 585 | + } | ||
| 586 | + if (avgRestingHeartRate != null) { | ||
| 587 | + val['avg_resting_heart_rate'] = avgRestingHeartRate; | ||
| 588 | + } | ||
| 589 | + if (avgSleepingHeartRate != null) { | ||
| 590 | + val['avg_sleeping_heart_rate'] = avgSleepingHeartRate; | ||
| 591 | + } | ||
| 592 | + if (hrvTrendList != null) { | ||
| 593 | + val['hrv_trend_list'] = hrvTrendList!.map((e) => e.toJson()).toList(); | ||
| 594 | + } | ||
| 595 | + if (hrvDistributionList != null) { | ||
| 596 | + val['hrv_distribution_list'] = | ||
| 597 | + hrvDistributionList!.map((e) => e.toJson()).toList(); | ||
| 598 | + } | ||
| 599 | + return val; | ||
| 600 | + } | ||
| 350 | } | 601 | } |
| 351 | 602 | ||
| 352 | -@JsonSerializable() | ||
| 353 | class HrvTrend { | 603 | class HrvTrend { |
| 354 | const HrvTrend({this.timeKey, this.average}); | 604 | const HrvTrend({this.timeKey, this.average}); |
| 355 | 605 | ||
| 356 | - @JsonKey(name: 'time_key') | ||
| 357 | final int? timeKey; | 606 | final int? timeKey; |
| 358 | final double? average; | 607 | final double? average; |
| 359 | 608 | ||
| 360 | - factory HrvTrend.fromJson(Map<String, dynamic> json) => | ||
| 361 | - _$HrvTrendFromJson(json); | ||
| 362 | - Map<String, dynamic> toJson() => _$HrvTrendToJson(this); | 609 | + factory HrvTrend.fromJson(Map<String, dynamic> json) { |
| 610 | + return HrvTrend( | ||
| 611 | + timeKey: _parseInt(json['time_key']), | ||
| 612 | + average: _parseDouble(json['average']), | ||
| 613 | + ); | ||
| 614 | + } | ||
| 615 | + | ||
| 616 | + Map<String, dynamic> toJson() { | ||
| 617 | + final val = <String, dynamic>{}; | ||
| 618 | + if (timeKey != null) val['time_key'] = timeKey; | ||
| 619 | + if (average != null) val['average'] = average; | ||
| 620 | + return val; | ||
| 621 | + } | ||
| 363 | } | 622 | } |
| 364 | 623 | ||
| 365 | -@JsonSerializable() | ||
| 366 | class HrvDistribution { | 624 | class HrvDistribution { |
| 367 | const HrvDistribution({this.timeKey, this.dayCounts}); | 625 | const HrvDistribution({this.timeKey, this.dayCounts}); |
| 368 | 626 | ||
| 369 | - @JsonKey(name: 'time_key') | ||
| 370 | final int? timeKey; | 627 | final int? timeKey; |
| 371 | - @JsonKey(name: 'day_counts') | ||
| 372 | final HrvDistributionDayCount? dayCounts; | 628 | final HrvDistributionDayCount? dayCounts; |
| 373 | 629 | ||
| 374 | - factory HrvDistribution.fromJson(Map<String, dynamic> json) => | ||
| 375 | - _$HrvDistributionFromJson(json); | ||
| 376 | - Map<String, dynamic> toJson() => _$HrvDistributionToJson(this); | 630 | + factory HrvDistribution.fromJson(Map<String, dynamic> json) { |
| 631 | + return HrvDistribution( | ||
| 632 | + timeKey: _parseInt(json['time_key']), | ||
| 633 | + dayCounts: json['day_counts'] == null | ||
| 634 | + ? null | ||
| 635 | + : HrvDistributionDayCount.fromJson( | ||
| 636 | + json['day_counts'] as Map<String, dynamic>), | ||
| 637 | + ); | ||
| 638 | + } | ||
| 639 | + | ||
| 640 | + Map<String, dynamic> toJson() { | ||
| 641 | + final val = <String, dynamic>{}; | ||
| 642 | + if (timeKey != null) val['time_key'] = timeKey; | ||
| 643 | + if (dayCounts != null) val['day_counts'] = dayCounts!.toJson(); | ||
| 644 | + return val; | ||
| 645 | + } | ||
| 377 | } | 646 | } |
| 378 | 647 | ||
| 379 | -@JsonSerializable() | ||
| 380 | class HrvDistributionDayCount { | 648 | class HrvDistributionDayCount { |
| 381 | const HrvDistributionDayCount({ | 649 | const HrvDistributionDayCount({ |
| 382 | this.stressful, | 650 | this.stressful, |
| @@ -388,7 +656,19 @@ class HrvDistributionDayCount { | @@ -388,7 +656,19 @@ class HrvDistributionDayCount { | ||
| 388 | final int? normal; | 656 | final int? normal; |
| 389 | final int? energetic; | 657 | final int? energetic; |
| 390 | 658 | ||
| 391 | - factory HrvDistributionDayCount.fromJson(Map<String, dynamic> json) => | ||
| 392 | - _$HrvDistributionDayCountFromJson(json); | ||
| 393 | - Map<String, dynamic> toJson() => _$HrvDistributionDayCountToJson(this); | 659 | + factory HrvDistributionDayCount.fromJson(Map<String, dynamic> json) { |
| 660 | + return HrvDistributionDayCount( | ||
| 661 | + stressful: _parseInt(json['stressful']), | ||
| 662 | + normal: _parseInt(json['normal']), | ||
| 663 | + energetic: _parseInt(json['energetic']), | ||
| 664 | + ); | ||
| 665 | + } | ||
| 666 | + | ||
| 667 | + Map<String, dynamic> toJson() { | ||
| 668 | + final val = <String, dynamic>{}; | ||
| 669 | + if (stressful != null) val['stressful'] = stressful; | ||
| 670 | + if (normal != null) val['normal'] = normal; | ||
| 671 | + if (energetic != null) val['energetic'] = energetic; | ||
| 672 | + return val; | ||
| 673 | + } | ||
| 394 | } | 674 | } |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'health_models.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -TodayStatusData _$TodayStatusDataFromJson(Map<String, dynamic> json) => | ||
| 10 | - TodayStatusData( | ||
| 11 | - recentData: json['recent_data'] == null | ||
| 12 | - ? null | ||
| 13 | - : TodayStatusRecentData.fromJson( | ||
| 14 | - json['recent_data'] as Map<String, dynamic>), | ||
| 15 | - hrvDataList: (json['hrv_data_list'] as List<dynamic>?) | ||
| 16 | - ?.map((e) => TodayHrvData.fromJson(e as Map<String, dynamic>)) | ||
| 17 | - .toList(), | ||
| 18 | - heartRateDataList: (json['heart_rate_data_list'] as List<dynamic>?) | ||
| 19 | - ?.map((e) => TodayHeartRateData.fromJson(e as Map<String, dynamic>)) | ||
| 20 | - .toList(), | ||
| 21 | - spo2DataList: (json['oxygen_saturation_data_list'] as List<dynamic>?) | ||
| 22 | - ?.map((e) => TodaySpo2Data.fromJson(e as Map<String, dynamic>)) | ||
| 23 | - .toList(), | ||
| 24 | - sleepDuration: (json['sleep_duration'] as num?)?.toInt(), | ||
| 25 | - ); | ||
| 26 | - | ||
| 27 | -Map<String, dynamic> _$TodayStatusDataToJson(TodayStatusData instance) => | ||
| 28 | - <String, dynamic>{ | ||
| 29 | - if (instance.recentData?.toJson() case final value?) 'recent_data': value, | ||
| 30 | - if (instance.hrvDataList?.map((e) => e.toJson()).toList() | ||
| 31 | - case final value?) | ||
| 32 | - 'hrv_data_list': value, | ||
| 33 | - if (instance.heartRateDataList?.map((e) => e.toJson()).toList() | ||
| 34 | - case final value?) | ||
| 35 | - 'heart_rate_data_list': value, | ||
| 36 | - if (instance.spo2DataList?.map((e) => e.toJson()).toList() | ||
| 37 | - case final value?) | ||
| 38 | - 'oxygen_saturation_data_list': value, | ||
| 39 | - if (instance.sleepDuration case final value?) 'sleep_duration': value, | ||
| 40 | - }; | ||
| 41 | - | ||
| 42 | -TodayStatusRecentData _$TodayStatusRecentDataFromJson( | ||
| 43 | - Map<String, dynamic> json) => | ||
| 44 | - TodayStatusRecentData( | ||
| 45 | - heartRate: (json['heart_rate'] as num?)?.toInt(), | ||
| 46 | - spo2: (json['oxygen_saturation'] as num?)?.toDouble(), | ||
| 47 | - move: (json['move'] as num?)?.toInt(), | ||
| 48 | - exercise: (json['exercise'] as num?)?.toInt(), | ||
| 49 | - stand: (json['stand'] as num?)?.toInt(), | ||
| 50 | - steps: (json['steps'] as num?)?.toInt(), | ||
| 51 | - ); | ||
| 52 | - | ||
| 53 | -Map<String, dynamic> _$TodayStatusRecentDataToJson( | ||
| 54 | - TodayStatusRecentData instance) => | ||
| 55 | - <String, dynamic>{ | ||
| 56 | - if (instance.heartRate case final value?) 'heart_rate': value, | ||
| 57 | - if (instance.spo2 case final value?) 'oxygen_saturation': value, | ||
| 58 | - if (instance.move case final value?) 'move': value, | ||
| 59 | - if (instance.exercise case final value?) 'exercise': value, | ||
| 60 | - if (instance.stand case final value?) 'stand': value, | ||
| 61 | - if (instance.steps case final value?) 'steps': value, | ||
| 62 | - }; | ||
| 63 | - | ||
| 64 | -TodayHrvData _$TodayHrvDataFromJson(Map<String, dynamic> json) => TodayHrvData( | ||
| 65 | - time: (json['time'] as num?)?.toInt(), | ||
| 66 | - value: (json['value'] as num?)?.toDouble(), | ||
| 67 | - hrvBaseline: (json['hrv_baseline'] as num?)?.toDouble(), | ||
| 68 | - ); | ||
| 69 | - | ||
| 70 | -Map<String, dynamic> _$TodayHrvDataToJson(TodayHrvData instance) => | ||
| 71 | - <String, dynamic>{ | ||
| 72 | - if (instance.time case final value?) 'time': value, | ||
| 73 | - if (instance.value case final value?) 'value': value, | ||
| 74 | - if (instance.hrvBaseline case final value?) 'hrv_baseline': value, | ||
| 75 | - }; | ||
| 76 | - | ||
| 77 | -TodayHeartRateData _$TodayHeartRateDataFromJson(Map<String, dynamic> json) => | ||
| 78 | - TodayHeartRateData( | ||
| 79 | - index: (json['bi_hour_index'] as num?)?.toInt(), | ||
| 80 | - minimum: (json['minimum'] as num?)?.toInt(), | ||
| 81 | - maximum: (json['maximum'] as num?)?.toInt(), | ||
| 82 | - ); | ||
| 83 | - | ||
| 84 | -Map<String, dynamic> _$TodayHeartRateDataToJson(TodayHeartRateData instance) => | ||
| 85 | - <String, dynamic>{ | ||
| 86 | - if (instance.index case final value?) 'bi_hour_index': value, | ||
| 87 | - if (instance.minimum case final value?) 'minimum': value, | ||
| 88 | - if (instance.maximum case final value?) 'maximum': value, | ||
| 89 | - }; | ||
| 90 | - | ||
| 91 | -TodaySpo2Data _$TodaySpo2DataFromJson(Map<String, dynamic> json) => | ||
| 92 | - TodaySpo2Data( | ||
| 93 | - index: (json['bi_hour_index'] as num?)?.toInt(), | ||
| 94 | - average: (json['average'] as num?)?.toDouble(), | ||
| 95 | - ); | ||
| 96 | - | ||
| 97 | -Map<String, dynamic> _$TodaySpo2DataToJson(TodaySpo2Data instance) => | ||
| 98 | - <String, dynamic>{ | ||
| 99 | - if (instance.index case final value?) 'bi_hour_index': value, | ||
| 100 | - if (instance.average case final value?) 'average': value, | ||
| 101 | - }; | ||
| 102 | - | ||
| 103 | -PkCurrentMonthData _$PkCurrentMonthDataFromJson(Map<String, dynamic> json) => | ||
| 104 | - PkCurrentMonthData( | ||
| 105 | - userWinAmount: (json['user_win'] as num?)?.toInt(), | ||
| 106 | - partnerWinAmount: (json['pair_user_win'] as num?)?.toInt(), | ||
| 107 | - todayRecord: json['data_today'] == null | ||
| 108 | - ? null | ||
| 109 | - : PkRecord.fromJson(json['data_today'] as Map<String, dynamic>), | ||
| 110 | - monthRecordList: (json['month_data_list'] as List<dynamic>?) | ||
| 111 | - ?.map((e) => PkRecord.fromJson(e as Map<String, dynamic>)) | ||
| 112 | - .toList(), | ||
| 113 | - ); | ||
| 114 | - | ||
| 115 | -Map<String, dynamic> _$PkCurrentMonthDataToJson(PkCurrentMonthData instance) => | ||
| 116 | - <String, dynamic>{ | ||
| 117 | - if (instance.userWinAmount case final value?) 'user_win': value, | ||
| 118 | - if (instance.partnerWinAmount case final value?) 'pair_user_win': value, | ||
| 119 | - if (instance.todayRecord?.toJson() case final value?) 'data_today': value, | ||
| 120 | - if (instance.monthRecordList?.map((e) => e.toJson()).toList() | ||
| 121 | - case final value?) | ||
| 122 | - 'month_data_list': value, | ||
| 123 | - }; | ||
| 124 | - | ||
| 125 | -PkRecord _$PkRecordFromJson(Map<String, dynamic> json) => PkRecord( | ||
| 126 | - date: (json['date'] as num?)?.toInt(), | ||
| 127 | - userScore: (json['user_score'] as num?)?.toInt(), | ||
| 128 | - userMove: (json['user_move'] as num?)?.toInt(), | ||
| 129 | - userStand: (json['user_stand'] as num?)?.toInt(), | ||
| 130 | - userSteps: (json['user_steps'] as num?)?.toInt(), | ||
| 131 | - partnerScore: (json['pair_user_score'] as num?)?.toInt(), | ||
| 132 | - partnerMove: (json['pair_user_move'] as num?)?.toInt(), | ||
| 133 | - partnerStand: (json['pair_user_stand'] as num?)?.toInt(), | ||
| 134 | - partnerSteps: (json['pair_user_steps'] as num?)?.toInt(), | ||
| 135 | - ); | ||
| 136 | - | ||
| 137 | -Map<String, dynamic> _$PkRecordToJson(PkRecord instance) => <String, dynamic>{ | ||
| 138 | - if (instance.date case final value?) 'date': value, | ||
| 139 | - if (instance.userScore case final value?) 'user_score': value, | ||
| 140 | - if (instance.userMove case final value?) 'user_move': value, | ||
| 141 | - if (instance.userStand case final value?) 'user_stand': value, | ||
| 142 | - if (instance.userSteps case final value?) 'user_steps': value, | ||
| 143 | - if (instance.partnerScore case final value?) 'pair_user_score': value, | ||
| 144 | - if (instance.partnerMove case final value?) 'pair_user_move': value, | ||
| 145 | - if (instance.partnerStand case final value?) 'pair_user_stand': value, | ||
| 146 | - if (instance.partnerSteps case final value?) 'pair_user_steps': value, | ||
| 147 | - }; | ||
| 148 | - | ||
| 149 | -SleepStatisticsData _$SleepStatisticsDataFromJson(Map<String, dynamic> json) => | ||
| 150 | - SleepStatisticsData( | ||
| 151 | - avgSleepDuration: (json['avg_sleep_duration'] as num?)?.toInt(), | ||
| 152 | - awakePercentage: (json['awake_percentage'] as num?)?.toDouble(), | ||
| 153 | - corePercentage: (json['core_percentage'] as num?)?.toDouble(), | ||
| 154 | - deepPercentage: (json['deep_percentage'] as num?)?.toDouble(), | ||
| 155 | - remPercentage: (json['rem_percentage'] as num?)?.toDouble(), | ||
| 156 | - sleepTrendList: (json['sleep_trend_list'] as List<dynamic>?) | ||
| 157 | - ?.map((e) => SleepTrend.fromJson(e as Map<String, dynamic>)) | ||
| 158 | - .toList(), | ||
| 159 | - asleepTimeDistributionList: (json['asleep_time_trend_list'] | ||
| 160 | - as List<dynamic>?) | ||
| 161 | - ?.map( | ||
| 162 | - (e) => AsleepTimeDistribution.fromJson(e as Map<String, dynamic>)) | ||
| 163 | - .toList(), | ||
| 164 | - ); | ||
| 165 | - | ||
| 166 | -Map<String, dynamic> _$SleepStatisticsDataToJson( | ||
| 167 | - SleepStatisticsData instance) => | ||
| 168 | - <String, dynamic>{ | ||
| 169 | - if (instance.avgSleepDuration case final value?) | ||
| 170 | - 'avg_sleep_duration': value, | ||
| 171 | - if (instance.awakePercentage case final value?) 'awake_percentage': value, | ||
| 172 | - if (instance.corePercentage case final value?) 'core_percentage': value, | ||
| 173 | - if (instance.deepPercentage case final value?) 'deep_percentage': value, | ||
| 174 | - if (instance.remPercentage case final value?) 'rem_percentage': value, | ||
| 175 | - if (instance.sleepTrendList?.map((e) => e.toJson()).toList() | ||
| 176 | - case final value?) | ||
| 177 | - 'sleep_trend_list': value, | ||
| 178 | - if (instance.asleepTimeDistributionList?.map((e) => e.toJson()).toList() | ||
| 179 | - case final value?) | ||
| 180 | - 'asleep_time_trend_list': value, | ||
| 181 | - }; | ||
| 182 | - | ||
| 183 | -SleepTrend _$SleepTrendFromJson(Map<String, dynamic> json) => SleepTrend( | ||
| 184 | - timeKey: (json['time_key'] as num?)?.toInt(), | ||
| 185 | - average: (json['average'] as num?)?.toInt(), | ||
| 186 | - ); | ||
| 187 | - | ||
| 188 | -Map<String, dynamic> _$SleepTrendToJson(SleepTrend instance) => | ||
| 189 | - <String, dynamic>{ | ||
| 190 | - if (instance.timeKey case final value?) 'time_key': value, | ||
| 191 | - if (instance.average case final value?) 'average': value, | ||
| 192 | - }; | ||
| 193 | - | ||
| 194 | -AsleepTimeDistribution _$AsleepTimeDistributionFromJson( | ||
| 195 | - Map<String, dynamic> json) => | ||
| 196 | - AsleepTimeDistribution( | ||
| 197 | - timeKey: (json['time_key'] as num?)?.toInt(), | ||
| 198 | - average: json['average'] as String?, | ||
| 199 | - ); | ||
| 200 | - | ||
| 201 | -Map<String, dynamic> _$AsleepTimeDistributionToJson( | ||
| 202 | - AsleepTimeDistribution instance) => | ||
| 203 | - <String, dynamic>{ | ||
| 204 | - if (instance.timeKey case final value?) 'time_key': value, | ||
| 205 | - if (instance.average case final value?) 'average': value, | ||
| 206 | - }; | ||
| 207 | - | ||
| 208 | -ActivityBurnStatisticsData _$ActivityBurnStatisticsDataFromJson( | ||
| 209 | - Map<String, dynamic> json) => | ||
| 210 | - ActivityBurnStatisticsData( | ||
| 211 | - totalCaloriesBurned: (json['total_move'] as num?)?.toInt(), | ||
| 212 | - avgCaloriesBurned: (json['avg_move'] as num?)?.toDouble(), | ||
| 213 | - maxCaloriesBurned: json['max_move'] == null | ||
| 214 | - ? null | ||
| 215 | - : CaloriesBurnedValue.fromJson( | ||
| 216 | - json['max_move'] as Map<String, dynamic>), | ||
| 217 | - minCaloriesBurned: json['min_move'] == null | ||
| 218 | - ? null | ||
| 219 | - : CaloriesBurnedValue.fromJson( | ||
| 220 | - json['min_move'] as Map<String, dynamic>), | ||
| 221 | - totalSteps: (json['total_steps'] as num?)?.toInt(), | ||
| 222 | - totalStand: (json['total_stand'] as num?)?.toInt(), | ||
| 223 | - caloriesBurnedTrendList: (json['move_trend_list'] as List<dynamic>?) | ||
| 224 | - ?.map((e) => CaloriesBurnedTrend.fromJson(e as Map<String, dynamic>)) | ||
| 225 | - .toList(), | ||
| 226 | - exerciseTimeTrendList: (json['excercise_trend_list'] as List<dynamic>?) | ||
| 227 | - ?.map((e) => ExerciseTimeTrend.fromJson(e as Map<String, dynamic>)) | ||
| 228 | - .toList(), | ||
| 229 | - activityTargetInfo: json['activity_target_info'] == null | ||
| 230 | - ? null | ||
| 231 | - : ActivityTargetInfo.fromJson( | ||
| 232 | - json['activity_target_info'] as Map<String, dynamic>), | ||
| 233 | - ); | ||
| 234 | - | ||
| 235 | -Map<String, dynamic> _$ActivityBurnStatisticsDataToJson( | ||
| 236 | - ActivityBurnStatisticsData instance) => | ||
| 237 | - <String, dynamic>{ | ||
| 238 | - if (instance.totalCaloriesBurned case final value?) 'total_move': value, | ||
| 239 | - if (instance.avgCaloriesBurned case final value?) 'avg_move': value, | ||
| 240 | - if (instance.maxCaloriesBurned?.toJson() case final value?) | ||
| 241 | - 'max_move': value, | ||
| 242 | - if (instance.minCaloriesBurned?.toJson() case final value?) | ||
| 243 | - 'min_move': value, | ||
| 244 | - if (instance.totalSteps case final value?) 'total_steps': value, | ||
| 245 | - if (instance.totalStand case final value?) 'total_stand': value, | ||
| 246 | - if (instance.caloriesBurnedTrendList?.map((e) => e.toJson()).toList() | ||
| 247 | - case final value?) | ||
| 248 | - 'move_trend_list': value, | ||
| 249 | - if (instance.exerciseTimeTrendList?.map((e) => e.toJson()).toList() | ||
| 250 | - case final value?) | ||
| 251 | - 'excercise_trend_list': value, | ||
| 252 | - if (instance.activityTargetInfo?.toJson() case final value?) | ||
| 253 | - 'activity_target_info': value, | ||
| 254 | - }; | ||
| 255 | - | ||
| 256 | -CaloriesBurnedValue _$CaloriesBurnedValueFromJson(Map<String, dynamic> json) => | ||
| 257 | - CaloriesBurnedValue( | ||
| 258 | - date: (json['date'] as num?)?.toInt(), | ||
| 259 | - value: (json['value'] as num?)?.toInt(), | ||
| 260 | - ); | ||
| 261 | - | ||
| 262 | -Map<String, dynamic> _$CaloriesBurnedValueToJson( | ||
| 263 | - CaloriesBurnedValue instance) => | ||
| 264 | - <String, dynamic>{ | ||
| 265 | - if (instance.date case final value?) 'date': value, | ||
| 266 | - if (instance.value case final value?) 'value': value, | ||
| 267 | - }; | ||
| 268 | - | ||
| 269 | -CaloriesBurnedTrend _$CaloriesBurnedTrendFromJson(Map<String, dynamic> json) => | ||
| 270 | - CaloriesBurnedTrend( | ||
| 271 | - timeKey: (json['time_key'] as num?)?.toInt(), | ||
| 272 | - value: (json['value'] as num?)?.toInt(), | ||
| 273 | - ); | ||
| 274 | - | ||
| 275 | -Map<String, dynamic> _$CaloriesBurnedTrendToJson( | ||
| 276 | - CaloriesBurnedTrend instance) => | ||
| 277 | - <String, dynamic>{ | ||
| 278 | - if (instance.timeKey case final value?) 'time_key': value, | ||
| 279 | - if (instance.value case final value?) 'value': value, | ||
| 280 | - }; | ||
| 281 | - | ||
| 282 | -ExerciseTimeTrend _$ExerciseTimeTrendFromJson(Map<String, dynamic> json) => | ||
| 283 | - ExerciseTimeTrend( | ||
| 284 | - timeKey: (json['time_key'] as num?)?.toInt(), | ||
| 285 | - value: (json['value'] as num?)?.toInt(), | ||
| 286 | - ); | ||
| 287 | - | ||
| 288 | -Map<String, dynamic> _$ExerciseTimeTrendToJson(ExerciseTimeTrend instance) => | ||
| 289 | - <String, dynamic>{ | ||
| 290 | - if (instance.timeKey case final value?) 'time_key': value, | ||
| 291 | - if (instance.value case final value?) 'value': value, | ||
| 292 | - }; | ||
| 293 | - | ||
| 294 | -ActivityTargetInfo _$ActivityTargetInfoFromJson(Map<String, dynamic> json) => | ||
| 295 | - ActivityTargetInfo( | ||
| 296 | - move: (json['move'] as num?)?.toInt(), | ||
| 297 | - step: (json['step'] as num?)?.toInt(), | ||
| 298 | - stand: (json['stand'] as num?)?.toInt(), | ||
| 299 | - ); | ||
| 300 | - | ||
| 301 | -Map<String, dynamic> _$ActivityTargetInfoToJson(ActivityTargetInfo instance) => | ||
| 302 | - <String, dynamic>{ | ||
| 303 | - if (instance.move case final value?) 'move': value, | ||
| 304 | - if (instance.step case final value?) 'step': value, | ||
| 305 | - if (instance.stand case final value?) 'stand': value, | ||
| 306 | - }; | ||
| 307 | - | ||
| 308 | -HrvStatisticsData _$HrvStatisticsDataFromJson(Map<String, dynamic> json) => | ||
| 309 | - HrvStatisticsData( | ||
| 310 | - avgHrv: (json['avg_hrv'] as num?)?.toDouble(), | ||
| 311 | - avgHrvBaseline: (json['avg_hrv_baseline'] as num?)?.toDouble(), | ||
| 312 | - avgWalkingHeartRate: (json['avg_walking_heart_rate'] as num?)?.toDouble(), | ||
| 313 | - avgRestingHeartRate: (json['avg_resting_heart_rate'] as num?)?.toDouble(), | ||
| 314 | - avgSleepingHeartRate: | ||
| 315 | - (json['avg_sleeping_heart_rate'] as num?)?.toDouble(), | ||
| 316 | - hrvTrendList: (json['hrv_trend_list'] as List<dynamic>?) | ||
| 317 | - ?.map((e) => HrvTrend.fromJson(e as Map<String, dynamic>)) | ||
| 318 | - .toList(), | ||
| 319 | - hrvDistributionList: (json['hrv_distribution_list'] as List<dynamic>?) | ||
| 320 | - ?.map((e) => HrvDistribution.fromJson(e as Map<String, dynamic>)) | ||
| 321 | - .toList(), | ||
| 322 | - ); | ||
| 323 | - | ||
| 324 | -Map<String, dynamic> _$HrvStatisticsDataToJson(HrvStatisticsData instance) => | ||
| 325 | - <String, dynamic>{ | ||
| 326 | - if (instance.avgHrv case final value?) 'avg_hrv': value, | ||
| 327 | - if (instance.avgHrvBaseline case final value?) 'avg_hrv_baseline': value, | ||
| 328 | - if (instance.avgWalkingHeartRate case final value?) | ||
| 329 | - 'avg_walking_heart_rate': value, | ||
| 330 | - if (instance.avgRestingHeartRate case final value?) | ||
| 331 | - 'avg_resting_heart_rate': value, | ||
| 332 | - if (instance.avgSleepingHeartRate case final value?) | ||
| 333 | - 'avg_sleeping_heart_rate': value, | ||
| 334 | - if (instance.hrvTrendList?.map((e) => e.toJson()).toList() | ||
| 335 | - case final value?) | ||
| 336 | - 'hrv_trend_list': value, | ||
| 337 | - if (instance.hrvDistributionList?.map((e) => e.toJson()).toList() | ||
| 338 | - case final value?) | ||
| 339 | - 'hrv_distribution_list': value, | ||
| 340 | - }; | ||
| 341 | - | ||
| 342 | -HrvTrend _$HrvTrendFromJson(Map<String, dynamic> json) => HrvTrend( | ||
| 343 | - timeKey: (json['time_key'] as num?)?.toInt(), | ||
| 344 | - average: (json['average'] as num?)?.toDouble(), | ||
| 345 | - ); | ||
| 346 | - | ||
| 347 | -Map<String, dynamic> _$HrvTrendToJson(HrvTrend instance) => <String, dynamic>{ | ||
| 348 | - if (instance.timeKey case final value?) 'time_key': value, | ||
| 349 | - if (instance.average case final value?) 'average': value, | ||
| 350 | - }; | ||
| 351 | - | ||
| 352 | -HrvDistribution _$HrvDistributionFromJson(Map<String, dynamic> json) => | ||
| 353 | - HrvDistribution( | ||
| 354 | - timeKey: (json['time_key'] as num?)?.toInt(), | ||
| 355 | - dayCounts: json['day_counts'] == null | ||
| 356 | - ? null | ||
| 357 | - : HrvDistributionDayCount.fromJson( | ||
| 358 | - json['day_counts'] as Map<String, dynamic>), | ||
| 359 | - ); | ||
| 360 | - | ||
| 361 | -Map<String, dynamic> _$HrvDistributionToJson(HrvDistribution instance) => | ||
| 362 | - <String, dynamic>{ | ||
| 363 | - if (instance.timeKey case final value?) 'time_key': value, | ||
| 364 | - if (instance.dayCounts?.toJson() case final value?) 'day_counts': value, | ||
| 365 | - }; | ||
| 366 | - | ||
| 367 | -HrvDistributionDayCount _$HrvDistributionDayCountFromJson( | ||
| 368 | - Map<String, dynamic> json) => | ||
| 369 | - HrvDistributionDayCount( | ||
| 370 | - stressful: (json['stressful'] as num?)?.toInt(), | ||
| 371 | - normal: (json['normal'] as num?)?.toInt(), | ||
| 372 | - energetic: (json['energetic'] as num?)?.toInt(), | ||
| 373 | - ); | ||
| 374 | - | ||
| 375 | -Map<String, dynamic> _$HrvDistributionDayCountToJson( | ||
| 376 | - HrvDistributionDayCount instance) => | ||
| 377 | - <String, dynamic>{ | ||
| 378 | - if (instance.stressful case final value?) 'stressful': value, | ||
| 379 | - if (instance.normal case final value?) 'normal': value, | ||
| 380 | - if (instance.energetic case final value?) 'energetic': value, | ||
| 381 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | import '../json/converters.dart'; | 1 | import '../json/converters.dart'; |
| 4 | 2 | ||
| 5 | -part 'health_upload_models.g.dart'; | ||
| 6 | - | ||
| 7 | sealed class HealthDataUploadValue { | 3 | sealed class HealthDataUploadValue { |
| 8 | const HealthDataUploadValue(); | 4 | const HealthDataUploadValue(); |
| 9 | } | 5 | } |
| @@ -18,7 +14,6 @@ final class HealthDataUploadDoubleValue extends HealthDataUploadValue { | @@ -18,7 +14,6 @@ final class HealthDataUploadDoubleValue extends HealthDataUploadValue { | ||
| 18 | final double value; | 14 | final double value; |
| 19 | } | 15 | } |
| 20 | 16 | ||
| 21 | -@JsonSerializable() | ||
| 22 | class HealthDataUploadItem { | 17 | class HealthDataUploadItem { |
| 23 | const HealthDataUploadItem({ | 18 | const HealthDataUploadItem({ |
| 24 | required this.dataType, | 19 | required this.dataType, |
| @@ -26,30 +21,47 @@ class HealthDataUploadItem { | @@ -26,30 +21,47 @@ class HealthDataUploadItem { | ||
| 26 | required this.time, | 21 | required this.time, |
| 27 | }); | 22 | }); |
| 28 | 23 | ||
| 29 | - @JsonKey(name: 'data_type') | ||
| 30 | final int dataType; | 24 | final int dataType; |
| 31 | - @HealthDataUploadValueConverter() | ||
| 32 | final HealthDataUploadValue value; | 25 | final HealthDataUploadValue value; |
| 33 | final int time; | 26 | final int time; |
| 34 | 27 | ||
| 35 | - factory HealthDataUploadItem.fromJson(Map<String, dynamic> json) => | ||
| 36 | - _$HealthDataUploadItemFromJson(json); | ||
| 37 | - Map<String, dynamic> toJson() => _$HealthDataUploadItemToJson(this); | 28 | + factory HealthDataUploadItem.fromJson(Map<String, dynamic> json) { |
| 29 | + return HealthDataUploadItem( | ||
| 30 | + dataType: json['data_type'] as int, | ||
| 31 | + value: const HealthDataUploadValueConverter().fromJson(json['value']), | ||
| 32 | + time: json['time'] as int, | ||
| 33 | + ); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + Map<String, dynamic> toJson() { | ||
| 37 | + return <String, dynamic>{ | ||
| 38 | + 'data_type': dataType, | ||
| 39 | + 'value': const HealthDataUploadValueConverter().toJson(value), | ||
| 40 | + 'time': time, | ||
| 41 | + }; | ||
| 42 | + } | ||
| 38 | } | 43 | } |
| 39 | 44 | ||
| 40 | -@JsonSerializable() | ||
| 41 | class HealthDataUploadItemList { | 45 | class HealthDataUploadItemList { |
| 42 | const HealthDataUploadItemList({required this.itemList}); | 46 | const HealthDataUploadItemList({required this.itemList}); |
| 43 | 47 | ||
| 44 | - @JsonKey(name: 'data_list') | ||
| 45 | final List<HealthDataUploadItem> itemList; | 48 | final List<HealthDataUploadItem> itemList; |
| 46 | 49 | ||
| 47 | - factory HealthDataUploadItemList.fromJson(Map<String, dynamic> json) => | ||
| 48 | - _$HealthDataUploadItemListFromJson(json); | ||
| 49 | - Map<String, dynamic> toJson() => _$HealthDataUploadItemListToJson(this); | 50 | + factory HealthDataUploadItemList.fromJson(Map<String, dynamic> json) { |
| 51 | + return HealthDataUploadItemList( | ||
| 52 | + itemList: (json['data_list'] as List<dynamic>) | ||
| 53 | + .map((e) => HealthDataUploadItem.fromJson(e as Map<String, dynamic>)) | ||
| 54 | + .toList(), | ||
| 55 | + ); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + Map<String, dynamic> toJson() { | ||
| 59 | + return <String, dynamic>{ | ||
| 60 | + 'data_list': itemList.map((e) => e.toJson()).toList(), | ||
| 61 | + }; | ||
| 62 | + } | ||
| 50 | } | 63 | } |
| 51 | 64 | ||
| 52 | -@JsonSerializable() | ||
| 53 | class SleepHealthDataUploadItem { | 65 | class SleepHealthDataUploadItem { |
| 54 | const SleepHealthDataUploadItem({ | 66 | const SleepHealthDataUploadItem({ |
| 55 | required this.dataType, | 67 | required this.dataType, |
| @@ -57,97 +69,151 @@ class SleepHealthDataUploadItem { | @@ -57,97 +69,151 @@ class SleepHealthDataUploadItem { | ||
| 57 | required this.toTime, | 69 | required this.toTime, |
| 58 | }); | 70 | }); |
| 59 | 71 | ||
| 60 | - @JsonKey(name: 'data_type') | ||
| 61 | final int dataType; | 72 | final int dataType; |
| 62 | - @JsonKey(name: 'from_time') | ||
| 63 | final int fromTime; | 73 | final int fromTime; |
| 64 | - @JsonKey(name: 'to_time') | ||
| 65 | final int toTime; | 74 | final int toTime; |
| 66 | 75 | ||
| 67 | - factory SleepHealthDataUploadItem.fromJson(Map<String, dynamic> json) => | ||
| 68 | - _$SleepHealthDataUploadItemFromJson(json); | ||
| 69 | - Map<String, dynamic> toJson() => _$SleepHealthDataUploadItemToJson(this); | 76 | + factory SleepHealthDataUploadItem.fromJson(Map<String, dynamic> json) { |
| 77 | + return SleepHealthDataUploadItem( | ||
| 78 | + dataType: json['data_type'] as int, | ||
| 79 | + fromTime: json['from_time'] as int, | ||
| 80 | + toTime: json['to_time'] as int, | ||
| 81 | + ); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + Map<String, dynamic> toJson() { | ||
| 85 | + return <String, dynamic>{ | ||
| 86 | + 'data_type': dataType, | ||
| 87 | + 'from_time': fromTime, | ||
| 88 | + 'to_time': toTime, | ||
| 89 | + }; | ||
| 90 | + } | ||
| 70 | } | 91 | } |
| 71 | 92 | ||
| 72 | -@JsonSerializable() | ||
| 73 | class SleepStateHealthDataUploadItemList { | 93 | class SleepStateHealthDataUploadItemList { |
| 74 | const SleepStateHealthDataUploadItemList({required this.itemList}); | 94 | const SleepStateHealthDataUploadItemList({required this.itemList}); |
| 75 | 95 | ||
| 76 | - @JsonKey(name: 'data_list') | ||
| 77 | final List<SleepHealthDataUploadItem> itemList; | 96 | final List<SleepHealthDataUploadItem> itemList; |
| 78 | 97 | ||
| 79 | factory SleepStateHealthDataUploadItemList.fromJson( | 98 | factory SleepStateHealthDataUploadItemList.fromJson( |
| 80 | Map<String, dynamic> json, | 99 | Map<String, dynamic> json, |
| 81 | - ) => | ||
| 82 | - _$SleepStateHealthDataUploadItemListFromJson(json); | ||
| 83 | - Map<String, dynamic> toJson() => | ||
| 84 | - _$SleepStateHealthDataUploadItemListToJson(this); | 100 | + ) { |
| 101 | + return SleepStateHealthDataUploadItemList( | ||
| 102 | + itemList: (json['data_list'] as List<dynamic>) | ||
| 103 | + .map((e) => | ||
| 104 | + SleepHealthDataUploadItem.fromJson(e as Map<String, dynamic>)) | ||
| 105 | + .toList(), | ||
| 106 | + ); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + Map<String, dynamic> toJson() { | ||
| 110 | + return <String, dynamic>{ | ||
| 111 | + 'data_list': itemList.map((e) => e.toJson()).toList(), | ||
| 112 | + }; | ||
| 113 | + } | ||
| 85 | } | 114 | } |
| 86 | 115 | ||
| 87 | -@JsonSerializable() | ||
| 88 | class HealthDataLatestUploadRecord { | 116 | class HealthDataLatestUploadRecord { |
| 89 | const HealthDataLatestUploadRecord({this.dataType, this.latestUploadTime}); | 117 | const HealthDataLatestUploadRecord({this.dataType, this.latestUploadTime}); |
| 90 | 118 | ||
| 91 | - @JsonKey(name: 'data_type') | ||
| 92 | final int? dataType; | 119 | final int? dataType; |
| 93 | - @JsonKey(name: 'latest_data_time') | ||
| 94 | final int? latestUploadTime; | 120 | final int? latestUploadTime; |
| 95 | 121 | ||
| 96 | - factory HealthDataLatestUploadRecord.fromJson(Map<String, dynamic> json) => | ||
| 97 | - _$HealthDataLatestUploadRecordFromJson(json); | ||
| 98 | - Map<String, dynamic> toJson() => _$HealthDataLatestUploadRecordToJson(this); | 122 | + factory HealthDataLatestUploadRecord.fromJson(Map<String, dynamic> json) { |
| 123 | + return HealthDataLatestUploadRecord( | ||
| 124 | + dataType: json['data_type'] as int?, | ||
| 125 | + latestUploadTime: json['latest_data_time'] as int?, | ||
| 126 | + ); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + Map<String, dynamic> toJson() { | ||
| 130 | + final val = <String, dynamic>{}; | ||
| 131 | + if (dataType != null) val['data_type'] = dataType; | ||
| 132 | + if (latestUploadTime != null) val['latest_data_time'] = latestUploadTime; | ||
| 133 | + return val; | ||
| 134 | + } | ||
| 99 | } | 135 | } |
| 100 | 136 | ||
| 101 | -@JsonSerializable() | ||
| 102 | class HealthDataLatestUploadRecordList { | 137 | class HealthDataLatestUploadRecordList { |
| 103 | const HealthDataLatestUploadRecordList({this.uploadInfoList}); | 138 | const HealthDataLatestUploadRecordList({this.uploadInfoList}); |
| 104 | 139 | ||
| 105 | - @JsonKey(name: 'latest_data_time_list') | ||
| 106 | final List<HealthDataLatestUploadRecord>? uploadInfoList; | 140 | final List<HealthDataLatestUploadRecord>? uploadInfoList; |
| 107 | 141 | ||
| 108 | factory HealthDataLatestUploadRecordList.fromJson( | 142 | factory HealthDataLatestUploadRecordList.fromJson( |
| 109 | Map<String, dynamic> json, | 143 | Map<String, dynamic> json, |
| 110 | - ) => | ||
| 111 | - _$HealthDataLatestUploadRecordListFromJson(json); | ||
| 112 | - Map<String, dynamic> toJson() => | ||
| 113 | - _$HealthDataLatestUploadRecordListToJson(this); | 144 | + ) { |
| 145 | + return HealthDataLatestUploadRecordList( | ||
| 146 | + uploadInfoList: (json['latest_data_time_list'] as List<dynamic>?) | ||
| 147 | + ?.map((e) => | ||
| 148 | + HealthDataLatestUploadRecord.fromJson(e as Map<String, dynamic>)) | ||
| 149 | + .toList(), | ||
| 150 | + ); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + Map<String, dynamic> toJson() { | ||
| 154 | + final val = <String, dynamic>{}; | ||
| 155 | + if (uploadInfoList != null) { | ||
| 156 | + val['latest_data_time_list'] = | ||
| 157 | + uploadInfoList!.map((e) => e.toJson()).toList(); | ||
| 158 | + } | ||
| 159 | + return val; | ||
| 160 | + } | ||
| 114 | } | 161 | } |
| 115 | 162 | ||
| 116 | -@JsonSerializable() | ||
| 117 | class HealthAuthRequest { | 163 | class HealthAuthRequest { |
| 118 | const HealthAuthRequest({required this.code}); | 164 | const HealthAuthRequest({required this.code}); |
| 119 | 165 | ||
| 120 | final String code; | 166 | final String code; |
| 121 | 167 | ||
| 122 | - factory HealthAuthRequest.fromJson(Map<String, dynamic> json) => | ||
| 123 | - _$HealthAuthRequestFromJson(json); | ||
| 124 | - Map<String, dynamic> toJson() => _$HealthAuthRequestToJson(this); | 168 | + factory HealthAuthRequest.fromJson(Map<String, dynamic> json) { |
| 169 | + return HealthAuthRequest( | ||
| 170 | + code: json['code'] as String, | ||
| 171 | + ); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + Map<String, dynamic> toJson() { | ||
| 175 | + return <String, dynamic>{ | ||
| 176 | + 'code': code, | ||
| 177 | + }; | ||
| 178 | + } | ||
| 125 | } | 179 | } |
| 126 | 180 | ||
| 127 | -@JsonSerializable() | ||
| 128 | class HealthAuthResponse { | 181 | class HealthAuthResponse { |
| 129 | const HealthAuthResponse({this.scope}); | 182 | const HealthAuthResponse({this.scope}); |
| 130 | 183 | ||
| 131 | final String? scope; | 184 | final String? scope; |
| 132 | 185 | ||
| 133 | - factory HealthAuthResponse.fromJson(Map<String, dynamic> json) => | ||
| 134 | - _$HealthAuthResponseFromJson(json); | ||
| 135 | - Map<String, dynamic> toJson() => _$HealthAuthResponseToJson(this); | 186 | + factory HealthAuthResponse.fromJson(Map<String, dynamic> json) { |
| 187 | + return HealthAuthResponse( | ||
| 188 | + scope: json['scope'] as String?, | ||
| 189 | + ); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + Map<String, dynamic> toJson() { | ||
| 193 | + final val = <String, dynamic>{}; | ||
| 194 | + if (scope != null) val['scope'] = scope; | ||
| 195 | + return val; | ||
| 196 | + } | ||
| 136 | } | 197 | } |
| 137 | 198 | ||
| 138 | -@JsonSerializable() | ||
| 139 | class PulseTypeRequest { | 199 | class PulseTypeRequest { |
| 140 | const PulseTypeRequest({required this.pulseType}); | 200 | const PulseTypeRequest({required this.pulseType}); |
| 141 | 201 | ||
| 142 | - @JsonKey(name: 'pulse_type') | ||
| 143 | final int pulseType; | 202 | final int pulseType; |
| 144 | 203 | ||
| 145 | - factory PulseTypeRequest.fromJson(Map<String, dynamic> json) => | ||
| 146 | - _$PulseTypeRequestFromJson(json); | ||
| 147 | - Map<String, dynamic> toJson() => _$PulseTypeRequestToJson(this); | 204 | + factory PulseTypeRequest.fromJson(Map<String, dynamic> json) { |
| 205 | + return PulseTypeRequest( | ||
| 206 | + pulseType: json['pulse_type'] as int, | ||
| 207 | + ); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + Map<String, dynamic> toJson() { | ||
| 211 | + return <String, dynamic>{ | ||
| 212 | + 'pulse_type': pulseType, | ||
| 213 | + }; | ||
| 214 | + } | ||
| 148 | } | 215 | } |
| 149 | 216 | ||
| 150 | -@JsonSerializable() | ||
| 151 | class PulseTypeResponse { | 217 | class PulseTypeResponse { |
| 152 | const PulseTypeResponse({ | 218 | const PulseTypeResponse({ |
| 153 | this.id, | 219 | this.id, |
| @@ -157,19 +223,29 @@ class PulseTypeResponse { | @@ -157,19 +223,29 @@ class PulseTypeResponse { | ||
| 157 | }); | 223 | }); |
| 158 | 224 | ||
| 159 | final int? id; | 225 | final int? id; |
| 160 | - @JsonKey(name: 'user_id') | ||
| 161 | final int? userId; | 226 | final int? userId; |
| 162 | - @JsonKey(name: 'pulse_type') | ||
| 163 | final int? pulseType; | 227 | final int? pulseType; |
| 164 | - @JsonKey(name: 'create_time') | ||
| 165 | final int? createTime; | 228 | final int? createTime; |
| 166 | 229 | ||
| 167 | - factory PulseTypeResponse.fromJson(Map<String, dynamic> json) => | ||
| 168 | - _$PulseTypeResponseFromJson(json); | ||
| 169 | - Map<String, dynamic> toJson() => _$PulseTypeResponseToJson(this); | 230 | + factory PulseTypeResponse.fromJson(Map<String, dynamic> json) { |
| 231 | + return PulseTypeResponse( | ||
| 232 | + id: json['id'] as int?, | ||
| 233 | + userId: json['user_id'] as int?, | ||
| 234 | + pulseType: json['pulse_type'] as int?, | ||
| 235 | + createTime: json['create_time'] as int?, | ||
| 236 | + ); | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + Map<String, dynamic> toJson() { | ||
| 240 | + final val = <String, dynamic>{}; | ||
| 241 | + if (id != null) val['id'] = id; | ||
| 242 | + if (userId != null) val['user_id'] = userId; | ||
| 243 | + if (pulseType != null) val['pulse_type'] = pulseType; | ||
| 244 | + if (createTime != null) val['create_time'] = createTime; | ||
| 245 | + return val; | ||
| 246 | + } | ||
| 170 | } | 247 | } |
| 171 | 248 | ||
| 172 | -@JsonSerializable() | ||
| 173 | class LatestHrvData { | 249 | class LatestHrvData { |
| 174 | const LatestHrvData({ | 250 | const LatestHrvData({ |
| 175 | this.userHrv, | 251 | this.userHrv, |
| @@ -178,16 +254,28 @@ class LatestHrvData { | @@ -178,16 +254,28 @@ class LatestHrvData { | ||
| 178 | this.partnerHrvBaseline, | 254 | this.partnerHrvBaseline, |
| 179 | }); | 255 | }); |
| 180 | 256 | ||
| 181 | - @JsonKey(name: 'user_hrv') | ||
| 182 | final double? userHrv; | 257 | final double? userHrv; |
| 183 | - @JsonKey(name: 'user_hrv_baseline') | ||
| 184 | final double? userHrvBaseline; | 258 | final double? userHrvBaseline; |
| 185 | - @JsonKey(name: 'pair_user_hrv') | ||
| 186 | final double? partnerHrv; | 259 | final double? partnerHrv; |
| 187 | - @JsonKey(name: 'pair_hrv_baseline') | ||
| 188 | final double? partnerHrvBaseline; | 260 | final double? partnerHrvBaseline; |
| 189 | 261 | ||
| 190 | - factory LatestHrvData.fromJson(Map<String, dynamic> json) => | ||
| 191 | - _$LatestHrvDataFromJson(json); | ||
| 192 | - Map<String, dynamic> toJson() => _$LatestHrvDataToJson(this); | 262 | + factory LatestHrvData.fromJson(Map<String, dynamic> json) { |
| 263 | + return LatestHrvData( | ||
| 264 | + userHrv: (json['user_hrv'] as num?)?.toDouble(), | ||
| 265 | + userHrvBaseline: (json['user_hrv_baseline'] as num?)?.toDouble(), | ||
| 266 | + partnerHrv: (json['pair_user_hrv'] as num?)?.toDouble(), | ||
| 267 | + partnerHrvBaseline: (json['pair_hrv_baseline'] as num?)?.toDouble(), | ||
| 268 | + ); | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + Map<String, dynamic> toJson() { | ||
| 272 | + final val = <String, dynamic>{}; | ||
| 273 | + if (userHrv != null) val['user_hrv'] = userHrv; | ||
| 274 | + if (userHrvBaseline != null) val['user_hrv_baseline'] = userHrvBaseline; | ||
| 275 | + if (partnerHrv != null) val['pair_user_hrv'] = partnerHrv; | ||
| 276 | + if (partnerHrvBaseline != null) { | ||
| 277 | + val['pair_hrv_baseline'] = partnerHrvBaseline; | ||
| 278 | + } | ||
| 279 | + return val; | ||
| 280 | + } | ||
| 193 | } | 281 | } |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'health_upload_models.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -HealthDataUploadItem _$HealthDataUploadItemFromJson( | ||
| 10 | - Map<String, dynamic> json) => | ||
| 11 | - HealthDataUploadItem( | ||
| 12 | - dataType: (json['data_type'] as num).toInt(), | ||
| 13 | - value: const HealthDataUploadValueConverter().fromJson(json['value']), | ||
| 14 | - time: (json['time'] as num).toInt(), | ||
| 15 | - ); | ||
| 16 | - | ||
| 17 | -Map<String, dynamic> _$HealthDataUploadItemToJson( | ||
| 18 | - HealthDataUploadItem instance) => | ||
| 19 | - <String, dynamic>{ | ||
| 20 | - 'data_type': instance.dataType, | ||
| 21 | - if (const HealthDataUploadValueConverter().toJson(instance.value) | ||
| 22 | - case final value?) | ||
| 23 | - 'value': value, | ||
| 24 | - 'time': instance.time, | ||
| 25 | - }; | ||
| 26 | - | ||
| 27 | -HealthDataUploadItemList _$HealthDataUploadItemListFromJson( | ||
| 28 | - Map<String, dynamic> json) => | ||
| 29 | - HealthDataUploadItemList( | ||
| 30 | - itemList: (json['data_list'] as List<dynamic>) | ||
| 31 | - .map((e) => HealthDataUploadItem.fromJson(e as Map<String, dynamic>)) | ||
| 32 | - .toList(), | ||
| 33 | - ); | ||
| 34 | - | ||
| 35 | -Map<String, dynamic> _$HealthDataUploadItemListToJson( | ||
| 36 | - HealthDataUploadItemList instance) => | ||
| 37 | - <String, dynamic>{ | ||
| 38 | - 'data_list': instance.itemList.map((e) => e.toJson()).toList(), | ||
| 39 | - }; | ||
| 40 | - | ||
| 41 | -SleepHealthDataUploadItem _$SleepHealthDataUploadItemFromJson( | ||
| 42 | - Map<String, dynamic> json) => | ||
| 43 | - SleepHealthDataUploadItem( | ||
| 44 | - dataType: (json['data_type'] as num).toInt(), | ||
| 45 | - fromTime: (json['from_time'] as num).toInt(), | ||
| 46 | - toTime: (json['to_time'] as num).toInt(), | ||
| 47 | - ); | ||
| 48 | - | ||
| 49 | -Map<String, dynamic> _$SleepHealthDataUploadItemToJson( | ||
| 50 | - SleepHealthDataUploadItem instance) => | ||
| 51 | - <String, dynamic>{ | ||
| 52 | - 'data_type': instance.dataType, | ||
| 53 | - 'from_time': instance.fromTime, | ||
| 54 | - 'to_time': instance.toTime, | ||
| 55 | - }; | ||
| 56 | - | ||
| 57 | -SleepStateHealthDataUploadItemList _$SleepStateHealthDataUploadItemListFromJson( | ||
| 58 | - Map<String, dynamic> json) => | ||
| 59 | - SleepStateHealthDataUploadItemList( | ||
| 60 | - itemList: (json['data_list'] as List<dynamic>) | ||
| 61 | - .map((e) => | ||
| 62 | - SleepHealthDataUploadItem.fromJson(e as Map<String, dynamic>)) | ||
| 63 | - .toList(), | ||
| 64 | - ); | ||
| 65 | - | ||
| 66 | -Map<String, dynamic> _$SleepStateHealthDataUploadItemListToJson( | ||
| 67 | - SleepStateHealthDataUploadItemList instance) => | ||
| 68 | - <String, dynamic>{ | ||
| 69 | - 'data_list': instance.itemList.map((e) => e.toJson()).toList(), | ||
| 70 | - }; | ||
| 71 | - | ||
| 72 | -HealthDataLatestUploadRecord _$HealthDataLatestUploadRecordFromJson( | ||
| 73 | - Map<String, dynamic> json) => | ||
| 74 | - HealthDataLatestUploadRecord( | ||
| 75 | - dataType: (json['data_type'] as num?)?.toInt(), | ||
| 76 | - latestUploadTime: (json['latest_data_time'] as num?)?.toInt(), | ||
| 77 | - ); | ||
| 78 | - | ||
| 79 | -Map<String, dynamic> _$HealthDataLatestUploadRecordToJson( | ||
| 80 | - HealthDataLatestUploadRecord instance) => | ||
| 81 | - <String, dynamic>{ | ||
| 82 | - if (instance.dataType case final value?) 'data_type': value, | ||
| 83 | - if (instance.latestUploadTime case final value?) | ||
| 84 | - 'latest_data_time': value, | ||
| 85 | - }; | ||
| 86 | - | ||
| 87 | -HealthDataLatestUploadRecordList _$HealthDataLatestUploadRecordListFromJson( | ||
| 88 | - Map<String, dynamic> json) => | ||
| 89 | - HealthDataLatestUploadRecordList( | ||
| 90 | - uploadInfoList: (json['latest_data_time_list'] as List<dynamic>?) | ||
| 91 | - ?.map((e) => | ||
| 92 | - HealthDataLatestUploadRecord.fromJson(e as Map<String, dynamic>)) | ||
| 93 | - .toList(), | ||
| 94 | - ); | ||
| 95 | - | ||
| 96 | -Map<String, dynamic> _$HealthDataLatestUploadRecordListToJson( | ||
| 97 | - HealthDataLatestUploadRecordList instance) => | ||
| 98 | - <String, dynamic>{ | ||
| 99 | - if (instance.uploadInfoList?.map((e) => e.toJson()).toList() | ||
| 100 | - case final value?) | ||
| 101 | - 'latest_data_time_list': value, | ||
| 102 | - }; | ||
| 103 | - | ||
| 104 | -HealthAuthRequest _$HealthAuthRequestFromJson(Map<String, dynamic> json) => | ||
| 105 | - HealthAuthRequest( | ||
| 106 | - code: json['code'] as String, | ||
| 107 | - ); | ||
| 108 | - | ||
| 109 | -Map<String, dynamic> _$HealthAuthRequestToJson(HealthAuthRequest instance) => | ||
| 110 | - <String, dynamic>{ | ||
| 111 | - 'code': instance.code, | ||
| 112 | - }; | ||
| 113 | - | ||
| 114 | -HealthAuthResponse _$HealthAuthResponseFromJson(Map<String, dynamic> json) => | ||
| 115 | - HealthAuthResponse( | ||
| 116 | - scope: json['scope'] as String?, | ||
| 117 | - ); | ||
| 118 | - | ||
| 119 | -Map<String, dynamic> _$HealthAuthResponseToJson(HealthAuthResponse instance) => | ||
| 120 | - <String, dynamic>{ | ||
| 121 | - if (instance.scope case final value?) 'scope': value, | ||
| 122 | - }; | ||
| 123 | - | ||
| 124 | -PulseTypeRequest _$PulseTypeRequestFromJson(Map<String, dynamic> json) => | ||
| 125 | - PulseTypeRequest( | ||
| 126 | - pulseType: (json['pulse_type'] as num).toInt(), | ||
| 127 | - ); | ||
| 128 | - | ||
| 129 | -Map<String, dynamic> _$PulseTypeRequestToJson(PulseTypeRequest instance) => | ||
| 130 | - <String, dynamic>{ | ||
| 131 | - 'pulse_type': instance.pulseType, | ||
| 132 | - }; | ||
| 133 | - | ||
| 134 | -PulseTypeResponse _$PulseTypeResponseFromJson(Map<String, dynamic> json) => | ||
| 135 | - PulseTypeResponse( | ||
| 136 | - id: (json['id'] as num?)?.toInt(), | ||
| 137 | - userId: (json['user_id'] as num?)?.toInt(), | ||
| 138 | - pulseType: (json['pulse_type'] as num?)?.toInt(), | ||
| 139 | - createTime: (json['create_time'] as num?)?.toInt(), | ||
| 140 | - ); | ||
| 141 | - | ||
| 142 | -Map<String, dynamic> _$PulseTypeResponseToJson(PulseTypeResponse instance) => | ||
| 143 | - <String, dynamic>{ | ||
| 144 | - if (instance.id case final value?) 'id': value, | ||
| 145 | - if (instance.userId case final value?) 'user_id': value, | ||
| 146 | - if (instance.pulseType case final value?) 'pulse_type': value, | ||
| 147 | - if (instance.createTime case final value?) 'create_time': value, | ||
| 148 | - }; | ||
| 149 | - | ||
| 150 | -LatestHrvData _$LatestHrvDataFromJson(Map<String, dynamic> json) => | ||
| 151 | - LatestHrvData( | ||
| 152 | - userHrv: (json['user_hrv'] as num?)?.toDouble(), | ||
| 153 | - userHrvBaseline: (json['user_hrv_baseline'] as num?)?.toDouble(), | ||
| 154 | - partnerHrv: (json['pair_user_hrv'] as num?)?.toDouble(), | ||
| 155 | - partnerHrvBaseline: (json['pair_hrv_baseline'] as num?)?.toDouble(), | ||
| 156 | - ); | ||
| 157 | - | ||
| 158 | -Map<String, dynamic> _$LatestHrvDataToJson(LatestHrvData instance) => | ||
| 159 | - <String, dynamic>{ | ||
| 160 | - if (instance.userHrv case final value?) 'user_hrv': value, | ||
| 161 | - if (instance.userHrvBaseline case final value?) | ||
| 162 | - 'user_hrv_baseline': value, | ||
| 163 | - if (instance.partnerHrv case final value?) 'pair_user_hrv': value, | ||
| 164 | - if (instance.partnerHrvBaseline case final value?) | ||
| 165 | - 'pair_hrv_baseline': value, | ||
| 166 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | -part 'interaction_models.g.dart'; | ||
| 4 | - | ||
| 5 | -@JsonSerializable() | ||
| 6 | class InteractionData { | 1 | class InteractionData { |
| 7 | const InteractionData({ | 2 | const InteractionData({ |
| 8 | this.interactionType, | 3 | this.interactionType, |
| @@ -10,30 +5,52 @@ class InteractionData { | @@ -10,30 +5,52 @@ class InteractionData { | ||
| 10 | this.action, | 5 | this.action, |
| 11 | }); | 6 | }); |
| 12 | 7 | ||
| 13 | - @JsonKey(name: 'interaction_type') | ||
| 14 | final int? interactionType; | 8 | final int? interactionType; |
| 15 | - @JsonKey(name: 'action_type') | ||
| 16 | final int? actionType; | 9 | final int? actionType; |
| 17 | - @JsonKey(name: 'action_variables') | ||
| 18 | final InteractionDataAction? action; | 10 | final InteractionDataAction? action; |
| 19 | 11 | ||
| 20 | - factory InteractionData.fromJson(Map<String, dynamic> json) => | ||
| 21 | - _$InteractionDataFromJson(json); | ||
| 22 | - Map<String, dynamic> toJson() => _$InteractionDataToJson(this); | 12 | + factory InteractionData.fromJson(Map<String, dynamic> json) { |
| 13 | + return InteractionData( | ||
| 14 | + interactionType: json['interaction_type'] as int?, | ||
| 15 | + actionType: json['action_type'] as int?, | ||
| 16 | + action: json['action_variables'] == null | ||
| 17 | + ? null | ||
| 18 | + : InteractionDataAction.fromJson( | ||
| 19 | + json['action_variables'] as Map<String, dynamic>), | ||
| 20 | + ); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + Map<String, dynamic> toJson() { | ||
| 24 | + final val = <String, dynamic>{}; | ||
| 25 | + if (interactionType != null) val['interaction_type'] = interactionType; | ||
| 26 | + if (actionType != null) val['action_type'] = actionType; | ||
| 27 | + if (action != null) val['action_variables'] = action!.toJson(); | ||
| 28 | + return val; | ||
| 29 | + } | ||
| 23 | } | 30 | } |
| 24 | 31 | ||
| 25 | -@JsonSerializable() | ||
| 26 | class InteractionRecordResponse { | 32 | class InteractionRecordResponse { |
| 27 | const InteractionRecordResponse({this.records}); | 33 | const InteractionRecordResponse({this.records}); |
| 28 | 34 | ||
| 29 | final List<InteractionRecord>? records; | 35 | final List<InteractionRecord>? records; |
| 30 | 36 | ||
| 31 | - factory InteractionRecordResponse.fromJson(Map<String, dynamic> json) => | ||
| 32 | - _$InteractionRecordResponseFromJson(json); | ||
| 33 | - Map<String, dynamic> toJson() => _$InteractionRecordResponseToJson(this); | 37 | + factory InteractionRecordResponse.fromJson(Map<String, dynamic> json) { |
| 38 | + return InteractionRecordResponse( | ||
| 39 | + records: (json['records'] as List<dynamic>?) | ||
| 40 | + ?.map((e) => InteractionRecord.fromJson(e as Map<String, dynamic>)) | ||
| 41 | + .toList(), | ||
| 42 | + ); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + Map<String, dynamic> toJson() { | ||
| 46 | + final val = <String, dynamic>{}; | ||
| 47 | + if (records != null) { | ||
| 48 | + val['records'] = records!.map((e) => e.toJson()).toList(); | ||
| 49 | + } | ||
| 50 | + return val; | ||
| 51 | + } | ||
| 34 | } | 52 | } |
| 35 | 53 | ||
| 36 | -@JsonSerializable() | ||
| 37 | class InteractionRecord { | 54 | class InteractionRecord { |
| 38 | const InteractionRecord({ | 55 | const InteractionRecord({ |
| 39 | this.id, | 56 | this.id, |
| @@ -47,26 +64,44 @@ class InteractionRecord { | @@ -47,26 +64,44 @@ class InteractionRecord { | ||
| 47 | }); | 64 | }); |
| 48 | 65 | ||
| 49 | final int? id; | 66 | final int? id; |
| 50 | - @JsonKey(name: 'create_time') | ||
| 51 | final int? createTime; | 67 | final int? createTime; |
| 52 | - @JsonKey(name: 'user_id') | ||
| 53 | final int? userId; | 68 | final int? userId; |
| 54 | - @JsonKey(name: 'pair_id') | ||
| 55 | final int? pairId; | 69 | final int? pairId; |
| 56 | - @JsonKey(name: 'interaction_type') | ||
| 57 | final int? interactionType; | 70 | final int? interactionType; |
| 58 | - @JsonKey(name: 'action_type') | ||
| 59 | final int? actionType; | 71 | final int? actionType; |
| 60 | - @JsonKey(name: 'action_variables') | ||
| 61 | final InteractionDataAction? action; | 72 | final InteractionDataAction? action; |
| 62 | final String? text; | 73 | final String? text; |
| 63 | 74 | ||
| 64 | - factory InteractionRecord.fromJson(Map<String, dynamic> json) => | ||
| 65 | - _$InteractionRecordFromJson(json); | ||
| 66 | - Map<String, dynamic> toJson() => _$InteractionRecordToJson(this); | 75 | + factory InteractionRecord.fromJson(Map<String, dynamic> json) { |
| 76 | + return InteractionRecord( | ||
| 77 | + id: json['id'] as int?, | ||
| 78 | + createTime: json['create_time'] as int?, | ||
| 79 | + userId: json['user_id'] as int?, | ||
| 80 | + pairId: json['pair_id'] as int?, | ||
| 81 | + interactionType: json['interaction_type'] as int?, | ||
| 82 | + actionType: json['action_type'] as int?, | ||
| 83 | + action: json['action_variables'] == null | ||
| 84 | + ? null | ||
| 85 | + : InteractionDataAction.fromJson( | ||
| 86 | + json['action_variables'] as Map<String, dynamic>), | ||
| 87 | + text: json['text'] as String?, | ||
| 88 | + ); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + Map<String, dynamic> toJson() { | ||
| 92 | + final val = <String, dynamic>{}; | ||
| 93 | + if (id != null) val['id'] = id; | ||
| 94 | + if (createTime != null) val['create_time'] = createTime; | ||
| 95 | + if (userId != null) val['user_id'] = userId; | ||
| 96 | + if (pairId != null) val['pair_id'] = pairId; | ||
| 97 | + if (interactionType != null) val['interaction_type'] = interactionType; | ||
| 98 | + if (actionType != null) val['action_type'] = actionType; | ||
| 99 | + if (action != null) val['action_variables'] = action!.toJson(); | ||
| 100 | + if (text != null) val['text'] = text; | ||
| 101 | + return val; | ||
| 102 | + } | ||
| 67 | } | 103 | } |
| 68 | 104 | ||
| 69 | -@JsonSerializable() | ||
| 70 | class InteractionDataAction { | 105 | class InteractionDataAction { |
| 71 | const InteractionDataAction({ | 106 | const InteractionDataAction({ |
| 72 | this.objectTarget, | 107 | this.objectTarget, |
| @@ -78,21 +113,35 @@ class InteractionDataAction { | @@ -78,21 +113,35 @@ class InteractionDataAction { | ||
| 78 | this.action, | 113 | this.action, |
| 79 | }); | 114 | }); |
| 80 | 115 | ||
| 81 | - @JsonKey(name: 'object') | ||
| 82 | final int? objectTarget; | 116 | final int? objectTarget; |
| 83 | - @JsonKey(name: 'data_status') | ||
| 84 | final String? status; | 117 | final String? status; |
| 85 | - @JsonKey(name: 'data_type') | ||
| 86 | final String? type; | 118 | final String? type; |
| 87 | - @JsonKey(name: 'data_date') | ||
| 88 | final String? date; | 119 | final String? date; |
| 89 | - @JsonKey(name: 'data_value') | ||
| 90 | final String? value; | 120 | final String? value; |
| 91 | - @JsonKey(name: 'data_unit') | ||
| 92 | final String? unit; | 121 | final String? unit; |
| 93 | final String? action; | 122 | final String? action; |
| 94 | 123 | ||
| 95 | - factory InteractionDataAction.fromJson(Map<String, dynamic> json) => | ||
| 96 | - _$InteractionDataActionFromJson(json); | ||
| 97 | - Map<String, dynamic> toJson() => _$InteractionDataActionToJson(this); | 124 | + factory InteractionDataAction.fromJson(Map<String, dynamic> json) { |
| 125 | + return InteractionDataAction( | ||
| 126 | + objectTarget: json['object'] as int?, | ||
| 127 | + status: json['data_status'] as String?, | ||
| 128 | + type: json['data_type'] as String?, | ||
| 129 | + date: json['data_date'] as String?, | ||
| 130 | + value: json['data_value'] as String?, | ||
| 131 | + unit: json['data_unit'] as String?, | ||
| 132 | + action: json['action'] as String?, | ||
| 133 | + ); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + Map<String, dynamic> toJson() { | ||
| 137 | + final val = <String, dynamic>{}; | ||
| 138 | + if (objectTarget != null) val['object'] = objectTarget; | ||
| 139 | + if (status != null) val['data_status'] = status; | ||
| 140 | + if (type != null) val['data_type'] = type; | ||
| 141 | + if (date != null) val['data_date'] = date; | ||
| 142 | + if (value != null) val['data_value'] = value; | ||
| 143 | + if (unit != null) val['data_unit'] = unit; | ||
| 144 | + if (action != null) val['action'] = action; | ||
| 145 | + return val; | ||
| 146 | + } | ||
| 98 | } | 147 | } |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'interaction_models.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -InteractionData _$InteractionDataFromJson(Map<String, dynamic> json) => | ||
| 10 | - InteractionData( | ||
| 11 | - interactionType: (json['interaction_type'] as num?)?.toInt(), | ||
| 12 | - actionType: (json['action_type'] as num?)?.toInt(), | ||
| 13 | - action: json['action_variables'] == null | ||
| 14 | - ? null | ||
| 15 | - : InteractionDataAction.fromJson( | ||
| 16 | - json['action_variables'] as Map<String, dynamic>), | ||
| 17 | - ); | ||
| 18 | - | ||
| 19 | -Map<String, dynamic> _$InteractionDataToJson(InteractionData instance) => | ||
| 20 | - <String, dynamic>{ | ||
| 21 | - if (instance.interactionType case final value?) 'interaction_type': value, | ||
| 22 | - if (instance.actionType case final value?) 'action_type': value, | ||
| 23 | - if (instance.action?.toJson() case final value?) | ||
| 24 | - 'action_variables': value, | ||
| 25 | - }; | ||
| 26 | - | ||
| 27 | -InteractionRecordResponse _$InteractionRecordResponseFromJson( | ||
| 28 | - Map<String, dynamic> json) => | ||
| 29 | - InteractionRecordResponse( | ||
| 30 | - records: (json['records'] as List<dynamic>?) | ||
| 31 | - ?.map((e) => InteractionRecord.fromJson(e as Map<String, dynamic>)) | ||
| 32 | - .toList(), | ||
| 33 | - ); | ||
| 34 | - | ||
| 35 | -Map<String, dynamic> _$InteractionRecordResponseToJson( | ||
| 36 | - InteractionRecordResponse instance) => | ||
| 37 | - <String, dynamic>{ | ||
| 38 | - if (instance.records?.map((e) => e.toJson()).toList() case final value?) | ||
| 39 | - 'records': value, | ||
| 40 | - }; | ||
| 41 | - | ||
| 42 | -InteractionRecord _$InteractionRecordFromJson(Map<String, dynamic> json) => | ||
| 43 | - InteractionRecord( | ||
| 44 | - id: (json['id'] as num?)?.toInt(), | ||
| 45 | - createTime: (json['create_time'] as num?)?.toInt(), | ||
| 46 | - userId: (json['user_id'] as num?)?.toInt(), | ||
| 47 | - pairId: (json['pair_id'] as num?)?.toInt(), | ||
| 48 | - interactionType: (json['interaction_type'] as num?)?.toInt(), | ||
| 49 | - actionType: (json['action_type'] as num?)?.toInt(), | ||
| 50 | - action: json['action_variables'] == null | ||
| 51 | - ? null | ||
| 52 | - : InteractionDataAction.fromJson( | ||
| 53 | - json['action_variables'] as Map<String, dynamic>), | ||
| 54 | - text: json['text'] as String?, | ||
| 55 | - ); | ||
| 56 | - | ||
| 57 | -Map<String, dynamic> _$InteractionRecordToJson(InteractionRecord instance) => | ||
| 58 | - <String, dynamic>{ | ||
| 59 | - if (instance.id case final value?) 'id': value, | ||
| 60 | - if (instance.createTime case final value?) 'create_time': value, | ||
| 61 | - if (instance.userId case final value?) 'user_id': value, | ||
| 62 | - if (instance.pairId case final value?) 'pair_id': value, | ||
| 63 | - if (instance.interactionType case final value?) 'interaction_type': value, | ||
| 64 | - if (instance.actionType case final value?) 'action_type': value, | ||
| 65 | - if (instance.action?.toJson() case final value?) | ||
| 66 | - 'action_variables': value, | ||
| 67 | - if (instance.text case final value?) 'text': value, | ||
| 68 | - }; | ||
| 69 | - | ||
| 70 | -InteractionDataAction _$InteractionDataActionFromJson( | ||
| 71 | - Map<String, dynamic> json) => | ||
| 72 | - InteractionDataAction( | ||
| 73 | - objectTarget: (json['object'] as num?)?.toInt(), | ||
| 74 | - status: json['data_status'] as String?, | ||
| 75 | - type: json['data_type'] as String?, | ||
| 76 | - date: json['data_date'] as String?, | ||
| 77 | - value: json['data_value'] as String?, | ||
| 78 | - unit: json['data_unit'] as String?, | ||
| 79 | - action: json['action'] as String?, | ||
| 80 | - ); | ||
| 81 | - | ||
| 82 | -Map<String, dynamic> _$InteractionDataActionToJson( | ||
| 83 | - InteractionDataAction instance) => | ||
| 84 | - <String, dynamic>{ | ||
| 85 | - if (instance.objectTarget case final value?) 'object': value, | ||
| 86 | - if (instance.status case final value?) 'data_status': value, | ||
| 87 | - if (instance.type case final value?) 'data_type': value, | ||
| 88 | - if (instance.date case final value?) 'data_date': value, | ||
| 89 | - if (instance.value case final value?) 'data_value': value, | ||
| 90 | - if (instance.unit case final value?) 'data_unit': value, | ||
| 91 | - if (instance.action case final value?) 'action': value, | ||
| 92 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | import '../health/health_upload_models.dart'; | 1 | import '../health/health_upload_models.dart'; |
| 4 | 2 | ||
| 5 | -class HealthDataUploadValueConverter | ||
| 6 | - implements JsonConverter<HealthDataUploadValue, Object?> { | 3 | +class HealthDataUploadValueConverter { |
| 7 | const HealthDataUploadValueConverter(); | 4 | const HealthDataUploadValueConverter(); |
| 8 | 5 | ||
| 9 | - @override | ||
| 10 | HealthDataUploadValue fromJson(Object? json) { | 6 | HealthDataUploadValue fromJson(Object? json) { |
| 11 | if (json is int) { | 7 | if (json is int) { |
| 12 | return HealthDataUploadIntValue(json); | 8 | return HealthDataUploadIntValue(json); |
| @@ -22,7 +18,6 @@ class HealthDataUploadValueConverter | @@ -22,7 +18,6 @@ class HealthDataUploadValueConverter | ||
| 22 | throw FormatException('Invalid HealthDataUploadValue: $json'); | 18 | throw FormatException('Invalid HealthDataUploadValue: $json'); |
| 23 | } | 19 | } |
| 24 | 20 | ||
| 25 | - @override | ||
| 26 | Object toJson(HealthDataUploadValue object) => switch (object) { | 21 | Object toJson(HealthDataUploadValue object) => switch (object) { |
| 27 | HealthDataUploadIntValue(:final value) => value, | 22 | HealthDataUploadIntValue(:final value) => value, |
| 28 | HealthDataUploadDoubleValue(:final value) => value, | 23 | HealthDataUploadDoubleValue(:final value) => value, |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | import '../user/user_models.dart'; | 1 | import '../user/user_models.dart'; |
| 4 | import '../vip/vip_info.dart'; | 2 | import '../vip/vip_info.dart'; |
| 5 | 3 | ||
| 6 | -part 'user_preferences.g.dart'; | ||
| 7 | - | ||
| 8 | /// Local session snapshot. | 4 | /// Local session snapshot. |
| 9 | -@JsonSerializable() | ||
| 10 | class UserPreferences { | 5 | class UserPreferences { |
| 11 | const UserPreferences({ | 6 | const UserPreferences({ |
| 12 | this.meUserInfo, | 7 | this.meUserInfo, |
| @@ -16,22 +11,44 @@ class UserPreferences { | @@ -16,22 +11,44 @@ class UserPreferences { | ||
| 16 | this.vipInfo, | 11 | this.vipInfo, |
| 17 | }); | 12 | }); |
| 18 | 13 | ||
| 19 | - @JsonKey(name: 'me_user_info') | ||
| 20 | final UserInfoResponse? meUserInfo; | 14 | final UserInfoResponse? meUserInfo; |
| 21 | - @JsonKey(name: 'partner_user_info') | ||
| 22 | final UserInfoResponse? partnerUserInfo; | 15 | final UserInfoResponse? partnerUserInfo; |
| 23 | - @JsonKey(name: 'access_token') | ||
| 24 | final String accessToken; | 16 | final String accessToken; |
| 25 | - @JsonKey(name: 'rongcloud_token') | ||
| 26 | final String rongcloudToken; | 17 | final String rongcloudToken; |
| 27 | - @JsonKey(name: 'vip_info') | ||
| 28 | final UserPreferencesVipInfo? vipInfo; | 18 | final UserPreferencesVipInfo? vipInfo; |
| 29 | 19 | ||
| 30 | static const empty = UserPreferences(); | 20 | static const empty = UserPreferences(); |
| 31 | 21 | ||
| 32 | - factory UserPreferences.fromJson(Map<String, dynamic> json) => | ||
| 33 | - _$UserPreferencesFromJson(json); | ||
| 34 | - Map<String, dynamic> toJson() => _$UserPreferencesToJson(this); | 22 | + factory UserPreferences.fromJson(Map<String, dynamic> json) { |
| 23 | + return UserPreferences( | ||
| 24 | + meUserInfo: json['me_user_info'] == null | ||
| 25 | + ? null | ||
| 26 | + : UserInfoResponse.fromJson( | ||
| 27 | + json['me_user_info'] as Map<String, dynamic>), | ||
| 28 | + partnerUserInfo: json['partner_user_info'] == null | ||
| 29 | + ? null | ||
| 30 | + : UserInfoResponse.fromJson( | ||
| 31 | + json['partner_user_info'] as Map<String, dynamic>), | ||
| 32 | + accessToken: (json['access_token'] as String?) ?? '', | ||
| 33 | + rongcloudToken: (json['rongcloud_token'] as String?) ?? '', | ||
| 34 | + vipInfo: json['vip_info'] == null | ||
| 35 | + ? null | ||
| 36 | + : UserPreferencesVipInfo.fromJson( | ||
| 37 | + json['vip_info'] as Map<String, dynamic>), | ||
| 38 | + ); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + Map<String, dynamic> toJson() { | ||
| 42 | + final val = <String, dynamic>{}; | ||
| 43 | + if (meUserInfo != null) val['me_user_info'] = meUserInfo!.toJson(); | ||
| 44 | + if (partnerUserInfo != null) { | ||
| 45 | + val['partner_user_info'] = partnerUserInfo!.toJson(); | ||
| 46 | + } | ||
| 47 | + val['access_token'] = accessToken; | ||
| 48 | + val['rongcloud_token'] = rongcloudToken; | ||
| 49 | + if (vipInfo != null) val['vip_info'] = vipInfo!.toJson(); | ||
| 50 | + return val; | ||
| 51 | + } | ||
| 35 | 52 | ||
| 36 | UserPreferences copyWith({ | 53 | UserPreferences copyWith({ |
| 37 | UserInfoResponse? meUserInfo, | 54 | UserInfoResponse? meUserInfo, |
| @@ -52,7 +69,6 @@ class UserPreferences { | @@ -52,7 +69,6 @@ class UserPreferences { | ||
| 52 | } | 69 | } |
| 53 | } | 70 | } |
| 54 | 71 | ||
| 55 | -@JsonSerializable() | ||
| 56 | class UserPreferencesVipInfo { | 72 | class UserPreferencesVipInfo { |
| 57 | const UserPreferencesVipInfo({ | 73 | const UserPreferencesVipInfo({ |
| 58 | this.isVip = false, | 74 | this.isVip = false, |
| @@ -62,20 +78,31 @@ class UserPreferencesVipInfo { | @@ -62,20 +78,31 @@ class UserPreferencesVipInfo { | ||
| 62 | this.vipEndDate = 0, | 78 | this.vipEndDate = 0, |
| 63 | }); | 79 | }); |
| 64 | 80 | ||
| 65 | - @JsonKey(name: 'is_vip') | ||
| 66 | final bool isVip; | 81 | final bool isVip; |
| 67 | - @JsonKey(name: 'is_forever_vip') | ||
| 68 | final bool isForeverVip; | 82 | final bool isForeverVip; |
| 69 | - @JsonKey(name: 'is_share') | ||
| 70 | final bool isShare; | 83 | final bool isShare; |
| 71 | - @JsonKey(name: 'vip_start_date') | ||
| 72 | final int vipStartDate; | 84 | final int vipStartDate; |
| 73 | - @JsonKey(name: 'vip_end_date') | ||
| 74 | final int vipEndDate; | 85 | final int vipEndDate; |
| 75 | 86 | ||
| 76 | - factory UserPreferencesVipInfo.fromJson(Map<String, dynamic> json) => | ||
| 77 | - _$UserPreferencesVipInfoFromJson(json); | ||
| 78 | - Map<String, dynamic> toJson() => _$UserPreferencesVipInfoToJson(this); | 87 | + factory UserPreferencesVipInfo.fromJson(Map<String, dynamic> json) { |
| 88 | + return UserPreferencesVipInfo( | ||
| 89 | + isVip: (json['is_vip'] as bool?) ?? false, | ||
| 90 | + isForeverVip: (json['is_forever_vip'] as bool?) ?? false, | ||
| 91 | + isShare: (json['is_share'] as bool?) ?? false, | ||
| 92 | + vipStartDate: (json['vip_start_date'] as num?)?.toInt() ?? 0, | ||
| 93 | + vipEndDate: (json['vip_end_date'] as num?)?.toInt() ?? 0, | ||
| 94 | + ); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + Map<String, dynamic> toJson() { | ||
| 98 | + return <String, dynamic>{ | ||
| 99 | + 'is_vip': isVip, | ||
| 100 | + 'is_forever_vip': isForeverVip, | ||
| 101 | + 'is_share': isShare, | ||
| 102 | + 'vip_start_date': vipStartDate, | ||
| 103 | + 'vip_end_date': vipEndDate, | ||
| 104 | + }; | ||
| 105 | + } | ||
| 79 | 106 | ||
| 80 | factory UserPreferencesVipInfo.fromVipInfo(VipInfo info) { | 107 | factory UserPreferencesVipInfo.fromVipInfo(VipInfo info) { |
| 81 | return UserPreferencesVipInfo( | 108 | return UserPreferencesVipInfo( |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'user_preferences.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -UserPreferences _$UserPreferencesFromJson(Map<String, dynamic> json) => | ||
| 10 | - UserPreferences( | ||
| 11 | - meUserInfo: json['me_user_info'] == null | ||
| 12 | - ? null | ||
| 13 | - : UserInfoResponse.fromJson( | ||
| 14 | - json['me_user_info'] as Map<String, dynamic>), | ||
| 15 | - partnerUserInfo: json['partner_user_info'] == null | ||
| 16 | - ? null | ||
| 17 | - : UserInfoResponse.fromJson( | ||
| 18 | - json['partner_user_info'] as Map<String, dynamic>), | ||
| 19 | - accessToken: json['access_token'] as String? ?? '', | ||
| 20 | - rongcloudToken: json['rongcloud_token'] as String? ?? '', | ||
| 21 | - vipInfo: json['vip_info'] == null | ||
| 22 | - ? null | ||
| 23 | - : UserPreferencesVipInfo.fromJson( | ||
| 24 | - json['vip_info'] as Map<String, dynamic>), | ||
| 25 | - ); | ||
| 26 | - | ||
| 27 | -Map<String, dynamic> _$UserPreferencesToJson(UserPreferences instance) => | ||
| 28 | - <String, dynamic>{ | ||
| 29 | - if (instance.meUserInfo?.toJson() case final value?) | ||
| 30 | - 'me_user_info': value, | ||
| 31 | - if (instance.partnerUserInfo?.toJson() case final value?) | ||
| 32 | - 'partner_user_info': value, | ||
| 33 | - 'access_token': instance.accessToken, | ||
| 34 | - 'rongcloud_token': instance.rongcloudToken, | ||
| 35 | - if (instance.vipInfo?.toJson() case final value?) 'vip_info': value, | ||
| 36 | - }; | ||
| 37 | - | ||
| 38 | -UserPreferencesVipInfo _$UserPreferencesVipInfoFromJson( | ||
| 39 | - Map<String, dynamic> json) => | ||
| 40 | - UserPreferencesVipInfo( | ||
| 41 | - isVip: json['is_vip'] as bool? ?? false, | ||
| 42 | - isForeverVip: json['is_forever_vip'] as bool? ?? false, | ||
| 43 | - isShare: json['is_share'] as bool? ?? false, | ||
| 44 | - vipStartDate: (json['vip_start_date'] as num?)?.toInt() ?? 0, | ||
| 45 | - vipEndDate: (json['vip_end_date'] as num?)?.toInt() ?? 0, | ||
| 46 | - ); | ||
| 47 | - | ||
| 48 | -Map<String, dynamic> _$UserPreferencesVipInfoToJson( | ||
| 49 | - UserPreferencesVipInfo instance) => | ||
| 50 | - <String, dynamic>{ | ||
| 51 | - 'is_vip': instance.isVip, | ||
| 52 | - 'is_forever_vip': instance.isForeverVip, | ||
| 53 | - 'is_share': instance.isShare, | ||
| 54 | - 'vip_start_date': instance.vipStartDate, | ||
| 55 | - 'vip_end_date': instance.vipEndDate, | ||
| 56 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | -part 'obs_models.g.dart'; | ||
| 4 | - | ||
| 5 | -@JsonSerializable() | ||
| 6 | class ObsTokenRequest { | 1 | class ObsTokenRequest { |
| 7 | const ObsTokenRequest({ | 2 | const ObsTokenRequest({ |
| 8 | this.source = 'doublefeel', | 3 | this.source = 'doublefeel', |
| @@ -12,17 +7,29 @@ class ObsTokenRequest { | @@ -12,17 +7,29 @@ class ObsTokenRequest { | ||
| 12 | }); | 7 | }); |
| 13 | 8 | ||
| 14 | final String source; | 9 | final String source; |
| 15 | - @JsonKey(name: 'file_type') | ||
| 16 | final String fileType; | 10 | final String fileType; |
| 17 | final int count; | 11 | final int count; |
| 18 | final String scene; | 12 | final String scene; |
| 19 | 13 | ||
| 20 | - factory ObsTokenRequest.fromJson(Map<String, dynamic> json) => | ||
| 21 | - _$ObsTokenRequestFromJson(json); | ||
| 22 | - Map<String, dynamic> toJson() => _$ObsTokenRequestToJson(this); | 14 | + factory ObsTokenRequest.fromJson(Map<String, dynamic> json) { |
| 15 | + return ObsTokenRequest( | ||
| 16 | + source: (json['source'] as String?) ?? 'doublefeel', | ||
| 17 | + fileType: json['file_type'] as String, | ||
| 18 | + count: json['count'] as int, | ||
| 19 | + scene: json['scene'] as String, | ||
| 20 | + ); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + Map<String, dynamic> toJson() { | ||
| 24 | + return <String, dynamic>{ | ||
| 25 | + 'source': source, | ||
| 26 | + 'file_type': fileType, | ||
| 27 | + 'count': count, | ||
| 28 | + 'scene': scene, | ||
| 29 | + }; | ||
| 30 | + } | ||
| 23 | } | 31 | } |
| 24 | 32 | ||
| 25 | -@JsonSerializable() | ||
| 26 | class ObsTokenResponse { | 33 | class ObsTokenResponse { |
| 27 | const ObsTokenResponse({ | 34 | const ObsTokenResponse({ |
| 28 | this.keys, | 35 | this.keys, |
| @@ -35,16 +42,32 @@ class ObsTokenResponse { | @@ -35,16 +42,32 @@ class ObsTokenResponse { | ||
| 35 | final List<String>? keys; | 42 | final List<String>? keys; |
| 36 | final ObsToken? token; | 43 | final ObsToken? token; |
| 37 | final String? host; | 44 | final String? host; |
| 38 | - @JsonKey(name: 'endpoint') | ||
| 39 | final String? endPoint; | 45 | final String? endPoint; |
| 40 | final String? bucket; | 46 | final String? bucket; |
| 41 | 47 | ||
| 42 | - factory ObsTokenResponse.fromJson(Map<String, dynamic> json) => | ||
| 43 | - _$ObsTokenResponseFromJson(json); | ||
| 44 | - Map<String, dynamic> toJson() => _$ObsTokenResponseToJson(this); | 48 | + factory ObsTokenResponse.fromJson(Map<String, dynamic> json) { |
| 49 | + return ObsTokenResponse( | ||
| 50 | + keys: (json['keys'] as List<dynamic>?)?.map((e) => e as String).toList(), | ||
| 51 | + token: json['token'] == null | ||
| 52 | + ? null | ||
| 53 | + : ObsToken.fromJson(json['token'] as Map<String, dynamic>), | ||
| 54 | + host: json['host'] as String?, | ||
| 55 | + endPoint: json['endpoint'] as String?, | ||
| 56 | + bucket: json['bucket'] as String?, | ||
| 57 | + ); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + Map<String, dynamic> toJson() { | ||
| 61 | + final val = <String, dynamic>{}; | ||
| 62 | + if (keys != null) val['keys'] = keys; | ||
| 63 | + if (token != null) val['token'] = token!.toJson(); | ||
| 64 | + if (host != null) val['host'] = host; | ||
| 65 | + if (endPoint != null) val['endpoint'] = endPoint; | ||
| 66 | + if (bucket != null) val['bucket'] = bucket; | ||
| 67 | + return val; | ||
| 68 | + } | ||
| 45 | } | 69 | } |
| 46 | 70 | ||
| 47 | -@JsonSerializable() | ||
| 48 | class ObsToken { | 71 | class ObsToken { |
| 49 | const ObsToken({ | 72 | const ObsToken({ |
| 50 | this.accessKey, | 73 | this.accessKey, |
| @@ -53,15 +76,26 @@ class ObsToken { | @@ -53,15 +76,26 @@ class ObsToken { | ||
| 53 | this.expiration, | 76 | this.expiration, |
| 54 | }); | 77 | }); |
| 55 | 78 | ||
| 56 | - @JsonKey(name: 'access_key') | ||
| 57 | final String? accessKey; | 79 | final String? accessKey; |
| 58 | - @JsonKey(name: 'secret_key') | ||
| 59 | final String? secretKey; | 80 | final String? secretKey; |
| 60 | - @JsonKey(name: 'security_token') | ||
| 61 | final String? securityToken; | 81 | final String? securityToken; |
| 62 | final String? expiration; | 82 | final String? expiration; |
| 63 | 83 | ||
| 64 | - factory ObsToken.fromJson(Map<String, dynamic> json) => | ||
| 65 | - _$ObsTokenFromJson(json); | ||
| 66 | - Map<String, dynamic> toJson() => _$ObsTokenToJson(this); | 84 | + factory ObsToken.fromJson(Map<String, dynamic> json) { |
| 85 | + return ObsToken( | ||
| 86 | + accessKey: json['access_key'] as String?, | ||
| 87 | + secretKey: json['secret_key'] as String?, | ||
| 88 | + securityToken: json['security_token'] as String?, | ||
| 89 | + expiration: json['expiration'] as String?, | ||
| 90 | + ); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + Map<String, dynamic> toJson() { | ||
| 94 | + final val = <String, dynamic>{}; | ||
| 95 | + if (accessKey != null) val['access_key'] = accessKey; | ||
| 96 | + if (secretKey != null) val['secret_key'] = secretKey; | ||
| 97 | + if (securityToken != null) val['security_token'] = securityToken; | ||
| 98 | + if (expiration != null) val['expiration'] = expiration; | ||
| 99 | + return val; | ||
| 100 | + } | ||
| 67 | } | 101 | } |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'obs_models.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -ObsTokenRequest _$ObsTokenRequestFromJson(Map<String, dynamic> json) => | ||
| 10 | - ObsTokenRequest( | ||
| 11 | - source: json['source'] as String? ?? 'doublefeel', | ||
| 12 | - fileType: json['file_type'] as String, | ||
| 13 | - count: (json['count'] as num).toInt(), | ||
| 14 | - scene: json['scene'] as String, | ||
| 15 | - ); | ||
| 16 | - | ||
| 17 | -Map<String, dynamic> _$ObsTokenRequestToJson(ObsTokenRequest instance) => | ||
| 18 | - <String, dynamic>{ | ||
| 19 | - 'source': instance.source, | ||
| 20 | - 'file_type': instance.fileType, | ||
| 21 | - 'count': instance.count, | ||
| 22 | - 'scene': instance.scene, | ||
| 23 | - }; | ||
| 24 | - | ||
| 25 | -ObsTokenResponse _$ObsTokenResponseFromJson(Map<String, dynamic> json) => | ||
| 26 | - ObsTokenResponse( | ||
| 27 | - keys: (json['keys'] as List<dynamic>?)?.map((e) => e as String).toList(), | ||
| 28 | - token: json['token'] == null | ||
| 29 | - ? null | ||
| 30 | - : ObsToken.fromJson(json['token'] as Map<String, dynamic>), | ||
| 31 | - host: json['host'] as String?, | ||
| 32 | - endPoint: json['endpoint'] as String?, | ||
| 33 | - bucket: json['bucket'] as String?, | ||
| 34 | - ); | ||
| 35 | - | ||
| 36 | -Map<String, dynamic> _$ObsTokenResponseToJson(ObsTokenResponse instance) => | ||
| 37 | - <String, dynamic>{ | ||
| 38 | - if (instance.keys case final value?) 'keys': value, | ||
| 39 | - if (instance.token?.toJson() case final value?) 'token': value, | ||
| 40 | - if (instance.host case final value?) 'host': value, | ||
| 41 | - if (instance.endPoint case final value?) 'endpoint': value, | ||
| 42 | - if (instance.bucket case final value?) 'bucket': value, | ||
| 43 | - }; | ||
| 44 | - | ||
| 45 | -ObsToken _$ObsTokenFromJson(Map<String, dynamic> json) => ObsToken( | ||
| 46 | - accessKey: json['access_key'] as String?, | ||
| 47 | - secretKey: json['secret_key'] as String?, | ||
| 48 | - securityToken: json['security_token'] as String?, | ||
| 49 | - expiration: json['expiration'] as String?, | ||
| 50 | - ); | ||
| 51 | - | ||
| 52 | -Map<String, dynamic> _$ObsTokenToJson(ObsToken instance) => <String, dynamic>{ | ||
| 53 | - if (instance.accessKey case final value?) 'access_key': value, | ||
| 54 | - if (instance.secretKey case final value?) 'secret_key': value, | ||
| 55 | - if (instance.securityToken case final value?) 'security_token': value, | ||
| 56 | - if (instance.expiration case final value?) 'expiration': value, | ||
| 57 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | -part 'pay_models.g.dart'; | ||
| 4 | - | ||
| 5 | -@JsonSerializable() | ||
| 6 | class PayProductListResponse { | 1 | class PayProductListResponse { |
| 7 | const PayProductListResponse({this.productList}); | 2 | const PayProductListResponse({this.productList}); |
| 8 | 3 | ||
| 9 | - @JsonKey(name: 'product_list') | ||
| 10 | final List<PayProduct>? productList; | 4 | final List<PayProduct>? productList; |
| 11 | 5 | ||
| 12 | - factory PayProductListResponse.fromJson(Map<String, dynamic> json) => | ||
| 13 | - _$PayProductListResponseFromJson(json); | ||
| 14 | - Map<String, dynamic> toJson() => _$PayProductListResponseToJson(this); | 6 | + factory PayProductListResponse.fromJson(Map<String, dynamic> json) { |
| 7 | + return PayProductListResponse( | ||
| 8 | + productList: (json['product_list'] as List<dynamic>?) | ||
| 9 | + ?.map((e) => PayProduct.fromJson(e as Map<String, dynamic>)) | ||
| 10 | + .toList(), | ||
| 11 | + ); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + Map<String, dynamic> toJson() { | ||
| 15 | + final val = <String, dynamic>{}; | ||
| 16 | + if (productList != null) { | ||
| 17 | + val['product_list'] = productList!.map((e) => e.toJson()).toList(); | ||
| 18 | + } | ||
| 19 | + return val; | ||
| 20 | + } | ||
| 15 | } | 21 | } |
| 16 | 22 | ||
| 17 | -@JsonSerializable() | ||
| 18 | class PayProduct { | 23 | class PayProduct { |
| 19 | const PayProduct({ | 24 | const PayProduct({ |
| 20 | this.id, | 25 | this.id, |
| @@ -33,21 +38,42 @@ class PayProduct { | @@ -33,21 +38,42 @@ class PayProduct { | ||
| 33 | final String? profile; | 38 | final String? profile; |
| 34 | final PayProductContent? content; | 39 | final PayProductContent? content; |
| 35 | final int? price; | 40 | final int? price; |
| 36 | - @JsonKey(name: 'serve_period') | ||
| 37 | final int? servePeriod; | 41 | final int? servePeriod; |
| 38 | - @JsonKey(name: 'discount_price') | ||
| 39 | final int? discountPrice; | 42 | final int? discountPrice; |
| 40 | - @JsonKey(name: 'discount_start_time') | ||
| 41 | final int? discountStartTime; | 43 | final int? discountStartTime; |
| 42 | - @JsonKey(name: 'discount_end_time') | ||
| 43 | final int? discountEndTime; | 44 | final int? discountEndTime; |
| 44 | 45 | ||
| 45 | - factory PayProduct.fromJson(Map<String, dynamic> json) => | ||
| 46 | - _$PayProductFromJson(json); | ||
| 47 | - Map<String, dynamic> toJson() => _$PayProductToJson(this); | 46 | + factory PayProduct.fromJson(Map<String, dynamic> json) { |
| 47 | + return PayProduct( | ||
| 48 | + id: json['id'] as int?, | ||
| 49 | + name: json['name'] as String?, | ||
| 50 | + profile: json['profile'] as String?, | ||
| 51 | + content: json['content'] == null | ||
| 52 | + ? null | ||
| 53 | + : PayProductContent.fromJson(json['content'] as Map<String, dynamic>), | ||
| 54 | + price: json['price'] as int?, | ||
| 55 | + servePeriod: json['serve_period'] as int?, | ||
| 56 | + discountPrice: json['discount_price'] as int?, | ||
| 57 | + discountStartTime: json['discount_start_time'] as int?, | ||
| 58 | + discountEndTime: json['discount_end_time'] as int?, | ||
| 59 | + ); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + Map<String, dynamic> toJson() { | ||
| 63 | + final val = <String, dynamic>{}; | ||
| 64 | + if (id != null) val['id'] = id; | ||
| 65 | + if (name != null) val['name'] = name; | ||
| 66 | + if (profile != null) val['profile'] = profile; | ||
| 67 | + if (content != null) val['content'] = content!.toJson(); | ||
| 68 | + if (price != null) val['price'] = price; | ||
| 69 | + if (servePeriod != null) val['serve_period'] = servePeriod; | ||
| 70 | + if (discountPrice != null) val['discount_price'] = discountPrice; | ||
| 71 | + if (discountStartTime != null) val['discount_start_time'] = discountStartTime; | ||
| 72 | + if (discountEndTime != null) val['discount_end_time'] = discountEndTime; | ||
| 73 | + return val; | ||
| 74 | + } | ||
| 48 | } | 75 | } |
| 49 | 76 | ||
| 50 | -@JsonSerializable() | ||
| 51 | class PayProductContent { | 77 | class PayProductContent { |
| 52 | const PayProductContent({ | 78 | const PayProductContent({ |
| 53 | this.type, | 79 | this.type, |
| @@ -59,20 +85,35 @@ class PayProductContent { | @@ -59,20 +85,35 @@ class PayProductContent { | ||
| 59 | }); | 85 | }); |
| 60 | 86 | ||
| 61 | final int? type; | 87 | final int? type; |
| 62 | - @JsonKey(name: 'vip_days') | ||
| 63 | final int? vipDays; | 88 | final int? vipDays; |
| 64 | final String? label; | 89 | final String? label; |
| 65 | final String? description; | 90 | final String? description; |
| 66 | - @JsonKey(name: 'is_forever') | ||
| 67 | final int? isForever; | 91 | final int? isForever; |
| 68 | final int? share; | 92 | final int? share; |
| 69 | 93 | ||
| 70 | - factory PayProductContent.fromJson(Map<String, dynamic> json) => | ||
| 71 | - _$PayProductContentFromJson(json); | ||
| 72 | - Map<String, dynamic> toJson() => _$PayProductContentToJson(this); | 94 | + factory PayProductContent.fromJson(Map<String, dynamic> json) { |
| 95 | + return PayProductContent( | ||
| 96 | + type: json['type'] as int?, | ||
| 97 | + vipDays: json['vip_days'] as int?, | ||
| 98 | + label: json['label'] as String?, | ||
| 99 | + description: json['description'] as String?, | ||
| 100 | + isForever: json['is_forever'] as int?, | ||
| 101 | + share: json['share'] as int?, | ||
| 102 | + ); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + Map<String, dynamic> toJson() { | ||
| 106 | + final val = <String, dynamic>{}; | ||
| 107 | + if (type != null) val['type'] = type; | ||
| 108 | + if (vipDays != null) val['vip_days'] = vipDays; | ||
| 109 | + if (label != null) val['label'] = label; | ||
| 110 | + if (description != null) val['description'] = description; | ||
| 111 | + if (isForever != null) val['is_forever'] = isForever; | ||
| 112 | + if (share != null) val['share'] = share; | ||
| 113 | + return val; | ||
| 114 | + } | ||
| 73 | } | 115 | } |
| 74 | 116 | ||
| 75 | -@JsonSerializable() | ||
| 76 | class CreatePayOrderRequest { | 117 | class CreatePayOrderRequest { |
| 77 | const CreatePayOrderRequest({ | 118 | const CreatePayOrderRequest({ |
| 78 | required this.productId, | 119 | required this.productId, |
| @@ -80,46 +121,67 @@ class CreatePayOrderRequest { | @@ -80,46 +121,67 @@ class CreatePayOrderRequest { | ||
| 80 | this.paymentChannel = 2, | 121 | this.paymentChannel = 2, |
| 81 | }); | 122 | }); |
| 82 | 123 | ||
| 83 | - @JsonKey(name: 'product_id') | ||
| 84 | final int productId; | 124 | final int productId; |
| 85 | - @JsonKey(name: 'product_channel') | ||
| 86 | final int productChannel; | 125 | final int productChannel; |
| 87 | - @JsonKey(name: 'payment_channel') | ||
| 88 | final int paymentChannel; | 126 | final int paymentChannel; |
| 89 | 127 | ||
| 90 | - factory CreatePayOrderRequest.fromJson(Map<String, dynamic> json) => | ||
| 91 | - _$CreatePayOrderRequestFromJson(json); | ||
| 92 | - Map<String, dynamic> toJson() => _$CreatePayOrderRequestToJson(this); | 128 | + factory CreatePayOrderRequest.fromJson(Map<String, dynamic> json) { |
| 129 | + return CreatePayOrderRequest( | ||
| 130 | + productId: json['product_id'] as int, | ||
| 131 | + productChannel: (json['product_channel'] as int?) ?? 1, | ||
| 132 | + paymentChannel: (json['payment_channel'] as int?) ?? 2, | ||
| 133 | + ); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + Map<String, dynamic> toJson() { | ||
| 137 | + return <String, dynamic>{ | ||
| 138 | + 'product_id': productId, | ||
| 139 | + 'product_channel': productChannel, | ||
| 140 | + 'payment_channel': paymentChannel, | ||
| 141 | + }; | ||
| 142 | + } | ||
| 93 | } | 143 | } |
| 94 | 144 | ||
| 95 | -@JsonSerializable() | ||
| 96 | class CreatePayOrderResponse { | 145 | class CreatePayOrderResponse { |
| 97 | const CreatePayOrderResponse({this.prepayData}); | 146 | const CreatePayOrderResponse({this.prepayData}); |
| 98 | 147 | ||
| 99 | - @JsonKey(name: 'prepay_data') | ||
| 100 | final String? prepayData; | 148 | final String? prepayData; |
| 101 | 149 | ||
| 102 | - factory CreatePayOrderResponse.fromJson(Map<String, dynamic> json) => | ||
| 103 | - _$CreatePayOrderResponseFromJson(json); | ||
| 104 | - Map<String, dynamic> toJson() => _$CreatePayOrderResponseToJson(this); | 150 | + factory CreatePayOrderResponse.fromJson(Map<String, dynamic> json) { |
| 151 | + return CreatePayOrderResponse( | ||
| 152 | + prepayData: json['prepay_data'] as String?, | ||
| 153 | + ); | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + Map<String, dynamic> toJson() { | ||
| 157 | + final val = <String, dynamic>{}; | ||
| 158 | + if (prepayData != null) val['prepay_data'] = prepayData; | ||
| 159 | + return val; | ||
| 160 | + } | ||
| 105 | } | 161 | } |
| 106 | 162 | ||
| 107 | -@JsonSerializable() | ||
| 108 | class SubscriptionProductListResponse { | 163 | class SubscriptionProductListResponse { |
| 109 | const SubscriptionProductListResponse({this.productList}); | 164 | const SubscriptionProductListResponse({this.productList}); |
| 110 | 165 | ||
| 111 | - @JsonKey(name: 'subscription_list') | ||
| 112 | final List<SubscriptionProduct>? productList; | 166 | final List<SubscriptionProduct>? productList; |
| 113 | 167 | ||
| 114 | - factory SubscriptionProductListResponse.fromJson( | ||
| 115 | - Map<String, dynamic> json, | ||
| 116 | - ) => | ||
| 117 | - _$SubscriptionProductListResponseFromJson(json); | ||
| 118 | - Map<String, dynamic> toJson() => | ||
| 119 | - _$SubscriptionProductListResponseToJson(this); | 168 | + factory SubscriptionProductListResponse.fromJson(Map<String, dynamic> json) { |
| 169 | + return SubscriptionProductListResponse( | ||
| 170 | + productList: (json['subscription_list'] as List<dynamic>?) | ||
| 171 | + ?.map((e) => SubscriptionProduct.fromJson(e as Map<String, dynamic>)) | ||
| 172 | + .toList(), | ||
| 173 | + ); | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + Map<String, dynamic> toJson() { | ||
| 177 | + final val = <String, dynamic>{}; | ||
| 178 | + if (productList != null) { | ||
| 179 | + val['subscription_list'] = productList!.map((e) => e.toJson()).toList(); | ||
| 180 | + } | ||
| 181 | + return val; | ||
| 182 | + } | ||
| 120 | } | 183 | } |
| 121 | 184 | ||
| 122 | -@JsonSerializable() | ||
| 123 | class SubscriptionProduct { | 185 | class SubscriptionProduct { |
| 124 | const SubscriptionProduct({ | 186 | const SubscriptionProduct({ |
| 125 | this.agreementNo, | 187 | this.agreementNo, |
| @@ -129,41 +191,68 @@ class SubscriptionProduct { | @@ -129,41 +191,68 @@ class SubscriptionProduct { | ||
| 129 | this.productInfo, | 191 | this.productInfo, |
| 130 | }); | 192 | }); |
| 131 | 193 | ||
| 132 | - @JsonKey(name: 'agreement_no') | ||
| 133 | final String? agreementNo; | 194 | final String? agreementNo; |
| 134 | - @JsonKey(name: 'last_execute_timestamp') | ||
| 135 | final int? startTime; | 195 | final int? startTime; |
| 136 | - @JsonKey(name: 'next_execute_timestamp') | ||
| 137 | final int? endTime; | 196 | final int? endTime; |
| 138 | - @JsonKey(name: 'single_amount') | ||
| 139 | final int? nextPayPrice; | 197 | final int? nextPayPrice; |
| 140 | - @JsonKey(name: 'product_info') | ||
| 141 | final SubscriptionProductInfo? productInfo; | 198 | final SubscriptionProductInfo? productInfo; |
| 142 | 199 | ||
| 143 | - factory SubscriptionProduct.fromJson(Map<String, dynamic> json) => | ||
| 144 | - _$SubscriptionProductFromJson(json); | ||
| 145 | - Map<String, dynamic> toJson() => _$SubscriptionProductToJson(this); | 200 | + factory SubscriptionProduct.fromJson(Map<String, dynamic> json) { |
| 201 | + return SubscriptionProduct( | ||
| 202 | + agreementNo: json['agreement_no'] as String?, | ||
| 203 | + startTime: json['last_execute_timestamp'] as int?, | ||
| 204 | + endTime: json['next_execute_timestamp'] as int?, | ||
| 205 | + nextPayPrice: json['single_amount'] as int?, | ||
| 206 | + productInfo: json['product_info'] == null | ||
| 207 | + ? null | ||
| 208 | + : SubscriptionProductInfo.fromJson( | ||
| 209 | + json['product_info'] as Map<String, dynamic>), | ||
| 210 | + ); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + Map<String, dynamic> toJson() { | ||
| 214 | + final val = <String, dynamic>{}; | ||
| 215 | + if (agreementNo != null) val['agreement_no'] = agreementNo; | ||
| 216 | + if (startTime != null) val['last_execute_timestamp'] = startTime; | ||
| 217 | + if (endTime != null) val['next_execute_timestamp'] = endTime; | ||
| 218 | + if (nextPayPrice != null) val['single_amount'] = nextPayPrice; | ||
| 219 | + if (productInfo != null) val['product_info'] = productInfo!.toJson(); | ||
| 220 | + return val; | ||
| 221 | + } | ||
| 146 | } | 222 | } |
| 147 | 223 | ||
| 148 | -@JsonSerializable() | ||
| 149 | class SubscriptionProductInfo { | 224 | class SubscriptionProductInfo { |
| 150 | const SubscriptionProductInfo({this.name}); | 225 | const SubscriptionProductInfo({this.name}); |
| 151 | 226 | ||
| 152 | final String? name; | 227 | final String? name; |
| 153 | 228 | ||
| 154 | - factory SubscriptionProductInfo.fromJson(Map<String, dynamic> json) => | ||
| 155 | - _$SubscriptionProductInfoFromJson(json); | ||
| 156 | - Map<String, dynamic> toJson() => _$SubscriptionProductInfoToJson(this); | 229 | + factory SubscriptionProductInfo.fromJson(Map<String, dynamic> json) { |
| 230 | + return SubscriptionProductInfo( | ||
| 231 | + name: json['name'] as String?, | ||
| 232 | + ); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + Map<String, dynamic> toJson() { | ||
| 236 | + final val = <String, dynamic>{}; | ||
| 237 | + if (name != null) val['name'] = name; | ||
| 238 | + return val; | ||
| 239 | + } | ||
| 157 | } | 240 | } |
| 158 | 241 | ||
| 159 | -@JsonSerializable() | ||
| 160 | class SubscriptionCancelRequest { | 242 | class SubscriptionCancelRequest { |
| 161 | const SubscriptionCancelRequest({required this.agreementNo}); | 243 | const SubscriptionCancelRequest({required this.agreementNo}); |
| 162 | 244 | ||
| 163 | - @JsonKey(name: 'agreement_no') | ||
| 164 | final String agreementNo; | 245 | final String agreementNo; |
| 165 | 246 | ||
| 166 | - factory SubscriptionCancelRequest.fromJson(Map<String, dynamic> json) => | ||
| 167 | - _$SubscriptionCancelRequestFromJson(json); | ||
| 168 | - Map<String, dynamic> toJson() => _$SubscriptionCancelRequestToJson(this); | 247 | + factory SubscriptionCancelRequest.fromJson(Map<String, dynamic> json) { |
| 248 | + return SubscriptionCancelRequest( | ||
| 249 | + agreementNo: json['agreement_no'] as String, | ||
| 250 | + ); | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + Map<String, dynamic> toJson() { | ||
| 254 | + return <String, dynamic>{ | ||
| 255 | + 'agreement_no': agreementNo, | ||
| 256 | + }; | ||
| 257 | + } | ||
| 169 | } | 258 | } |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'pay_models.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -PayProductListResponse _$PayProductListResponseFromJson( | ||
| 10 | - Map<String, dynamic> json) => | ||
| 11 | - PayProductListResponse( | ||
| 12 | - productList: (json['product_list'] as List<dynamic>?) | ||
| 13 | - ?.map((e) => PayProduct.fromJson(e as Map<String, dynamic>)) | ||
| 14 | - .toList(), | ||
| 15 | - ); | ||
| 16 | - | ||
| 17 | -Map<String, dynamic> _$PayProductListResponseToJson( | ||
| 18 | - PayProductListResponse instance) => | ||
| 19 | - <String, dynamic>{ | ||
| 20 | - if (instance.productList?.map((e) => e.toJson()).toList() | ||
| 21 | - case final value?) | ||
| 22 | - 'product_list': value, | ||
| 23 | - }; | ||
| 24 | - | ||
| 25 | -PayProduct _$PayProductFromJson(Map<String, dynamic> json) => PayProduct( | ||
| 26 | - id: (json['id'] as num?)?.toInt(), | ||
| 27 | - name: json['name'] as String?, | ||
| 28 | - profile: json['profile'] as String?, | ||
| 29 | - content: json['content'] == null | ||
| 30 | - ? null | ||
| 31 | - : PayProductContent.fromJson(json['content'] as Map<String, dynamic>), | ||
| 32 | - price: (json['price'] as num?)?.toInt(), | ||
| 33 | - servePeriod: (json['serve_period'] as num?)?.toInt(), | ||
| 34 | - discountPrice: (json['discount_price'] as num?)?.toInt(), | ||
| 35 | - discountStartTime: (json['discount_start_time'] as num?)?.toInt(), | ||
| 36 | - discountEndTime: (json['discount_end_time'] as num?)?.toInt(), | ||
| 37 | - ); | ||
| 38 | - | ||
| 39 | -Map<String, dynamic> _$PayProductToJson(PayProduct instance) => | ||
| 40 | - <String, dynamic>{ | ||
| 41 | - if (instance.id case final value?) 'id': value, | ||
| 42 | - if (instance.name case final value?) 'name': value, | ||
| 43 | - if (instance.profile case final value?) 'profile': value, | ||
| 44 | - if (instance.content?.toJson() case final value?) 'content': value, | ||
| 45 | - if (instance.price case final value?) 'price': value, | ||
| 46 | - if (instance.servePeriod case final value?) 'serve_period': value, | ||
| 47 | - if (instance.discountPrice case final value?) 'discount_price': value, | ||
| 48 | - if (instance.discountStartTime case final value?) | ||
| 49 | - 'discount_start_time': value, | ||
| 50 | - if (instance.discountEndTime case final value?) | ||
| 51 | - 'discount_end_time': value, | ||
| 52 | - }; | ||
| 53 | - | ||
| 54 | -PayProductContent _$PayProductContentFromJson(Map<String, dynamic> json) => | ||
| 55 | - PayProductContent( | ||
| 56 | - type: (json['type'] as num?)?.toInt(), | ||
| 57 | - vipDays: (json['vip_days'] as num?)?.toInt(), | ||
| 58 | - label: json['label'] as String?, | ||
| 59 | - description: json['description'] as String?, | ||
| 60 | - isForever: (json['is_forever'] as num?)?.toInt(), | ||
| 61 | - share: (json['share'] as num?)?.toInt(), | ||
| 62 | - ); | ||
| 63 | - | ||
| 64 | -Map<String, dynamic> _$PayProductContentToJson(PayProductContent instance) => | ||
| 65 | - <String, dynamic>{ | ||
| 66 | - if (instance.type case final value?) 'type': value, | ||
| 67 | - if (instance.vipDays case final value?) 'vip_days': value, | ||
| 68 | - if (instance.label case final value?) 'label': value, | ||
| 69 | - if (instance.description case final value?) 'description': value, | ||
| 70 | - if (instance.isForever case final value?) 'is_forever': value, | ||
| 71 | - if (instance.share case final value?) 'share': value, | ||
| 72 | - }; | ||
| 73 | - | ||
| 74 | -CreatePayOrderRequest _$CreatePayOrderRequestFromJson( | ||
| 75 | - Map<String, dynamic> json) => | ||
| 76 | - CreatePayOrderRequest( | ||
| 77 | - productId: (json['product_id'] as num).toInt(), | ||
| 78 | - productChannel: (json['product_channel'] as num?)?.toInt() ?? 1, | ||
| 79 | - paymentChannel: (json['payment_channel'] as num?)?.toInt() ?? 2, | ||
| 80 | - ); | ||
| 81 | - | ||
| 82 | -Map<String, dynamic> _$CreatePayOrderRequestToJson( | ||
| 83 | - CreatePayOrderRequest instance) => | ||
| 84 | - <String, dynamic>{ | ||
| 85 | - 'product_id': instance.productId, | ||
| 86 | - 'product_channel': instance.productChannel, | ||
| 87 | - 'payment_channel': instance.paymentChannel, | ||
| 88 | - }; | ||
| 89 | - | ||
| 90 | -CreatePayOrderResponse _$CreatePayOrderResponseFromJson( | ||
| 91 | - Map<String, dynamic> json) => | ||
| 92 | - CreatePayOrderResponse( | ||
| 93 | - prepayData: json['prepay_data'] as String?, | ||
| 94 | - ); | ||
| 95 | - | ||
| 96 | -Map<String, dynamic> _$CreatePayOrderResponseToJson( | ||
| 97 | - CreatePayOrderResponse instance) => | ||
| 98 | - <String, dynamic>{ | ||
| 99 | - if (instance.prepayData case final value?) 'prepay_data': value, | ||
| 100 | - }; | ||
| 101 | - | ||
| 102 | -SubscriptionProductListResponse _$SubscriptionProductListResponseFromJson( | ||
| 103 | - Map<String, dynamic> json) => | ||
| 104 | - SubscriptionProductListResponse( | ||
| 105 | - productList: (json['subscription_list'] as List<dynamic>?) | ||
| 106 | - ?.map((e) => SubscriptionProduct.fromJson(e as Map<String, dynamic>)) | ||
| 107 | - .toList(), | ||
| 108 | - ); | ||
| 109 | - | ||
| 110 | -Map<String, dynamic> _$SubscriptionProductListResponseToJson( | ||
| 111 | - SubscriptionProductListResponse instance) => | ||
| 112 | - <String, dynamic>{ | ||
| 113 | - if (instance.productList?.map((e) => e.toJson()).toList() | ||
| 114 | - case final value?) | ||
| 115 | - 'subscription_list': value, | ||
| 116 | - }; | ||
| 117 | - | ||
| 118 | -SubscriptionProduct _$SubscriptionProductFromJson(Map<String, dynamic> json) => | ||
| 119 | - SubscriptionProduct( | ||
| 120 | - agreementNo: json['agreement_no'] as String?, | ||
| 121 | - startTime: (json['last_execute_timestamp'] as num?)?.toInt(), | ||
| 122 | - endTime: (json['next_execute_timestamp'] as num?)?.toInt(), | ||
| 123 | - nextPayPrice: (json['single_amount'] as num?)?.toInt(), | ||
| 124 | - productInfo: json['product_info'] == null | ||
| 125 | - ? null | ||
| 126 | - : SubscriptionProductInfo.fromJson( | ||
| 127 | - json['product_info'] as Map<String, dynamic>), | ||
| 128 | - ); | ||
| 129 | - | ||
| 130 | -Map<String, dynamic> _$SubscriptionProductToJson( | ||
| 131 | - SubscriptionProduct instance) => | ||
| 132 | - <String, dynamic>{ | ||
| 133 | - if (instance.agreementNo case final value?) 'agreement_no': value, | ||
| 134 | - if (instance.startTime case final value?) 'last_execute_timestamp': value, | ||
| 135 | - if (instance.endTime case final value?) 'next_execute_timestamp': value, | ||
| 136 | - if (instance.nextPayPrice case final value?) 'single_amount': value, | ||
| 137 | - if (instance.productInfo?.toJson() case final value?) | ||
| 138 | - 'product_info': value, | ||
| 139 | - }; | ||
| 140 | - | ||
| 141 | -SubscriptionProductInfo _$SubscriptionProductInfoFromJson( | ||
| 142 | - Map<String, dynamic> json) => | ||
| 143 | - SubscriptionProductInfo( | ||
| 144 | - name: json['name'] as String?, | ||
| 145 | - ); | ||
| 146 | - | ||
| 147 | -Map<String, dynamic> _$SubscriptionProductInfoToJson( | ||
| 148 | - SubscriptionProductInfo instance) => | ||
| 149 | - <String, dynamic>{ | ||
| 150 | - if (instance.name case final value?) 'name': value, | ||
| 151 | - }; | ||
| 152 | - | ||
| 153 | -SubscriptionCancelRequest _$SubscriptionCancelRequestFromJson( | ||
| 154 | - Map<String, dynamic> json) => | ||
| 155 | - SubscriptionCancelRequest( | ||
| 156 | - agreementNo: json['agreement_no'] as String, | ||
| 157 | - ); | ||
| 158 | - | ||
| 159 | -Map<String, dynamic> _$SubscriptionCancelRequestToJson( | ||
| 160 | - SubscriptionCancelRequest instance) => | ||
| 161 | - <String, dynamic>{ | ||
| 162 | - 'agreement_no': instance.agreementNo, | ||
| 163 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | -part 'user_models.g.dart'; | ||
| 4 | - | ||
| 5 | // ─── Requests(手写 toJson,无 fromJson)──────────────────────────────────── | 1 | // ─── Requests(手写 toJson,无 fromJson)──────────────────────────────────── |
| 6 | 2 | ||
| 7 | class LoginRequest { | 3 | class LoginRequest { |
| @@ -97,54 +93,79 @@ class UserInfoUpdateRequest { | @@ -97,54 +93,79 @@ class UserInfoUpdateRequest { | ||
| 97 | } | 93 | } |
| 98 | } | 94 | } |
| 99 | 95 | ||
| 100 | -// ─── Responses(json_annotation 代码生成)────────────────────────────────── | 96 | +// ─── Responses(手动反序列化)────────────────────────────────── |
| 101 | 97 | ||
| 102 | -@JsonSerializable() | ||
| 103 | class UserAccessToken { | 98 | class UserAccessToken { |
| 104 | const UserAccessToken({this.accessToken, this.expireTime}); | 99 | const UserAccessToken({this.accessToken, this.expireTime}); |
| 105 | 100 | ||
| 106 | - @JsonKey(name: 'access_token') | ||
| 107 | final String? accessToken; | 101 | final String? accessToken; |
| 108 | - @JsonKey(name: 'expire_time') | ||
| 109 | final int? expireTime; | 102 | final int? expireTime; |
| 110 | 103 | ||
| 111 | - factory UserAccessToken.fromJson(Map<String, dynamic> json) => | ||
| 112 | - _$UserAccessTokenFromJson(json); | ||
| 113 | - Map<String, dynamic> toJson() => _$UserAccessTokenToJson(this); | 104 | + factory UserAccessToken.fromJson(Map<String, dynamic> json) { |
| 105 | + return UserAccessToken( | ||
| 106 | + accessToken: json['access_token'] as String?, | ||
| 107 | + expireTime: json['expire_time'] as int?, | ||
| 108 | + ); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + Map<String, dynamic> toJson() { | ||
| 112 | + final val = <String, dynamic>{}; | ||
| 113 | + if (accessToken != null) val['access_token'] = accessToken; | ||
| 114 | + if (expireTime != null) val['expire_time'] = expireTime; | ||
| 115 | + return val; | ||
| 116 | + } | ||
| 114 | } | 117 | } |
| 115 | 118 | ||
| 116 | -@JsonSerializable() | ||
| 117 | class LoginResponse { | 119 | class LoginResponse { |
| 118 | const LoginResponse({this.isNewUser, this.accessTokenInfo, this.id}); | 120 | const LoginResponse({this.isNewUser, this.accessTokenInfo, this.id}); |
| 119 | 121 | ||
| 120 | - @JsonKey(name: 'is_new_user') | ||
| 121 | final bool? isNewUser; | 122 | final bool? isNewUser; |
| 122 | - @JsonKey(name: 'token_info') | ||
| 123 | final UserAccessToken? accessTokenInfo; | 123 | final UserAccessToken? accessTokenInfo; |
| 124 | final int? id; | 124 | final int? id; |
| 125 | 125 | ||
| 126 | String get accessToken => accessTokenInfo?.accessToken ?? ''; | 126 | String get accessToken => accessTokenInfo?.accessToken ?? ''; |
| 127 | 127 | ||
| 128 | - factory LoginResponse.fromJson(Map<String, dynamic> json) => | ||
| 129 | - _$LoginResponseFromJson(json); | ||
| 130 | - Map<String, dynamic> toJson() => _$LoginResponseToJson(this); | 128 | + factory LoginResponse.fromJson(Map<String, dynamic> json) { |
| 129 | + return LoginResponse( | ||
| 130 | + isNewUser: json['is_new_user'] as bool?, | ||
| 131 | + accessTokenInfo: json['token_info'] == null | ||
| 132 | + ? null | ||
| 133 | + : UserAccessToken.fromJson(json['token_info'] as Map<String, dynamic>), | ||
| 134 | + id: json['id'] as int?, | ||
| 135 | + ); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + Map<String, dynamic> toJson() { | ||
| 139 | + final val = <String, dynamic>{}; | ||
| 140 | + if (isNewUser != null) val['is_new_user'] = isNewUser; | ||
| 141 | + if (accessTokenInfo != null) val['token_info'] = accessTokenInfo!.toJson(); | ||
| 142 | + if (id != null) val['id'] = id; | ||
| 143 | + return val; | ||
| 144 | + } | ||
| 131 | } | 145 | } |
| 132 | 146 | ||
| 133 | -@JsonSerializable() | ||
| 134 | class RegisterResponse { | 147 | class RegisterResponse { |
| 135 | const RegisterResponse({this.accessTokenInfo}); | 148 | const RegisterResponse({this.accessTokenInfo}); |
| 136 | 149 | ||
| 137 | - @JsonKey(name: 'token_info') | ||
| 138 | final UserAccessToken? accessTokenInfo; | 150 | final UserAccessToken? accessTokenInfo; |
| 139 | 151 | ||
| 140 | String get accessToken => accessTokenInfo?.accessToken ?? ''; | 152 | String get accessToken => accessTokenInfo?.accessToken ?? ''; |
| 141 | 153 | ||
| 142 | - factory RegisterResponse.fromJson(Map<String, dynamic> json) => | ||
| 143 | - _$RegisterResponseFromJson(json); | ||
| 144 | - Map<String, dynamic> toJson() => _$RegisterResponseToJson(this); | 154 | + factory RegisterResponse.fromJson(Map<String, dynamic> json) { |
| 155 | + return RegisterResponse( | ||
| 156 | + accessTokenInfo: json['token_info'] == null | ||
| 157 | + ? null | ||
| 158 | + : UserAccessToken.fromJson(json['token_info'] as Map<String, dynamic>), | ||
| 159 | + ); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + Map<String, dynamic> toJson() { | ||
| 163 | + final val = <String, dynamic>{}; | ||
| 164 | + if (accessTokenInfo != null) val['token_info'] = accessTokenInfo!.toJson(); | ||
| 165 | + return val; | ||
| 166 | + } | ||
| 145 | } | 167 | } |
| 146 | 168 | ||
| 147 | -@JsonSerializable() | ||
| 148 | class UserInfoResponse { | 169 | class UserInfoResponse { |
| 149 | const UserInfoResponse({ | 170 | const UserInfoResponse({ |
| 150 | this.id, | 171 | this.id, |
| @@ -161,48 +182,92 @@ class UserInfoResponse { | @@ -161,48 +182,92 @@ class UserInfoResponse { | ||
| 161 | }); | 182 | }); |
| 162 | 183 | ||
| 163 | final int? id; | 184 | final int? id; |
| 164 | - @JsonKey(name: 'pair_code') | ||
| 165 | final String? pairCode; | 185 | final String? pairCode; |
| 166 | - @JsonKey(name: 'pair_id') | ||
| 167 | final int? pairId; | 186 | final int? pairId; |
| 168 | final String? telephone; | 187 | final String? telephone; |
| 169 | final String? nickname; | 188 | final String? nickname; |
| 170 | final String? avatar; | 189 | final String? avatar; |
| 171 | final int? persona; | 190 | final int? persona; |
| 172 | final int? status; | 191 | final int? status; |
| 173 | - @JsonKey(name: 'last_login_time') | ||
| 174 | final int? lastLoginTime; | 192 | final int? lastLoginTime; |
| 175 | - @JsonKey(name: 'create_time') | ||
| 176 | final int? createTime; | 193 | final int? createTime; |
| 177 | - @JsonKey(name: 'is_bot') | ||
| 178 | final int? isBot; | 194 | final int? isBot; |
| 179 | 195 | ||
| 180 | - factory UserInfoResponse.fromJson(Map<String, dynamic> json) => | ||
| 181 | - _$UserInfoResponseFromJson(json); | ||
| 182 | - Map<String, dynamic> toJson() => _$UserInfoResponseToJson(this); | 196 | + factory UserInfoResponse.fromJson(Map<String, dynamic> json) { |
| 197 | + return UserInfoResponse( | ||
| 198 | + id: json['id'] as int?, | ||
| 199 | + pairCode: json['pair_code'] as String?, | ||
| 200 | + pairId: json['pair_id'] as int?, | ||
| 201 | + telephone: json['telephone'] as String?, | ||
| 202 | + nickname: json['nickname'] as String?, | ||
| 203 | + avatar: json['avatar'] as String?, | ||
| 204 | + persona: json['persona'] as int?, | ||
| 205 | + status: json['status'] as int?, | ||
| 206 | + lastLoginTime: json['last_login_time'] as int?, | ||
| 207 | + createTime: json['create_time'] as int?, | ||
| 208 | + isBot: json['is_bot'] as int?, | ||
| 209 | + ); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + Map<String, dynamic> toJson() { | ||
| 213 | + final val = <String, dynamic>{}; | ||
| 214 | + if (id != null) val['id'] = id; | ||
| 215 | + if (pairCode != null) val['pair_code'] = pairCode; | ||
| 216 | + if (pairId != null) val['pair_id'] = pairId; | ||
| 217 | + if (telephone != null) val['telephone'] = telephone; | ||
| 218 | + if (nickname != null) val['nickname'] = nickname; | ||
| 219 | + if (avatar != null) val['avatar'] = avatar; | ||
| 220 | + if (persona != null) val['persona'] = persona; | ||
| 221 | + if (status != null) val['status'] = status; | ||
| 222 | + if (lastLoginTime != null) val['last_login_time'] = lastLoginTime; | ||
| 223 | + if (createTime != null) val['create_time'] = createTime; | ||
| 224 | + if (isBot != null) val['is_bot'] = isBot; | ||
| 225 | + return val; | ||
| 226 | + } | ||
| 183 | } | 227 | } |
| 184 | 228 | ||
| 185 | -@JsonSerializable() | ||
| 186 | class BoundUserInfoResponse { | 229 | class BoundUserInfoResponse { |
| 187 | const BoundUserInfoResponse({this.userInfo, this.partnerUserInfo}); | 230 | const BoundUserInfoResponse({this.userInfo, this.partnerUserInfo}); |
| 188 | 231 | ||
| 189 | - @JsonKey(name: 'user_info') | ||
| 190 | final UserInfoResponse? userInfo; | 232 | final UserInfoResponse? userInfo; |
| 191 | - @JsonKey(name: 'pair_user_info') | ||
| 192 | final UserInfoResponse? partnerUserInfo; | 233 | final UserInfoResponse? partnerUserInfo; |
| 193 | 234 | ||
| 194 | - factory BoundUserInfoResponse.fromJson(Map<String, dynamic> json) => | ||
| 195 | - _$BoundUserInfoResponseFromJson(json); | ||
| 196 | - Map<String, dynamic> toJson() => _$BoundUserInfoResponseToJson(this); | 235 | + factory BoundUserInfoResponse.fromJson(Map<String, dynamic> json) { |
| 236 | + return BoundUserInfoResponse( | ||
| 237 | + userInfo: json['user_info'] == null | ||
| 238 | + ? null | ||
| 239 | + : UserInfoResponse.fromJson(json['user_info'] as Map<String, dynamic>), | ||
| 240 | + partnerUserInfo: json['pair_user_info'] == null | ||
| 241 | + ? null | ||
| 242 | + : UserInfoResponse.fromJson( | ||
| 243 | + json['pair_user_info'] as Map<String, dynamic>), | ||
| 244 | + ); | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + Map<String, dynamic> toJson() { | ||
| 248 | + final val = <String, dynamic>{}; | ||
| 249 | + if (userInfo != null) val['user_info'] = userInfo!.toJson(); | ||
| 250 | + if (partnerUserInfo != null) { | ||
| 251 | + val['pair_user_info'] = partnerUserInfo!.toJson(); | ||
| 252 | + } | ||
| 253 | + return val; | ||
| 254 | + } | ||
| 197 | } | 255 | } |
| 198 | 256 | ||
| 199 | -@JsonSerializable() | ||
| 200 | class RongcloudTokenResponse { | 257 | class RongcloudTokenResponse { |
| 201 | const RongcloudTokenResponse({this.token}); | 258 | const RongcloudTokenResponse({this.token}); |
| 202 | 259 | ||
| 203 | final String? token; | 260 | final String? token; |
| 204 | 261 | ||
| 205 | - factory RongcloudTokenResponse.fromJson(Map<String, dynamic> json) => | ||
| 206 | - _$RongcloudTokenResponseFromJson(json); | ||
| 207 | - Map<String, dynamic> toJson() => _$RongcloudTokenResponseToJson(this); | 262 | + factory RongcloudTokenResponse.fromJson(Map<String, dynamic> json) { |
| 263 | + return RongcloudTokenResponse( | ||
| 264 | + token: json['token'] as String?, | ||
| 265 | + ); | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + Map<String, dynamic> toJson() { | ||
| 269 | + final val = <String, dynamic>{}; | ||
| 270 | + if (token != null) val['token'] = token; | ||
| 271 | + return val; | ||
| 272 | + } | ||
| 208 | } | 273 | } |
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'user_models.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -UserAccessToken _$UserAccessTokenFromJson(Map<String, dynamic> json) => | ||
| 10 | - UserAccessToken( | ||
| 11 | - accessToken: json['access_token'] as String?, | ||
| 12 | - expireTime: (json['expire_time'] as num?)?.toInt(), | ||
| 13 | - ); | ||
| 14 | - | ||
| 15 | -Map<String, dynamic> _$UserAccessTokenToJson(UserAccessToken instance) => | ||
| 16 | - <String, dynamic>{ | ||
| 17 | - if (instance.accessToken case final value?) 'access_token': value, | ||
| 18 | - if (instance.expireTime case final value?) 'expire_time': value, | ||
| 19 | - }; | ||
| 20 | - | ||
| 21 | -LoginResponse _$LoginResponseFromJson(Map<String, dynamic> json) => | ||
| 22 | - LoginResponse( | ||
| 23 | - isNewUser: json['is_new_user'] as bool?, | ||
| 24 | - accessTokenInfo: json['token_info'] == null | ||
| 25 | - ? null | ||
| 26 | - : UserAccessToken.fromJson( | ||
| 27 | - json['token_info'] as Map<String, dynamic>), | ||
| 28 | - id: (json['id'] as num?)?.toInt(), | ||
| 29 | - ); | ||
| 30 | - | ||
| 31 | -Map<String, dynamic> _$LoginResponseToJson(LoginResponse instance) => | ||
| 32 | - <String, dynamic>{ | ||
| 33 | - if (instance.isNewUser case final value?) 'is_new_user': value, | ||
| 34 | - if (instance.accessTokenInfo?.toJson() case final value?) | ||
| 35 | - 'token_info': value, | ||
| 36 | - if (instance.id case final value?) 'id': value, | ||
| 37 | - }; | ||
| 38 | - | ||
| 39 | -RegisterResponse _$RegisterResponseFromJson(Map<String, dynamic> json) => | ||
| 40 | - RegisterResponse( | ||
| 41 | - accessTokenInfo: json['token_info'] == null | ||
| 42 | - ? null | ||
| 43 | - : UserAccessToken.fromJson( | ||
| 44 | - json['token_info'] as Map<String, dynamic>), | ||
| 45 | - ); | ||
| 46 | - | ||
| 47 | -Map<String, dynamic> _$RegisterResponseToJson(RegisterResponse instance) => | ||
| 48 | - <String, dynamic>{ | ||
| 49 | - if (instance.accessTokenInfo?.toJson() case final value?) | ||
| 50 | - 'token_info': value, | ||
| 51 | - }; | ||
| 52 | - | ||
| 53 | -UserInfoResponse _$UserInfoResponseFromJson(Map<String, dynamic> json) => | ||
| 54 | - UserInfoResponse( | ||
| 55 | - id: (json['id'] as num?)?.toInt(), | ||
| 56 | - pairCode: json['pair_code'] as String?, | ||
| 57 | - pairId: (json['pair_id'] as num?)?.toInt(), | ||
| 58 | - telephone: json['telephone'] as String?, | ||
| 59 | - nickname: json['nickname'] as String?, | ||
| 60 | - avatar: json['avatar'] as String?, | ||
| 61 | - persona: (json['persona'] as num?)?.toInt(), | ||
| 62 | - status: (json['status'] as num?)?.toInt(), | ||
| 63 | - lastLoginTime: (json['last_login_time'] as num?)?.toInt(), | ||
| 64 | - createTime: (json['create_time'] as num?)?.toInt(), | ||
| 65 | - isBot: (json['is_bot'] as num?)?.toInt(), | ||
| 66 | - ); | ||
| 67 | - | ||
| 68 | -Map<String, dynamic> _$UserInfoResponseToJson(UserInfoResponse instance) => | ||
| 69 | - <String, dynamic>{ | ||
| 70 | - if (instance.id case final value?) 'id': value, | ||
| 71 | - if (instance.pairCode case final value?) 'pair_code': value, | ||
| 72 | - if (instance.pairId case final value?) 'pair_id': value, | ||
| 73 | - if (instance.telephone case final value?) 'telephone': value, | ||
| 74 | - if (instance.nickname case final value?) 'nickname': value, | ||
| 75 | - if (instance.avatar case final value?) 'avatar': value, | ||
| 76 | - if (instance.persona case final value?) 'persona': value, | ||
| 77 | - if (instance.status case final value?) 'status': value, | ||
| 78 | - if (instance.lastLoginTime case final value?) 'last_login_time': value, | ||
| 79 | - if (instance.createTime case final value?) 'create_time': value, | ||
| 80 | - if (instance.isBot case final value?) 'is_bot': value, | ||
| 81 | - }; | ||
| 82 | - | ||
| 83 | -BoundUserInfoResponse _$BoundUserInfoResponseFromJson( | ||
| 84 | - Map<String, dynamic> json) => | ||
| 85 | - BoundUserInfoResponse( | ||
| 86 | - userInfo: json['user_info'] == null | ||
| 87 | - ? null | ||
| 88 | - : UserInfoResponse.fromJson( | ||
| 89 | - json['user_info'] as Map<String, dynamic>), | ||
| 90 | - partnerUserInfo: json['pair_user_info'] == null | ||
| 91 | - ? null | ||
| 92 | - : UserInfoResponse.fromJson( | ||
| 93 | - json['pair_user_info'] as Map<String, dynamic>), | ||
| 94 | - ); | ||
| 95 | - | ||
| 96 | -Map<String, dynamic> _$BoundUserInfoResponseToJson( | ||
| 97 | - BoundUserInfoResponse instance) => | ||
| 98 | - <String, dynamic>{ | ||
| 99 | - if (instance.userInfo?.toJson() case final value?) 'user_info': value, | ||
| 100 | - if (instance.partnerUserInfo?.toJson() case final value?) | ||
| 101 | - 'pair_user_info': value, | ||
| 102 | - }; | ||
| 103 | - | ||
| 104 | -RongcloudTokenResponse _$RongcloudTokenResponseFromJson( | ||
| 105 | - Map<String, dynamic> json) => | ||
| 106 | - RongcloudTokenResponse( | ||
| 107 | - token: json['token'] as String?, | ||
| 108 | - ); | ||
| 109 | - | ||
| 110 | -Map<String, dynamic> _$RongcloudTokenResponseToJson( | ||
| 111 | - RongcloudTokenResponse instance) => | ||
| 112 | - <String, dynamic>{ | ||
| 113 | - if (instance.token case final value?) 'token': value, | ||
| 114 | - }; |
| 1 | -import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | - | ||
| 3 | -part 'vip_info.g.dart'; | ||
| 4 | - | ||
| 5 | -@JsonSerializable() | ||
| 6 | class VipInfo { | 1 | class VipInfo { |
| 7 | const VipInfo({ | 2 | const VipInfo({ |
| 8 | this.isVip, | 3 | this.isVip, |
| @@ -12,18 +7,29 @@ class VipInfo { | @@ -12,18 +7,29 @@ class VipInfo { | ||
| 12 | this.vipEndDate, | 7 | this.vipEndDate, |
| 13 | }); | 8 | }); |
| 14 | 9 | ||
| 15 | - @JsonKey(name: 'is_vip') | ||
| 16 | final bool? isVip; | 10 | final bool? isVip; |
| 17 | - @JsonKey(name: 'vip_is_forever') | ||
| 18 | final bool? isForeverVip; | 11 | final bool? isForeverVip; |
| 19 | - @JsonKey(name: 'is_share') | ||
| 20 | final bool? isShare; | 12 | final bool? isShare; |
| 21 | - @JsonKey(name: 'vip_start_date') | ||
| 22 | final int? vipStartDate; | 13 | final int? vipStartDate; |
| 23 | - @JsonKey(name: 'vip_end_date') | ||
| 24 | final int? vipEndDate; | 14 | final int? vipEndDate; |
| 25 | 15 | ||
| 26 | - factory VipInfo.fromJson(Map<String, dynamic> json) => | ||
| 27 | - _$VipInfoFromJson(json); | ||
| 28 | - Map<String, dynamic> toJson() => _$VipInfoToJson(this); | 16 | + factory VipInfo.fromJson(Map<String, dynamic> json) { |
| 17 | + return VipInfo( | ||
| 18 | + isVip: json['is_vip'] as bool?, | ||
| 19 | + isForeverVip: json['vip_is_forever'] as bool?, | ||
| 20 | + isShare: json['is_share'] as bool?, | ||
| 21 | + vipStartDate: (json['vip_start_date'] as num?)?.toInt(), | ||
| 22 | + vipEndDate: (json['vip_end_date'] as num?)?.toInt(), | ||
| 23 | + ); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + Map<String, dynamic> toJson() { | ||
| 27 | + final val = <String, dynamic>{}; | ||
| 28 | + if (isVip != null) val['is_vip'] = isVip; | ||
| 29 | + if (isForeverVip != null) val['vip_is_forever'] = isForeverVip; | ||
| 30 | + if (isShare != null) val['is_share'] = isShare; | ||
| 31 | + if (vipStartDate != null) val['vip_start_date'] = vipStartDate; | ||
| 32 | + if (vipEndDate != null) val['vip_end_date'] = vipEndDate; | ||
| 33 | + return val; | ||
| 34 | + } | ||
| 29 | } | 35 | } |
lib/data/models/vip/vip_info.g.dart
deleted
100644 → 0
| 1 | -// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | - | ||
| 3 | -part of 'vip_info.dart'; | ||
| 4 | - | ||
| 5 | -// ************************************************************************** | ||
| 6 | -// JsonSerializableGenerator | ||
| 7 | -// ************************************************************************** | ||
| 8 | - | ||
| 9 | -VipInfo _$VipInfoFromJson(Map<String, dynamic> json) => VipInfo( | ||
| 10 | - isVip: json['is_vip'] as bool?, | ||
| 11 | - isForeverVip: json['vip_is_forever'] as bool?, | ||
| 12 | - isShare: json['is_share'] as bool?, | ||
| 13 | - vipStartDate: (json['vip_start_date'] as num?)?.toInt(), | ||
| 14 | - vipEndDate: (json['vip_end_date'] as num?)?.toInt(), | ||
| 15 | - ); | ||
| 16 | - | ||
| 17 | -Map<String, dynamic> _$VipInfoToJson(VipInfo instance) => <String, dynamic>{ | ||
| 18 | - if (instance.isVip case final value?) 'is_vip': value, | ||
| 19 | - if (instance.isForeverVip case final value?) 'vip_is_forever': value, | ||
| 20 | - if (instance.isShare case final value?) 'is_share': value, | ||
| 21 | - if (instance.vipStartDate case final value?) 'vip_start_date': value, | ||
| 22 | - if (instance.vipEndDate case final value?) 'vip_end_date': value, | ||
| 23 | - }; |
| @@ -62,7 +62,8 @@ import 'app_localizations_zh.dart'; | @@ -62,7 +62,8 @@ import 'app_localizations_zh.dart'; | ||
| 62 | /// be consistent with the languages listed in the AppLocalizations.supportedLocales | 62 | /// be consistent with the languages listed in the AppLocalizations.supportedLocales |
| 63 | /// property. | 63 | /// property. |
| 64 | abstract class AppLocalizations { | 64 | abstract class AppLocalizations { |
| 65 | - AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); | 65 | + AppLocalizations(String locale) |
| 66 | + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); | ||
| 66 | 67 | ||
| 67 | final String localeName; | 68 | final String localeName; |
| 68 | 69 | ||
| @@ -70,7 +71,8 @@ abstract class AppLocalizations { | @@ -70,7 +71,8 @@ abstract class AppLocalizations { | ||
| 70 | return Localizations.of<AppLocalizations>(context, AppLocalizations); | 71 | return Localizations.of<AppLocalizations>(context, AppLocalizations); |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | - static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate(); | 74 | + static const LocalizationsDelegate<AppLocalizations> delegate = |
| 75 | + _AppLocalizationsDelegate(); | ||
| 74 | 76 | ||
| 75 | /// A list of this localizations delegate along with the default localizations | 77 | /// A list of this localizations delegate along with the default localizations |
| 76 | /// delegates. | 78 | /// delegates. |
| @@ -82,7 +84,8 @@ abstract class AppLocalizations { | @@ -82,7 +84,8 @@ abstract class AppLocalizations { | ||
| 82 | /// Additional delegates can be added by appending to this list in | 84 | /// Additional delegates can be added by appending to this list in |
| 83 | /// MaterialApp. This list does not have to be used at all if a custom list | 85 | /// MaterialApp. This list does not have to be used at all if a custom list |
| 84 | /// of delegates is preferred or required. | 86 | /// of delegates is preferred or required. |
| 85 | - static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[ | 87 | + static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = |
| 88 | + <LocalizationsDelegate<dynamic>>[ | ||
| 86 | delegate, | 89 | delegate, |
| 87 | GlobalMaterialLocalizations.delegate, | 90 | GlobalMaterialLocalizations.delegate, |
| 88 | GlobalCupertinoLocalizations.delegate, | 91 | GlobalCupertinoLocalizations.delegate, |
| @@ -525,7 +528,8 @@ abstract class AppLocalizations { | @@ -525,7 +528,8 @@ abstract class AppLocalizations { | ||
| 525 | /// | 528 | /// |
| 526 | /// In zh, this message translates to: | 529 | /// In zh, this message translates to: |
| 527 | /// **'你们现在可以查看彼此的 HRV、压力与睡眠变化,并在对方疲惫时及时送上关心。'** | 530 | /// **'你们现在可以查看彼此的 HRV、压力与睡眠变化,并在对方疲惫时及时送上关心。'** |
| 528 | - String get youCanNowViewEachOtherSHrvStressLevelsAndSleepPatternsAndReachOutToCheckInWhenTheOtherPersonSeemsTired; | 531 | + String |
| 532 | + get youCanNowViewEachOtherSHrvStressLevelsAndSleepPatternsAndReachOutToCheckInWhenTheOtherPersonSeemsTired; | ||
| 529 | 533 | ||
| 530 | /// No description provided for @bindPartnerTitle. | 534 | /// No description provided for @bindPartnerTitle. |
| 531 | /// | 535 | /// |
| @@ -756,7 +760,8 @@ abstract class AppLocalizations { | @@ -756,7 +760,8 @@ abstract class AppLocalizations { | ||
| 756 | String get todayHealthDataAuthAction; | 760 | String get todayHealthDataAuthAction; |
| 757 | } | 761 | } |
| 758 | 762 | ||
| 759 | -class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> { | 763 | +class _AppLocalizationsDelegate |
| 764 | + extends LocalizationsDelegate<AppLocalizations> { | ||
| 760 | const _AppLocalizationsDelegate(); | 765 | const _AppLocalizationsDelegate(); |
| 761 | 766 | ||
| 762 | @override | 767 | @override |
| @@ -765,25 +770,25 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> | @@ -765,25 +770,25 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> | ||
| 765 | } | 770 | } |
| 766 | 771 | ||
| 767 | @override | 772 | @override |
| 768 | - bool isSupported(Locale locale) => <String>['en', 'zh'].contains(locale.languageCode); | 773 | + bool isSupported(Locale locale) => |
| 774 | + <String>['en', 'zh'].contains(locale.languageCode); | ||
| 769 | 775 | ||
| 770 | @override | 776 | @override |
| 771 | bool shouldReload(_AppLocalizationsDelegate old) => false; | 777 | bool shouldReload(_AppLocalizationsDelegate old) => false; |
| 772 | } | 778 | } |
| 773 | 779 | ||
| 774 | AppLocalizations lookupAppLocalizations(Locale locale) { | 780 | AppLocalizations lookupAppLocalizations(Locale locale) { |
| 775 | - | ||
| 776 | - | ||
| 777 | // Lookup logic when only language code is specified. | 781 | // Lookup logic when only language code is specified. |
| 778 | switch (locale.languageCode) { | 782 | switch (locale.languageCode) { |
| 779 | - case 'en': return AppLocalizationsEn(); | ||
| 780 | - case 'zh': return AppLocalizationsZh(); | 783 | + case 'en': |
| 784 | + return AppLocalizationsEn(); | ||
| 785 | + case 'zh': | ||
| 786 | + return AppLocalizationsZh(); | ||
| 781 | } | 787 | } |
| 782 | 788 | ||
| 783 | throw FlutterError( | 789 | throw FlutterError( |
| 784 | - 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' | ||
| 785 | - 'an issue with the localizations generation tool. Please file an issue ' | ||
| 786 | - 'on GitHub with a reproducible sample app and the gen-l10n configuration ' | ||
| 787 | - 'that was used.' | ||
| 788 | - ); | 790 | + 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' |
| 791 | + 'an issue with the localizations generation tool. Please file an issue ' | ||
| 792 | + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' | ||
| 793 | + 'that was used.'); | ||
| 789 | } | 794 | } |
| 1 | +// ignore: unused_import | ||
| 2 | +import 'package:intl/intl.dart' as intl; | ||
| 1 | import 'app_localizations.dart'; | 3 | import 'app_localizations.dart'; |
| 2 | 4 | ||
| 3 | // ignore_for_file: type=lint | 5 | // ignore_for_file: type=lint |
| @@ -67,10 +69,12 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -67,10 +69,12 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 67 | String get settings => 'Settings'; | 69 | String get settings => 'Settings'; |
| 68 | 70 | ||
| 69 | @override | 71 | @override |
| 70 | - String get onboardingIntroTitle => 'DoubleFeel is a health companion app built for Apple Watch'; | 72 | + String get onboardingIntroTitle => |
| 73 | + 'DoubleFeel is a health companion app built for Apple Watch'; | ||
| 71 | 74 | ||
| 72 | @override | 75 | @override |
| 73 | - String get onboardingIntroBody => 'We hope to help you\n<em>notice changes in your mind and body, and help the people who love you</em> see when you are <em>tired or need support</em>'; | 76 | + String get onboardingIntroBody => |
| 77 | + 'We hope to help you\n<em>notice changes in your mind and body, and help the people who love you</em> see when you are <em>tired or need support</em>'; | ||
| 74 | 78 | ||
| 75 | @override | 79 | @override |
| 76 | String get onboardingStateQuestion => 'Which of these often happens to you?'; | 80 | String get onboardingStateQuestion => 'Which of these often happens to you?'; |
| @@ -82,16 +86,19 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -82,16 +86,19 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 82 | String get onboardingStateTired => 'I get tired easily'; | 86 | String get onboardingStateTired => 'I get tired easily'; |
| 83 | 87 | ||
| 84 | @override | 88 | @override |
| 85 | - String get onboardingStatePoorRest => 'I wake up but still do not feel rested'; | 89 | + String get onboardingStatePoorRest => |
| 90 | + 'I wake up but still do not feel rested'; | ||
| 86 | 91 | ||
| 87 | @override | 92 | @override |
| 88 | - String get onboardingStateNeedStimulants => 'I rely on cigarettes, alcohol, coffee, or other stimulants to stay alert'; | 93 | + String get onboardingStateNeedStimulants => |
| 94 | + 'I rely on cigarettes, alcohol, coffee, or other stimulants to stay alert'; | ||
| 89 | 95 | ||
| 90 | @override | 96 | @override |
| 91 | String get onboardingStateNone => 'None of the above'; | 97 | String get onboardingStateNone => 'None of the above'; |
| 92 | 98 | ||
| 93 | @override | 99 | @override |
| 94 | - String get onboardingStressGoalQuestion => 'What do you want to learn by understanding stress?'; | 100 | + String get onboardingStressGoalQuestion => |
| 101 | + 'What do you want to learn by understanding stress?'; | ||
| 95 | 102 | ||
| 96 | @override | 103 | @override |
| 97 | String get onboardingStressGoalSource => 'Understand where stress comes from'; | 104 | String get onboardingStressGoalSource => 'Understand where stress comes from'; |
| @@ -100,7 +107,8 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -100,7 +107,8 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 100 | String get onboardingStressGoalReminder => 'Get reminded when stress appears'; | 107 | String get onboardingStressGoalReminder => 'Get reminded when stress appears'; |
| 101 | 108 | ||
| 102 | @override | 109 | @override |
| 103 | - String get onboardingStressGoalLovedOnes => 'Let people who care about me know my stress state'; | 110 | + String get onboardingStressGoalLovedOnes => |
| 111 | + 'Let people who care about me know my stress state'; | ||
| 104 | 112 | ||
| 105 | @override | 113 | @override |
| 106 | String get onboardingStressGoalRelax => 'Understand stress and feel lighter'; | 114 | String get onboardingStressGoalRelax => 'Understand stress and feel lighter'; |
| @@ -109,7 +117,8 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -109,7 +117,8 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 109 | String get onboardingStressGoalBodyTalk => 'Communicate better with my body'; | 117 | String get onboardingStressGoalBodyTalk => 'Communicate better with my body'; |
| 110 | 118 | ||
| 111 | @override | 119 | @override |
| 112 | - String get onboardingReliefQuestion => 'Which methods do you think can ease stress?'; | 120 | + String get onboardingReliefQuestion => |
| 121 | + 'Which methods do you think can ease stress?'; | ||
| 113 | 122 | ||
| 114 | @override | 123 | @override |
| 115 | String get onboardingReliefSleep => 'Regular sleep'; | 124 | String get onboardingReliefSleep => 'Regular sleep'; |
| @@ -133,7 +142,8 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -133,7 +142,8 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 133 | String get onboardingKeyDataTitle => 'Did you know?'; | 142 | String get onboardingKeyDataTitle => 'Did you know?'; |
| 134 | 143 | ||
| 135 | @override | 144 | @override |
| 136 | - String get onboardingKeyDataSubtitle => 'Everyone has a magical and important body metric that can help us:'; | 145 | + String get onboardingKeyDataSubtitle => |
| 146 | + 'Everyone has a magical and important body metric that can help us:'; | ||
| 137 | 147 | ||
| 138 | @override | 148 | @override |
| 139 | String get onboardingKeyDataStress => 'Monitor stress'; | 149 | String get onboardingKeyDataStress => 'Monitor stress'; |
| @@ -148,7 +158,8 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -148,7 +158,8 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 148 | String get onboardingKeyDataHabits => 'Build healthy habits'; | 158 | String get onboardingKeyDataHabits => 'Build healthy habits'; |
| 149 | 159 | ||
| 150 | @override | 160 | @override |
| 151 | - String get onboardingKeyDataLovedOnes => 'Help important people care about your state in time'; | 161 | + String get onboardingKeyDataLovedOnes => |
| 162 | + 'Help important people care about your state in time'; | ||
| 152 | 163 | ||
| 153 | @override | 164 | @override |
| 154 | String get onboardingTellMeWhatItIs => 'Tell me what it is!'; | 165 | String get onboardingTellMeWhatItIs => 'Tell me what it is!'; |
| @@ -157,16 +168,19 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -157,16 +168,19 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 157 | String get onboardingHrvTitle => 'It is HRV, heart rate variability'; | 168 | String get onboardingHrvTitle => 'It is HRV, heart rate variability'; |
| 158 | 169 | ||
| 159 | @override | 170 | @override |
| 160 | - String get onboardingHrvSubtitle => 'It helps us measure overall stress and health'; | 171 | + String get onboardingHrvSubtitle => |
| 172 | + 'It helps us measure overall stress and health'; | ||
| 161 | 173 | ||
| 162 | @override | 174 | @override |
| 163 | - String get onboardingHrvDescription => 'Heart rate variability (HRV) is the tiny variation in time between heartbeats. It reflects autonomic nervous system activity and how the body responds to stress.'; | 175 | + String get onboardingHrvDescription => |
| 176 | + 'Heart rate variability (HRV) is the tiny variation in time between heartbeats. It reflects autonomic nervous system activity and how the body responds to stress.'; | ||
| 164 | 177 | ||
| 165 | @override | 178 | @override |
| 166 | String get onboardingTellMeMore => 'Tell me more'; | 179 | String get onboardingTellMeMore => 'Tell me more'; |
| 167 | 180 | ||
| 168 | @override | 181 | @override |
| 169 | - String get onboardingResearchTitle => 'Many studies show that HRV changes are closely related to how our body and mind feel'; | 182 | + String get onboardingResearchTitle => |
| 183 | + 'Many studies show that HRV changes are closely related to how our body and mind feel'; | ||
| 170 | 184 | ||
| 171 | @override | 185 | @override |
| 172 | String get onboardingResearchFatigue => 'Physical fatigue'; | 186 | String get onboardingResearchFatigue => 'Physical fatigue'; |
| @@ -184,25 +198,30 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -184,25 +198,30 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 184 | String get onboardingHealthPermissionTitle => 'Allow health data access'; | 198 | String get onboardingHealthPermissionTitle => 'Allow health data access'; |
| 185 | 199 | ||
| 186 | @override | 200 | @override |
| 187 | - String get onboardingHealthPermissionBody => 'DoubleFeel needs connected wearable health data to send reminders, count stress moments, and provide suggestions.'; | 201 | + String get onboardingHealthPermissionBody => |
| 202 | + 'DoubleFeel needs connected wearable health data to send reminders, count stress moments, and provide suggestions.'; | ||
| 188 | 203 | ||
| 189 | @override | 204 | @override |
| 190 | - String get onboardingHealthPermissionPrivacy => 'Your health data is stored locally. We do not upload any related data.'; | 205 | + String get onboardingHealthPermissionPrivacy => |
| 206 | + 'Your health data is stored locally. We do not upload any related data.'; | ||
| 191 | 207 | ||
| 192 | @override | 208 | @override |
| 193 | String get onboardingNotificationTitle => 'Turn on notifications'; | 209 | String get onboardingNotificationTitle => 'Turn on notifications'; |
| 194 | 210 | ||
| 195 | @override | 211 | @override |
| 196 | - String get onboardingNotificationSubtitle => 'Learn about every body change in time'; | 212 | + String get onboardingNotificationSubtitle => |
| 213 | + 'Learn about every body change in time'; | ||
| 197 | 214 | ||
| 198 | @override | 215 | @override |
| 199 | - String get onboardingNotificationBody => 'After Apple Watch data updates, we can remind you in time and help you act to improve your stress state.'; | 216 | + String get onboardingNotificationBody => |
| 217 | + 'After Apple Watch data updates, we can remind you in time and help you act to improve your stress state.'; | ||
| 200 | 218 | ||
| 201 | @override | 219 | @override |
| 202 | String get onboardingMemberTitle => 'Get an annual membership offer'; | 220 | String get onboardingMemberTitle => 'Get an annual membership offer'; |
| 203 | 221 | ||
| 204 | @override | 222 | @override |
| 205 | - String get onboardingMemberBody => 'Start your pressure alert and health companion journey, so love and care are always present.'; | 223 | + String get onboardingMemberBody => |
| 224 | + 'Start your pressure alert and health companion journey, so love and care are always present.'; | ||
| 206 | 225 | ||
| 207 | @override | 226 | @override |
| 208 | String get onboardingMemberOriginalPrice => 'Original ¥72.00/year'; | 227 | String get onboardingMemberOriginalPrice => 'Original ¥72.00/year'; |
| @@ -217,13 +236,16 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -217,13 +236,16 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 217 | String get onboardingMemberAllOptions => 'View all purchase options'; | 236 | String get onboardingMemberAllOptions => 'View all purchase options'; |
| 218 | 237 | ||
| 219 | @override | 238 | @override |
| 220 | - String get healthCompanionIsNowAvailable => 'Health Companion is now available'; | 239 | + String get healthCompanionIsNowAvailable => |
| 240 | + 'Health Companion is now available'; | ||
| 221 | 241 | ||
| 222 | @override | 242 | @override |
| 223 | - String get youCanNowViewEachOtherSHrvStressLevelsAndSleepPatternsAndReachOutToCheckInWhenTheOtherPersonSeemsTired => 'You can now view each other\'s HRV, stress levels, and sleep patterns, and reach out to check in when the other person seems tired.'; | 243 | + String get youCanNowViewEachOtherSHrvStressLevelsAndSleepPatternsAndReachOutToCheckInWhenTheOtherPersonSeemsTired => |
| 244 | + 'You can now view each other\'s HRV, stress levels, and sleep patterns, and reach out to check in when the other person seems tired.'; | ||
| 224 | 245 | ||
| 225 | @override | 246 | @override |
| 226 | - String get bindPartnerTitle => 'Add a Close Contact\nOne more person to care about your health'; | 247 | + String get bindPartnerTitle => |
| 248 | + 'Add a Close Contact\nOne more person to care about your health'; | ||
| 227 | 249 | ||
| 228 | @override | 250 | @override |
| 229 | String get bindPartnerMyId => 'My ID'; | 251 | String get bindPartnerMyId => 'My ID'; |
| @@ -262,7 +284,8 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -262,7 +284,8 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 262 | String get onboardingResearchGoodSleep => 'Good Sleep'; | 284 | String get onboardingResearchGoodSleep => 'Good Sleep'; |
| 263 | 285 | ||
| 264 | @override | 286 | @override |
| 265 | - String get loginSlogan => 'Start your pressure alert and health companion journey\nso love and care are always present'; | 287 | + String get loginSlogan => |
| 288 | + 'Start your pressure alert and health companion journey\nso love and care are always present'; | ||
| 266 | 289 | ||
| 267 | @override | 290 | @override |
| 268 | String get loginWithPhone => 'Sign in with Phone'; | 291 | String get loginWithPhone => 'Sign in with Phone'; |
| @@ -312,13 +335,15 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -312,13 +335,15 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 312 | String get phoneLoginCodeHint => 'Enter verification code'; | 335 | String get phoneLoginCodeHint => 'Enter verification code'; |
| 313 | 336 | ||
| 314 | @override | 337 | @override |
| 315 | - String get phoneLoginAutoRegisterHint => 'Unregistered numbers will be registered automatically'; | 338 | + String get phoneLoginAutoRegisterHint => |
| 339 | + 'Unregistered numbers will be registered automatically'; | ||
| 316 | 340 | ||
| 317 | @override | 341 | @override |
| 318 | String get phoneLoginLoggingIn => 'Signing in...'; | 342 | String get phoneLoginLoggingIn => 'Signing in...'; |
| 319 | 343 | ||
| 320 | @override | 344 | @override |
| 321 | - String get loginAgreeToTermsToast => 'Please read and agree to the Terms of Service and Privacy Policy first'; | 345 | + String get loginAgreeToTermsToast => |
| 346 | + 'Please read and agree to the Terms of Service and Privacy Policy first'; | ||
| 322 | 347 | ||
| 323 | @override | 348 | @override |
| 324 | String get phoneLoginInvalidPhone => 'Invalid phone number'; | 349 | String get phoneLoginInvalidPhone => 'Invalid phone number'; |
| @@ -330,10 +355,12 @@ class AppLocalizationsEn extends AppLocalizations { | @@ -330,10 +355,12 @@ class AppLocalizationsEn extends AppLocalizations { | ||
| 330 | String get phoneLoginInvalidCode => 'Invalid verification code'; | 355 | String get phoneLoginInvalidCode => 'Invalid verification code'; |
| 331 | 356 | ||
| 332 | @override | 357 | @override |
| 333 | - String get todayHealthDataAuthTitle => 'Unable to access heart rate health data'; | 358 | + String get todayHealthDataAuthTitle => |
| 359 | + 'Unable to access heart rate health data'; | ||
| 334 | 360 | ||
| 335 | @override | 361 | @override |
| 336 | - String get todayHealthDataAuthDescription => 'DoubleFeel needs permission to access your health data to provide stress reminders, real-time stress statistics, and health suggestions. Otherwise, some app features may not work properly. Your health data is stored locally only and will not be uploaded to any server.'; | 362 | + String get todayHealthDataAuthDescription => |
| 363 | + 'DoubleFeel needs permission to access your health data to provide stress reminders, real-time stress statistics, and health suggestions. Otherwise, some app features may not work properly. Your health data is stored locally only and will not be uploaded to any server.'; | ||
| 337 | 364 | ||
| 338 | @override | 365 | @override |
| 339 | String get todayHealthDataAuthAction => 'Authorize health data access'; | 366 | String get todayHealthDataAuthAction => 'Authorize health data access'; |
| 1 | +// ignore: unused_import | ||
| 2 | +import 'package:intl/intl.dart' as intl; | ||
| 1 | import 'app_localizations.dart'; | 3 | import 'app_localizations.dart'; |
| 2 | 4 | ||
| 3 | // ignore_for_file: type=lint | 5 | // ignore_for_file: type=lint |
| @@ -70,7 +72,8 @@ class AppLocalizationsZh extends AppLocalizations { | @@ -70,7 +72,8 @@ class AppLocalizationsZh extends AppLocalizations { | ||
| 70 | String get onboardingIntroTitle => 'DoubleFeel 是专为 Apple Watch 打造的健康陪伴app'; | 72 | String get onboardingIntroTitle => 'DoubleFeel 是专为 Apple Watch 打造的健康陪伴app'; |
| 71 | 73 | ||
| 72 | @override | 74 | @override |
| 73 | - String get onboardingIntroBody => '我们希望可以帮助你\n<em>关注自己的身心变化,也让爱你的人</em>及时发现你的<em>疲惫与需要</em>'; | 75 | + String get onboardingIntroBody => |
| 76 | + '我们希望可以帮助你\n<em>关注自己的身心变化,也让爱你的人</em>及时发现你的<em>疲惫与需要</em>'; | ||
| 74 | 77 | ||
| 75 | @override | 78 | @override |
| 76 | String get onboardingStateQuestion => '请问以下哪些描述,经常发生在你身上?'; | 79 | String get onboardingStateQuestion => '请问以下哪些描述,经常发生在你身上?'; |
| @@ -160,7 +163,8 @@ class AppLocalizationsZh extends AppLocalizations { | @@ -160,7 +163,8 @@ class AppLocalizationsZh extends AppLocalizations { | ||
| 160 | String get onboardingHrvSubtitle => '它能帮助我们衡量整体的压力和健康状态'; | 163 | String get onboardingHrvSubtitle => '它能帮助我们衡量整体的压力和健康状态'; |
| 161 | 164 | ||
| 162 | @override | 165 | @override |
| 163 | - String get onboardingHrvDescription => '心率变异性(HRV, Heart Rate Variability)即心跳之间间隔时间的微小变化,反映了自主神经系统活动和身体对压力的反应能力'; | 166 | + String get onboardingHrvDescription => |
| 167 | + '心率变异性(HRV, Heart Rate Variability)即心跳之间间隔时间的微小变化,反映了自主神经系统活动和身体对压力的反应能力'; | ||
| 164 | 168 | ||
| 165 | @override | 169 | @override |
| 166 | String get onboardingTellMeMore => '展开说说'; | 170 | String get onboardingTellMeMore => '展开说说'; |
| @@ -184,10 +188,12 @@ class AppLocalizationsZh extends AppLocalizations { | @@ -184,10 +188,12 @@ class AppLocalizationsZh extends AppLocalizations { | ||
| 184 | String get onboardingHealthPermissionTitle => '允许访问健康数据'; | 188 | String get onboardingHealthPermissionTitle => '允许访问健康数据'; |
| 185 | 189 | ||
| 186 | @override | 190 | @override |
| 187 | - String get onboardingHealthPermissionBody => 'DoubleFeel需要连接健康穿戴设备数据,以提醒、统计压力时刻、提供建议。'; | 191 | + String get onboardingHealthPermissionBody => |
| 192 | + 'DoubleFeel需要连接健康穿戴设备数据,以提醒、统计压力时刻、提供建议。'; | ||
| 188 | 193 | ||
| 189 | @override | 194 | @override |
| 190 | - String get onboardingHealthPermissionPrivacy => '请放心,你的健康数据只会存储在本地,我们不上传任何相关数据。'; | 195 | + String get onboardingHealthPermissionPrivacy => |
| 196 | + '请放心,你的健康数据只会存储在本地,我们不上传任何相关数据。'; | ||
| 191 | 197 | ||
| 192 | @override | 198 | @override |
| 193 | String get onboardingNotificationTitle => '开启通知'; | 199 | String get onboardingNotificationTitle => '开启通知'; |
| @@ -196,7 +202,8 @@ class AppLocalizationsZh extends AppLocalizations { | @@ -196,7 +202,8 @@ class AppLocalizationsZh extends AppLocalizations { | ||
| 196 | String get onboardingNotificationSubtitle => '及时了解身体每一次异动'; | 202 | String get onboardingNotificationSubtitle => '及时了解身体每一次异动'; |
| 197 | 203 | ||
| 198 | @override | 204 | @override |
| 199 | - String get onboardingNotificationBody => 'AppleWatch数据更新后会及时提醒你,帮助你及时行动,改善压力状态'; | 205 | + String get onboardingNotificationBody => |
| 206 | + 'AppleWatch数据更新后会及时提醒你,帮助你及时行动,改善压力状态'; | ||
| 200 | 207 | ||
| 201 | @override | 208 | @override |
| 202 | String get onboardingMemberTitle => '获得年度会员优惠'; | 209 | String get onboardingMemberTitle => '获得年度会员优惠'; |
| @@ -220,7 +227,9 @@ class AppLocalizationsZh extends AppLocalizations { | @@ -220,7 +227,9 @@ class AppLocalizationsZh extends AppLocalizations { | ||
| 220 | String get healthCompanionIsNowAvailable => '健康陪伴已开启'; | 227 | String get healthCompanionIsNowAvailable => '健康陪伴已开启'; |
| 221 | 228 | ||
| 222 | @override | 229 | @override |
| 223 | - String get youCanNowViewEachOtherSHrvStressLevelsAndSleepPatternsAndReachOutToCheckInWhenTheOtherPersonSeemsTired => '你们现在可以查看彼此的 HRV、压力与睡眠变化,并在对方疲惫时及时送上关心。'; | 230 | + String |
| 231 | + get youCanNowViewEachOtherSHrvStressLevelsAndSleepPatternsAndReachOutToCheckInWhenTheOtherPersonSeemsTired => | ||
| 232 | + '你们现在可以查看彼此的 HRV、压力与睡眠变化,并在对方疲惫时及时送上关心。'; | ||
| 224 | 233 | ||
| 225 | @override | 234 | @override |
| 226 | String get bindPartnerTitle => '添加亲密联系人\n多一个人关注你的健康'; | 235 | String get bindPartnerTitle => '添加亲密联系人\n多一个人关注你的健康'; |
| @@ -333,7 +342,8 @@ class AppLocalizationsZh extends AppLocalizations { | @@ -333,7 +342,8 @@ class AppLocalizationsZh extends AppLocalizations { | ||
| 333 | String get todayHealthDataAuthTitle => '无法获取心率健康数据'; | 342 | String get todayHealthDataAuthTitle => '无法获取心率健康数据'; |
| 334 | 343 | ||
| 335 | @override | 344 | @override |
| 336 | - String get todayHealthDataAuthDescription => 'DoubleFeel 需要授权访问你的健康数据,才能提供压力提醒、实时压力统计和健康建议;否则应用功能可能无法正常使用。请放心,你的健康数据仅存储在本地,不会上传到任何服务器。'; | 345 | + String get todayHealthDataAuthDescription => |
| 346 | + 'DoubleFeel 需要授权访问你的健康数据,才能提供压力提醒、实时压力统计和健康建议;否则应用功能可能无法正常使用。请放心,你的健康数据仅存储在本地,不会上传到任何服务器。'; | ||
| 337 | 347 | ||
| 338 | @override | 348 | @override |
| 339 | String get todayHealthDataAuthAction => '授权访问健康数据'; | 349 | String get todayHealthDataAuthAction => '授权访问健康数据'; |
| @@ -133,10 +133,10 @@ packages: | @@ -133,10 +133,10 @@ packages: | ||
| 133 | dependency: transitive | 133 | dependency: transitive |
| 134 | description: | 134 | description: |
| 135 | name: characters | 135 | name: characters |
| 136 | - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" | 136 | + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 |
| 137 | url: "https://pub.dev" | 137 | url: "https://pub.dev" |
| 138 | source: hosted | 138 | source: hosted |
| 139 | - version: "1.3.0" | 139 | + version: "1.4.0" |
| 140 | checked_yaml: | 140 | checked_yaml: |
| 141 | dependency: transitive | 141 | dependency: transitive |
| 142 | description: | 142 | description: |
| @@ -149,10 +149,10 @@ packages: | @@ -149,10 +149,10 @@ packages: | ||
| 149 | dependency: transitive | 149 | dependency: transitive |
| 150 | description: | 150 | description: |
| 151 | name: clock | 151 | name: clock |
| 152 | - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf | 152 | + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b |
| 153 | url: "https://pub.dev" | 153 | url: "https://pub.dev" |
| 154 | source: hosted | 154 | source: hosted |
| 155 | - version: "1.1.1" | 155 | + version: "1.1.2" |
| 156 | code_builder: | 156 | code_builder: |
| 157 | dependency: transitive | 157 | dependency: transitive |
| 158 | description: | 158 | description: |
| @@ -165,10 +165,10 @@ packages: | @@ -165,10 +165,10 @@ packages: | ||
| 165 | dependency: transitive | 165 | dependency: transitive |
| 166 | description: | 166 | description: |
| 167 | name: collection | 167 | name: collection |
| 168 | - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf | 168 | + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" |
| 169 | url: "https://pub.dev" | 169 | url: "https://pub.dev" |
| 170 | source: hosted | 170 | source: hosted |
| 171 | - version: "1.19.0" | 171 | + version: "1.19.1" |
| 172 | convert: | 172 | convert: |
| 173 | dependency: transitive | 173 | dependency: transitive |
| 174 | description: | 174 | description: |
| @@ -237,10 +237,10 @@ packages: | @@ -237,10 +237,10 @@ packages: | ||
| 237 | dependency: transitive | 237 | dependency: transitive |
| 238 | description: | 238 | description: |
| 239 | name: fake_async | 239 | name: fake_async |
| 240 | - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" | 240 | + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" |
| 241 | url: "https://pub.dev" | 241 | url: "https://pub.dev" |
| 242 | source: hosted | 242 | source: hosted |
| 243 | - version: "1.3.1" | 243 | + version: "1.3.3" |
| 244 | ffi: | 244 | ffi: |
| 245 | dependency: transitive | 245 | dependency: transitive |
| 246 | description: | 246 | description: |
| @@ -426,7 +426,7 @@ packages: | @@ -426,7 +426,7 @@ packages: | ||
| 426 | dependency: transitive | 426 | dependency: transitive |
| 427 | description: | 427 | description: |
| 428 | path: image_cropper_for_web | 428 | path: image_cropper_for_web |
| 429 | - ref: "br_v9.1.0_ohos" | 429 | + ref: "65c2c99891882ea59732959a672f3d5993a837bb" |
| 430 | resolved-ref: "65c2c99891882ea59732959a672f3d5993a837bb" | 430 | resolved-ref: "65c2c99891882ea59732959a672f3d5993a837bb" |
| 431 | url: "https://gitcode.com/openharmony-sig/fluttertpc_image_cropper.git" | 431 | url: "https://gitcode.com/openharmony-sig/fluttertpc_image_cropper.git" |
| 432 | source: git | 432 | source: git |
| @@ -435,7 +435,7 @@ packages: | @@ -435,7 +435,7 @@ packages: | ||
| 435 | dependency: transitive | 435 | dependency: transitive |
| 436 | description: | 436 | description: |
| 437 | path: image_cropper_platform_interface | 437 | path: image_cropper_platform_interface |
| 438 | - ref: "br_v9.1.0_ohos" | 438 | + ref: "65c2c99891882ea59732959a672f3d5993a837bb" |
| 439 | resolved-ref: "65c2c99891882ea59732959a672f3d5993a837bb" | 439 | resolved-ref: "65c2c99891882ea59732959a672f3d5993a837bb" |
| 440 | url: "https://gitcode.com/openharmony-sig/fluttertpc_image_cropper.git" | 440 | url: "https://gitcode.com/openharmony-sig/fluttertpc_image_cropper.git" |
| 441 | source: git | 441 | source: git |
| @@ -517,10 +517,10 @@ packages: | @@ -517,10 +517,10 @@ packages: | ||
| 517 | dependency: "direct main" | 517 | dependency: "direct main" |
| 518 | description: | 518 | description: |
| 519 | name: intl | 519 | name: intl |
| 520 | - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf | 520 | + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" |
| 521 | url: "https://pub.dev" | 521 | url: "https://pub.dev" |
| 522 | source: hosted | 522 | source: hosted |
| 523 | - version: "0.19.0" | 523 | + version: "0.20.2" |
| 524 | io: | 524 | io: |
| 525 | dependency: transitive | 525 | dependency: transitive |
| 526 | description: | 526 | description: |
| @@ -538,45 +538,37 @@ packages: | @@ -538,45 +538,37 @@ packages: | ||
| 538 | source: hosted | 538 | source: hosted |
| 539 | version: "0.7.1" | 539 | version: "0.7.1" |
| 540 | json_annotation: | 540 | json_annotation: |
| 541 | - dependency: "direct main" | 541 | + dependency: transitive |
| 542 | description: | 542 | description: |
| 543 | name: json_annotation | 543 | name: json_annotation |
| 544 | sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" | 544 | sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" |
| 545 | url: "https://pub.dev" | 545 | url: "https://pub.dev" |
| 546 | source: hosted | 546 | source: hosted |
| 547 | version: "4.9.0" | 547 | version: "4.9.0" |
| 548 | - json_serializable: | ||
| 549 | - dependency: "direct dev" | ||
| 550 | - description: | ||
| 551 | - name: json_serializable | ||
| 552 | - sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c | ||
| 553 | - url: "https://pub.dev" | ||
| 554 | - source: hosted | ||
| 555 | - version: "6.9.5" | ||
| 556 | leak_tracker: | 548 | leak_tracker: |
| 557 | dependency: transitive | 549 | dependency: transitive |
| 558 | description: | 550 | description: |
| 559 | name: leak_tracker | 551 | name: leak_tracker |
| 560 | - sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" | 552 | + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" |
| 561 | url: "https://pub.dev" | 553 | url: "https://pub.dev" |
| 562 | source: hosted | 554 | source: hosted |
| 563 | - version: "10.0.7" | 555 | + version: "11.0.2" |
| 564 | leak_tracker_flutter_testing: | 556 | leak_tracker_flutter_testing: |
| 565 | dependency: transitive | 557 | dependency: transitive |
| 566 | description: | 558 | description: |
| 567 | name: leak_tracker_flutter_testing | 559 | name: leak_tracker_flutter_testing |
| 568 | - sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" | 560 | + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" |
| 569 | url: "https://pub.dev" | 561 | url: "https://pub.dev" |
| 570 | source: hosted | 562 | source: hosted |
| 571 | - version: "3.0.8" | 563 | + version: "3.0.10" |
| 572 | leak_tracker_testing: | 564 | leak_tracker_testing: |
| 573 | dependency: transitive | 565 | dependency: transitive |
| 574 | description: | 566 | description: |
| 575 | name: leak_tracker_testing | 567 | name: leak_tracker_testing |
| 576 | - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" | 568 | + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" |
| 577 | url: "https://pub.dev" | 569 | url: "https://pub.dev" |
| 578 | source: hosted | 570 | source: hosted |
| 579 | - version: "3.0.1" | 571 | + version: "3.0.2" |
| 580 | lints: | 572 | lints: |
| 581 | dependency: transitive | 573 | dependency: transitive |
| 582 | description: | 574 | description: |
| @@ -605,10 +597,10 @@ packages: | @@ -605,10 +597,10 @@ packages: | ||
| 605 | dependency: transitive | 597 | dependency: transitive |
| 606 | description: | 598 | description: |
| 607 | name: matcher | 599 | name: matcher |
| 608 | - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb | 600 | + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 |
| 609 | url: "https://pub.dev" | 601 | url: "https://pub.dev" |
| 610 | source: hosted | 602 | source: hosted |
| 611 | - version: "0.12.16+1" | 603 | + version: "0.12.17" |
| 612 | material_color_utilities: | 604 | material_color_utilities: |
| 613 | dependency: transitive | 605 | dependency: transitive |
| 614 | description: | 606 | description: |
| @@ -621,10 +613,10 @@ packages: | @@ -621,10 +613,10 @@ packages: | ||
| 621 | dependency: transitive | 613 | dependency: transitive |
| 622 | description: | 614 | description: |
| 623 | name: meta | 615 | name: meta |
| 624 | - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 | 616 | + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" |
| 625 | url: "https://pub.dev" | 617 | url: "https://pub.dev" |
| 626 | source: hosted | 618 | source: hosted |
| 627 | - version: "1.15.0" | 619 | + version: "1.17.0" |
| 628 | mime: | 620 | mime: |
| 629 | dependency: transitive | 621 | dependency: transitive |
| 630 | description: | 622 | description: |
| @@ -653,10 +645,10 @@ packages: | @@ -653,10 +645,10 @@ packages: | ||
| 653 | dependency: transitive | 645 | dependency: transitive |
| 654 | description: | 646 | description: |
| 655 | name: path | 647 | name: path |
| 656 | - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" | 648 | + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" |
| 657 | url: "https://pub.dev" | 649 | url: "https://pub.dev" |
| 658 | source: hosted | 650 | source: hosted |
| 659 | - version: "1.9.0" | 651 | + version: "1.9.1" |
| 660 | path_provider: | 652 | path_provider: |
| 661 | dependency: transitive | 653 | dependency: transitive |
| 662 | description: | 654 | description: |
| @@ -922,22 +914,6 @@ packages: | @@ -922,22 +914,6 @@ packages: | ||
| 922 | description: flutter | 914 | description: flutter |
| 923 | source: sdk | 915 | source: sdk |
| 924 | version: "0.0.0" | 916 | version: "0.0.0" |
| 925 | - source_gen: | ||
| 926 | - dependency: transitive | ||
| 927 | - description: | ||
| 928 | - name: source_gen | ||
| 929 | - sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" | ||
| 930 | - url: "https://pub.dev" | ||
| 931 | - source: hosted | ||
| 932 | - version: "2.0.0" | ||
| 933 | - source_helper: | ||
| 934 | - dependency: transitive | ||
| 935 | - description: | ||
| 936 | - name: source_helper | ||
| 937 | - sha256: a447acb083d3a5ef17f983dd36201aeea33fedadb3228fa831f2f0c92f0f3aca | ||
| 938 | - url: "https://pub.dev" | ||
| 939 | - source: hosted | ||
| 940 | - version: "1.3.7" | ||
| 941 | source_span: | 917 | source_span: |
| 942 | dependency: transitive | 918 | dependency: transitive |
| 943 | description: | 919 | description: |
| @@ -990,18 +966,18 @@ packages: | @@ -990,18 +966,18 @@ packages: | ||
| 990 | dependency: transitive | 966 | dependency: transitive |
| 991 | description: | 967 | description: |
| 992 | name: stack_trace | 968 | name: stack_trace |
| 993 | - sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" | 969 | + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" |
| 994 | url: "https://pub.dev" | 970 | url: "https://pub.dev" |
| 995 | source: hosted | 971 | source: hosted |
| 996 | - version: "1.12.0" | 972 | + version: "1.12.1" |
| 997 | stream_channel: | 973 | stream_channel: |
| 998 | dependency: transitive | 974 | dependency: transitive |
| 999 | description: | 975 | description: |
| 1000 | name: stream_channel | 976 | name: stream_channel |
| 1001 | - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 | 977 | + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" |
| 1002 | url: "https://pub.dev" | 978 | url: "https://pub.dev" |
| 1003 | source: hosted | 979 | source: hosted |
| 1004 | - version: "2.1.2" | 980 | + version: "2.1.4" |
| 1005 | stream_transform: | 981 | stream_transform: |
| 1006 | dependency: transitive | 982 | dependency: transitive |
| 1007 | description: | 983 | description: |
| @@ -1030,10 +1006,10 @@ packages: | @@ -1030,10 +1006,10 @@ packages: | ||
| 1030 | dependency: "direct main" | 1006 | dependency: "direct main" |
| 1031 | description: | 1007 | description: |
| 1032 | name: table_calendar | 1008 | name: table_calendar |
| 1033 | - sha256: b2896b7c86adf3a4d9c911d860120fe3dbe03c85db43b22fd61f14ee78cdbb63 | 1009 | + sha256: "0c0c6219878b363a2d5f40c7afb159d845f253d061dc3c822aa0d5fe0f721982" |
| 1034 | url: "https://pub.dev" | 1010 | url: "https://pub.dev" |
| 1035 | source: hosted | 1011 | source: hosted |
| 1036 | - version: "3.1.3" | 1012 | + version: "3.2.0" |
| 1037 | term_glyph: | 1013 | term_glyph: |
| 1038 | dependency: transitive | 1014 | dependency: transitive |
| 1039 | description: | 1015 | description: |
| @@ -1046,10 +1022,10 @@ packages: | @@ -1046,10 +1022,10 @@ packages: | ||
| 1046 | dependency: transitive | 1022 | dependency: transitive |
| 1047 | description: | 1023 | description: |
| 1048 | name: test_api | 1024 | name: test_api |
| 1049 | - sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" | 1025 | + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 |
| 1050 | url: "https://pub.dev" | 1026 | url: "https://pub.dev" |
| 1051 | source: hosted | 1027 | source: hosted |
| 1052 | - version: "0.7.3" | 1028 | + version: "0.7.7" |
| 1053 | timing: | 1029 | timing: |
| 1054 | dependency: transitive | 1030 | dependency: transitive |
| 1055 | description: | 1031 | description: |
| @@ -1078,10 +1054,10 @@ packages: | @@ -1078,10 +1054,10 @@ packages: | ||
| 1078 | dependency: transitive | 1054 | dependency: transitive |
| 1079 | description: | 1055 | description: |
| 1080 | name: vector_math | 1056 | name: vector_math |
| 1081 | - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" | 1057 | + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b |
| 1082 | url: "https://pub.dev" | 1058 | url: "https://pub.dev" |
| 1083 | source: hosted | 1059 | source: hosted |
| 1084 | - version: "2.1.4" | 1060 | + version: "2.2.0" |
| 1085 | vm_service: | 1061 | vm_service: |
| 1086 | dependency: transitive | 1062 | dependency: transitive |
| 1087 | description: | 1063 | description: |
| @@ -1135,8 +1111,8 @@ packages: | @@ -1135,8 +1111,8 @@ packages: | ||
| 1135 | dependency: transitive | 1111 | dependency: transitive |
| 1136 | description: | 1112 | description: |
| 1137 | path: "packages/webview_flutter/webview_flutter_android" | 1113 | path: "packages/webview_flutter/webview_flutter_android" |
| 1138 | - ref: "br_webview_flutter-v4.13.0_ohos" | ||
| 1139 | - resolved-ref: "8d70938aa190eb7d7cd4d66f0d16fddb3c2d03ba" | 1114 | + ref: de942e79c9057b32ad31106508bd87c0d60aef83 |
| 1115 | + resolved-ref: de942e79c9057b32ad31106508bd87c0d60aef83 | ||
| 1140 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" | 1116 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" |
| 1141 | source: git | 1117 | source: git |
| 1142 | version: "4.7.0" | 1118 | version: "4.7.0" |
| @@ -1144,8 +1120,8 @@ packages: | @@ -1144,8 +1120,8 @@ packages: | ||
| 1144 | dependency: transitive | 1120 | dependency: transitive |
| 1145 | description: | 1121 | description: |
| 1146 | path: "packages/webview_flutter/webview_flutter_ohos" | 1122 | path: "packages/webview_flutter/webview_flutter_ohos" |
| 1147 | - ref: "br_webview_flutter-v4.13.0_ohos" | ||
| 1148 | - resolved-ref: "8d70938aa190eb7d7cd4d66f0d16fddb3c2d03ba" | 1123 | + ref: de942e79c9057b32ad31106508bd87c0d60aef83 |
| 1124 | + resolved-ref: de942e79c9057b32ad31106508bd87c0d60aef83 | ||
| 1149 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" | 1125 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" |
| 1150 | source: git | 1126 | source: git |
| 1151 | version: "4.7.0" | 1127 | version: "4.7.0" |
| @@ -1153,8 +1129,8 @@ packages: | @@ -1153,8 +1129,8 @@ packages: | ||
| 1153 | dependency: transitive | 1129 | dependency: transitive |
| 1154 | description: | 1130 | description: |
| 1155 | path: "packages/webview_flutter/webview_flutter_platform_interface" | 1131 | path: "packages/webview_flutter/webview_flutter_platform_interface" |
| 1156 | - ref: "br_webview_flutter-v4.13.0_ohos" | ||
| 1157 | - resolved-ref: "8d70938aa190eb7d7cd4d66f0d16fddb3c2d03ba" | 1132 | + ref: de942e79c9057b32ad31106508bd87c0d60aef83 |
| 1133 | + resolved-ref: de942e79c9057b32ad31106508bd87c0d60aef83 | ||
| 1158 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" | 1134 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" |
| 1159 | source: git | 1135 | source: git |
| 1160 | version: "2.13.1" | 1136 | version: "2.13.1" |
| @@ -1162,8 +1138,8 @@ packages: | @@ -1162,8 +1138,8 @@ packages: | ||
| 1162 | dependency: transitive | 1138 | dependency: transitive |
| 1163 | description: | 1139 | description: |
| 1164 | path: "packages/webview_flutter/webview_flutter_wkwebview" | 1140 | path: "packages/webview_flutter/webview_flutter_wkwebview" |
| 1165 | - ref: "br_webview_flutter-v4.13.0_ohos" | ||
| 1166 | - resolved-ref: "8d70938aa190eb7d7cd4d66f0d16fddb3c2d03ba" | 1141 | + ref: de942e79c9057b32ad31106508bd87c0d60aef83 |
| 1142 | + resolved-ref: de942e79c9057b32ad31106508bd87c0d60aef83 | ||
| 1167 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" | 1143 | url: "https://gitcode.com/openharmony-tpc/flutter_packages.git" |
| 1168 | source: git | 1144 | source: git |
| 1169 | version: "3.22.0" | 1145 | version: "3.22.0" |
| @@ -1184,5 +1160,5 @@ packages: | @@ -1184,5 +1160,5 @@ packages: | ||
| 1184 | source: hosted | 1160 | source: hosted |
| 1185 | version: "3.1.3" | 1161 | version: "3.1.3" |
| 1186 | sdks: | 1162 | sdks: |
| 1187 | - dart: ">=3.6.2 <4.0.0" | 1163 | + dart: ">=3.8.0-0 <4.0.0" |
| 1188 | flutter: ">=3.27.0" | 1164 | flutter: ">=3.27.0" |
| @@ -13,7 +13,6 @@ dependencies: | @@ -13,7 +13,6 @@ dependencies: | ||
| 13 | get: ^4.7.2 | 13 | get: ^4.7.2 |
| 14 | dio: ^5.7.0 | 14 | dio: ^5.7.0 |
| 15 | pretty_dio_logger: ^1.4.0 | 15 | pretty_dio_logger: ^1.4.0 |
| 16 | - json_annotation: ^4.9.0 | ||
| 17 | cached_network_image: ^3.4.1 | 16 | cached_network_image: ^3.4.1 |
| 18 | fl_chart: ^0.70.2 | 17 | fl_chart: ^0.70.2 |
| 19 | logger: ^2.6.2 | 18 | logger: ^2.6.2 |
| @@ -43,7 +42,7 @@ dependencies: | @@ -43,7 +42,7 @@ dependencies: | ||
| 43 | url: https://gitcode.com/openharmony-sig/flutter_permission_handler.git | 42 | url: https://gitcode.com/openharmony-sig/flutter_permission_handler.git |
| 44 | path: permission_handler_ohos | 43 | path: permission_handler_ohos |
| 45 | ref: br_permission_handler_v11.3.1_ohos | 44 | ref: br_permission_handler_v11.3.1_ohos |
| 46 | - intl: ^0.19.0 | 45 | + intl: ^0.20.2 |
| 47 | flutter_localizations: | 46 | flutter_localizations: |
| 48 | sdk: flutter | 47 | sdk: flutter |
| 49 | table_calendar: ^3.1.3 | 48 | table_calendar: ^3.1.3 |
| @@ -54,7 +53,6 @@ dev_dependencies: | @@ -54,7 +53,6 @@ dev_dependencies: | ||
| 54 | sdk: flutter | 53 | sdk: flutter |
| 55 | flutter_lints: ^5.0.0 | 54 | flutter_lints: ^5.0.0 |
| 56 | build_runner: ^2.4.15 | 55 | build_runner: ^2.4.15 |
| 57 | - json_serializable: ^6.9.5 | ||
| 58 | pigeon: | 56 | pigeon: |
| 59 | git: | 57 | git: |
| 60 | url: https://gitcode.com/openharmony-sig/flutter_packages.git | 58 | url: https://gitcode.com/openharmony-sig/flutter_packages.git |
-
Please register or login to post a comment