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,43 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:news/utils/api.dart';
import 'package:news/utils/strings.dart';
abstract class AuthorState {}
class AuthorInitial extends AuthorState {}
class AuthorInProgress extends AuthorState {}
class AuthorApproved extends AuthorState {
AuthorApproved();
}
class AuthorRequestSent extends AuthorState {
final String responseMessage;
AuthorRequestSent(this.responseMessage);
}
class AuthorPending extends AuthorState {
final String errorMessage;
AuthorPending(this.errorMessage);
}
class AuthorRejected extends AuthorState {
final String errorMessage;
AuthorRejected(this.errorMessage);
}
class AuthorCubit extends Cubit<AuthorState> {
AuthorCubit() : super(AuthorInitial());
void requestToBecomeAuthor() async {
try {
final result = await Api.sendApiRequest(body: {}, url: Api.becomeAnAuthorApi);
(!result[ERROR]) ? emit(AuthorRequestSent(result[MESSAGE])) : emit(AuthorPending(result[MESSAGE]));
} catch (e) {
emit(AuthorPending(e.toString()));
}
}
}