mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 08:07:56 +00:00
profile
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user