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
28 lines
1.0 KiB
import 'package:data/app_setting_data/repository/app_setting_box_repository_impl.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:local_db_core/lib/boxes/box_list/setting_box/app_setting_box.dart';
|
|
import 'package:repositories/app_setting_box_domain/repository/app_setting_box_repository.dart';
|
|
import 'package:sonnat/core/utils/base_cubit_type.dart';
|
|
|
|
class SplashCubit extends Cubit<BaseCubitType<SplashCubitState>> {
|
|
final AppSettingBoxRepository _repository = AppSettingBoxRepositoryImpl(appSettingBox: AppSettingBox());
|
|
|
|
SplashCubit() : super(BaseCubitType(eventName: SplashCubitState.empty));
|
|
|
|
void empty() => emit(BaseCubitType(eventName: SplashCubitState.empty));
|
|
|
|
Future<void> checkLanguageSet() async {
|
|
String? language = _repository.getCurrentLanguage();
|
|
if (language == null || language == '') {
|
|
emit(BaseCubitType(eventName: SplashCubitState.notSet));
|
|
} else {
|
|
emit(BaseCubitType(eventName: SplashCubitState.set));
|
|
}
|
|
}
|
|
}
|
|
|
|
enum SplashCubitState {
|
|
empty,
|
|
set,
|
|
notSet,
|
|
}
|