feat(settings): User Avatar display

This commit is contained in:
2024-04-23 12:14:53 +03:00
parent 8392135698
commit 94f61f733b
3 changed files with 22 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
import 'bloc/chat_bloc.dart';
/*import 'bloc/chat_bloc.dart';
import 'models/chat_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
@@ -722,5 +722,4 @@ class ChatScreen extends StatelessWidget {
NavigatorService.goBack();
}
}
_
*/

View File

@@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:hive/hive.dart';
import 'package:flutter/services.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:http/http.dart' as http;
import 'package:fl_chart/fl_chart.dart';
import 'package:intl/intl.dart';
@@ -55,12 +56,7 @@ class MyProfileScreen extends StatelessWidget {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(
context,
((state.userDetails?['first_name'] ?? '') +
' ' +
(state.userDetails?['last_name'] ?? '')) ??
'loading'.tr),
appBar: _buildAppBar(context, state),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 8.h, vertical: 18.v),
@@ -83,16 +79,29 @@ class MyProfileScreen extends StatelessWidget {
}
/// Section Widget
_buildAppBar(BuildContext context, String username) {
_buildAppBar(BuildContext context, MyProfileLoadedState state) {
print(state.user?['profile_photo_url']);
return CustomAppBar(
height: 54.v,
leadingWidth: 28.h,
title: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Row(children: [
AppbarTitleCircleimage(imagePath: ImageConstant.imgEllipse1),
CachedNetworkImage(
imageUrl: state.user?['profile_photo_url'],
imageBuilder: (context, imageProvider) => CircleAvatar(
backgroundImage: imageProvider,
radius: 20,
),
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) => CircleAvatar(
child: Icon(Icons.error),
backgroundColor: Colors.red,
radius: 20,
),
),
AppbarSubtitle(
text: username,
text: state.user?['name'],
margin: EdgeInsets.only(left: 35.h, top: 12.v, bottom: 9.v))
])),
actions: [

View File

@@ -20,7 +20,7 @@ import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart';
import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart';
import 'package:eatvio_app/presentation/profile/my_profile_screen/my_settings_screen.dart';
import 'package:eatvio_app/presentation/diary/diary_edit_screen/diary_edit_screen.dart';
import 'package:eatvio_app/presentation/chat/chat_screen/chat_screen.dart';
//import 'package:eatvio_app/presentation/chat/chat_screen/chat_screen.dart';
import 'package:eatvio_app/presentation/chat/chat_select_screen/chat_select_screen.dart';
class AppRoutes {
@@ -101,7 +101,7 @@ class AppRoutes {
myProfile: MyProfileScreen.builder,
mySettings: MySettingsScreen.builder,
diaryEdit: DiaryEditScreen.builder,
chatScreen: ChatScreen.builder,
//chatScreen: ChatScreen.builder,
chatSelectScreen: ChatSelectScreen.builder,
};
}