Files
umbrix/lib/features/profile_detail/notifier/profile_detail_state.dart
problematicconsumer b617c95f62 initial
2023-07-06 17:18:41 +03:30

23 lines
762 B
Dart

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hiddify/domain/profiles/profiles.dart';
import 'package:hiddify/utils/utils.dart';
part 'profile_detail_state.freezed.dart';
@freezed
class ProfileDetailState with _$ProfileDetailState {
const ProfileDetailState._();
const factory ProfileDetailState({
required Profile profile,
@Default(false) bool isEditing,
@Default(false) bool showErrorMessages,
@Default(MutationState.initial()) MutationState<ProfileFailure> save,
@Default(MutationState.initial()) MutationState<ProfileFailure> delete,
}) = _ProfileDetailState;
bool get isBusy =>
(save.isInProgress || save is MutationSuccess) ||
(delete.isInProgress || delete is MutationSuccess);
}