elCaribe app - customization and branding

This commit is contained in:
2025-12-12 19:09:42 -04:00
parent 9e5d0d8ebf
commit ba7deac9f3
402 changed files with 31833 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:news/data/models/CategoryModel.dart';
import 'package:news/data/repositories/SubCategory/subCatRepository.dart';
abstract class SubCategoryState {}
class SubCategoryInitial extends SubCategoryState {}
class SubCategoryFetchInProgress extends SubCategoryState {}
class SubCategoryFetchSuccess extends SubCategoryState {
final List<SubCategoryModel> subCategory;
SubCategoryFetchSuccess({required this.subCategory});
}
class SubCategoryFetchFailure extends SubCategoryState {
final String errorMessage;
SubCategoryFetchFailure(this.errorMessage);
}
class SubCategoryCubit extends Cubit<SubCategoryState> {
final SubCategoryRepository _subCategoryRepository;
SubCategoryCubit(this._subCategoryRepository) : super(SubCategoryInitial());
void getSubCategory({required BuildContext context, required String catId, required String langId}) async {
try {
emit(SubCategoryFetchInProgress());
final result = await _subCategoryRepository.getSubCategory(context: context, catId: catId, langId: langId);
emit(SubCategoryFetchSuccess(subCategory: result['SubCategory']));
} catch (e) {
emit(SubCategoryFetchFailure(e.toString()));
}
}
}