Sonnat Project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.0 KiB

1 year ago
1 year ago
1 year ago
  1. import 'package:data/app_setting_data/repository/app_setting_box_repository_impl.dart';
  2. import 'package:flutter_bloc/flutter_bloc.dart';
  3. import 'package:local_db_core/lib/boxes/box_list/setting_box/app_setting_box.dart';
  4. import 'package:repositories/app_setting_box_domain/repository/app_setting_box_repository.dart';
  5. import 'package:sonnat/core/utils/base_cubit_type.dart';
  6. class SplashCubit extends Cubit<BaseCubitType<SplashCubitState>> {
  7. final AppSettingBoxRepository _repository = AppSettingBoxRepositoryImpl(appSettingBox: AppSettingBox());
  8. SplashCubit() : super(BaseCubitType(eventName: SplashCubitState.empty));
  9. void empty() => emit(BaseCubitType(eventName: SplashCubitState.empty));
  10. Future<void> checkLanguageSet() async {
  11. String? language = _repository.getCurrentLanguage();
  12. if (language == null || language == '') {
  13. emit(BaseCubitType(eventName: SplashCubitState.notSet));
  14. } else {
  15. emit(BaseCubitType(eventName: SplashCubitState.set));
  16. }
  17. }
  18. }
  19. enum SplashCubitState {
  20. empty,
  21. set,
  22. notSet,
  23. }