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,39 @@
import 'package:news/data/models/NewsModel.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:news/data/repositories/NewsById/NewsByIdRepository.dart';
abstract class NewsByIdState {}
class NewsByIdInitial extends NewsByIdState {}
class NewsByIdFetchInProgress extends NewsByIdState {}
class NewsByIdFetchSuccess extends NewsByIdState {
final List<NewsModel> newsById;
NewsByIdFetchSuccess({required this.newsById});
}
class NewsByIdFetchFailure extends NewsByIdState {
final String errorMessage;
NewsByIdFetchFailure(this.errorMessage);
}
class NewsByIdCubit extends Cubit<NewsByIdState> {
final NewsByIdRepository _newsByIdRepository;
NewsByIdCubit(this._newsByIdRepository) : super(NewsByIdInitial());
Future<List<NewsModel>> getNewsById({required String newsId, required String langId}) async {
try {
emit(NewsByIdFetchInProgress());
final result = await _newsByIdRepository.getNewsById(langId: langId, newsId: newsId);
emit(NewsByIdFetchSuccess(newsById: result['NewsById']));
return result['NewsById'];
} catch (e) {
emit(NewsByIdFetchFailure(e.toString()));
return [];
}
}
}