Merge pull request 'Отображение аватара пользователя в профиле' (#45) from maxxkim/eatvio_app:diary into main

Reviewed-on: eatvio/eatvio_app#45
Reviewed-by: apoloz <anatoliy.poloz@gmail.com>
This commit is contained in:
apoloz
2024-04-23 13:25:54 +00:00
12 changed files with 1059 additions and 113 deletions

View File

@@ -0,0 +1,4 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 27C22.4183 27 26 23.4183 26 19C26 14.5817 22.4183 11 18 11C13.5817 11 10 14.5817 10 19C10 23.4183 13.5817 27 18 27Z" stroke="#7B8794" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M28.0004 28.9999L23.6504 24.6499" stroke="#7B8794" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 442 B

View File

@@ -14,6 +14,7 @@ class ImageConstant {
static String imageNotFound = 'assets/images/image_not_found.png';
static String imaGlass = 'assets/images/image_glass.svg';
// Настройки images
static String imgClose = '$imagePath/img_close.svg';

View File

@@ -1,7 +1,8 @@
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';
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
class ChatScreen extends StatelessWidget {
const ChatScreen({Key? key}) : super(key: key);
@@ -15,6 +16,710 @@ class ChatScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return Container();
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppbar(context),
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
SizedBox(height: 13.v),
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
height: 34.v,
width: 211.h,
margin: EdgeInsets.only(right: 17.h),
child: Stack(
alignment: Alignment.bottomRight,
children: [
CustomImageView(
imagePath: ImageConstant.imgPath,
height: 34.v,
width: 211.h,
alignment: Alignment.center,
),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: EdgeInsets.only(
right: 9.h,
bottom: 4.v,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(bottom: 1.v),
child: Text(
"msg_food_is_amazing".tr,
style: theme.textTheme.bodyLarge,
),
),
Padding(
padding: EdgeInsets.only(
left: 7.h,
top: 7.v,
),
child: Text(
"lbl_10_10".tr,
style: theme.textTheme.bodySmall,
),
),
CustomImageView(
imagePath:
ImageConstant.imgCheckmarkBlueA400,
height: 7.v,
width: 14.h,
margin: EdgeInsets.only(
left: 2.h,
top: 9.v,
bottom: 4.v,
),
)
],
),
),
)
],
),
),
SizedBox(height: 8.v),
Padding(
padding: EdgeInsets.only(
left: 84.h,
right: 17.h,
),
child: _buildColumncheckmark(
context,
imageOne: ImageConstant.imgRectangle,
time: "lbl_10_15".tr,
),
),
SizedBox(height: 8.v),
Padding(
padding: EdgeInsets.only(
left: 84.h,
right: 17.h,
),
child: _buildColumncheckmark(
context,
imageOne: ImageConstant.imgRectangle186x254,
time: "lbl_10_15".tr,
),
),
SizedBox(height: 20.v),
Align(
alignment: Alignment.centerLeft,
child: Container(
margin: EdgeInsets.only(
left: 10.h,
right: 77.h,
),
padding: EdgeInsets.symmetric(
horizontal: 11.h,
vertical: 4.v,
),
decoration: BoxDecoration(
image: DecorationImage(
image: fs.Svg(
ImageConstant.imgGroup14,
),
fit: BoxFit.cover,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 3.v),
Padding(
padding: EdgeInsets.only(left: 7.h),
child: Row(
children: [
SizedBox(
height: 33.v,
child: VerticalDivider(
width: 2.h,
thickness: 2.v,
endIndent: 1.h,
),
),
Padding(
padding: EdgeInsets.only(left: 8.h),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"lbl_martha_craig".tr,
style: CustomTextStyles
.bodyMediumLightblueA70001,
),
Text(
"lbl_good_morning".tr,
style: CustomTextStyles
.bodyMediumBluegray800_1,
)
],
),
)
],
),
),
SizedBox(height: 4.v),
Padding(
padding: EdgeInsets.only(left: 6.h),
child: Row(
children: [
Text(
"msg_do_you_know_what".tr,
style: theme.textTheme.bodyLarge,
),
Padding(
padding: EdgeInsets.only(
left: 14.h,
top: 8.v,
),
child: Text(
"lbl_11_40".tr,
style: CustomTextStyles
.bodySmallBluegray40001,
),
)
],
),
)
],
),
),
),
SizedBox(height: 20.v),
Container(
height: 34.v,
width: 266.h,
margin: EdgeInsets.only(right: 11.h),
child: Stack(
alignment: Alignment.topCenter,
children: [
CustomImageView(
imagePath: ImageConstant.imgPathGray50,
height: 34.v,
width: 266.h,
alignment: Alignment.center,
),
Align(
alignment: Alignment.topCenter,
child: Padding(
padding: EdgeInsets.only(top: 2.v),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(top: 4.v),
child: Text(
"msg_it_s_morning_in".tr,
style: theme.textTheme.bodyLarge,
),
),
CustomImageView(
imagePath: ImageConstant.img,
height: 19.v,
width: 17.h,
margin: EdgeInsets.only(
left: 10.h,
bottom: 7.v,
),
),
Padding(
padding: EdgeInsets.only(
left: 14.h,
top: 12.v,
),
child: Text(
"lbl_11_43".tr,
style: theme.textTheme.bodySmall,
),
),
CustomImageView(
imagePath:
ImageConstant.imgCheckmarkBlueA400,
height: 7.v,
width: 14.h,
margin: EdgeInsets.only(
left: 2.h,
top: 13.v,
bottom: 5.v,
),
)
],
),
),
)
],
),
),
SizedBox(height: 20.v),
Align(
alignment: Alignment.centerLeft,
child: Container(
width: 281.h,
margin: EdgeInsets.only(
left: 17.h,
right: 76.h,
),
padding: EdgeInsets.symmetric(
horizontal: 11.h,
vertical: 2.v,
),
decoration: BoxDecoration(
image: DecorationImage(
image: fs.Svg(
ImageConstant.imgGroup76,
),
fit: BoxFit.cover,
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Container(
width: 191.h,
margin: EdgeInsets.only(top: 3.v),
child: Text(
"msg_what_is_the_most".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.bodyLarge!.copyWith(
height: 1.29,
),
),
),
),
Padding(
padding: EdgeInsets.only(
left: 38.h,
top: 34.v,
),
child: Text(
"lbl_11_45".tr,
style: CustomTextStyles.bodySmallBluegray40001,
),
)
],
),
),
),
SizedBox(height: 8.v),
Align(
alignment: Alignment.centerLeft,
child: Container(
height: 34.v,
width: 178.h,
margin: EdgeInsets.only(left: 10.h),
child: Stack(
alignment: Alignment.bottomCenter,
children: [
CustomImageView(
imagePath: ImageConstant.imgGroup14,
height: 34.v,
width: 178.h,
alignment: Alignment.center,
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.only(bottom: 3.v),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 1.v),
child: Text(
"lbl_do_you_like_it".tr,
style: theme.textTheme.bodyLarge,
),
),
Padding(
padding: EdgeInsets.only(
left: 1.h,
top: 8.v,
),
child: Text(
"lbl_11_45".tr,
style: CustomTextStyles
.bodySmallBluegray40001,
),
)
],
),
),
)
],
),
),
),
SizedBox(height: 20.v),
Container(
height: 34.v,
width: 218.h,
margin: EdgeInsets.only(right: 17.h),
child: Stack(
alignment: Alignment.bottomCenter,
children: [
CustomImageView(
imagePath: ImageConstant.imgPath,
height: 34.v,
width: 218.h,
alignment: Alignment.center,
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.only(bottom: 4.v),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"msg_i_think_top_two".tr,
style: theme.textTheme.bodyLarge,
),
Padding(
padding: EdgeInsets.only(
left: 12.h,
top: 7.v,
),
child: Text(
"lbl_11_50".tr,
style: theme.textTheme.bodySmall,
),
),
CustomImageView(
imagePath:
ImageConstant.imgCheckmarkBlueA400,
height: 7.v,
width: 14.h,
margin: EdgeInsets.only(
left: 2.h,
top: 9.v,
bottom: 4.v,
),
)
],
),
),
)
],
),
),
SizedBox(height: 8.v),
Container(
width: 235.h,
margin: EdgeInsets.only(
left: 123.h,
right: 16.h,
),
padding: EdgeInsets.symmetric(
horizontal: 9.h,
vertical: 2.v,
),
decoration: BoxDecoration(
image: DecorationImage(
image: fs.Svg(
ImageConstant.imgGroup11,
),
fit: BoxFit.cover,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 20.v),
Padding(
padding: EdgeInsets.only(left: 14.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomImageView(
imagePath: ImageConstant.imgDownload,
height: 40.adaptSize,
width: 40.adaptSize,
margin: EdgeInsets.only(bottom: 2.v),
),
Padding(
padding: EdgeInsets.only(
left: 31.h,
top: 5.v,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"lbl7".tr,
style:
CustomTextStyles.bodyLargeBlueA400,
),
Text(
"lbl_2_8_mb".tr,
style:
CustomTextStyles.bodyMediumBlueA400,
)
],
),
)
],
),
),
SizedBox(height: 4.v),
_buildRowcheckmark(
context,
time: "lbl_11_51".tr,
)
],
),
),
SizedBox(height: 30.v),
_buildRowattachone(context)
],
),
),
)
],
),
),
bottomNavigationBar: _buildBottomBar(context),
);
}
/// Section Widget
_buildAppbar(BuildContext context) {
return CustomAppBar(
leadingWidth: 26.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(
left: 16.h,
top: 18.v,
bottom: 25.v,
),
onTap: () {
onTapArrowleftone(context);
},
),
title: Padding(
padding: EdgeInsets.only(left: 12.h),
child: Row(
children: [
AppbarTitleCircleimage(
imagePath: ImageConstant.imgOval40x40,
margin: EdgeInsets.only(bottom: 3.v),
),
Padding(
padding: EdgeInsets.only(
left: 12.h,
top: 2.v,
),
child: Column(
children: [
AppbarTitle(
text: "lbl2".tr,
),
SizedBox(height: 3.v),
AppbarSubtitle(
text: "msg_12_30".tr,
margin: EdgeInsets.only(right: 38.h),
)
],
),
)
],
),
),
styleType: Style.bgFill,
);
}
/// Section Widget
Widget _buildRowattachone(BuildContext context) {
return Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: 7.h,
vertical: 6.v,
),
decoration: AppDecoration.outlineGray,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomImageView(
imagePath: ImageConstant.imgAttach,
height: 29.adaptSize,
width: 29.adaptSize,
margin: EdgeInsets.only(
top: 1.v,
bottom: 6.v,
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(
left: 4.h,
bottom: 4.v,
),
child: BlocSelector<ChatBloc, ChatState, TextEditingController?>(
selector: (state) => state.messageController,
builder: (context, messageController) {
return CustomTextFormField(
controller: messageController,
hintText: "lbl_message".tr,
textInputAction: TextInputAction.done,
);
},
),
),
),
CustomImageView(
imagePath: ImageConstant.imgMenu,
height: 24.v,
width: 18.h,
margin: EdgeInsets.only(
left: 11.h,
top: 4.v,
bottom: 8.v,
),
)
],
),
);
}
/// Section Widget
_buildBottomBar(BuildContext context) {
return CustomBottomBar(onChanged: (BottomBarEnum type) {});
}
/// Common widget
Widget _buildColumncheckmark(
BuildContext context, {
required String imageOne,
required String time,
}) {
return Container(
padding: EdgeInsets.all(9.h),
decoration: BoxDecoration(
image: DecorationImage(
image: fs.Svg(
ImageConstant.imgGroup11,
),
fit: BoxFit.cover,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
CustomImageView(
imagePath: imageOne,
height: 186.v,
width: 254.h,
radius: BorderRadius.circular(
8.h,
),
margin: EdgeInsets.only(right: 1.h),
),
SizedBox(height: 10.v),
Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
time,
style: theme.textTheme.bodySmall!.copyWith(
color: appTheme.blueA400,
),
),
CustomImageView(
imagePath: ImageConstant.imgCheckmarkBlueA400,
height: 7.v,
width: 14.h,
margin: EdgeInsets.only(
left: 3.h,
bottom: 4.v,
),
)
],
)
],
),
);
}
/// Common widget
Widget _buildRowcheckmark(
BuildContext context, {
required String time,
}) {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
time,
style: theme.textTheme.bodySmall!.copyWith(
color: appTheme.blueA400,
),
),
CustomImageView(
imagePath: ImageConstant.imgCheckmarkBlueA400,
height: 7.v,
width: 14.h,
margin: EdgeInsets.only(
left: 2.h,
top: 2.v,
bottom: 3.v,
),
)
],
);
}
///Handling route based on bottom click actions
String getCurrentRoute(BottomBarEnum type) {
switch (type) {
case BottomBarEnum.tf:
return AppRoutes.k1Page;
default:
return "/";
}
}
///Handling page based on route
Widget getCurrentPage(
BuildContext context,
String currentRoute,
) {
switch (currentRoute) {
case AppRoutes.k1Page:
return K1Page.builder(context);
default:
return DefaultWidget();
}
}
/// Navigates to the previous screen.
onTapArrowleftone(BuildContext context) {
NavigatorService.goBack();
}
}
*/

View File

@@ -2,6 +2,7 @@ import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/chat/chat_select_screen/models/chat_select_model.dart';
import 'package:eatvio_app/presentation/chat/chat_select_screen/models/chat_entry.dart'; // ignore: must_be_immutable
part 'chat_select_event.dart';
part 'chat_select_state.dart';
@@ -11,11 +12,38 @@ class ChatSelectBloc extends Bloc<ChatSelectEvent, ChatSelectState> {
on<ChatSelectInitialEvent>(_onInitialize);
}
List<ChatItemModel> fillChatEntryList() {
return [
ChatItemModel(
userImage: ImageConstant.imgLogo,
username: "Ксения Обрамова",
dateText: "9/29",
greetingText: "Привет, хорошая статья"),
ChatItemModel(
userImage: ImageConstant.imgLogo,
username: "Ксения Обрамова",
dateText: "9/29",
greetingText: "Привет, хорошая статья"),
ChatItemModel(
userImage: ImageConstant.imgLogo,
username: "Данил Иванов",
dateText: "9/29",
greetingText: "Посоветуй пожалуйста рецепт..."),
ChatItemModel(
userImage: ImageConstant.imgLogo,
username: "Данил Иванов",
dateText: "9/29",
greetingText: "Посоветуй пожалуйста рецепт...")
];
}
_onInitialize(
ChatSelectInitialEvent event,
Emitter<ChatSelectState> emit,
) async {
emit(state.copyWith(
chatSelectModelObj: state.chatSelectModelObj?.copyWith()));
chatSelectModelObj: state.chatSelectModelObj?.copyWith(
userprofileItemList: fillChatEntryList(),
)));
}
}

View File

@@ -0,0 +1,164 @@
import 'package:flutter/material.dart';
import 'package:eatvio_app/core/app_export.dart';
class CustomSearchView extends StatelessWidget {
CustomSearchView(
{Key? key,
this.alignment,
this.width,
this.scrollPadding,
this.controller,
this.focusNode,
this.autofocus = false,
this.textStyle,
this.textInputType = TextInputType.text,
this.maxLines,
this.hintText,
this.hintStyle,
this.prefix,
this.prefixConstraints,
this.suffix,
this.suffixConstraints,
this.contentPadding,
this.borderDecoration,
this.fillColor,
this.filled = true,
this.validator,
this.onChanged})
: super(
key: key,
);
final Alignment? alignment;
final double? width;
final TextEditingController? scrollPadding;
final TextEditingController? controller;
final FocusNode? focusNode;
final bool? autofocus;
final TextStyle? textStyle;
final TextInputType? textInputType;
final int? maxLines;
final String? hintText;
final TextStyle? hintStyle;
final Widget? prefix;
final BoxConstraints? prefixConstraints;
final Widget? suffix;
final BoxConstraints? suffixConstraints;
final EdgeInsets? contentPadding;
final InputBorder? borderDecoration;
final Color? fillColor;
final bool? filled;
final FormFieldValidator<String>? validator;
final Function(String)? onChanged;
@override
Widget build(BuildContext context) {
return alignment != null
? Align(
alignment: alignment ?? Alignment.center,
child: searchViewWidget(context))
: searchViewWidget(context);
}
searchViewWidget(BuildContext context) => SizedBox(
width: width ?? double.maxFinite,
child: TextFormField(
scrollPadding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
controller: controller,
focusNode: focusNode,
onTapOutside: (event) => onTapOutside(),
autofocus: autofocus!,
style: textStyle ?? CustomTextStyles.bodySmallMulishBluegray800,
keyboardType: textInputType,
maxLines: maxLines ?? 1,
decoration: decoration,
validator: validator,
onChanged: (String value) => onChanged?.call(value),
),
);
void onTapOutside() {
if (focusNode != null) {
focusNode?.unfocus();
} else {
FocusManager.instance.primaryFocus?.unfocus();
}
}
InputDecoration get decoration => InputDecoration(
hintText: hintText ?? "",
hintStyle: hintStyle ?? CustomTextStyles.bodySmallMulishBluegray800,
prefixIcon: prefix ??
SizedBox(
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Icon(Icons.search)),
),
prefixIconConstraints: prefixConstraints ??
BoxConstraints(
maxHeight: 40.v,
),
suffixIcon: suffix ??
Padding(
padding: EdgeInsets.only(
right: 15.h,
),
child: IconButton(
onPressed: () => controller!.clear(),
icon: Icon(
Icons.clear,
color: Colors.grey.shade600,
),
),
),
suffixIconConstraints: suffixConstraints ??
BoxConstraints(
maxHeight: 40.v,
),
isDense: true,
contentPadding: contentPadding ??
EdgeInsets.only(
top: 11.v,
right: 11.h,
bottom: 11.v,
),
fillColor: fillColor ?? appTheme.gray100,
filled: filled,
border: borderDecoration ??
OutlineInputBorder(
borderRadius: BorderRadius.circular(8.h),
borderSide: BorderSide.none,
),
enabledBorder: borderDecoration ??
OutlineInputBorder(
borderRadius: BorderRadius.circular(8.h),
borderSide: BorderSide.none,
),
focusedBorder: borderDecoration ??
OutlineInputBorder(
borderRadius: BorderRadius.circular(8.h),
borderSide: BorderSide.none,
),
);
}

View File

@@ -1,6 +1,8 @@
import 'bloc/chat_select_bloc.dart';
import 'models/chat_select_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import '../chat_select_screen/chat_search_view.dart';
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
import 'package:flutter/material.dart';
import 'package:eatvio_app/presentation/chat/chat_select_screen/models/chat_entry.dart'; // ignore: must_be_immutable
import 'package:eatvio_app/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart'; // ignore: must_be_immutable
@@ -20,50 +22,61 @@ class ChatSelectScreen extends StatelessWidget {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: AppDecoration.fillGray,
child: Column(
children: [
SizedBox(height: 30.v),
Container(
margin: EdgeInsets.only(
left: 16.h,
right: 20.h,
),
padding: EdgeInsets.all(12.h),
decoration: AppDecoration.outlinePrimary.copyWith(
borderRadius: BorderRadiusStyle.circleBorder8,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
BlocSelector<ChatSelectBloc, ChatSelectState,
TextEditingController?>(
selector: (state) => TextEditingController(),
builder: (context, searchController) {
return Container();
},
),
SizedBox(height: 20.v),
_buildUserprofile(context)
],
),
)
],
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
decoration: AppDecoration.fillGray,
child: Column(
children: [
SizedBox(height: 30.v),
Container(
margin: EdgeInsets.only(
left: 16.h,
right: 20.h,
),
padding: EdgeInsets.all(12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(12)),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),
],
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
BlocSelector<ChatSelectBloc, ChatSelectState,
TextEditingController?>(
selector: (state) => TextEditingController(),
builder: (context, searchController) {
return CustomSearchView(
controller: searchController,
hintText: "Поиск",
);
},
),
SizedBox(height: 20.v),
_buildChatList(context)
],
),
)
],
),
),
),
),
bottomNavigationBar: _buildBottomBar(context)),
);
}
_buildUserprofile(BuildContext context) {
_buildChatList(BuildContext context) {
return BlocSelector<ChatSelectBloc, ChatSelectState, ChatSelectModel?>(
selector: (state) => state.chatSelectModelObj,
builder: (context, chatSelectModelObj) {
return ListView.separated(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
separatorBuilder: (context, index) {
return SizedBox(
@@ -72,9 +85,9 @@ class ChatSelectScreen extends StatelessWidget {
},
itemCount: chatSelectModelObj?.userprofileItemList.length ?? 0,
itemBuilder: (context, index) {
UserprofileItemModel model =
ChatItemModel model =
chatSelectModelObj?.userprofileItemList[index] ??
UserprofileItemModel();
ChatItemModel();
return UserprofileItemWidget(
model,
);
@@ -83,4 +96,8 @@ class ChatSelectScreen extends StatelessWidget {
},
);
}
_buildBottomBar(BuildContext context) {
return CustomBottomBar(onChanged: (BottomBarEnum type) {});
}
}

View File

@@ -3,8 +3,8 @@ import 'package:eatvio_app/core/app_export.dart';
/// This class is used in the [userprofile_item_widget] screen.
// ignore_for_file: must_be_immutable
class UserprofileItemModel {
UserprofileItemModel(
class ChatItemModel {
ChatItemModel(
{this.userImage,
this.username,
this.dateText,

View File

@@ -8,8 +8,8 @@ import 'package:eatvio_app/presentation/chat/chat_select_screen/models/chat_entr
class ChatSelectModel extends Equatable {
ChatSelectModel({this.userprofileItemList = const []});
List<UserprofileItemModel> userprofileItemList;
ChatSelectModel copyWith({List<UserprofileItemModel>? userprofileItemList}) {
List<ChatItemModel> userprofileItemList;
ChatSelectModel copyWith({List<ChatItemModel>? userprofileItemList}) {
return ChatSelectModel(
userprofileItemList: userprofileItemList ?? this.userprofileItemList,
);

View File

@@ -10,7 +10,7 @@ class UserprofileItemWidget extends StatelessWidget {
key: key,
);
UserprofileItemModel userprofileItemModelObj;
ChatItemModel userprofileItemModelObj;
@override
Widget build(BuildContext context) {
@@ -32,12 +32,14 @@ class UserprofileItemWidget extends StatelessWidget {
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(
left: 12.h,
top: 2.v,
bottom: 11.v,
),
child: Padding(
padding: EdgeInsets.only(
left: 12.h,
top: 2.v,
bottom: 11.v,
),
child: GestureDetector(
onTap: () => Navigator.pushNamed(context, AppRoutes.chatScreen),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -77,7 +79,7 @@ class UserprofileItemWidget extends StatelessWidget {
],
),
),
)
))
],
),
);

View File

@@ -13,7 +13,7 @@ import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart';
import 'package:eatvio_app/widgets/custom_edit_drop_down.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_scale_element.dart';
//import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
import 'package:carousel_slider/carousel_slider.dart';
// ignore: must_be_immutable
@@ -57,44 +57,73 @@ class DiaryEditScreen extends StatelessWidget {
BuildContext context, DiaryEditLoadedState state) {
mediaQueryData = MediaQuery.of(context);
return RefreshIndicator(
onRefresh: refreshPage(context),
child: FormBuilder(
onRefresh: refreshPage(context),
child: Stack(
children: [
FormBuilder(
child: SafeArea(
child: Scaffold(
backgroundColor: Color.fromARGB(255, 240, 242, 245),
resizeToAvoidBottomInset: true,
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 5.v),
child: Column(
children: [
_buildHeaderRow(context, state),
SizedBox(height: 30.v),
_buildWakupRetire(context, state),
SizedBox(height: 30.v),
_buildMeal(context, state),
SizedBox(height: 20.v),
_buildMood(context, state),
SizedBox(height: 30.v),
_buildNutritionChart(context, state),
SizedBox(height: 30.v),
_buildComment(context, state),
],
child: Scaffold(
backgroundColor: Color.fromARGB(255, 240, 242, 245),
resizeToAvoidBottomInset: true,
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 5.v),
child: Column(
children: [
_buildHeaderRow(context, state),
SizedBox(height: 30.v),
_buildWakupRetire(context, state),
SizedBox(height: 30.v),
_buildMeal(context, state),
SizedBox(height: 20.v),
_buildMood(context, state),
SizedBox(height: 30.v),
_buildNutritionChart(context, state),
SizedBox(height: 30.v),
_buildComment(context, state),
],
),
),
),
),
),
],
),
],
),
bottomNavigationBar: _buildBottomBar(context),
),
),
bottomNavigationBar: _buildEndDay(context),
),
)));
Positioned(
left: 16.h,
right: 16.h,
bottom: 50.v, // Adjusted position to lift the button higher
child: _buildEndDay(context),
),
],
),
);
}
_buildEndDay(BuildContext context) {
return CustomOutlinedButton(
text: "Закончить день",
margin: EdgeInsets.only(
left: 16.h,
right: 16.h,
bottom: 41.v,
),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
decoration: BoxDecoration(
color: Colors.transparent,
),
onPressed: onFinishDayPressed(context),
// Установите прозрачный фон
);
}
refreshPage(BuildContext context) {
@@ -159,6 +188,10 @@ class DiaryEditScreen extends StatelessWidget {
};
}
_buildBottomBar(BuildContext context) {
return CustomBottomBar(onChanged: (BottomBarEnum type) {});
}
/// Section Widget
_buildAddProduct(BuildContext context, DiaryEditLoadedState state) {
return CustomOutlinedButton(
@@ -1082,22 +1115,6 @@ class DiaryEditScreen extends StatelessWidget {
}
/// Section Widget
_buildEndDay(BuildContext context) {
return CustomOutlinedButton(
text: "Закончить день",
margin: EdgeInsets.only(
left: 16.h,
right: 16.h,
bottom: 41.v,
),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
decoration: BoxDecoration(
color: Colors.transparent,
),
onPressed: onFinishDayPressed(context),
// Установите прозрачный фон
);
}
Function() onFinishDayPressed(BuildContext context) {
return () {

View File

@@ -2,7 +2,6 @@ import 'bloc/my_profile_bloc.dart';
import 'models/my_profile_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_circleimage.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
import 'package:eatvio_app/widgets/app_bar/exit_button.dart';
@@ -13,6 +12,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 +55,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 +78,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,
};
}