From d549f01a23b9f40d1ec80cba4ce0f70da0c11ae9 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 22 Apr 2024 12:46:36 +0300 Subject: [PATCH 1/9] feat(chat): Layouts for chat select finished --- assets/images/img_glass.svg | 4 + lib/core/utils/image_constant.dart | 1 + .../bloc/chat_select_bloc.dart | 30 +++- .../chat_select_screen/chat_search_view.dart | 164 ++++++++++++++++++ .../chat_select_screen.dart | 91 ++++++---- .../chat_select_screen/models/chat_entry.dart | 4 +- .../models/chat_select_model.dart | 4 +- .../widgets/chat_entry_widget.dart | 2 +- 8 files changed, 257 insertions(+), 43 deletions(-) create mode 100644 assets/images/img_glass.svg create mode 100644 lib/presentation/chat/chat_select_screen/chat_search_view.dart diff --git a/assets/images/img_glass.svg b/assets/images/img_glass.svg new file mode 100644 index 00000000..063af954 --- /dev/null +++ b/assets/images/img_glass.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/core/utils/image_constant.dart b/lib/core/utils/image_constant.dart index e7dd2b2a..8534fec2 100644 --- a/lib/core/utils/image_constant.dart +++ b/lib/core/utils/image_constant.dart @@ -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'; diff --git a/lib/presentation/chat/chat_select_screen/bloc/chat_select_bloc.dart b/lib/presentation/chat/chat_select_screen/bloc/chat_select_bloc.dart index 1fbde95f..04059200 100644 --- a/lib/presentation/chat/chat_select_screen/bloc/chat_select_bloc.dart +++ b/lib/presentation/chat/chat_select_screen/bloc/chat_select_bloc.dart @@ -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 { on(_onInitialize); } + List 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 emit, ) async { emit(state.copyWith( - chatSelectModelObj: state.chatSelectModelObj?.copyWith())); + chatSelectModelObj: state.chatSelectModelObj?.copyWith( + userprofileItemList: fillChatEntryList(), + ))); } } diff --git a/lib/presentation/chat/chat_select_screen/chat_search_view.dart b/lib/presentation/chat/chat_select_screen/chat_search_view.dart new file mode 100644 index 00000000..b9447660 --- /dev/null +++ b/lib/presentation/chat/chat_select_screen/chat_search_view.dart @@ -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? 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, + ), + ); +} diff --git a/lib/presentation/chat/chat_select_screen/chat_select_screen.dart b/lib/presentation/chat/chat_select_screen/chat_select_screen.dart index 7b9b2f65..563c487e 100644 --- a/lib/presentation/chat/chat_select_screen/chat_select_screen.dart +++ b/lib/presentation/chat/chat_select_screen/chat_select_screen.dart @@ -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,41 +22,53 @@ 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( - 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( + selector: (state) => TextEditingController(), + builder: (context, searchController) { + return CustomSearchView( + controller: searchController, + hintText: "Поиск", + ); + }, + ), + SizedBox(height: 20.v), + _buildUserprofile(context) + ], + ), + ) + ], + ), ), - ), - ), + bottomNavigationBar: _buildBottomBar(context)), ); } @@ -63,7 +77,6 @@ class ChatSelectScreen extends StatelessWidget { 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) {}); + } } diff --git a/lib/presentation/chat/chat_select_screen/models/chat_entry.dart b/lib/presentation/chat/chat_select_screen/models/chat_entry.dart index 2cd363fe..40fb78ef 100644 --- a/lib/presentation/chat/chat_select_screen/models/chat_entry.dart +++ b/lib/presentation/chat/chat_select_screen/models/chat_entry.dart @@ -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, diff --git a/lib/presentation/chat/chat_select_screen/models/chat_select_model.dart b/lib/presentation/chat/chat_select_screen/models/chat_select_model.dart index a7014788..4a3b9669 100644 --- a/lib/presentation/chat/chat_select_screen/models/chat_select_model.dart +++ b/lib/presentation/chat/chat_select_screen/models/chat_select_model.dart @@ -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 userprofileItemList; - ChatSelectModel copyWith({List? userprofileItemList}) { + List userprofileItemList; + ChatSelectModel copyWith({List? userprofileItemList}) { return ChatSelectModel( userprofileItemList: userprofileItemList ?? this.userprofileItemList, ); diff --git a/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart b/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart index 13fb8371..97f0ec28 100644 --- a/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart +++ b/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart @@ -10,7 +10,7 @@ class UserprofileItemWidget extends StatelessWidget { key: key, ); - UserprofileItemModel userprofileItemModelObj; + ChatItemModel userprofileItemModelObj; @override Widget build(BuildContext context) { From 2e99f579b64133cffd2ccb3e1d5ed30819cfc316 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 22 Apr 2024 13:54:54 +0300 Subject: [PATCH 2/9] feat(diary): Navbar added to diary edit screen --- .../chat_select_screen.dart | 4 +- .../diary_edit_screen/diary_edit_screen.dart | 113 ++++++++++-------- 2 files changed, 67 insertions(+), 50 deletions(-) diff --git a/lib/presentation/chat/chat_select_screen/chat_select_screen.dart b/lib/presentation/chat/chat_select_screen/chat_select_screen.dart index 563c487e..f92e2e3b 100644 --- a/lib/presentation/chat/chat_select_screen/chat_select_screen.dart +++ b/lib/presentation/chat/chat_select_screen/chat_select_screen.dart @@ -61,7 +61,7 @@ class ChatSelectScreen extends StatelessWidget { }, ), SizedBox(height: 20.v), - _buildUserprofile(context) + _buildChatList(context) ], ), ) @@ -72,7 +72,7 @@ class ChatSelectScreen extends StatelessWidget { ); } - _buildUserprofile(BuildContext context) { + _buildChatList(BuildContext context) { return BlocSelector( selector: (state) => state.chatSelectModelObj, builder: (context, chatSelectModelObj) { diff --git a/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart b/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart index e742aac5..b189b214 100644 --- a/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart +++ b/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart @@ -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 () { From d1fca66b4b27db2bb8afc16d2cdc0f1a968b2b05 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 22 Apr 2024 14:47:03 +0300 Subject: [PATCH 3/9] feat(ios): Some fixed for iOS build --- ios/Flutter/AppFrameworkInfo.plist | 2 +- ios/Runner.xcodeproj/project.pbxproj | 7 +++++-- .../project.xcworkspace/contents.xcworkspacedata | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index f2872cf4..8c6e5614 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 12.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 36428fd8..37b6bff4 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -127,7 +127,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -171,10 +171,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -185,6 +187,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16..919434a6 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140cf..b52b2e69 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ Date: Mon, 22 Apr 2024 14:48:22 +0300 Subject: [PATCH 4/9] refactor(app): Dart fix applied --- lib/localization/app_localization.dart | 1 - .../date_of_birth_screen/date_of_birth_screen.dart | 12 +++++------- lib/theme/bloc/theme_bloc.dart | 1 - lib/theme/custom_text_style.dart | 1 - 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/localization/app_localization.dart b/lib/localization/app_localization.dart index 4701a670..1405c02e 100644 --- a/lib/localization/app_localization.dart +++ b/lib/localization/app_localization.dart @@ -2,7 +2,6 @@ import 'ru/ru_translations.dart'; //import 'en_us/en_us_translations.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/cupertino.dart'; -import '../core/app_export.dart'; class AppLocalization { AppLocalization(this.locale); diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart index df859872..7015d217 100644 --- a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart @@ -160,12 +160,10 @@ class _DateOfBirthScreenState extends State { DateTime.now().day, ), ); - if (dateTime != null) { - if (mounted) { - setState(() { - selectedDate = dateTime; - }); - } + if (mounted) { + setState(() { + selectedDate = dateTime; + }); + } } - } } diff --git a/lib/theme/bloc/theme_bloc.dart b/lib/theme/bloc/theme_bloc.dart index 60f947d2..b80c4314 100644 --- a/lib/theme/bloc/theme_bloc.dart +++ b/lib/theme/bloc/theme_bloc.dart @@ -1,6 +1,5 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import '../../core/app_export.dart'; part 'theme_event.dart'; part 'theme_state.dart'; diff --git a/lib/theme/custom_text_style.dart b/lib/theme/custom_text_style.dart index ff969f92..7565b69e 100644 --- a/lib/theme/custom_text_style.dart +++ b/lib/theme/custom_text_style.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import '../core/app_export.dart'; /// A collection of pre-defined text styles for customizing text appearance, /// categorized by different font families and weights. From 12832d6874c5825c2e3e4448a6361148b354de1f Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 22 Apr 2024 18:39:53 +0300 Subject: [PATCH 5/9] feat(chat): Initial layouts for single chat screen --- .../chat/chat_screen/chat_screen.dart | 708 +++++++++++++++++- .../widgets/chat_entry_widget.dart | 16 +- 2 files changed, 716 insertions(+), 8 deletions(-) diff --git a/lib/presentation/chat/chat_screen/chat_screen.dart b/lib/presentation/chat/chat_screen/chat_screen.dart index e78a8f38..afd7ab40 100644 --- a/lib/presentation/chat/chat_screen/chat_screen.dart +++ b/lib/presentation/chat/chat_screen/chat_screen.dart @@ -2,6 +2,7 @@ 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,711 @@ 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( + 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(); } } + +_ \ No newline at end of file diff --git a/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart b/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart index 97f0ec28..0df63990 100644 --- a/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart +++ b/lib/presentation/chat/chat_select_screen/widgets/chat_entry_widget.dart @@ -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 { ], ), ), - ) + )) ], ), ); From 514d4ed9457189084b0fb7fa76d3c365615b4479 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Tue, 23 Apr 2024 08:46:32 +0000 Subject: [PATCH 6/9] revert d1fca66b4b27db2bb8afc16d2cdc0f1a968b2b05 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Я все сломал( --- ios/Flutter/AppFrameworkInfo.plist | 2 +- ios/Runner.xcodeproj/project.pbxproj | 7 ++----- .../project.xcworkspace/contents.xcworkspacedata | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 8c6e5614..f2872cf4 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 9.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 37b6bff4..36428fd8 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -127,7 +127,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -171,12 +171,10 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -187,7 +185,6 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 919434a6..1d526a16 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "group:Runner.xcodeproj"> diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index b52b2e69..a28140cf 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ Date: Tue, 23 Apr 2024 08:48:19 +0000 Subject: [PATCH 7/9] revert c486ee6b986431ef58ad5a5aa14176bb2fa13510 revert --- lib/localization/app_localization.dart | 1 + .../date_of_birth_screen/date_of_birth_screen.dart | 12 +++++++----- lib/theme/bloc/theme_bloc.dart | 1 + lib/theme/custom_text_style.dart | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/localization/app_localization.dart b/lib/localization/app_localization.dart index 1405c02e..4701a670 100644 --- a/lib/localization/app_localization.dart +++ b/lib/localization/app_localization.dart @@ -2,6 +2,7 @@ import 'ru/ru_translations.dart'; //import 'en_us/en_us_translations.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/cupertino.dart'; +import '../core/app_export.dart'; class AppLocalization { AppLocalization(this.locale); diff --git a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart index 7015d217..df859872 100644 --- a/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart @@ -160,10 +160,12 @@ class _DateOfBirthScreenState extends State { DateTime.now().day, ), ); - if (mounted) { - setState(() { - selectedDate = dateTime; - }); - } + if (dateTime != null) { + if (mounted) { + setState(() { + selectedDate = dateTime; + }); + } } + } } diff --git a/lib/theme/bloc/theme_bloc.dart b/lib/theme/bloc/theme_bloc.dart index b80c4314..60f947d2 100644 --- a/lib/theme/bloc/theme_bloc.dart +++ b/lib/theme/bloc/theme_bloc.dart @@ -1,5 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; +import '../../core/app_export.dart'; part 'theme_event.dart'; part 'theme_state.dart'; diff --git a/lib/theme/custom_text_style.dart b/lib/theme/custom_text_style.dart index 7565b69e..ff969f92 100644 --- a/lib/theme/custom_text_style.dart +++ b/lib/theme/custom_text_style.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import '../core/app_export.dart'; /// A collection of pre-defined text styles for customizing text appearance, /// categorized by different font families and weights. From 94f61f733bcaf7416e3b7773cffb1ea41b2a2b1b Mon Sep 17 00:00:00 2001 From: maxxkim Date: Tue, 23 Apr 2024 12:14:53 +0300 Subject: [PATCH 8/9] feat(settings): User Avatar display --- .../chat/chat_screen/chat_screen.dart | 5 ++-- .../my_profile_screen/my_profile_screen.dart | 27 ++++++++++++------- lib/routes/app_routes.dart | 4 +-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/lib/presentation/chat/chat_screen/chat_screen.dart b/lib/presentation/chat/chat_screen/chat_screen.dart index afd7ab40..8b1fc731 100644 --- a/lib/presentation/chat/chat_screen/chat_screen.dart +++ b/lib/presentation/chat/chat_screen/chat_screen.dart @@ -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(); } } - -_ \ No newline at end of file +*/ \ No newline at end of file diff --git a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart index 0a387801..5e328570 100644 --- a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart @@ -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: [ diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 97311c58..6f988361 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -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, }; } From 9d1762b7d19afd656c9de5fe3a96378b35d19064 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Tue, 23 Apr 2024 13:26:57 +0300 Subject: [PATCH 9/9] feat(settings): Code metrix fix --- .../profile/my_profile_screen/my_profile_screen.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart index 5e328570..7ac120a4 100644 --- a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart @@ -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';