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,61 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:news/cubits/Auth/authCubit.dart';
import 'package:news/data/models/AuthModel.dart';
import 'package:news/data/repositories/Auth/authRepository.dart';
abstract class UpdateUserState {}
class UpdateUserInitial extends UpdateUserState {}
class UpdateUserFetchInProgress extends UpdateUserState {}
class UpdateUserFetchSuccess extends UpdateUserState {
AuthModel? updatedUser;
String? imgUpdatedPath;
UpdateUserFetchSuccess({this.updatedUser, this.imgUpdatedPath});
}
class UpdateUserFetchFailure extends UpdateUserState {
final String errorMessage;
UpdateUserFetchFailure(this.errorMessage);
}
class UpdateUserCubit extends Cubit<UpdateUserState> {
final AuthRepository _updateUserRepository;
UpdateUserCubit(this._updateUserRepository) : super(UpdateUserInitial());
void setUpdateUser(
{String? name,
String? mobile,
String? email,
String? filePath,
required BuildContext context,
String? authorBio,
String? whatsappLink,
String? facebookLink,
String? telegramLink,
String? linkedInLink}) async {
try {
emit(UpdateUserFetchInProgress());
final Map<String, dynamic> result = await _updateUserRepository.updateUserData(
mobile: mobile,
name: name,
email: email,
filePath: filePath,
authorBio: authorBio,
whatsappLink: whatsappLink,
facebookLink: facebookLink,
telegramLink: telegramLink,
linkedInLink: linkedInLink);
//only incase of name,mobile & mail, not Profile Picture
context.read<AuthCubit>().updateDetails(authModel: AuthModel.fromJson(result["data"]));
emit(UpdateUserFetchSuccess(updatedUser: AuthModel.fromJson(result["data"])));
} catch (e) {
emit(UpdateUserFetchFailure(e.toString()));
}
}
}