This commit is contained in:
mohammad
2024-07-23 16:28:53 +03:00
parent e5e839248d
commit 1044775066
2 changed files with 7 additions and 4 deletions
@@ -67,6 +67,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
try {
emit(LoadingInitialState());
AuthCubit.user = await ProfileApi.fetchUserInfo(AuthCubit.user!.uuid);
emit(SaveState());
} catch (e) {
emit(FailedState(errorMessage: e.toString()));
return;
@@ -176,7 +177,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}
Future<void> _saveImage() async {
emit(ChangeImageState());
emit(LoadingInitialState());
List<int> imageBytes = image!.readAsBytesSync();
String base64Image = base64Encode(imageBytes);
print(base64Image);
@@ -184,7 +185,6 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
emit(ImageSelectedState());
}
void _showPermissionDeniedDialog(BuildContext context) {
showDialog(
context: context,
@@ -217,7 +217,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
try {
add(const ChangeNameEvent(value: false));
isSaving = true;
emit(LoadingSaveState());
emit(LoadingInitialState());
final fullName = nameController.text;
final nameParts = fullName.split(' ');
final firstName = nameParts[0];
@@ -28,7 +28,10 @@ class ProfileView extends StatelessWidget {
Uint8List? imageBytes = profileBloc.decodeBase64Image(AuthCubit.user!.profilePicture);
return DefaultScaffold(
title: 'Syncrow Account',
child: Column(
child:
state is LoadingInitialState
? const Center(child: CircularProgressIndicator()):
Column(
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.05,