forked from eatvio/eatvio_app
48 lines
2.0 KiB
Dart
48 lines
2.0 KiB
Dart
import 'package:eatvio_app/features/insights/models/insights_payload_model.dart';
|
|
import 'package:eatvio_app/features/insights/models/insights_period.dart';
|
|
import 'package:eatvio_app/features/insights/presentation/cubit/insights_panel.dart';
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'insights_state.freezed.dart';
|
|
|
|
/// Видимость серий (чипы под графиком): `true` — серия показана.
|
|
@freezed
|
|
abstract class InsightsSeriesVisibility with _$InsightsSeriesVisibility {
|
|
const factory InsightsSeriesVisibility({
|
|
/// Талия, Грудь, Бёдра.
|
|
@Default([true, true, true]) List<bool> measure,
|
|
|
|
/// Калории, Белки, Жиры, Углеводы.
|
|
@Default([true, true, true, true]) List<bool> daily,
|
|
|
|
/// Белки, Жиры, Углеводы, Сытость, Настроение.
|
|
@Default([true, true, true, true, true]) List<bool> intra,
|
|
}) = _InsightsSeriesVisibility;
|
|
}
|
|
|
|
@freezed
|
|
abstract class InsightsState with _$InsightsState {
|
|
const factory InsightsState.initial() = InsightsStateInitial;
|
|
|
|
const factory InsightsState.loading() = InsightsStateLoading;
|
|
|
|
/// 403: данные недоступны, блок не показывается.
|
|
const factory InsightsState.hidden() = InsightsStateHidden;
|
|
|
|
const factory InsightsState.error({required String message}) =
|
|
InsightsStateError;
|
|
|
|
const factory InsightsState.loaded({
|
|
required InsightsPayloadModel payload,
|
|
@Default(BodyPeriod.threeMonths) BodyPeriod bodyPeriod,
|
|
@Default(InsightsPanel.weight) InsightsPanel panel,
|
|
@Default(InsightsSeriesVisibility())
|
|
InsightsSeriesVisibility seriesVisibility,
|
|
@Default(true) bool showSleep,
|
|
@Default(false) bool isExpanded,
|
|
|
|
/// Идёт перезапрос (смена периода / обновление) — старые данные остаются на экране.
|
|
@Default(false) bool isRefreshing,
|
|
}) = InsightsStateLoaded;
|
|
}
|