From 104477506640e5e9104c4024dcef456106ded0f9 Mon Sep 17 00:00:00 2001 From: mohammad Date: Tue, 23 Jul 2024 16:28:53 +0300 Subject: [PATCH] profile --- lib/features/menu/bloc/profile_bloc/profile_bloc.dart | 6 +++--- lib/features/menu/view/widgets/profile/profile_view.dart | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/features/menu/bloc/profile_bloc/profile_bloc.dart b/lib/features/menu/bloc/profile_bloc/profile_bloc.dart index 821aeb5..7b0f77a 100644 --- a/lib/features/menu/bloc/profile_bloc/profile_bloc.dart +++ b/lib/features/menu/bloc/profile_bloc/profile_bloc.dart @@ -67,6 +67,7 @@ class ProfileBloc extends Bloc { 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 { } Future _saveImage() async { - emit(ChangeImageState()); + emit(LoadingInitialState()); List imageBytes = image!.readAsBytesSync(); String base64Image = base64Encode(imageBytes); print(base64Image); @@ -184,7 +185,6 @@ class ProfileBloc extends Bloc { emit(ImageSelectedState()); } - void _showPermissionDeniedDialog(BuildContext context) { showDialog( context: context, @@ -217,7 +217,7 @@ class ProfileBloc extends Bloc { try { add(const ChangeNameEvent(value: false)); isSaving = true; - emit(LoadingSaveState()); + emit(LoadingInitialState()); final fullName = nameController.text; final nameParts = fullName.split(' '); final firstName = nameParts[0]; diff --git a/lib/features/menu/view/widgets/profile/profile_view.dart b/lib/features/menu/view/widgets/profile/profile_view.dart index 4fcc965..ad0e30c 100644 --- a/lib/features/menu/view/widgets/profile/profile_view.dart +++ b/lib/features/menu/view/widgets/profile/profile_view.dart @@ -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,