Merge pull request 'fix: fix errors' (#124) from mso7nueh/eatvio_app:main into main

Reviewed-on: eatvio/eatvio_app#124
This commit is contained in:
mso7nueh
2024-08-30 13:11:22 +00:00
111 changed files with 3141 additions and 2029 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -1,59 +1 @@
# eatvio_app
### Системные требования
- Flutter (Channel stable, 3.19.0, on Ubuntu 22.04.3 LTS 6.2.0-39-generic, locale en_US.UTF-8)
- Android Studio (version 2023.1)
- VS Code (version 1.85.0)
- Android SDK (version 34.0.0) - устанавливается из Android Studio (Tools->SDK Manager->Android Command Line Tools)
- Эмулятор (2 available)
### Структура приложения
```
.
├── android - Папка для крмпиляции Android приложения
├── assets - Медиа и шрифты
├── ios - Папка для крмпиляции iOS приложения
├── lib - Основной код
├── main.dart - Файл из которого компилируется приложение
├── presentation - Виджеты экранов (верстка)
├── routes - Роутер (пути до экранов)
└── theme - Темы и оформление
└── widgets - Кастомные виджеты
├── pubspec.yaml - Пакеты
```
### Как запускать?
Для запуска на эмуляторе в программе VS Code скомпилируйте и запустите файл main.dart (предварительно необходимо установить эмулятор в Android Studio или подключите устройство в режиме разработчика через USB)
Для тестирования на устройствах Android в корневой папке проекта выполните команду
`# flutter build apk`
после чего `.apk` файл скомпилируется в директории `build/app/outputs/flutter-apk/app-release.apk`
Данный файл установит приложение на устройство с актуальной версией OS
### Библиотеки и инструменты
- **flutter_bloc** - контроль состояний
- **cached_network_image** - кеширование картинок из веба
- **flutter_svg** - работа с изображениями
- **equatable** - сравнение без оператора "=="
- **validators** - валидация
- **hive** - локальная бд (1)
- **hive_flutter** - локальная бд (2)
- **isar_flutter_libs** - локальная бд (3)
- **path_provider** - динамичкские пути до файлов
- **fl_chart** - построение графиков
- **flutter_spinkit** - прелоадеры
- **flutter_dotenv** - переменные окружения
### Поддержка
Telegram: @maxx_kim (https://t.me/maxx_kim)
# eatvio_app

View File

@@ -19,7 +19,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.1" apply false
id "org.jetbrains.kotlin.android" version "1.9.10" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}
include ":app"

Binary file not shown.

Binary file not shown.

29
assets/icons/calendar.svg Normal file
View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X8 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="500px" height="500px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 5000 5000"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil0 {fill:#43A6F2;fill-rule:nonzero}
]]>
</style>
</defs>
<g id="Слой_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<g id="_2067874566720">
<path class="fil0" d="M5000 2768l0 1308c0,254 -103,484 -269,652 -166,168 -395,272 -647,272l-3168 0c-252,0 -481,-104 -647,-272 -166,-168 -269,-399 -269,-652l0 -2682c0,-254 108,-501 278,-682 169,-180 401,-298 653,-298l3168 0c251,0 474,117 636,296 164,182 265,430 265,684l0 1374zm-350 1308l0 -2682c0,-168 -66,-331 -174,-450 -98,-109 -231,-180 -377,-180l-3168 0c-151,0 -292,74 -398,187 -112,119 -183,279 -183,443l0 2682c0,159 64,302 167,406 102,104 244,168 399,168l3168 0c155,0 297,-64 400,-168 102,-104 166,-247 166,-406z"/>
<path class="fil0" d="M2325 175c0,-97 78,-175 175,-175 97,0 175,78 175,175l0 829c0,97 -78,175 -175,175 -97,0 -175,-78 -175,-175l0 -829z"/>
<path class="fil0" d="M1163 175c0,-97 78,-175 175,-175 96,0 175,78 175,175l0 829c0,97 -79,175 -175,175 -97,0 -175,-78 -175,-175l0 -829z"/>
<path class="fil0" d="M3487 175c0,-97 79,-175 175,-175 97,0 175,78 175,175l0 829c0,97 -78,175 -175,175 -96,0 -175,-78 -175,-175l0 -829z"/>
<path class="fil0" d="M175 1746c-96,0 -174,-78 -174,-174 0,-96 78,-174 174,-174l4650 0c96,0 174,78 174,174 0,96 -78,174 -174,174l-4650 0z"/>
<path class="fil0" d="M999 2084l406 0c85,0 163,34 219,91l1 0c56,56 91,134 91,219l0 406c0,85 -35,162 -91,219l-1 0c-56,56 -134,91 -219,91l-406 0c-85,0 -162,-35 -218,-91l-1 0c-56,-57 -91,-134 -91,-219l0 -406c0,-85 35,-163 91,-219l1 0c56,-56 133,-91 218,-91zm367 350l-327 0 0 326 327 0 0 -326z"/>
<path class="fil0" d="M2297 2084l406 0c85,0 162,35 219,91l0 0c56,56 91,134 91,219l0 406c0,85 -35,162 -91,219l0 0c-57,56 -134,91 -219,91l-406 0c-85,0 -162,-35 -219,-91l0 0c-56,-57 -91,-134 -91,-219l0 -406c0,-85 35,-163 91,-219l0 0c57,-56 134,-91 219,-91zm366 350l-326 0 0 326 326 0 0 -326z"/>
<path class="fil0" d="M3961 2434l-327 0 0 326 327 0 0 -326zm-366 -350l406 0c85,0 162,35 218,91l1 0c56,56 91,134 91,219l0 406c0,85 -35,162 -91,219l-1 0c-56,56 -133,91 -218,91l-406 0c-85,0 -163,-35 -219,-91l-1 0c-56,-57 -91,-134 -91,-219l0 -406c0,-85 35,-163 91,-219l1 0c56,-57 134,-91 219,-91z"/>
<path class="fil0" d="M999 3287l406 0c85,0 163,35 219,91l1 0c56,56 91,133 91,219l0 406c0,85 -35,162 -91,219l-1 0c-56,56 -134,91 -219,91l-406 0c-85,0 -162,-35 -218,-91l-1 0c-56,-57 -91,-134 -91,-219l0 -406c0,-86 35,-163 91,-219l1 0c56,-56 133,-91 218,-91zm367 350l-327 0 0 326 327 0 0 -326z"/>
<path class="fil0" d="M2297 3287l406 0c85,0 162,35 219,91l0 0c56,56 91,133 91,219l0 406c0,85 -35,162 -91,219l0 0c-57,56 -134,91 -219,91l-406 0c-85,0 -162,-35 -219,-91l0 0c-56,-57 -91,-134 -91,-219l0 -406c0,-86 35,-163 91,-219l0 0c57,-56 134,-91 219,-91zm366 350l-326 0 0 326 326 0 0 -326z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

24
assets/icons/diets.svg Normal file
View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X8 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="500px" height="500px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 5000 5000"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil0 {fill:#43A6F2;fill-rule:nonzero}
]]>
</style>
</defs>
<g id="Слой_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<g id="_2067876093536">
<path class="fil0" d="M3543 5000c-497,0 -841,-167 -1073,-421 -283,-312 -384,-748 -384,-1167 0,-316 76,-588 230,-782 154,-193 377,-305 673,-305 207,0 319,33 415,60 47,14 88,26 139,26 51,0 92,-12 139,-26 95,-27 208,-60 415,-60 296,0 519,112 672,305 155,194 231,466 231,782 0,419 -101,855 -385,1167 -231,254 -575,421 -1072,421zm-814 -657c168,186 428,307 814,307 386,0 646,-121 814,-307 216,-237 293,-588 293,-931 0,-238 -51,-435 -154,-565 -87,-109 -219,-172 -399,-172 -162,0 -246,24 -318,45 -75,22 -140,41 -236,41 -96,0 -161,-19 -236,-41 -72,-21 -156,-45 -318,-45 -180,0 -312,63 -399,172 -104,130 -154,327 -154,565 0,343 77,694 293,931z"/>
<path class="fil0" d="M3843 2315c227,31 385,-8 497,-111 115,-107 197,-285 262,-527 -233,21 -413,64 -536,152 -124,90 -198,241 -223,486zm733 146c-224,207 -525,267 -956,167l0 0c-79,-18 -137,-90 -135,-174 11,-456 137,-734 378,-908 227,-164 542,-216 952,-232 15,0 30,1 45,4 94,19 155,111 136,205 -88,429 -210,744 -420,938z"/>
<path class="fil0" d="M3741 2500c0,97 -78,175 -175,175 -96,0 -175,-78 -175,-175l0 -1779c0,-102 -41,-194 -109,-262 -67,-67 -160,-109 -262,-109l-2306 0c-102,0 -195,42 -262,109 -67,67 -109,160 -109,262l0 2307c0,102 42,194 109,262 67,67 160,109 262,109l1552 0c97,0 175,78 175,175 0,96 -78,175 -175,175l-1552 0c-199,0 -379,-81 -510,-212 -130,-130 -211,-311 -211,-509l0 -2307c0,-198 81,-379 211,-509 131,-131 311,-212 510,-212l2306 0c199,0 379,81 510,212 130,130 211,311 211,509l0 1779z"/>
<path class="fil0" d="M1004 1118c-77,44 -106,132 -99,220 3,42 14,84 31,121 16,35 38,65 64,87 39,35 93,48 157,20l34 -14c61,-27 122,-53 191,-75 162,-52 331,-78 497,-78 167,0 335,26 498,78 68,22 129,48 191,75l33 14c59,26 115,10 156,-28 26,-23 48,-53 63,-87 17,-35 27,-74 30,-114 5,-81 -27,-165 -113,-215 -135,-67 -276,-117 -422,-151 -146,-34 -296,-52 -448,-52 -154,0 -307,13 -453,44 -143,31 -281,80 -410,155zm-448 246c-16,-210 63,-427 273,-549 164,-94 336,-156 513,-194 173,-37 350,-52 525,-52 177,0 354,21 527,61 172,40 339,100 500,180l8 4c226,126 309,339 296,545 -5,83 -27,165 -62,240 -36,77 -85,145 -145,199 -137,124 -324,176 -528,88l-33 -14c-54,-23 -107,-46 -159,-63 -125,-40 -258,-60 -392,-60 -134,0 -267,20 -392,60 -52,17 -105,40 -158,63l-34 14c-206,90 -389,41 -525,-77 -63,-55 -113,-125 -150,-203 -35,-75 -57,-159 -64,-242z"/>
<path class="fil0" d="M1596 1577c36,89 -6,191 -95,227 -89,37 -191,-6 -228,-95l-138 -334c-37,-89 6,-191 95,-227 89,-37 191,6 228,95l138 334z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -13,6 +13,8 @@ import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
import 'package:eatvio_app/features/feed/presentation/pages/feed_screen.dart';
import 'package:eatvio_app/features/menu/presentation/pages/menu_screen.dart';
import 'package:eatvio_app/features/notifications/presentation/pages/notifications_screen.dart';
import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart';
import 'package:eatvio_app/features/recipes/presentation/pages/about_recipes_screen.dart';
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_create_screen.dart';
@@ -24,7 +26,6 @@ import 'package:eatvio_app/presentation/diets/diet_select_screen/diet_select_scr
import 'package:eatvio_app/presentation/feed/blog_post_edit_screen/blog_post_edit_screen.dart';
import 'package:eatvio_app/presentation/glossary/glossary_screen/glossary_screen.dart';
import 'package:eatvio_app/presentation/plans/plan_select_screen/plan_select_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/recipe/recipe_select_screen/recipe_select_screen.dart';
import 'package:flutter/material.dart';
@@ -62,32 +63,43 @@ class AppRouter {
},
routes: [
GoRoute(
pageBuilder: (context, state) => NoTransitionPage(child: ProfileScreen()),
path: '/my-profile-screen',
name: 'myProfileScreen',
redirect: (context, state) async {
await context.read<InitializationCubit>().runInitialization();
return null;
},
builder: (context, state) => MyProfileScreen(),
),
GoRoute(
pageBuilder: (context, state) => NoTransitionPage(child: FeedScreen()),
path: '/feed-screen',
name: 'feedScreen',
builder: (context, state) => FeedScreen(),
),
GoRoute(
path: '/diary-screen',
name: 'diaryScreen',
builder: (context, state) {
if (state.extra != null)
return DiaryScreen(diaryID: state.extra as String);
else
return DiaryScreen(diaryID: '0');
}),
pageBuilder: (context, state) {
if (state.extra != null)
return NoTransitionPage(child: DiaryScreen(diaryID: state.extra as String));
else
return NoTransitionPage(child: DiaryScreen(diaryID: '0'));
},
path: '/diary-screen',
name: 'diaryScreen',
),
GoRoute(
pageBuilder: (context, state) => NoTransitionPage(child: ChatSelectScreen()),
path: '/chat-select-screen',
name: 'chatSelectScreen',
builder: (context, state) => ChatSelectScreen(),
),
GoRoute(
pageBuilder: (context, state) => NoTransitionPage(child: NotificationsScreen()),
path: '/notifications-screen',
name: 'notificationsScreen',
),
GoRoute(
pageBuilder: (context, state) => NoTransitionPage(child: MenuScreen()),
path: '/menu-screen',
name: 'menuScreen',
),
],
),

View File

@@ -3,7 +3,6 @@ export 'package:eatvio_app/core/errors/exceptions.dart';
export 'package:eatvio_app/core/utils/date_time_utils.dart';
export 'package:eatvio_app/core/utils/image_constant.dart';
export 'package:eatvio_app/core/utils/logger.dart';
export 'package:eatvio_app/core/utils/pref_utils.dart';
export 'package:eatvio_app/core/utils/size_utils.dart';
export 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
export 'package:eatvio_app/localization/app_localization.dart';
@@ -12,6 +11,4 @@ export 'package:eatvio_app/theme/custom_text_style.dart';
export 'package:eatvio_app/theme/theme_helper.dart';
export 'package:eatvio_app/widgets/custom_image_view.dart';
export 'package:flutter_bloc/flutter_bloc.dart';
export '../theme/bloc/theme_bloc.dart';
export '../theme/custom_button_style.dart';

View File

@@ -27,7 +27,7 @@ class InitializationCubit extends Cubit<InitializationState> {
privateNotificationChannel.subscribe();
privateNotificationChannel.bindToAll().listen((event) {
sl<NotificationsCubit>().incrementCounter();
sl<NotificationsCubit>().incrementCounter(event.name);
});
}

View File

@@ -84,9 +84,6 @@ class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$InitializationStateImplCopyWithImpl<$Res>
__$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value,
$Res Function(_$InitializationStateImpl) _then)
: super(_value, _then);
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -224,9 +218,6 @@ class __$$InitializationStateLoadingImplCopyWithImpl<$Res>
_$InitializationStateLoadingImpl _value,
$Res Function(_$InitializationStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -348,8 +339,6 @@ class __$$InitializationStateSuccessImplCopyWithImpl<$Res>
$Res Function(_$InitializationStateSuccessImpl) _then)
: super(_value, _then);
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -388,9 +377,7 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess {
@override
int get hashCode => Object.hash(runtimeType, client);
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl>
@@ -478,10 +465,7 @@ abstract class InitializationStateSuccess implements InitializationState {
_$InitializationStateSuccessImpl;
PusherChannelsClient get client;
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -506,8 +490,6 @@ class __$$InitializationStateErrorImplCopyWithImpl<$Res>
$Res Function(_$InitializationStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -547,9 +529,7 @@ class _$InitializationStateErrorImpl implements InitializationStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl>
@@ -636,10 +616,7 @@ abstract class InitializationStateError implements InitializationState {
_$InitializationStateErrorImpl;
String get errorMessage;
/// Create a copy of InitializationState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -1,6 +1,6 @@
import 'package:dio/dio.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
abstract class TokenStorage {
static _addTokenToDioHeader(String token) {
@@ -8,22 +8,20 @@ abstract class TokenStorage {
}
static haveTokenInStorage() async {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (await FlutterSecureStorage().read(key: 'token') == null) {
return false;
} else {
_addTokenToDioHeader(token);
_addTokenToDioHeader((await FlutterSecureStorage().read(key: 'token'))!);
return true;
}
}
static Future<String> getTokenFromStorage() async => (await Hive.openBox('token')).get('token');
static Future<String> getTokenFromStorage() async => (await FlutterSecureStorage().read(key: 'token'))!;
static saveTokenInStorage(String token) async {
(await Hive.openBox('token')).put('token', token);
await FlutterSecureStorage().write(key: 'token', value: token);
_addTokenToDioHeader(token);
}
static removeTokenInStorage() async => (await Hive.openBox('token')).delete('token');
static removeTokenInStorage() async => (await FlutterSecureStorage().delete(key: 'token'));
}

View File

@@ -1,34 +0,0 @@
import 'package:shared_preferences/shared_preferences.dart';
class PrefUtils {
static SharedPreferences? _sharedPreferences;
PrefUtils() {
// init();
SharedPreferences.getInstance().then((value) {
_sharedPreferences = value;
});
}
Future<void> init() async {
_sharedPreferences ??= await SharedPreferences.getInstance();
print('SharedPreference Initialized');
}
///will clear all the data stored in preference
void clearPreferencesData() async {
_sharedPreferences!.clear();
}
Future<void> setThemeData(String value) {
return _sharedPreferences!.setString('themeData', value);
}
String getThemeData() {
try {
return _sharedPreferences!.getString('themeData')!;
} catch (e) {
return 'primary';
}
}
}

View File

@@ -21,9 +21,7 @@ mixin _$SelectionPopupModel {
dynamic get value => throw _privateConstructorUsedError;
bool get isSelected => throw _privateConstructorUsedError;
/// Create a copy of SelectionPopupModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$SelectionPopupModelCopyWith<SelectionPopupModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -47,8 +45,6 @@ class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of SelectionPopupModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -97,8 +93,6 @@ class __$$SelectionPopupModelImplCopyWithImpl<$Res>
$Res Function(_$SelectionPopupModelImpl) _then)
: super(_value, _then);
/// Create a copy of SelectionPopupModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -165,9 +159,7 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel {
int get hashCode => Object.hash(runtimeType, id, title,
const DeepCollectionEquality().hash(value), isSelected);
/// Create a copy of SelectionPopupModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith =>
@@ -190,11 +182,8 @@ abstract class _SelectionPopupModel implements SelectionPopupModel {
dynamic get value;
@override
bool get isSelected;
/// Create a copy of SelectionPopupModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -1,10 +0,0 @@
import 'package:hive/hive.dart';
/// https://pub.dev/packages/flutter_secure_storage TODO replace hive to secure_storage for token storage
@HiveType(typeId: 0)
class TokenModel {
@HiveField(0)
String token;
TokenModel({required this.token});
}

View File

@@ -68,12 +68,8 @@ mixin _$UserRegistrationSheet {
@JsonKey(name: 'activity_coefficient')
double get activityCoefficient => throw _privateConstructorUsedError;
/// Serializes this UserRegistrationSheet to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of UserRegistrationSheet
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$UserRegistrationSheetCopyWith<UserRegistrationSheet> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -125,8 +121,6 @@ class _$UserRegistrationSheetCopyWithImpl<$Res,
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of UserRegistrationSheet
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -319,8 +313,6 @@ class __$$UserRegistrationSheetImplCopyWithImpl<$Res>
$Res Function(_$UserRegistrationSheetImpl) _then)
: super(_value, _then);
/// Create a copy of UserRegistrationSheet
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -635,7 +627,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet {
other.activityCoefficient == activityCoefficient));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hashAll([
runtimeType,
@@ -668,9 +660,7 @@ class _$UserRegistrationSheetImpl implements _UserRegistrationSheet {
activityCoefficient
]);
/// Create a copy of UserRegistrationSheet
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl>
@@ -797,11 +787,8 @@ abstract class _UserRegistrationSheet implements UserRegistrationSheet {
@override
@JsonKey(name: 'activity_coefficient')
double get activityCoefficient;
/// Create a copy of UserRegistrationSheet
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -78,7 +78,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
floatingActionButton: SizedBox(
width: MediaQuery.of(context).size.width - 32,
child: FloatingActionButton.extended(
heroTag: 'nextButtonRegistration',
heroTag: 'createBlogPost',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,

View File

@@ -84,9 +84,6 @@ class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$NewMessagesStateImplCopyWithImpl<$Res>
__$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value,
$Res Function(_$NewMessagesStateImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -221,9 +215,6 @@ class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>
__$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value,
$Res Function(_$NewMessagesStateEmptyImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -344,8 +335,6 @@ class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$NewMessagesStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -385,9 +374,7 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded {
@override
int get hashCode => Object.hash(runtimeType, messagesCount);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl>
@@ -474,10 +461,7 @@ abstract class NewMessagesStateLoaded implements NewMessagesState {
_$NewMessagesStateLoadedImpl;
int get messagesCount;
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -500,8 +484,6 @@ class __$$NewMessagesStateErrorImplCopyWithImpl<$Res>
$Res Function(_$NewMessagesStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -541,9 +523,7 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl>
@@ -630,10 +610,7 @@ abstract class NewMessagesStateError implements NewMessagesState {
_$NewMessagesStateErrorImpl;
String get errorMessage;
/// Create a copy of NewMessagesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -3,11 +3,18 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/noti
class NotificationsCubit extends Cubit<NotificationsState> {
int _notificationsCount = 0;
List<String> notifications = [];
NotificationsCubit() : super(const NotificationsState.empty());
incrementCounter() {
incrementCounter(String data) {
_notificationsCount++;
emit(NotificationsState.loaded(notificationsCount: _notificationsCount));
notifications.add(data);
emit(
NotificationsState.loaded(
notifications: notifications,
notificationsCount: _notificationsCount,
),
);
}
}

View File

@@ -9,6 +9,7 @@ abstract class NotificationsState with _$NotificationsState {
const factory NotificationsState.empty() = NotificationsStateEmpty;
const factory NotificationsState.loaded({
required List<String> notifications,
required int notificationsCount,
}) = NotificationsStateLoaded;

View File

@@ -20,7 +20,9 @@ mixin _$NotificationsState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@@ -28,7 +30,8 @@ mixin _$NotificationsState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) =>
throw _privateConstructorUsedError;
@@ -36,7 +39,8 @@ mixin _$NotificationsState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) =>
@@ -84,9 +88,6 @@ class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +104,6 @@ class __$$NotificationsStateImplCopyWithImpl<$Res>
__$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value,
$Res Function(_$NotificationsStateImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -132,7 +130,9 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
@@ -143,7 +143,8 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
@@ -154,7 +155,8 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -223,9 +225,6 @@ class __$$NotificationsStateEmptyImplCopyWithImpl<$Res>
_$NotificationsStateEmptyImpl _value,
$Res Function(_$NotificationsStateEmptyImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -253,7 +252,9 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return empty();
@@ -264,7 +265,8 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return empty?.call();
@@ -275,7 +277,8 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -334,7 +337,7 @@ abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> {
$Res Function(_$NotificationsStateLoadedImpl) then) =
__$$NotificationsStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({int notificationsCount});
$Res call({List<String> notifications, int notificationsCount});
}
/// @nodoc
@@ -347,14 +350,17 @@ class __$$NotificationsStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$NotificationsStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? notifications = null,
Object? notificationsCount = null,
}) {
return _then(_$NotificationsStateLoadedImpl(
notifications: null == notifications
? _value._notifications
: notifications // ignore: cast_nullable_to_non_nullable
as List<String>,
notificationsCount: null == notificationsCount
? _value.notificationsCount
: notificationsCount // ignore: cast_nullable_to_non_nullable
@@ -366,14 +372,25 @@ class __$$NotificationsStateLoadedImplCopyWithImpl<$Res>
/// @nodoc
class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
const _$NotificationsStateLoadedImpl({required this.notificationsCount});
const _$NotificationsStateLoadedImpl(
{required final List<String> notifications,
required this.notificationsCount})
: _notifications = notifications;
final List<String> _notifications;
@override
List<String> get notifications {
if (_notifications is EqualUnmodifiableListView) return _notifications;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_notifications);
}
@override
final int notificationsCount;
@override
String toString() {
return 'NotificationsState.loaded(notificationsCount: $notificationsCount)';
return 'NotificationsState.loaded(notifications: $notifications, notificationsCount: $notificationsCount)';
}
@override
@@ -381,16 +398,17 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsStateLoadedImpl &&
const DeepCollectionEquality()
.equals(other._notifications, _notifications) &&
(identical(other.notificationsCount, notificationsCount) ||
other.notificationsCount == notificationsCount));
}
@override
int get hashCode => Object.hash(runtimeType, notificationsCount);
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_notifications), notificationsCount);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl>
@@ -402,10 +420,12 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(notificationsCount);
return loaded(notifications, notificationsCount);
}
@override
@@ -413,10 +433,11 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(notificationsCount);
return loaded?.call(notifications, notificationsCount);
}
@override
@@ -424,12 +445,13 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(notificationsCount);
return loaded(notifications, notificationsCount);
}
return orElse();
}
@@ -474,13 +496,12 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
abstract class NotificationsStateLoaded implements NotificationsState {
const factory NotificationsStateLoaded(
{required final int notificationsCount}) = _$NotificationsStateLoadedImpl;
{required final List<String> notifications,
required final int notificationsCount}) = _$NotificationsStateLoadedImpl;
List<String> get notifications;
int get notificationsCount;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -505,8 +526,6 @@ class __$$NotificationsStateErrorImplCopyWithImpl<$Res>
$Res Function(_$NotificationsStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -546,9 +565,7 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl>
@@ -560,7 +577,9 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
@@ -571,7 +590,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
@@ -582,7 +602,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -635,10 +656,7 @@ abstract class NotificationsStateError implements NotificationsState {
_$NotificationsStateErrorImpl;
String get errorMessage;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,22 @@
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart';
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class ProfileAvatarCubit extends Cubit<ProfileAvatarState> {
final ProfileRepository profileRepository;
ProfileAvatarCubit({
required this.profileRepository,
}) : super(const ProfileAvatarState.loading());
getMyProfile() async {
try {
emit(ProfileAvatarState.loaded(
profile: await profileRepository.getMyProfile(),
));
} catch (e) {
emit(ProfileAvatarState.error(errorMessage: e.toString()));
print(e);
}
}
}

View File

@@ -0,0 +1,19 @@
import 'package:eatvio_app/features/profile/models/profile_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'profile_avatar_state.freezed.dart';
@freezed
abstract class ProfileAvatarState with _$ProfileAvatarState {
const factory ProfileAvatarState() = _ProfileAvatarState;
const factory ProfileAvatarState.loading() = ProfileAvatarStateLoading;
const factory ProfileAvatarState.loaded({
required ProfileModel profile,
}) = ProfileAvatarStateLoaded;
const factory ProfileAvatarState.error({
required String errorMessage,
}) = ProfileAvatarStateError;
}

View File

@@ -0,0 +1,630 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'profile_avatar_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ProfileAvatarState {
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ProfileAvatarState value) $default, {
required TResult Function(ProfileAvatarStateLoading value) loading,
required TResult Function(ProfileAvatarStateLoaded value) loaded,
required TResult Function(ProfileAvatarStateError value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ProfileAvatarState value)? $default, {
TResult? Function(ProfileAvatarStateLoading value)? loading,
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
TResult? Function(ProfileAvatarStateError value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ProfileAvatarState value)? $default, {
TResult Function(ProfileAvatarStateLoading value)? loading,
TResult Function(ProfileAvatarStateLoaded value)? loaded,
TResult Function(ProfileAvatarStateError value)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProfileAvatarStateCopyWith<$Res> {
factory $ProfileAvatarStateCopyWith(
ProfileAvatarState value, $Res Function(ProfileAvatarState) then) =
_$ProfileAvatarStateCopyWithImpl<$Res, ProfileAvatarState>;
}
/// @nodoc
class _$ProfileAvatarStateCopyWithImpl<$Res, $Val extends ProfileAvatarState>
implements $ProfileAvatarStateCopyWith<$Res> {
_$ProfileAvatarStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$ProfileAvatarStateImplCopyWith<$Res> {
factory _$$ProfileAvatarStateImplCopyWith(_$ProfileAvatarStateImpl value,
$Res Function(_$ProfileAvatarStateImpl) then) =
__$$ProfileAvatarStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ProfileAvatarStateImplCopyWithImpl<$Res>
extends _$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateImpl>
implements _$$ProfileAvatarStateImplCopyWith<$Res> {
__$$ProfileAvatarStateImplCopyWithImpl(_$ProfileAvatarStateImpl _value,
$Res Function(_$ProfileAvatarStateImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$ProfileAvatarStateImpl implements _ProfileAvatarState {
const _$ProfileAvatarStateImpl();
@override
String toString() {
return 'ProfileAvatarState()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$ProfileAvatarStateImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ProfileAvatarState value) $default, {
required TResult Function(ProfileAvatarStateLoading value) loading,
required TResult Function(ProfileAvatarStateLoaded value) loaded,
required TResult Function(ProfileAvatarStateError value) error,
}) {
return $default(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ProfileAvatarState value)? $default, {
TResult? Function(ProfileAvatarStateLoading value)? loading,
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
TResult? Function(ProfileAvatarStateError value)? error,
}) {
return $default?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ProfileAvatarState value)? $default, {
TResult Function(ProfileAvatarStateLoading value)? loading,
TResult Function(ProfileAvatarStateLoaded value)? loaded,
TResult Function(ProfileAvatarStateError value)? error,
required TResult orElse(),
}) {
if ($default != null) {
return $default(this);
}
return orElse();
}
}
abstract class _ProfileAvatarState implements ProfileAvatarState {
const factory _ProfileAvatarState() = _$ProfileAvatarStateImpl;
}
/// @nodoc
abstract class _$$ProfileAvatarStateLoadingImplCopyWith<$Res> {
factory _$$ProfileAvatarStateLoadingImplCopyWith(
_$ProfileAvatarStateLoadingImpl value,
$Res Function(_$ProfileAvatarStateLoadingImpl) then) =
__$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>
extends _$ProfileAvatarStateCopyWithImpl<$Res,
_$ProfileAvatarStateLoadingImpl>
implements _$$ProfileAvatarStateLoadingImplCopyWith<$Res> {
__$$ProfileAvatarStateLoadingImplCopyWithImpl(
_$ProfileAvatarStateLoadingImpl _value,
$Res Function(_$ProfileAvatarStateLoadingImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$ProfileAvatarStateLoadingImpl implements ProfileAvatarStateLoading {
const _$ProfileAvatarStateLoadingImpl();
@override
String toString() {
return 'ProfileAvatarState.loading()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProfileAvatarStateLoadingImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (loading != null) {
return loading();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ProfileAvatarState value) $default, {
required TResult Function(ProfileAvatarStateLoading value) loading,
required TResult Function(ProfileAvatarStateLoaded value) loaded,
required TResult Function(ProfileAvatarStateError value) error,
}) {
return loading(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ProfileAvatarState value)? $default, {
TResult? Function(ProfileAvatarStateLoading value)? loading,
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
TResult? Function(ProfileAvatarStateError value)? error,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ProfileAvatarState value)? $default, {
TResult Function(ProfileAvatarStateLoading value)? loading,
TResult Function(ProfileAvatarStateLoaded value)? loaded,
TResult Function(ProfileAvatarStateError value)? error,
required TResult orElse(),
}) {
if (loading != null) {
return loading(this);
}
return orElse();
}
}
abstract class ProfileAvatarStateLoading implements ProfileAvatarState {
const factory ProfileAvatarStateLoading() = _$ProfileAvatarStateLoadingImpl;
}
/// @nodoc
abstract class _$$ProfileAvatarStateLoadedImplCopyWith<$Res> {
factory _$$ProfileAvatarStateLoadedImplCopyWith(
_$ProfileAvatarStateLoadedImpl value,
$Res Function(_$ProfileAvatarStateLoadedImpl) then) =
__$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({ProfileModel profile});
$ProfileModelCopyWith<$Res> get profile;
}
/// @nodoc
class __$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>
extends _$ProfileAvatarStateCopyWithImpl<$Res,
_$ProfileAvatarStateLoadedImpl>
implements _$$ProfileAvatarStateLoadedImplCopyWith<$Res> {
__$$ProfileAvatarStateLoadedImplCopyWithImpl(
_$ProfileAvatarStateLoadedImpl _value,
$Res Function(_$ProfileAvatarStateLoadedImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? profile = null,
}) {
return _then(_$ProfileAvatarStateLoadedImpl(
profile: null == profile
? _value.profile
: profile // ignore: cast_nullable_to_non_nullable
as ProfileModel,
));
}
@override
@pragma('vm:prefer-inline')
$ProfileModelCopyWith<$Res> get profile {
return $ProfileModelCopyWith<$Res>(_value.profile, (value) {
return _then(_value.copyWith(profile: value));
});
}
}
/// @nodoc
class _$ProfileAvatarStateLoadedImpl implements ProfileAvatarStateLoaded {
const _$ProfileAvatarStateLoadedImpl({required this.profile});
@override
final ProfileModel profile;
@override
String toString() {
return 'ProfileAvatarState.loaded(profile: $profile)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProfileAvatarStateLoadedImpl &&
(identical(other.profile, profile) || other.profile == profile));
}
@override
int get hashCode => Object.hash(runtimeType, profile);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl>
get copyWith => __$$ProfileAvatarStateLoadedImplCopyWithImpl<
_$ProfileAvatarStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(profile);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(profile);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(profile);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ProfileAvatarState value) $default, {
required TResult Function(ProfileAvatarStateLoading value) loading,
required TResult Function(ProfileAvatarStateLoaded value) loaded,
required TResult Function(ProfileAvatarStateError value) error,
}) {
return loaded(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ProfileAvatarState value)? $default, {
TResult? Function(ProfileAvatarStateLoading value)? loading,
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
TResult? Function(ProfileAvatarStateError value)? error,
}) {
return loaded?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ProfileAvatarState value)? $default, {
TResult Function(ProfileAvatarStateLoading value)? loading,
TResult Function(ProfileAvatarStateLoaded value)? loaded,
TResult Function(ProfileAvatarStateError value)? error,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(this);
}
return orElse();
}
}
abstract class ProfileAvatarStateLoaded implements ProfileAvatarState {
const factory ProfileAvatarStateLoaded(
{required final ProfileModel profile}) = _$ProfileAvatarStateLoadedImpl;
ProfileModel get profile;
@JsonKey(ignore: true)
_$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$ProfileAvatarStateErrorImplCopyWith<$Res> {
factory _$$ProfileAvatarStateErrorImplCopyWith(
_$ProfileAvatarStateErrorImpl value,
$Res Function(_$ProfileAvatarStateErrorImpl) then) =
__$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>
extends _$ProfileAvatarStateCopyWithImpl<$Res,
_$ProfileAvatarStateErrorImpl>
implements _$$ProfileAvatarStateErrorImplCopyWith<$Res> {
__$$ProfileAvatarStateErrorImplCopyWithImpl(
_$ProfileAvatarStateErrorImpl _value,
$Res Function(_$ProfileAvatarStateErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? errorMessage = null,
}) {
return _then(_$ProfileAvatarStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$ProfileAvatarStateErrorImpl implements ProfileAvatarStateError {
const _$ProfileAvatarStateErrorImpl({required this.errorMessage});
@override
final String errorMessage;
@override
String toString() {
return 'ProfileAvatarState.error(errorMessage: $errorMessage)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProfileAvatarStateErrorImpl &&
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl>
get copyWith => __$$ProfileAvatarStateErrorImplCopyWithImpl<
_$ProfileAvatarStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(errorMessage);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ProfileAvatarState value) $default, {
required TResult Function(ProfileAvatarStateLoading value) loading,
required TResult Function(ProfileAvatarStateLoaded value) loaded,
required TResult Function(ProfileAvatarStateError value) error,
}) {
return error(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ProfileAvatarState value)? $default, {
TResult? Function(ProfileAvatarStateLoading value)? loading,
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
TResult? Function(ProfileAvatarStateError value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ProfileAvatarState value)? $default, {
TResult Function(ProfileAvatarStateLoading value)? loading,
TResult Function(ProfileAvatarStateLoaded value)? loaded,
TResult Function(ProfileAvatarStateError value)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(this);
}
return orElse();
}
}
abstract class ProfileAvatarStateError implements ProfileAvatarState {
const factory ProfileAvatarStateError({required final String errorMessage}) =
_$ProfileAvatarStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
_$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -4,7 +4,8 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.dart';
import 'package:eatvio_app/widgets/custom_navigation_menu.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
@@ -44,22 +45,10 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
GoRouter.of(context).replace('/chat-select-screen');
break;
case 4:
GoRouter.of(context).replace('/notifications-screen');
break;
case 5:
final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
final size = overlay.size;
showMenu(
context: context,
color: Colors.white,
shadowColor: Colors.white,
surfaceTintColor: Colors.white,
items: [
PopupMenuItem(
child: CustomNavigationMenu(),
),
],
position: RelativeRect.fromLTRB(size.width, size.height, 0, 0),
);
GoRouter.of(context).replace('/menu-screen');
break;
}
}
@@ -68,119 +57,154 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
Widget build(BuildContext context) {
return Scaffold(
body: widget.child,
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
onTap: _onItemTapped,
selectedFontSize: 12,
unselectedFontSize: 12,
selectedItemColor: appTheme.blueA400,
currentIndex: currentBottomNavBarIndex,
items: [
BottomNavigationBarItem(
label: '',
icon: SvgPicture.asset(
ImageConstant.imgLogo,
),
),
BottomNavigationBarItem(
label: 'Лента',
icon: SvgPicture.asset(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
width: 24,
height: 24,
ImageConstant.icnFeed,
),
activeIcon: SvgPicture.asset(
ImageConstant.icnFeed,
width: 24,
height: 24,
colorFilter: ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
bottomNavigationBar: SizedBox(
height: 58,
child: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
onTap: _onItemTapped,
selectedFontSize: 10,
unselectedFontSize: 10,
selectedItemColor: appTheme.blueA400,
currentIndex: currentBottomNavBarIndex,
items: [
BottomNavigationBarItem(
label: '',
icon: SvgPicture.asset(
ImageConstant.imgLogo,
height: 32,
),
),
),
BottomNavigationBarItem(
label: "diary".tr,
icon: SvgPicture.asset(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
ImageConstant.icnDiary,
width: 24,
height: 24,
),
activeIcon: SvgPicture.asset(
ImageConstant.icnDiary,
width: 24,
height: 24,
colorFilter: ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
BottomNavigationBarItem(
label: 'Лента',
icon: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
width: 20,
height: 20,
ImageConstant.icnFeed,
),
),
activeIcon: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
ImageConstant.icnFeed,
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
),
),
),
),
),
BottomNavigationBarItem(
label: "chat".tr,
icon: BlocBuilder<NewMessagesCubit, NewMessagesState>(
builder: (BuildContext context, NewMessagesState state) {
return badges.Badge(
position: badges.BadgePosition.topEnd(),
badgeContent: Text(
(state is NewMessagesStateLoaded) ? state.messagesCount.toString() : '0',
style: TextStyle(
color: Colors.white,
BottomNavigationBarItem(
label: "diary".tr,
icon: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
ImageConstant.icnDiary,
width: 20,
height: 20,
),
),
activeIcon: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
ImageConstant.icnDiary,
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
),
),
),
),
BottomNavigationBarItem(
label: "chat".tr,
icon: BlocBuilder<NewMessagesCubit, NewMessagesState>(
builder: (BuildContext context, NewMessagesState state) {
return badges.Badge(
position: badges.BadgePosition.topEnd(),
badgeAnimation: badges.BadgeAnimation.fade(),
badgeContent: Text(
(state is NewMessagesStateLoaded) ? state.messagesCount.toString() : '0',
style: TextStyle(
color: Colors.white,
fontSize: 8,
),
),
),
child: SvgPicture.asset(
ImageConstant.icnChat,
width: 24,
height: 24,
colorFilter: currentBottomNavBarIndex == 3
? ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
)
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
),
);
},
),
),
BottomNavigationBarItem(
label: '',
icon: BlocBuilder<NotificationsCubit, NotificationsState>(
builder: (BuildContext context, NotificationsState state) {
return badges.Badge(
position: badges.BadgePosition.topEnd(),
badgeContent: Text(
(state is NotificationsStateLoaded) ? state.notificationsCount.toString() : '0',
style: TextStyle(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
ImageConstant.icnChat,
width: 20,
height: 20,
colorFilter: currentBottomNavBarIndex == 3
? ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
)
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
),
),
),
child: SvgPicture.asset(
ImageConstant.icnBell,
colorFilter: currentBottomNavBarIndex == 4
? ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
)
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
width: 24,
height: 24,
),
);
},
);
},
),
),
),
BottomNavigationBarItem(
label: '',
icon: Image.asset(
ImageConstant.imgEllipse1,
width: 32,
height: 32,
BottomNavigationBarItem(
label: 'Уведомления',
icon: BlocBuilder<NotificationsCubit, NotificationsState>(
builder: (BuildContext context, NotificationsState state) {
return badges.Badge(
position: badges.BadgePosition.topEnd(),
badgeAnimation: badges.BadgeAnimation.fade(),
badgeContent: Text(
(state is NotificationsStateLoaded) ? state.notificationsCount.toString() : '0',
style: TextStyle(
color: Colors.white,
fontSize: 8,
),
),
child: Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SvgPicture.asset(
ImageConstant.icnBell,
colorFilter: currentBottomNavBarIndex == 4
? ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
)
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
width: 20,
height: 20,
),
),
);
},
),
),
),
],
BottomNavigationBarItem(
label: '',
icon: BlocBuilder<ProfileAvatarCubit, ProfileAvatarState>(
builder: (BuildContext context, ProfileAvatarState state) {
if (state is ProfileAvatarStateLoaded && state.profile.user.profilePhotoUrl.isNotEmpty) {
return CircleAvatar(
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl),
radius: 16,
);
}
return CircleAvatar(
radius: 16,
backgroundColor: Colors.black12,
);
},
),
),
],
),
),
);
}

View File

@@ -25,12 +25,8 @@ mixin _$CalendarModel {
throw _privateConstructorUsedError;
Object? get diary => throw _privateConstructorUsedError;
/// Serializes this CalendarModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of CalendarModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$CalendarModelCopyWith<CalendarModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -57,8 +53,6 @@ class _$CalendarModelCopyWithImpl<$Res, $Val extends CalendarModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CalendarModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -103,8 +97,6 @@ class __$$CalendarModelImplCopyWithImpl<$Res>
_$CalendarModelImpl _value, $Res Function(_$CalendarModelImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -165,7 +157,7 @@ class _$CalendarModelImpl implements _CalendarModel {
const DeepCollectionEquality().equals(other.diary, diary));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -173,9 +165,7 @@ class _$CalendarModelImpl implements _CalendarModel {
is_current_day_included_in_the_chosen_diet_progression,
const DeepCollectionEquality().hash(diary));
/// Create a copy of CalendarModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$CalendarModelImplCopyWith<_$CalendarModelImpl> get copyWith =>
@@ -205,11 +195,8 @@ abstract class _CalendarModel implements CalendarModel {
bool get is_current_day_included_in_the_chosen_diet_progression;
@override
Object? get diary;
/// Create a copy of CalendarModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$CalendarModelImplCopyWith<_$CalendarModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,9 +84,6 @@ class _$CalendarStateCopyWithImpl<$Res, $Val extends CalendarState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$CalendarStateImplCopyWithImpl<$Res>
__$$CalendarStateImplCopyWithImpl(
_$CalendarStateImpl _value, $Res Function(_$CalendarStateImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -220,9 +214,6 @@ class __$$CalendarStateLoadingImplCopyWithImpl<$Res>
__$$CalendarStateLoadingImplCopyWithImpl(_$CalendarStateLoadingImpl _value,
$Res Function(_$CalendarStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -341,8 +332,6 @@ class __$$CalendarStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$CalendarStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -390,9 +379,7 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_calendarList));
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$CalendarStateLoadedImplCopyWith<_$CalendarStateLoadedImpl> get copyWith =>
@@ -480,10 +467,7 @@ abstract class CalendarStateLoaded implements CalendarState {
_$CalendarStateLoadedImpl;
List<CalendarModel> get calendarList;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$CalendarStateLoadedImplCopyWith<_$CalendarStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -505,8 +489,6 @@ class __$$CalendarStateErrorImplCopyWithImpl<$Res>
$Res Function(_$CalendarStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -546,9 +528,7 @@ class _$CalendarStateErrorImpl implements CalendarStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$CalendarStateErrorImplCopyWith<_$CalendarStateErrorImpl> get copyWith =>
@@ -635,10 +615,7 @@ abstract class CalendarStateError implements CalendarState {
_$CalendarStateErrorImpl;
String get errorMessage;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$CalendarStateErrorImplCopyWith<_$CalendarStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -29,12 +29,8 @@ mixin _$ChatMessageModel {
@JsonKey(name: 'updated_at')
String get updatedAt => throw _privateConstructorUsedError;
/// Serializes this ChatMessageModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatMessageModelCopyWith<ChatMessageModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -63,8 +59,6 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -123,8 +117,6 @@ class __$$ChatMessageModelImplCopyWithImpl<$Res>
$Res Function(_$ChatMessageModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -215,14 +207,12 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, data,
const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt);
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith =>
@@ -262,11 +252,8 @@ abstract class _ChatMessageModel implements ChatMessageModel {
@override
@JsonKey(name: 'updated_at')
String get updatedAt;
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -24,12 +24,8 @@ mixin _$ChatMessagesModel {
List<ChatMessageModel> get messagesList => throw _privateConstructorUsedError;
ChatMetaModel get meta => throw _privateConstructorUsedError;
/// Serializes this ChatMessagesModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatMessagesModelCopyWith<ChatMessagesModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -57,8 +53,6 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -77,8 +71,6 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel>
) as $Val);
}
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatMetaModelCopyWith<$Res> get meta {
@@ -112,8 +104,6 @@ class __$$ChatMessagesModelImplCopyWithImpl<$Res>
$Res Function(_$ChatMessagesModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -172,14 +162,12 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_messagesList), meta);
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith =>
@@ -208,11 +196,8 @@ abstract class _ChatMessagesModel implements ChatMessagesModel {
List<ChatMessageModel> get messagesList;
@override
ChatMetaModel get meta;
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,12 +23,8 @@ mixin _$ChatMetaModel {
@JsonKey(name: "last_page")
int get lastPage => throw _privateConstructorUsedError;
/// Serializes this ChatMetaModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatMetaModelCopyWith<ChatMetaModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -52,8 +48,6 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -87,8 +81,6 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res>
_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -130,13 +122,11 @@ class _$ChatMetaModelImpl implements _ChatMetaModel {
other.lastPage == lastPage));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, lastPage);
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith =>
@@ -161,11 +151,8 @@ abstract class _ChatMetaModel implements ChatMetaModel {
@override
@JsonKey(name: "last_page")
int get lastPage;
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -26,12 +26,8 @@ mixin _$ChatRoomModel {
throw _privateConstructorUsedError;
Map<String, ChatUserModel> get users => throw _privateConstructorUsedError;
/// Serializes this ChatRoomModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatRoomModelCopyWith<ChatRoomModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -61,8 +57,6 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -86,8 +80,6 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
) as $Val);
}
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings {
@@ -124,8 +116,6 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res>
_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -191,14 +181,12 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
const DeepCollectionEquality().equals(other._users, _users));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, chatRoomSettings,
const DeepCollectionEquality().hash(_users));
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith =>
@@ -229,11 +217,8 @@ abstract class _ChatRoomModel implements ChatRoomModel {
ChatRoomSettingsModel get chatRoomSettings;
@override
Map<String, ChatUserModel> get users;
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,12 +23,8 @@ mixin _$ChatRoomPreviewModel {
@JsonKey(name: "chatRooms")
List<ChatRoom> get chatRooms => throw _privateConstructorUsedError;
/// Serializes this ChatRoomPreviewModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatRoomPreviewModelCopyWith<ChatRoomPreviewModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -53,8 +49,6 @@ class _$ChatRoomPreviewModelCopyWithImpl<$Res,
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -88,8 +82,6 @@ class __$$ChatRoomPreviewModelImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomPreviewModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -137,14 +129,12 @@ class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel {
.equals(other._chatRooms, _chatRooms));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(_chatRooms));
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomPreviewModelImplCopyWith<_$ChatRoomPreviewModelImpl>
@@ -171,11 +161,8 @@ abstract class _ChatRoomPreviewModel implements ChatRoomPreviewModel {
@override
@JsonKey(name: "chatRooms")
List<ChatRoom> get chatRooms;
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatRoomPreviewModelImplCopyWith<_$ChatRoomPreviewModelImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -195,12 +182,8 @@ mixin _$ChatRoom {
@JsonKey(name: "users")
Users get users => throw _privateConstructorUsedError;
/// Serializes this ChatRoom to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatRoomCopyWith<ChatRoom> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -229,8 +212,6 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -259,8 +240,6 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom>
) as $Val);
}
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UsersCopyWith<$Res> get users {
@@ -296,8 +275,6 @@ class __$$ChatRoomImplCopyWithImpl<$Res>
_$ChatRoomImpl _value, $Res Function(_$ChatRoomImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -370,14 +347,12 @@ class _$ChatRoomImpl implements _ChatRoom {
(identical(other.users, users) || other.users == users));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, roomName,
const DeepCollectionEquality().hash(lastMessage), users);
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomImplCopyWith<_$ChatRoomImpl> get copyWith =>
@@ -413,11 +388,8 @@ abstract class _ChatRoom implements ChatRoom {
@override
@JsonKey(name: "users")
Users get users;
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatRoomImplCopyWith<_$ChatRoomImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -443,12 +415,8 @@ mixin _$LastMessageClass {
@JsonKey(name: "updated_at")
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Serializes this LastMessageClass to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$LastMessageClassCopyWith<LastMessageClass> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -480,8 +448,6 @@ class _$LastMessageClassCopyWithImpl<$Res, $Val extends LastMessageClass>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -553,8 +519,6 @@ class __$$LastMessageClassImplCopyWithImpl<$Res>
$Res Function(_$LastMessageClassImpl) _then)
: super(_value, _then);
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -669,7 +633,7 @@ class _$LastMessageClassImpl implements _LastMessageClass {
other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -681,9 +645,7 @@ class _$LastMessageClassImpl implements _LastMessageClass {
readByToUser,
updatedAt);
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$LastMessageClassImplCopyWith<_$LastMessageClassImpl> get copyWith =>
@@ -734,11 +696,8 @@ abstract class _LastMessageClass implements LastMessageClass {
@override
@JsonKey(name: "updated_at")
DateTime get updatedAt;
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$LastMessageClassImplCopyWith<_$LastMessageClassImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -754,12 +713,8 @@ mixin _$Users {
@JsonKey(name: "to_chat_user")
ChatUser get toChatUser => throw _privateConstructorUsedError;
/// Serializes this Users to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$UsersCopyWith<Users> get copyWith => throw _privateConstructorUsedError;
}
@@ -786,8 +741,6 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -806,8 +759,6 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
) as $Val);
}
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatUserCopyWith<$Res> get fromChatUser {
@@ -816,8 +767,6 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
});
}
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatUserCopyWith<$Res> get toChatUser {
@@ -852,8 +801,6 @@ class __$$UsersImplCopyWithImpl<$Res>
_$UsersImpl _value, $Res Function(_$UsersImpl) _then)
: super(_value, _then);
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -906,13 +853,11 @@ class _$UsersImpl implements _Users {
other.toChatUser == toChatUser));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, fromChatUser, toChatUser);
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$UsersImplCopyWith<_$UsersImpl> get copyWith =>
@@ -940,11 +885,8 @@ abstract class _Users implements Users {
@override
@JsonKey(name: "to_chat_user")
ChatUser get toChatUser;
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$UsersImplCopyWith<_$UsersImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -964,12 +906,8 @@ mixin _$ChatUser {
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl => throw _privateConstructorUsedError;
/// Serializes this ChatUser to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatUserCopyWith<ChatUser> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -996,8 +934,6 @@ class _$ChatUserCopyWithImpl<$Res, $Val extends ChatUser>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1050,8 +986,6 @@ class __$$ChatUserImplCopyWithImpl<$Res>
_$ChatUserImpl _value, $Res Function(_$ChatUserImpl) _then)
: super(_value, _then);
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1124,14 +1058,12 @@ class _$ChatUserImpl implements _ChatUser {
other.profilePhotoUrl == profilePhotoUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl);
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatUserImplCopyWith<_$ChatUserImpl> get copyWith =>
@@ -1169,11 +1101,8 @@ abstract class _ChatUser implements ChatUser {
@override
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl;
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatUserImplCopyWith<_$ChatUserImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -30,12 +30,8 @@ mixin _$ChatRoomSettingsModel {
@JsonKey(name: 'updated_at')
String get updatedAt => throw _privateConstructorUsedError;
/// Serializes this ChatRoomSettingsModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatRoomSettingsModelCopyWith<ChatRoomSettingsModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -65,8 +61,6 @@ class _$ChatRoomSettingsModelCopyWithImpl<$Res,
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -127,8 +121,6 @@ class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomSettingsModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -210,14 +202,12 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel {
other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt);
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
@@ -257,11 +247,8 @@ abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel {
@override
@JsonKey(name: 'updated_at')
String get updatedAt;
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -27,12 +27,8 @@ mixin _$ChatUserModel {
@JsonKey(name: 'profile_photo_url')
String? get profilePhotoUrl => throw _privateConstructorUsedError;
/// Serializes this ChatUserModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ChatUserModelCopyWith<ChatUserModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -60,8 +56,6 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -114,8 +108,6 @@ class __$$ChatUserModelImplCopyWithImpl<$Res>
_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -186,14 +178,12 @@ class _$ChatUserModelImpl implements _ChatUserModel {
other.profilePhotoUrl == profilePhotoUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl);
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith =>
@@ -228,11 +218,8 @@ abstract class _ChatUserModel implements ChatUserModel {
@override
@JsonKey(name: 'profile_photo_url')
String? get profilePhotoUrl;
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -27,12 +27,8 @@ mixin _$WebsocketInfoModel {
@JsonKey(name: 'user_id')
int get userId => throw _privateConstructorUsedError;
/// Serializes this WebsocketInfoModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$WebsocketInfoModelCopyWith<WebsocketInfoModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -61,8 +57,6 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -121,8 +115,6 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res>
$Res Function(_$WebsocketInfoModelImpl) _then)
: super(_value, _then);
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -199,14 +191,12 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
(identical(other.userId, userId) || other.userId == userId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, key, host, port, cluster, userId);
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
@@ -244,11 +234,8 @@ abstract class _WebsocketInfoModel implements WebsocketInfoModel {
@override
@JsonKey(name: 'user_id')
int get userId;
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:io';
import 'package:audioplayers/audioplayers.dart';
import 'package:dart_pusher_channels/dart_pusher_channels.dart';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:eatvio_app/core/constants/constants.dart';
@@ -65,7 +66,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
final chatMessages = await chatRepository.getChatMessages(chatId, currentPage);
lastPage = chatMessages.meta.lastPage;
await subscribeToChatChannel(initCubit: initializationCubit, chatId: chatId);
await _subscribeToChatChannel(initCubit: initializationCubit, chatId: chatId);
emit(ChatRoomState.loaded(
chatRoom: chatRoom,
@@ -79,7 +80,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
}
}
Future<void> subscribeToChatChannel({
Future<void> _subscribeToChatChannel({
required InitializationCubit initCubit,
required String chatId,
}) async {
@@ -98,7 +99,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
privateChatChannel.subscribe();
privateChatChannel.bind('App\\Events\\ChatMessageUpdated').listen((event) {
print(jsonDecode(event.data));
AudioPlayer().play((AssetSource('audio/recive_message.wav')));
List<ChatMessageModel> messagesList = [
ChatMessageModel.fromJson(jsonDecode(event.data)['message']),
...(state as ChatRoomStateLoaded).chatMessages,
@@ -147,6 +148,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
data: data,
files: files,
);
AudioPlayer().play((AssetSource('audio/send_message.wav')));
}
@override

View File

@@ -90,9 +90,6 @@ class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -109,9 +106,6 @@ class __$$ChatRoomStateImplCopyWithImpl<$Res>
__$$ChatRoomStateImplCopyWithImpl(
_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -232,9 +226,6 @@ class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>
__$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value,
$Res Function(_$ChatRoomStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -365,8 +356,6 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -395,8 +384,6 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatRoomModelCopyWith<$Res> get chatRoom {
@@ -455,9 +442,7 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
int get hashCode => Object.hash(runtimeType, chatRoom,
const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith =>
@@ -556,10 +541,7 @@ abstract class ChatRoomStateLoaded implements ChatRoomState {
List<ChatMessageModel> get chatMessages;
bool get isTyping;
bool get isLoading;
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -581,8 +563,6 @@ class __$$ChatRoomStateErrorImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -622,9 +602,7 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith =>
@@ -717,10 +695,7 @@ abstract class ChatRoomStateError implements ChatRoomState {
_$ChatRoomStateErrorImpl;
String get errorMessage;
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,9 +84,6 @@ class _$ChatSelectStateCopyWithImpl<$Res, $Val extends ChatSelectState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$ChatSelectStateImplCopyWithImpl<$Res>
__$$ChatSelectStateImplCopyWithImpl(
_$ChatSelectStateImpl _value, $Res Function(_$ChatSelectStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -222,9 +216,6 @@ class __$$ChatSelectStateLoadingImplCopyWithImpl<$Res>
_$ChatSelectStateLoadingImpl _value,
$Res Function(_$ChatSelectStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -343,8 +334,6 @@ class __$$ChatSelectStateErrorImplCopyWithImpl<$Res>
$Res Function(_$ChatSelectStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -384,9 +373,7 @@ class _$ChatSelectStateErrorImpl implements ChatSelectStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatSelectStateErrorImplCopyWith<_$ChatSelectStateErrorImpl>
@@ -474,10 +461,7 @@ abstract class ChatSelectStateError implements ChatSelectState {
_$ChatSelectStateErrorImpl;
String get errorMessage;
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatSelectStateErrorImplCopyWith<_$ChatSelectStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -500,8 +484,6 @@ class __$$ChatSelectStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$ChatSelectStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -548,9 +530,7 @@ class _$ChatSelectStateLoadedImpl implements ChatSelectStateLoaded {
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(_chatRooms));
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatSelectStateLoadedImplCopyWith<_$ChatSelectStateLoadedImpl>
@@ -637,10 +617,7 @@ abstract class ChatSelectStateLoaded implements ChatSelectState {
{required final List<ChatRoom> chatRooms}) = _$ChatSelectStateLoadedImpl;
List<ChatRoom> get chatRooms;
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ChatSelectStateLoadedImplCopyWith<_$ChatSelectStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -1,5 +1,4 @@
import 'dart:io';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
@@ -60,23 +59,29 @@ class _ChatScreenState extends State<ChatScreen> {
centerTitle: false,
title: Row(
children: [
Container(
width: 40,
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFEBF4FF),
shape: BoxShape.circle,
if (state.chatRoom.users['to_chat_user']!.profilePhotoUrl != null)
CircleAvatar(
radius: 20,
foregroundImage: NetworkImage(state.chatRoom.users['to_chat_user']!.profilePhotoUrl!),
),
child: Text(
state.chatRoom.users['to_chat_user']!.name.split(' ').first[0] + state.chatRoom.users['to_chat_user']!.name.split(' ')[1][0],
style: TextStyle(
color: Color(0xFF7F9CF5),
fontWeight: FontWeight.w400,
fontSize: 20,
if (state.chatRoom.users['to_chat_user']!.profilePhotoUrl == null)
Container(
width: 40,
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFEBF4FF),
shape: BoxShape.circle,
),
child: Text(
state.chatRoom.users['to_chat_user']!.name.split(' ').first[0] + state.chatRoom.users['to_chat_user']!.name.split(' ')[1][0],
style: TextStyle(
color: Color(0xFF7F9CF5),
fontWeight: FontWeight.w400,
fontSize: 20,
),
),
),
),
SizedBox(width: 16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -214,7 +219,7 @@ class _ChatScreenState extends State<ChatScreen> {
),
SizedBox(width: 8),
SizedBox(
width: mediaQueryData.size.width - 96,
width: MediaQuery.of(context).size.width - 96,
child: TextFormField(
controller: textEditingController,
maxLines: 5,

View File

@@ -39,6 +39,7 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
title: Padding(
padding: const EdgeInsets.only(top: 8),
child: ChatSearchBarWidget(
onSuffixIconTap: () => context.read<ChatSelectCubit>().getChatRooms(),
onChanged: (query) {
if (query.length > 2) {
EasyDebounce.debounce(

View File

@@ -1,8 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dismissible_page/dismissible_page.dart';
import 'package:eatvio_app/core/constants/constants.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
import 'package:eatvio_app/theme/app_decoration.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -29,12 +28,17 @@ class ChatBubbleWidget extends StatelessWidget {
child: DecoratedBox(
decoration: BoxDecoration(
color: isCurrentUser ? Color(0xFF7F9CF5) : Colors.white,
borderRadius: BorderRadiusStyle.circleBorder17,
borderRadius: mediaData.length > 0
? BorderRadius.circular(24)
: BorderRadius.horizontal(
left: isCurrentUser ? Radius.circular(32) : Radius.circular(16),
right: isCurrentUser ? Radius.circular(16) : Radius.circular(24),
),
),
child: Padding(
padding: const EdgeInsets.all(12),
padding: mediaData.length > 0 ? EdgeInsets.all(8) : EdgeInsets.only(top: 8, bottom: 8, left: isCurrentUser ? 16 : 8, right: isCurrentUser ? 8 : 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: isCurrentUser ? CrossAxisAlignment.end : CrossAxisAlignment.start,
children: [
if (mediaData.isNotEmpty)
CustomScrollView(
@@ -86,7 +90,7 @@ class ChatBubbleWidget extends StatelessWidget {
tag: baseUrl + '/storage/' + '${mediaData[index]}',
transitionOnUserGestures: true,
child: ClipRRect(
borderRadius: BorderRadiusStyle.roundedBorder8,
borderRadius: BorderRadius.circular(16),
child: CachedNetworkImage(
imageUrl: baseUrl + '/storage/' + '${mediaData[index]}',
),
@@ -103,10 +107,17 @@ class ChatBubbleWidget extends StatelessWidget {
if (text.isNotEmpty)
Text(
text,
style: TextStyle(
color: isCurrentUser ? Colors.white : Color(0xFF323F4B),
),
style: TextStyle(color: isCurrentUser ? Colors.white : Color(0xFF323F4B), height: 1),
),
SizedBox(height: 4),
Text(
DateTime.parse(sendTime).format('hh:mm'),
style: TextStyle(
color: isCurrentUser ? Colors.white.withOpacity(0.4) : Color(0xFF323F4B).withOpacity(0.4),
height: 1,
fontSize: 10,
),
),
],
),
),

View File

@@ -95,6 +95,7 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
}
buildAvatarByUsername(String username) {
username = username.trim();
return Container(
width: 48,
height: 48,

View File

@@ -25,6 +25,7 @@ class ChatSearchBarWidget extends StatelessWidget {
this.filled = true,
this.validator,
this.onChanged,
required this.onSuffixIconTap,
}) : super(key: key);
final Alignment? alignment;
@@ -69,6 +70,8 @@ class ChatSearchBarWidget extends StatelessWidget {
final Function(String)? onChanged;
final Function() onSuffixIconTap;
@override
Widget build(BuildContext context) {
return searchViewWidget(context);
@@ -111,7 +114,10 @@ class ChatSearchBarWidget extends StatelessWidget {
),
suffixIcon: suffix ??
IconButton(
onPressed: () => controller!.clear(),
onPressed: () {
controller!.clear();
onSuffixIconTap();
},
icon: Icon(
Icons.clear,
color: Colors.grey.shade600,

View File

@@ -29,12 +29,8 @@ mixin _$DiaryModel {
DateTime? get wakeup => throw _privateConstructorUsedError;
DateTime? get retire => throw _privateConstructorUsedError;
/// Serializes this DiaryModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$DiaryModelCopyWith<DiaryModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -68,8 +64,6 @@ class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -118,8 +112,6 @@ class _$DiaryModelCopyWithImpl<$Res, $Val extends DiaryModel>
) as $Val);
}
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$StateCopyWith<$Res> get state {
@@ -159,8 +151,6 @@ class __$$DiaryModelImplCopyWithImpl<$Res>
_$DiaryModelImpl _value, $Res Function(_$DiaryModelImpl) _then)
: super(_value, _then);
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -270,7 +260,7 @@ class _$DiaryModelImpl implements _DiaryModel {
(identical(other.retire, retire) || other.retire == retire));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -283,9 +273,7 @@ class _$DiaryModelImpl implements _DiaryModel {
wakeup,
retire);
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith =>
@@ -329,11 +317,8 @@ abstract class _DiaryModel implements DiaryModel {
DateTime? get wakeup;
@override
DateTime? get retire;
/// Create a copy of DiaryModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DiaryModelImplCopyWith<_$DiaryModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -28,12 +28,8 @@ mixin _$Meal {
List<Portion> get portions => throw _privateConstructorUsedError;
List<Photo> get photos => throw _privateConstructorUsedError;
/// Serializes this Meal to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Meal
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$MealCopyWith<Meal> get copyWith => throw _privateConstructorUsedError;
}
@@ -62,8 +58,6 @@ class _$MealCopyWithImpl<$Res, $Val extends Meal>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Meal
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -132,8 +126,6 @@ class __$$MealImplCopyWithImpl<$Res>
__$$MealImplCopyWithImpl(_$MealImpl _value, $Res Function(_$MealImpl) _then)
: super(_value, _then);
/// Create a copy of Meal
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -240,7 +232,7 @@ class _$MealImpl implements _Meal {
const DeepCollectionEquality().equals(other._photos, _photos));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -252,9 +244,7 @@ class _$MealImpl implements _Meal {
const DeepCollectionEquality().hash(_portions),
const DeepCollectionEquality().hash(_photos));
/// Create a copy of Meal
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$MealImplCopyWith<_$MealImpl> get copyWith =>
@@ -294,11 +284,8 @@ abstract class _Meal implements Meal {
List<Portion> get portions;
@override
List<Photo> get photos;
/// Create a copy of Meal
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$MealImplCopyWith<_$MealImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -25,12 +25,8 @@ mixin _$Photo {
String get originalName => throw _privateConstructorUsedError;
String get path => throw _privateConstructorUsedError;
/// Serializes this Photo to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Photo
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$PhotoCopyWith<Photo> get copyWith => throw _privateConstructorUsedError;
}
@@ -55,8 +51,6 @@ class _$PhotoCopyWithImpl<$Res, $Val extends Photo>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Photo
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -102,8 +96,6 @@ class __$$PhotoImplCopyWithImpl<$Res>
_$PhotoImpl _value, $Res Function(_$PhotoImpl) _then)
: super(_value, _then);
/// Create a copy of Photo
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -163,13 +155,11 @@ class _$PhotoImpl implements _Photo {
(identical(other.path, path) || other.path == path));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, originalName, path);
/// Create a copy of Photo
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith =>
@@ -198,11 +188,8 @@ abstract class _Photo implements Photo {
String get originalName;
@override
String get path;
/// Create a copy of Photo
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$PhotoImplCopyWith<_$PhotoImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -26,12 +26,8 @@ mixin _$Portion {
String get portion => throw _privateConstructorUsedError;
bool get from_diet => throw _privateConstructorUsedError;
/// Serializes this Portion to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Portion
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$PortionCopyWith<Portion> get copyWith => throw _privateConstructorUsedError;
}
@@ -58,8 +54,6 @@ class _$PortionCopyWithImpl<$Res, $Val extends Portion>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Portion
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -117,8 +111,6 @@ class __$$PortionImplCopyWithImpl<$Res>
_$PortionImpl _value, $Res Function(_$PortionImpl) _then)
: super(_value, _then);
/// Create a copy of Portion
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -197,14 +189,12 @@ class _$PortionImpl implements _Portion {
other.from_diet == from_diet));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, id, product_name, quantity, portion, from_diet);
/// Create a copy of Portion
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PortionImplCopyWith<_$PortionImpl> get copyWith =>
@@ -238,11 +228,8 @@ abstract class _Portion implements Portion {
String get portion;
@override
bool get from_diet;
/// Create a copy of Portion
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$PortionImplCopyWith<_$PortionImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,12 +23,8 @@ mixin _$Product {
int get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
/// Serializes this Product to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Product
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$ProductCopyWith<Product> get copyWith => throw _privateConstructorUsedError;
}
@@ -50,8 +46,6 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Product
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -89,8 +83,6 @@ class __$$ProductImplCopyWithImpl<$Res>
_$ProductImpl _value, $Res Function(_$ProductImpl) _then)
: super(_value, _then);
/// Create a copy of Product
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -137,13 +129,11 @@ class _$ProductImpl implements _Product {
(identical(other.name, name) || other.name == name));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, name);
/// Create a copy of Product
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ProductImplCopyWith<_$ProductImpl> get copyWith =>
@@ -167,11 +157,8 @@ abstract class _Product implements Product {
int get id;
@override
String get name;
/// Create a copy of Product
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ProductImplCopyWith<_$ProductImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,12 +23,8 @@ mixin _$State {
bool get has_chosen_diet => throw _privateConstructorUsedError;
bool get has_chosen_plan => throw _privateConstructorUsedError;
/// Serializes this State to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of State
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$StateCopyWith<State> get copyWith => throw _privateConstructorUsedError;
}
@@ -50,8 +46,6 @@ class _$StateCopyWithImpl<$Res, $Val extends State>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of State
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -89,8 +83,6 @@ class __$$StateImplCopyWithImpl<$Res>
_$StateImpl _value, $Res Function(_$StateImpl) _then)
: super(_value, _then);
/// Create a copy of State
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -140,14 +132,12 @@ class _$StateImpl implements _State {
other.has_chosen_plan == has_chosen_plan));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, has_chosen_diet, has_chosen_plan);
/// Create a copy of State
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$StateImplCopyWith<_$StateImpl> get copyWith =>
@@ -172,11 +162,8 @@ abstract class _State implements State {
bool get has_chosen_diet;
@override
bool get has_chosen_plan;
/// Create a copy of State
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$StateImplCopyWith<_$StateImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -174,9 +174,6 @@ class _$DiaryStateCopyWithImpl<$Res, $Val extends DiaryState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -193,9 +190,6 @@ class __$$DiaryStateImplCopyWithImpl<$Res>
__$$DiaryStateImplCopyWithImpl(
_$DiaryStateImpl _value, $Res Function(_$DiaryStateImpl) _then)
: super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -403,8 +397,6 @@ class __$$DiaryStateLoadingImplCopyWithImpl<$Res>
$Res Function(_$DiaryStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -443,9 +435,7 @@ class _$DiaryStateLoadingImpl implements DiaryStateLoading {
@override
int get hashCode => Object.hash(runtimeType, id);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DiaryStateLoadingImplCopyWith<_$DiaryStateLoadingImpl> get copyWith =>
@@ -621,10 +611,7 @@ abstract class DiaryStateLoading implements DiaryState {
const factory DiaryStateLoading({final int? id}) = _$DiaryStateLoadingImpl;
int? get id;
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DiaryStateLoadingImplCopyWith<_$DiaryStateLoadingImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -679,8 +666,6 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$DiaryStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -834,8 +819,6 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$DiaryModelCopyWith<$Res> get diary {
@@ -844,8 +827,6 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
});
}
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MealCopyWith<$Res> get currentMeal {
@@ -854,8 +835,6 @@ class __$$DiaryStateLoadedImplCopyWithImpl<$Res>
});
}
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SelectionPopupModelCopyWith<$Res> get portionController {
@@ -1121,9 +1100,7 @@ class _$DiaryStateLoadedImpl implements DiaryStateLoaded {
const DeepCollectionEquality().hash(_chartDataCounted)
]);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith =>
@@ -1443,10 +1420,7 @@ abstract class DiaryStateLoaded implements DiaryState {
bool get isLoading;
bool get isAdded;
List<NutritionData>? get chartDataCounted;
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DiaryStateLoadedImplCopyWith<_$DiaryStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1468,8 +1442,6 @@ class __$$DiaryStateErrorImplCopyWithImpl<$Res>
_$DiaryStateErrorImpl _value, $Res Function(_$DiaryStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1509,9 +1481,7 @@ class _$DiaryStateErrorImpl implements DiaryStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith =>
@@ -1688,10 +1658,7 @@ abstract class DiaryStateError implements DiaryState {
_$DiaryStateErrorImpl;
String get errorMessage;
/// Create a copy of DiaryState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DiaryStateErrorImplCopyWith<_$DiaryStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -18,7 +18,7 @@ import 'package:flutter/services.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:image_picker/image_picker.dart';
// import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
class DiaryScreen extends StatelessWidget {
final String? diaryID;
@@ -136,30 +136,30 @@ class DiaryScreen extends StatelessWidget {
Text(
"от дневной суточной нормы",
),
// Transform.rotate(
// angle: -1.5708,
// child: ClipRect(
// child: Align(
// alignment: Alignment.centerRight,
// widthFactor: 0.5,
// child: SfCircularChart(
// series: <CircularSeries>[
// RadialBarSeries<NutritionData, String>(
// dataSource: state.chartDataCounted,
// xValueMapper: (NutritionData data, _) => data.category,
// yValueMapper: (NutritionData data, _) => data.nutrition,
// pointColorMapper: (NutritionData data, _) => data.color,
// trackColor: Color.fromRGBO(59, 130, 246, 1),
// trackOpacity: 0.1,
// gap: "8%",
// radius: "110%",
// innerRadius: '20%', // Измените значение по вашему усмотрению
// )
// ],
// ),
// ),
// ),
// ),
Transform.rotate(
angle: -1.5708,
child: ClipRect(
child: Align(
alignment: Alignment.centerRight,
widthFactor: 0.5,
child: SfCircularChart(
series: <CircularSeries>[
RadialBarSeries<NutritionData, String>(
dataSource: state.chartDataCounted,
xValueMapper: (NutritionData data, _) => data.category,
yValueMapper: (NutritionData data, _) => data.nutrition,
pointColorMapper: (NutritionData data, _) => data.color,
trackColor: Color.fromRGBO(59, 130, 246, 1),
trackOpacity: 0.1,
gap: "8%",
radius: "110%",
innerRadius: '20%', // Измените значение по вашему усмотрению
)
],
),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -201,6 +201,7 @@ class DiaryScreen extends StatelessWidget {
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(left: 4, right: 4),
child: FloatingActionButton.extended(
heroTag: 'endDayButton',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,
@@ -264,6 +265,7 @@ class DiaryScreen extends StatelessWidget {
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(left: 4, right: 4),
child: FloatingActionButton.extended(
heroTag: 'addProduct',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,

View File

@@ -2,13 +2,11 @@ import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/core/constants/constants.dart';
import 'package:eatvio_app/features/feed/models/comment_model.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart' as Diets;
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/comments_cubit/comments_state.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

View File

@@ -27,12 +27,8 @@ mixin _$Comment {
@JsonKey(name: "meta")
Meta get meta => throw _privateConstructorUsedError;
/// Serializes this Comment to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$CommentCopyWith<Comment> get copyWith => throw _privateConstructorUsedError;
}
@@ -60,8 +56,6 @@ class _$CommentCopyWithImpl<$Res, $Val extends Comment>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -85,8 +79,6 @@ class _$CommentCopyWithImpl<$Res, $Val extends Comment>
) as $Val);
}
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LinksCopyWith<$Res> get links {
@@ -95,8 +87,6 @@ class _$CommentCopyWithImpl<$Res, $Val extends Comment>
});
}
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res> get meta {
@@ -132,8 +122,6 @@ class __$$CommentImplCopyWithImpl<$Res>
_$CommentImpl _value, $Res Function(_$CommentImpl) _then)
: super(_value, _then);
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -201,14 +189,12 @@ class _$CommentImpl implements _Comment {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_data), links, meta);
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$CommentImplCopyWith<_$CommentImpl> get copyWith =>
@@ -239,11 +225,8 @@ abstract class _Comment implements Comment {
@override
@JsonKey(name: "meta")
Meta get meta;
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$CommentImplCopyWith<_$CommentImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -265,12 +248,8 @@ mixin _$Datum {
@JsonKey(name: "children_comments")
List<Datum> get childrenComments => throw _privateConstructorUsedError;
/// Serializes this Datum to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$DatumCopyWith<Datum> get copyWith => throw _privateConstructorUsedError;
}
@@ -297,8 +276,6 @@ class _$DatumCopyWithImpl<$Res, $Val extends Datum>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -356,8 +333,6 @@ class __$$DatumImplCopyWithImpl<$Res>
_$DatumImpl _value, $Res Function(_$DatumImpl) _then)
: super(_value, _then);
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -449,7 +424,7 @@ class _$DatumImpl implements _Datum {
.equals(other._childrenComments, _childrenComments));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -459,9 +434,7 @@ class _$DatumImpl implements _Datum {
body,
const DeepCollectionEquality().hash(_childrenComments));
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DatumImplCopyWith<_$DatumImpl> get copyWith =>
@@ -502,11 +475,8 @@ abstract class _Datum implements Datum {
@override
@JsonKey(name: "children_comments")
List<Datum> get childrenComments;
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DatumImplCopyWith<_$DatumImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -526,12 +496,8 @@ mixin _$Links {
@JsonKey(name: "next")
dynamic get next => throw _privateConstructorUsedError;
/// Serializes this Links to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$LinksCopyWith<Links> get copyWith => throw _privateConstructorUsedError;
}
@@ -557,8 +523,6 @@ class _$LinksCopyWithImpl<$Res, $Val extends Links>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -610,8 +574,6 @@ class __$$LinksImplCopyWithImpl<$Res>
_$LinksImpl _value, $Res Function(_$LinksImpl) _then)
: super(_value, _then);
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -682,7 +644,7 @@ class _$LinksImpl implements _Links {
const DeepCollectionEquality().equals(other.next, next));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -691,9 +653,7 @@ class _$LinksImpl implements _Links {
const DeepCollectionEquality().hash(prev),
const DeepCollectionEquality().hash(next));
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$LinksImplCopyWith<_$LinksImpl> get copyWith =>
@@ -728,11 +688,8 @@ abstract class _Links implements Links {
@override
@JsonKey(name: "next")
dynamic get next;
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$LinksImplCopyWith<_$LinksImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -760,12 +717,8 @@ mixin _$Meta {
@JsonKey(name: "total")
int get total => throw _privateConstructorUsedError;
/// Serializes this Meta to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$MetaCopyWith<Meta> get copyWith => throw _privateConstructorUsedError;
}
@@ -795,8 +748,6 @@ class _$MetaCopyWithImpl<$Res, $Val extends Meta>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -871,8 +822,6 @@ class __$$MetaImplCopyWithImpl<$Res>
__$$MetaImplCopyWithImpl(_$MetaImpl _value, $Res Function(_$MetaImpl) _then)
: super(_value, _then);
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -992,14 +941,12 @@ class _$MetaImpl implements _Meta {
(identical(other.total, total) || other.total == total));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, currentPage, from, lastPage,
const DeepCollectionEquality().hash(_links), path, perPage, to, total);
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$MetaImplCopyWith<_$MetaImpl> get copyWith =>
@@ -1050,11 +997,8 @@ abstract class _Meta implements Meta {
@override
@JsonKey(name: "total")
int get total;
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$MetaImplCopyWith<_$MetaImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1072,12 +1016,8 @@ mixin _$Link {
@JsonKey(name: "active")
bool get active => throw _privateConstructorUsedError;
/// Serializes this Link to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$LinkCopyWith<Link> get copyWith => throw _privateConstructorUsedError;
}
@@ -1102,8 +1042,6 @@ class _$LinkCopyWithImpl<$Res, $Val extends Link>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1148,8 +1086,6 @@ class __$$LinkImplCopyWithImpl<$Res>
__$$LinkImplCopyWithImpl(_$LinkImpl _value, $Res Function(_$LinkImpl) _then)
: super(_value, _then);
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1210,13 +1146,11 @@ class _$LinkImpl implements _Link {
(identical(other.active, active) || other.active == active));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, url, label, active);
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$LinkImplCopyWith<_$LinkImpl> get copyWith =>
@@ -1247,11 +1181,8 @@ abstract class _Link implements Link {
@override
@JsonKey(name: "active")
bool get active;
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$LinkImplCopyWith<_$LinkImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -27,12 +27,8 @@ mixin _$DietsPagination {
@JsonKey(name: "meta")
Meta get meta => throw _privateConstructorUsedError;
/// Serializes this DietsPagination to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$DietsPaginationCopyWith<DietsPagination> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -62,8 +58,6 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -87,8 +81,6 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination>
) as $Val);
}
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LinksCopyWith<$Res> get links {
@@ -97,8 +89,6 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination>
});
}
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res> get meta {
@@ -135,8 +125,6 @@ class __$$DietsPaginationImplCopyWithImpl<$Res>
_$DietsPaginationImpl _value, $Res Function(_$DietsPaginationImpl) _then)
: super(_value, _then);
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -204,14 +192,12 @@ class _$DietsPaginationImpl implements _DietsPagination {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_data), links, meta);
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith =>
@@ -244,11 +230,8 @@ abstract class _DietsPagination implements DietsPagination {
@override
@JsonKey(name: "meta")
Meta get meta;
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -285,12 +268,8 @@ mixin _$Datum {
@JsonKey(name: "total_comments")
int get totalComments => throw _privateConstructorUsedError;
/// Serializes this Datum to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$DatumCopyWith<Datum> get copyWith => throw _privateConstructorUsedError;
}
@@ -328,8 +307,6 @@ class _$DatumCopyWithImpl<$Res, $Val extends Datum>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -398,8 +375,6 @@ class _$DatumCopyWithImpl<$Res, $Val extends Datum>
) as $Val);
}
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TypeCopyWith<$Res> get type {
@@ -408,8 +383,6 @@ class _$DatumCopyWithImpl<$Res, $Val extends Datum>
});
}
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthorCopyWith<$Res> get author {
@@ -455,8 +428,6 @@ class __$$DatumImplCopyWithImpl<$Res>
_$DatumImpl _value, $Res Function(_$DatumImpl) _then)
: super(_value, _then);
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -620,7 +591,7 @@ class _$DatumImpl implements _Datum {
other.totalComments == totalComments));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -637,9 +608,7 @@ class _$DatumImpl implements _Datum {
totalViews,
totalComments);
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DatumImplCopyWith<_$DatumImpl> get copyWith =>
@@ -708,11 +677,8 @@ abstract class _Datum implements Datum {
@override
@JsonKey(name: "total_comments")
int get totalComments;
/// Create a copy of Datum
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DatumImplCopyWith<_$DatumImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -732,12 +698,8 @@ mixin _$Author {
@JsonKey(name: "author_is_me")
bool get authorIsMe => throw _privateConstructorUsedError;
/// Serializes this Author to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$AuthorCopyWith<Author> get copyWith => throw _privateConstructorUsedError;
}
@@ -763,8 +725,6 @@ class _$AuthorCopyWithImpl<$Res, $Val extends Author>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -816,8 +776,6 @@ class __$$AuthorImplCopyWithImpl<$Res>
_$AuthorImpl _value, $Res Function(_$AuthorImpl) _then)
: super(_value, _then);
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -892,14 +850,12 @@ class _$AuthorImpl implements _Author {
other.authorIsMe == authorIsMe));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, authorSlug, authorName, authorProfileIcon, authorIsMe);
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$AuthorImplCopyWith<_$AuthorImpl> get copyWith =>
@@ -936,11 +892,8 @@ abstract class _Author implements Author {
@override
@JsonKey(name: "author_is_me")
bool get authorIsMe;
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$AuthorImplCopyWith<_$AuthorImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -960,12 +913,8 @@ mixin _$DailySchedule {
@JsonKey(name: "quantity")
int get quantity => throw _privateConstructorUsedError;
/// Serializes this DailySchedule to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$DailyScheduleCopyWith<DailySchedule> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -993,8 +942,6 @@ class _$DailyScheduleCopyWithImpl<$Res, $Val extends DailySchedule>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1047,8 +994,6 @@ class __$$DailyScheduleImplCopyWithImpl<$Res>
_$DailyScheduleImpl _value, $Res Function(_$DailyScheduleImpl) _then)
: super(_value, _then);
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1120,13 +1065,11 @@ class _$DailyScheduleImpl implements _DailySchedule {
other.quantity == quantity));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, name, uniq, portion, quantity);
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith =>
@@ -1163,11 +1106,8 @@ abstract class _DailySchedule implements DailySchedule {
@override
@JsonKey(name: "quantity")
int get quantity;
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1187,12 +1127,8 @@ mixin _$Type {
@JsonKey(name: "meat")
bool? get meat => throw _privateConstructorUsedError;
/// Serializes this Type to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Type
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$TypeCopyWith<Type> get copyWith => throw _privateConstructorUsedError;
}
@@ -1218,8 +1154,6 @@ class _$TypeCopyWithImpl<$Res, $Val extends Type>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Type
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1270,8 +1204,6 @@ class __$$TypeImplCopyWithImpl<$Res>
__$$TypeImplCopyWithImpl(_$TypeImpl _value, $Res Function(_$TypeImpl) _then)
: super(_value, _then);
/// Create a copy of Type
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1342,13 +1274,11 @@ class _$TypeImpl implements _Type {
(identical(other.meat, meat) || other.meat == meat));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, alko, veg, corb, meat);
/// Create a copy of Type
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$TypeImplCopyWith<_$TypeImpl> get copyWith =>
@@ -1383,11 +1313,8 @@ abstract class _Type implements Type {
@override
@JsonKey(name: "meat")
bool? get meat;
/// Create a copy of Type
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$TypeImplCopyWith<_$TypeImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1407,12 +1334,8 @@ mixin _$Links {
@JsonKey(name: "next")
dynamic get next => throw _privateConstructorUsedError;
/// Serializes this Links to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$LinksCopyWith<Links> get copyWith => throw _privateConstructorUsedError;
}
@@ -1438,8 +1361,6 @@ class _$LinksCopyWithImpl<$Res, $Val extends Links>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1491,8 +1412,6 @@ class __$$LinksImplCopyWithImpl<$Res>
_$LinksImpl _value, $Res Function(_$LinksImpl) _then)
: super(_value, _then);
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1563,7 +1482,7 @@ class _$LinksImpl implements _Links {
const DeepCollectionEquality().equals(other.next, next));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -1572,9 +1491,7 @@ class _$LinksImpl implements _Links {
const DeepCollectionEquality().hash(prev),
const DeepCollectionEquality().hash(next));
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$LinksImplCopyWith<_$LinksImpl> get copyWith =>
@@ -1609,11 +1526,8 @@ abstract class _Links implements Links {
@override
@JsonKey(name: "next")
dynamic get next;
/// Create a copy of Links
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$LinksImplCopyWith<_$LinksImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1641,12 +1555,8 @@ mixin _$Meta {
@JsonKey(name: "total")
int get total => throw _privateConstructorUsedError;
/// Serializes this Meta to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$MetaCopyWith<Meta> get copyWith => throw _privateConstructorUsedError;
}
@@ -1676,8 +1586,6 @@ class _$MetaCopyWithImpl<$Res, $Val extends Meta>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1752,8 +1660,6 @@ class __$$MetaImplCopyWithImpl<$Res>
__$$MetaImplCopyWithImpl(_$MetaImpl _value, $Res Function(_$MetaImpl) _then)
: super(_value, _then);
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1873,14 +1779,12 @@ class _$MetaImpl implements _Meta {
(identical(other.total, total) || other.total == total));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, currentPage, from, lastPage,
const DeepCollectionEquality().hash(_links), path, perPage, to, total);
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$MetaImplCopyWith<_$MetaImpl> get copyWith =>
@@ -1931,11 +1835,8 @@ abstract class _Meta implements Meta {
@override
@JsonKey(name: "total")
int get total;
/// Create a copy of Meta
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$MetaImplCopyWith<_$MetaImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1953,12 +1854,8 @@ mixin _$Link {
@JsonKey(name: "active")
bool get active => throw _privateConstructorUsedError;
/// Serializes this Link to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$LinkCopyWith<Link> get copyWith => throw _privateConstructorUsedError;
}
@@ -1983,8 +1880,6 @@ class _$LinkCopyWithImpl<$Res, $Val extends Link>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -2029,8 +1924,6 @@ class __$$LinkImplCopyWithImpl<$Res>
__$$LinkImplCopyWithImpl(_$LinkImpl _value, $Res Function(_$LinkImpl) _then)
: super(_value, _then);
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -2091,13 +1984,11 @@ class _$LinkImpl implements _Link {
(identical(other.active, active) || other.active == active));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, url, label, active);
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$LinkImplCopyWith<_$LinkImpl> get copyWith =>
@@ -2128,11 +2019,8 @@ abstract class _Link implements Link {
@override
@JsonKey(name: "active")
bool get active;
/// Create a copy of Link
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$LinkImplCopyWith<_$LinkImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -41,12 +41,8 @@ mixin _$FeedBlogPostModel {
@JsonKey(name: "was_liked_by_me")
bool get wasLikedByMe => throw _privateConstructorUsedError;
/// Serializes this FeedBlogPostModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$FeedBlogPostModelCopyWith<FeedBlogPostModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -85,8 +81,6 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -160,8 +154,6 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel>
) as $Val);
}
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthorCopyWith<$Res> get author {
@@ -206,8 +198,6 @@ class __$$FeedBlogPostModelImplCopyWithImpl<$Res>
$Res Function(_$FeedBlogPostModelImpl) _then)
: super(_value, _then);
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -370,7 +360,7 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel {
other.wasLikedByMe == wasLikedByMe));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -388,9 +378,7 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel {
totalComments,
wasLikedByMe);
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith =>
@@ -458,11 +446,8 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel {
@override
@JsonKey(name: "was_liked_by_me")
bool get wasLikedByMe;
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -26,12 +26,8 @@ mixin _$FeedBlogPostSettingsModel {
throw _privateConstructorUsedError;
Meta get meta => throw _privateConstructorUsedError;
/// Serializes this FeedBlogPostSettingsModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$FeedBlogPostSettingsModelCopyWith<FeedBlogPostSettingsModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -60,8 +56,6 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res,
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -80,8 +74,6 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res,
) as $Val);
}
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res> get meta {
@@ -118,8 +110,6 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>
$Res Function(_$FeedBlogPostSettingsModelImpl) _then)
: super(_value, _then);
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -179,14 +169,12 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_feedBlogPostList), meta);
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl>
@@ -215,11 +203,8 @@ abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel {
List<FeedBlogPostModel> get feedBlogPostList;
@override
Meta get meta;
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -45,12 +45,8 @@ mixin _$Recipes {
int get viewsCount => throw _privateConstructorUsedError;
Author get author => throw _privateConstructorUsedError;
/// Serializes this Recipes to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$RecipesCopyWith<Recipes> get copyWith => throw _privateConstructorUsedError;
}
@@ -91,8 +87,6 @@ class _$RecipesCopyWithImpl<$Res, $Val extends Recipes>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -186,8 +180,6 @@ class _$RecipesCopyWithImpl<$Res, $Val extends Recipes>
) as $Val);
}
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthorCopyWith<$Res> get author {
@@ -235,8 +227,6 @@ class __$$RecipesImplCopyWithImpl<$Res>
_$RecipesImpl _value, $Res Function(_$RecipesImpl) _then)
: super(_value, _then);
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -450,7 +440,7 @@ class _$RecipesImpl implements _Recipes {
(identical(other.author, author) || other.author == author));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -472,9 +462,7 @@ class _$RecipesImpl implements _Recipes {
viewsCount,
author);
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RecipesImplCopyWith<_$RecipesImpl> get copyWith =>
@@ -551,11 +539,8 @@ abstract class _Recipes implements Recipes {
int get viewsCount;
@override
Author get author;
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RecipesImplCopyWith<_$RecipesImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -570,12 +555,8 @@ mixin _$Ingredient {
String? get unit => throw _privateConstructorUsedError;
String get portion => throw _privateConstructorUsedError;
/// Serializes this Ingredient to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$IngredientCopyWith<Ingredient> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -599,8 +580,6 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -644,8 +623,6 @@ class __$$IngredientImplCopyWithImpl<$Res>
_$IngredientImpl _value, $Res Function(_$IngredientImpl) _then)
: super(_value, _then);
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -701,13 +678,11 @@ class _$IngredientImpl implements _Ingredient {
(identical(other.portion, portion) || other.portion == portion));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, name, unit, portion);
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$IngredientImplCopyWith<_$IngredientImpl> get copyWith =>
@@ -736,11 +711,8 @@ abstract class _Ingredient implements Ingredient {
String? get unit;
@override
String get portion;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$IngredientImplCopyWith<_$IngredientImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -754,12 +726,8 @@ mixin _$Step {
String get image => throw _privateConstructorUsedError;
String get description => throw _privateConstructorUsedError;
/// Serializes this Step to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$StepCopyWith<Step> get copyWith => throw _privateConstructorUsedError;
}
@@ -781,8 +749,6 @@ class _$StepCopyWithImpl<$Res, $Val extends Step>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -819,8 +785,6 @@ class __$$StepImplCopyWithImpl<$Res>
__$$StepImplCopyWithImpl(_$StepImpl _value, $Res Function(_$StepImpl) _then)
: super(_value, _then);
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -868,13 +832,11 @@ class _$StepImpl implements _Step {
other.description == description));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, image, description);
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$StepImplCopyWith<_$StepImpl> get copyWith =>
@@ -899,11 +861,8 @@ abstract class _Step implements Step {
String get image;
@override
String get description;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$StepImplCopyWith<_$StepImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,12 +23,8 @@ mixin _$RecipesPagination {
@JsonKey(name: 'data')
List<Recipes> get recipesList => throw _privateConstructorUsedError;
/// Serializes this RecipesPagination to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$RecipesPaginationCopyWith<RecipesPagination> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -52,8 +48,6 @@ class _$RecipesPaginationCopyWithImpl<$Res, $Val extends RecipesPagination>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -87,8 +81,6 @@ class __$$RecipesPaginationImplCopyWithImpl<$Res>
$Res Function(_$RecipesPaginationImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -136,14 +128,12 @@ class _$RecipesPaginationImpl implements _RecipesPagination {
.equals(other._recipesList, _recipesList));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_recipesList));
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RecipesPaginationImplCopyWith<_$RecipesPaginationImpl> get copyWith =>
@@ -169,11 +159,8 @@ abstract class _RecipesPagination implements RecipesPagination {
@override
@JsonKey(name: 'data')
List<Recipes> get recipesList;
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RecipesPaginationImplCopyWith<_$RecipesPaginationImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,9 +84,6 @@ class _$CommentsStateCopyWithImpl<$Res, $Val extends CommentsState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$CommentsStateImplCopyWithImpl<$Res>
__$$CommentsStateImplCopyWithImpl(
_$CommentsStateImpl _value, $Res Function(_$CommentsStateImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -220,9 +214,6 @@ class __$$CommentsStateLoadingImplCopyWithImpl<$Res>
__$$CommentsStateLoadingImplCopyWithImpl(_$CommentsStateLoadingImpl _value,
$Res Function(_$CommentsStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -343,8 +334,6 @@ class __$$CommentsStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$CommentsStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -358,8 +347,6 @@ class __$$CommentsStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$CommentCopyWith<$Res> get comment {
@@ -393,9 +380,7 @@ class _$CommentsStateLoadedImpl implements CommentsStateLoaded {
@override
int get hashCode => Object.hash(runtimeType, comment);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$CommentsStateLoadedImplCopyWith<_$CommentsStateLoadedImpl> get copyWith =>
@@ -482,10 +467,7 @@ abstract class CommentsStateLoaded implements CommentsState {
_$CommentsStateLoadedImpl;
Comment get comment;
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$CommentsStateLoadedImplCopyWith<_$CommentsStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -507,8 +489,6 @@ class __$$CommentsStateErrorImplCopyWithImpl<$Res>
$Res Function(_$CommentsStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -548,9 +528,7 @@ class _$CommentsStateErrorImpl implements CommentsStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$CommentsStateErrorImplCopyWith<_$CommentsStateErrorImpl> get copyWith =>
@@ -637,10 +615,7 @@ abstract class CommentsStateError implements CommentsState {
_$CommentsStateErrorImpl;
String get errorMessage;
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$CommentsStateErrorImplCopyWith<_$CommentsStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,9 +84,6 @@ class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$DietsStateImplCopyWithImpl<$Res>
__$$DietsStateImplCopyWithImpl(
_$DietsStateImpl _value, $Res Function(_$DietsStateImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -220,9 +214,6 @@ class __$$DietsStateLoadingImplCopyWithImpl<$Res>
__$$DietsStateLoadingImplCopyWithImpl(_$DietsStateLoadingImpl _value,
$Res Function(_$DietsStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -342,8 +333,6 @@ class __$$DietsStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$DietsStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -357,8 +346,6 @@ class __$$DietsStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$DietsPaginationCopyWith<$Res> get diets {
@@ -392,9 +379,7 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded {
@override
int get hashCode => Object.hash(runtimeType, diets);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith =>
@@ -481,10 +466,7 @@ abstract class DietsStateLoaded implements DietsState {
_$DietsStateLoadedImpl;
DietsPagination get diets;
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -506,8 +488,6 @@ class __$$DietsStateErrorImplCopyWithImpl<$Res>
_$DietsStateErrorImpl _value, $Res Function(_$DietsStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -547,9 +527,7 @@ class _$DietsStateErrorImpl implements DietsStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith =>
@@ -636,10 +614,7 @@ abstract class DietsStateError implements DietsState {
_$DietsStateErrorImpl;
String get errorMessage;
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -87,9 +87,6 @@ class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -106,9 +103,6 @@ class __$$FeedStateImplCopyWithImpl<$Res>
__$$FeedStateImplCopyWithImpl(
_$FeedStateImpl _value, $Res Function(_$FeedStateImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -227,9 +221,6 @@ class __$$FeedStateLoadingImplCopyWithImpl<$Res>
__$$FeedStateLoadingImplCopyWithImpl(_$FeedStateLoadingImpl _value,
$Res Function(_$FeedStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -351,8 +342,6 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res>
_$FeedStateLoadedImpl _value, $Res Function(_$FeedStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -412,9 +401,7 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_feedBlogPostList), isLoading);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith =>
@@ -507,10 +494,7 @@ abstract class FeedStateLoaded implements FeedState {
List<FeedBlogPostModel> get feedBlogPostList;
bool get isLoading;
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -532,8 +516,6 @@ class __$$FeedStateErrorImplCopyWithImpl<$Res>
_$FeedStateErrorImpl _value, $Res Function(_$FeedStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -573,9 +555,7 @@ class _$FeedStateErrorImpl implements FeedStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith =>
@@ -666,10 +646,7 @@ abstract class FeedStateError implements FeedState {
_$FeedStateErrorImpl;
String get errorMessage;
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,9 +84,6 @@ class _$RecipesStateCopyWithImpl<$Res, $Val extends RecipesState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$RecipesStateImplCopyWithImpl<$Res>
__$$RecipesStateImplCopyWithImpl(
_$RecipesStateImpl _value, $Res Function(_$RecipesStateImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -220,9 +214,6 @@ class __$$RecipesStateLoadingImplCopyWithImpl<$Res>
__$$RecipesStateLoadingImplCopyWithImpl(_$RecipesStateLoadingImpl _value,
$Res Function(_$RecipesStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -341,8 +332,6 @@ class __$$RecipesStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$RecipesStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -389,9 +378,7 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_recipesList));
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RecipesStateLoadedImplCopyWith<_$RecipesStateLoadedImpl> get copyWith =>
@@ -478,10 +465,7 @@ abstract class RecipesStateLoaded implements RecipesState {
_$RecipesStateLoadedImpl;
List<Recipes> get recipesList;
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RecipesStateLoadedImplCopyWith<_$RecipesStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -503,8 +487,6 @@ class __$$RecipesStateErrorImplCopyWithImpl<$Res>
$Res Function(_$RecipesStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -544,9 +526,7 @@ class _$RecipesStateErrorImpl implements RecipesStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RecipesStateErrorImplCopyWith<_$RecipesStateErrorImpl> get copyWith =>
@@ -633,10 +613,7 @@ abstract class RecipesStateError implements RecipesState {
_$RecipesStateErrorImpl;
String get errorMessage;
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RecipesStateErrorImplCopyWith<_$RecipesStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -390,7 +390,9 @@ class _FeedService implements FeedService {
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||
requestOptions.responseType == ResponseType.stream)) {
if (T == String) {
requestOptions.responseType = ResponseType.plain;
} else {

View File

@@ -0,0 +1,119 @@
import 'package:dio/dio.dart';
import 'package:eatvio_app/core/constants/constants.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/core/utils/image_constant.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
class MenuScreen extends StatelessWidget {
const MenuScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Меню'),
),
body: SingleChildScrollView(
child: Column(
children: [
_tile(
title: 'Настройки профиля',
leading: ImageConstant.icnProfileSettings,
onTap: () => GoRouter.of(context).push('/my-settings-screen'),
),
_divider(context),
_tile(
leading: ImageConstant.icnRecipes,
title: 'Мои рецепты',
onTap: () => GoRouter.of(context).push('/recipe-select-screen'),
),
_divider(context),
_tile(
leading: 'assets/icons/diets.svg',
title: 'Мои диеты',
onTap: () => GoRouter.of(context).push('/diet-select-screen'),
),
_divider(context),
_tile(
leading: ImageConstant.icnPlans,
title: 'Мои планы',
onTap: () => GoRouter.of(context).push('/plan-select-screen'),
),
_divider(context),
_tile(
leading: 'assets/icons/calendar.svg',
title: 'Календарь',
onTap: () => GoRouter.of(context).push('/calendar-screen'),
),
_divider(context),
_tile(
leading: ImageConstant.icnGlossary,
title: 'Глоссарий',
onTap: () => GoRouter.of(context).push('/glossary-screen'),
),
_divider(context),
_tile(
leading: ImageConstant.icnSupport,
title: 'Поддержка',
onTap: () {},
),
_divider(context),
_tile(
leading: ImageConstant.icnExit,
title: 'Выход',
onTap: _onTapLogout(context),
),
],
),
),
);
}
_tile({
required String title,
required String leading,
required Function() onTap,
}) {
return ListTile(
onTap: onTap,
leading: SvgPicture.asset(
leading,
height: 24,
width: 24,
),
title: Text(title),
trailing: Icon(
Icons.arrow_forward_ios_rounded,
size: 12,
color: Colors.black38,
),
);
}
_divider(BuildContext context) {
return Container(
height: 0.4,
width: MediaQuery.of(context).size.width - 32,
decoration: BoxDecoration(
color: Colors.black26,
borderRadius: BorderRadius.circular(16),
),
);
}
_onTapLogout(BuildContext context) {
return () async {
final response = await sl<Dio>().post(
baseUrl + '/api/profile/logout',
);
if (response.statusCode == 204) {
await TokenStorage.removeTokenInStorage();
GoRouter.of(context).go('/auth-screen');
}
};
}
}

View File

@@ -0,0 +1,27 @@
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.dart';
import 'package:flutter/material.dart';
class NotificationsScreen extends StatelessWidget {
const NotificationsScreen({super.key});
@override
Widget build(BuildContext context) {
return BlocBuilder<NotificationsCubit, NotificationsState>(
builder: (BuildContext context, NotificationsState state) {
return Scaffold(
appBar: AppBar(
title: Text('Уведомления'),
),
body: SingleChildScrollView(
padding: EdgeInsets.all(16),
child: Text(
state is NotificationsStateLoaded ? state.notifications.toString() : 'Уведомлений нет',
),
),
);
},
);
}
}

View File

@@ -1,24 +1,38 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'profile_model.freezed.dart';
part 'profile_model.g.dart';
@freezed
class Profile with _$Profile {
const factory Profile({
class ProfileModel with _$ProfileModel {
const factory ProfileModel({
@JsonKey(name: "user") required User user,
@JsonKey(name: "chartPoints") required List<dynamic> chartPoints,
@JsonKey(name: "chartPoints") required List<ChartPoint> chartPoints,
@JsonKey(name: "userDetails") required UserDetails userDetails,
@JsonKey(name: "circumferences") required List<dynamic> circumferences,
@JsonKey(name: "circumferences") required List<Circumference> circumferences,
@JsonKey(name: "finishedPlans") required List<dynamic> finishedPlans,
@JsonKey(name: "rejectedPlans") required List<dynamic> rejectedPlans,
@JsonKey(name: "startedPlan") required List<dynamic> startedPlan,
@JsonKey(name: "paidPlan") required List<dynamic> paidPlan,
@JsonKey(name: "requestedPlan") required List<dynamic> requestedPlan,
@JsonKey(name: "initedPlan") required List<dynamic> initedPlan,
}) = _Profile;
}) = _ProfileModel;
factory Profile.fromJson(Map<String, Object?> json) => _$ProfileFromJson(json);
factory ProfileModel.fromJson(Map<String, dynamic> json) => _$ProfileModelFromJson(json);
}
@freezed
class Circumference with _$Circumference {
const factory Circumference({
@JsonKey(name: "id") required int id,
@JsonKey(name: "user_id") required int userId,
@JsonKey(name: "chest_circumference") required int chestCircumference,
@JsonKey(name: "waist_circumference") required int waistCircumference,
@JsonKey(name: "hip_circumference") required int hipCircumference,
@JsonKey(name: "created_at") required DateTime createdAt,
@JsonKey(name: "updated_at") required DateTime updatedAt,
}) = _Circumference;
factory Circumference.fromJson(Map<String, dynamic> json) => _$CircumferenceFromJson(json);
}
@freezed
@@ -41,7 +55,7 @@ class User with _$User {
@JsonKey(name: "detailz") required UserDetails detailz,
}) = _User;
factory User.fromJson(Map<String, Object?> json) => _$UserFromJson(json);
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
}
@freezed
@@ -78,5 +92,19 @@ class UserDetails with _$UserDetails {
@JsonKey(name: "activity_coefficient") required double activityCoefficient,
}) = _UserDetails;
factory UserDetails.fromJson(Map<String, Object?> json) => _$UserDetailsFromJson(json);
factory UserDetails.fromJson(Map<String, dynamic> json) => _$UserDetailsFromJson(json);
}
@freezed
class ChartPoint with _$ChartPoint {
const factory ChartPoint({
@JsonKey(name: "id") required int id,
@JsonKey(name: "user_id") required int userId,
@JsonKey(name: "weight") required int weight,
@JsonKey(name: "bmi") required String bmi,
@JsonKey(name: "created_at") required DateTime createdAt,
@JsonKey(name: "updated_at") required DateTime updatedAt,
}) = _ChartPoint;
factory ChartPoint.fromJson(Map<String, dynamic> json) => _$ChartPointFromJson(json);
}

File diff suppressed because it is too large Load Diff

View File

@@ -6,13 +6,17 @@ part of 'profile_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ProfileImpl _$$ProfileImplFromJson(Map<String, dynamic> json) =>
_$ProfileImpl(
_$ProfileModelImpl _$$ProfileModelImplFromJson(Map<String, dynamic> json) =>
_$ProfileModelImpl(
user: User.fromJson(json['user'] as Map<String, dynamic>),
chartPoints: json['chartPoints'] as List<dynamic>,
chartPoints: (json['chartPoints'] as List<dynamic>)
.map((e) => ChartPoint.fromJson(e as Map<String, dynamic>))
.toList(),
userDetails:
UserDetails.fromJson(json['userDetails'] as Map<String, dynamic>),
circumferences: json['circumferences'] as List<dynamic>,
circumferences: (json['circumferences'] as List<dynamic>)
.map((e) => Circumference.fromJson(e as Map<String, dynamic>))
.toList(),
finishedPlans: json['finishedPlans'] as List<dynamic>,
rejectedPlans: json['rejectedPlans'] as List<dynamic>,
startedPlan: json['startedPlan'] as List<dynamic>,
@@ -21,7 +25,7 @@ _$ProfileImpl _$$ProfileImplFromJson(Map<String, dynamic> json) =>
initedPlan: json['initedPlan'] as List<dynamic>,
);
Map<String, dynamic> _$$ProfileImplToJson(_$ProfileImpl instance) =>
Map<String, dynamic> _$$ProfileModelImplToJson(_$ProfileModelImpl instance) =>
<String, dynamic>{
'user': instance.user,
'chartPoints': instance.chartPoints,
@@ -35,6 +39,28 @@ Map<String, dynamic> _$$ProfileImplToJson(_$ProfileImpl instance) =>
'initedPlan': instance.initedPlan,
};
_$CircumferenceImpl _$$CircumferenceImplFromJson(Map<String, dynamic> json) =>
_$CircumferenceImpl(
id: (json['id'] as num).toInt(),
userId: (json['user_id'] as num).toInt(),
chestCircumference: (json['chest_circumference'] as num).toInt(),
waistCircumference: (json['waist_circumference'] as num).toInt(),
hipCircumference: (json['hip_circumference'] as num).toInt(),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
Map<String, dynamic> _$$CircumferenceImplToJson(_$CircumferenceImpl instance) =>
<String, dynamic>{
'id': instance.id,
'user_id': instance.userId,
'chest_circumference': instance.chestCircumference,
'waist_circumference': instance.waistCircumference,
'hip_circumference': instance.hipCircumference,
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
};
_$UserImpl _$$UserImplFromJson(Map<String, dynamic> json) => _$UserImpl(
id: (json['id'] as num).toInt(),
name: json['name'] as String,
@@ -137,3 +163,23 @@ Map<String, dynamic> _$$UserDetailsImplToJson(_$UserDetailsImpl instance) =>
'is_bedtime_fillable': instance.isBedtimeFillable,
'activity_coefficient': instance.activityCoefficient,
};
_$ChartPointImpl _$$ChartPointImplFromJson(Map<String, dynamic> json) =>
_$ChartPointImpl(
id: (json['id'] as num).toInt(),
userId: (json['user_id'] as num).toInt(),
weight: (json['weight'] as num).toInt(),
bmi: json['bmi'] as String,
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
Map<String, dynamic> _$$ChartPointImplToJson(_$ChartPointImpl instance) =>
<String, dynamic>{
'id': instance.id,
'user_id': instance.userId,
'weight': instance.weight,
'bmi': instance.bmi,
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
};

View File

@@ -5,11 +5,56 @@ import 'package:eatvio_app/features/profile/repositories/profile_repository.dart
class ProfileCubit extends Cubit<ProfileState> {
final ProfileRepository profileRepository;
ProfileCubit({required this.profileRepository}) : super(const ProfileState.loading());
ProfileCubit({
required this.profileRepository,
}) : super(const ProfileState.loading());
getProfileBySlug(String slug) async {
try {
emit(ProfileState.loaded(profile: await profileRepository.getProfileBySlug(slug)));
emit(ProfileState.loaded(
profile: await profileRepository.getProfileBySlug(slug),
));
} catch (e) {
emit(ProfileState.error(errorMessage: e.toString()));
print(e);
}
}
getMyProfile() async {
try {
emit(ProfileState.loaded(
profile: await profileRepository.getMyProfile(),
));
} catch (e) {
emit(ProfileState.error(errorMessage: e.toString()));
print(e);
}
}
addCircumference({
required int chestCircumference,
required int waistCircumference,
required int hipCircumference,
}) async {
try {
await profileRepository.addCircumference(
chestCircumference: chestCircumference,
waistCircumference: waistCircumference,
hipCircumference: hipCircumference,
);
} catch (e) {
emit(ProfileState.error(errorMessage: e.toString()));
print(e);
}
}
addWeight({
required int weight,
}) async {
try {
await profileRepository.addWeight(
weight: weight,
);
} catch (e) {
emit(ProfileState.error(errorMessage: e.toString()));
print(e);

View File

@@ -10,7 +10,7 @@ abstract class ProfileState with _$ProfileState {
const factory ProfileState.loading() = ProfileStateLoading;
const factory ProfileState.loaded({
required Profile profile,
required ProfileModel profile,
}) = ProfileStateLoaded;
const factory ProfileState.error({

View File

@@ -20,7 +20,7 @@ mixin _$ProfileState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(Profile profile) loaded,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@@ -28,7 +28,7 @@ mixin _$ProfileState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(Profile profile)? loaded,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) =>
throw _privateConstructorUsedError;
@@ -36,7 +36,7 @@ mixin _$ProfileState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(Profile profile)? loaded,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) =>
@@ -84,9 +84,6 @@ class _$ProfileStateCopyWithImpl<$Res, $Val extends ProfileState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,9 +100,6 @@ class __$$ProfileStateImplCopyWithImpl<$Res>
__$$ProfileStateImplCopyWithImpl(
_$ProfileStateImpl _value, $Res Function(_$ProfileStateImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -132,7 +126,7 @@ class _$ProfileStateImpl implements _ProfileState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(Profile profile) loaded,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
@@ -143,7 +137,7 @@ class _$ProfileStateImpl implements _ProfileState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(Profile profile)? loaded,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
@@ -154,7 +148,7 @@ class _$ProfileStateImpl implements _ProfileState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(Profile profile)? loaded,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -220,9 +214,6 @@ class __$$ProfileStateLoadingImplCopyWithImpl<$Res>
__$$ProfileStateLoadingImplCopyWithImpl(_$ProfileStateLoadingImpl _value,
$Res Function(_$ProfileStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -250,7 +241,7 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(Profile profile) loaded,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return loading();
@@ -261,7 +252,7 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(Profile profile)? loaded,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return loading?.call();
@@ -272,7 +263,7 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(Profile profile)? loaded,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -330,9 +321,9 @@ abstract class _$$ProfileStateLoadedImplCopyWith<$Res> {
$Res Function(_$ProfileStateLoadedImpl) then) =
__$$ProfileStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({Profile profile});
$Res call({ProfileModel profile});
$ProfileCopyWith<$Res> get profile;
$ProfileModelCopyWith<$Res> get profile;
}
/// @nodoc
@@ -343,8 +334,6 @@ class __$$ProfileStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$ProfileStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -354,16 +343,14 @@ class __$$ProfileStateLoadedImplCopyWithImpl<$Res>
profile: null == profile
? _value.profile
: profile // ignore: cast_nullable_to_non_nullable
as Profile,
as ProfileModel,
));
}
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ProfileCopyWith<$Res> get profile {
return $ProfileCopyWith<$Res>(_value.profile, (value) {
$ProfileModelCopyWith<$Res> get profile {
return $ProfileModelCopyWith<$Res>(_value.profile, (value) {
return _then(_value.copyWith(profile: value));
});
}
@@ -375,7 +362,7 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
const _$ProfileStateLoadedImpl({required this.profile});
@override
final Profile profile;
final ProfileModel profile;
@override
String toString() {
@@ -393,9 +380,7 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
@override
int get hashCode => Object.hash(runtimeType, profile);
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ProfileStateLoadedImplCopyWith<_$ProfileStateLoadedImpl> get copyWith =>
@@ -407,7 +392,7 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(Profile profile) loaded,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(profile);
@@ -418,7 +403,7 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(Profile profile)? loaded,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(profile);
@@ -429,7 +414,7 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(Profile profile)? loaded,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -478,14 +463,11 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
}
abstract class ProfileStateLoaded implements ProfileState {
const factory ProfileStateLoaded({required final Profile profile}) =
const factory ProfileStateLoaded({required final ProfileModel profile}) =
_$ProfileStateLoadedImpl;
Profile get profile;
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
ProfileModel get profile;
@JsonKey(ignore: true)
_$$ProfileStateLoadedImplCopyWith<_$ProfileStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -507,8 +489,6 @@ class __$$ProfileStateErrorImplCopyWithImpl<$Res>
$Res Function(_$ProfileStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -548,9 +528,7 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ProfileStateErrorImplCopyWith<_$ProfileStateErrorImpl> get copyWith =>
@@ -562,7 +540,7 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(Profile profile) loaded,
required TResult Function(ProfileModel profile) loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
@@ -573,7 +551,7 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(Profile profile)? loaded,
TResult? Function(ProfileModel profile)? loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
@@ -584,7 +562,7 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(Profile profile)? loaded,
TResult Function(ProfileModel profile)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -637,10 +615,7 @@ abstract class ProfileStateError implements ProfileState {
_$ProfileStateErrorImpl;
String get errorMessage;
/// Create a copy of ProfileState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$ProfileStateErrorImplCopyWith<_$ProfileStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -1,46 +1,59 @@
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/profile/models/profile_model.dart';
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_state.dart';
import 'package:eatvio_app/features/profile/presentation/widgets/circumference_chart_widget.dart';
import 'package:eatvio_app/features/profile/presentation/widgets/imt_chart_widget.dart';
import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:flutter/material.dart';
class ProfileScreen extends StatelessWidget {
final Author author;
class ProfileScreen extends StatefulWidget {
final Author? author;
const ProfileScreen({super.key, required this.author});
const ProfileScreen({super.key, this.author});
@override
State<ProfileScreen> createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
List<Circumference> chartData = [];
List<ChartPoint> chartPoints = [];
@override
Widget build(BuildContext context) {
return BlocProvider<ProfileCubit>(
create: (BuildContext context) => sl<ProfileCubit>()..getProfileBySlug(author.authorSlug),
create: (BuildContext context) {
if (widget.author == null)
return sl<ProfileCubit>()..getMyProfile();
else
return sl<ProfileCubit>()..getProfileBySlug(widget.author!.authorSlug);
},
child: BlocBuilder<ProfileCubit, ProfileState>(
builder: (BuildContext context, ProfileState state) {
if (state is ProfileStateLoaded) {
chartData = state.profile.circumferences;
chartPoints = state.profile.chartPoints;
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
state.profile.user.name,
style: TextStyle(
color: Colors.black,
fontSize: 24,
fontWeight: FontWeight.w400,
height: 1,
),
),
toolbarHeight: 0,
),
body: SingleChildScrollView(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
Padding(
padding: const EdgeInsets.only(left: 16, bottom: 32),
child: CircleAvatar(
maxRadius: 128,
minRadius: 128,
radius: 32,
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl),
),
),
CircumferenceChartWidget(chartData: chartData),
WeightChartWidget(chartPoints: chartPoints),
ImtChartWidget(chartPoints: chartPoints),
],
),
),

View File

@@ -0,0 +1,107 @@
import 'package:eatvio_app/features/profile/models/profile_model.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:intl/intl.dart';
class CircumferenceChartWidget extends StatelessWidget {
final List<Circumference> chartData;
const CircumferenceChartWidget({
super.key,
required this.chartData,
});
@override
Widget build(BuildContext context) {
return SfCartesianChart(
margin: EdgeInsets.zero,
enableAxisAnimation: true,
enableSideBySideSeriesPlacement: true,
legend: const Legend(
isVisible: true,
opacity: 0.7,
position: LegendPosition.bottom,
),
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
),
primaryXAxis: DateTimeAxis(
dateFormat: DateFormat.MMMd('ru'),
axisLine: AxisLine(
width: 1,
),
),
primaryYAxis: NumericAxis(
labelFormat: '{value} см',
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
);
}
List<CartesianSeries<Circumference, DateTime>> _getSplineSeries() {
final Color seriesColor1 = Colors.red;
final Color seriesColor2 = Colors.blue;
final Color seriesColor3 = Colors.green;
return <CartesianSeries<Circumference, DateTime>>[
SplineSeries<Circumference, DateTime>(
markerSettings: MarkerSettings(
isVisible: true,
color: seriesColor1,
height: 12,
width: 12,
),
dataLabelSettings: DataLabelSettings(
labelAlignment: ChartDataLabelAlignment.top,
isVisible: true,
),
dataSource: chartData,
color: seriesColor1,
name: 'Грудь',
xValueMapper: (Circumference value, int index) => value.createdAt,
yValueMapper: (Circumference value, int index) => value.chestCircumference,
),
SplineSeries<Circumference, DateTime>(
markerSettings: MarkerSettings(
isVisible: true,
color: seriesColor2,
height: 12,
width: 12,
),
dataLabelSettings: DataLabelSettings(
labelAlignment: ChartDataLabelAlignment.top,
isVisible: true,
),
dataSource: chartData,
color: seriesColor2,
name: 'Талия',
xValueMapper: (Circumference value, int index) => value.createdAt,
yValueMapper: (Circumference value, int index) => value.waistCircumference,
),
SplineSeries<Circumference, DateTime>(
markerSettings: MarkerSettings(
isVisible: true,
color: seriesColor3,
height: 12,
width: 12,
),
dataLabelSettings: DataLabelSettings(
labelAlignment: ChartDataLabelAlignment.top,
isVisible: true,
),
dataSource: chartData,
color: seriesColor3,
name: 'Бёдра',
xValueMapper: (Circumference value, int index) => value.createdAt,
yValueMapper: (Circumference value, int index) => value.hipCircumference,
),
];
}
}

View File

@@ -0,0 +1,69 @@
import 'package:eatvio_app/features/profile/models/profile_model.dart' as ProfileModel;
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:intl/intl.dart';
class ImtChartWidget extends StatelessWidget {
final List<ProfileModel.ChartPoint> chartPoints;
const ImtChartWidget({
super.key,
required this.chartPoints,
});
@override
Widget build(BuildContext context) {
return SfCartesianChart(
margin: EdgeInsets.zero,
enableAxisAnimation: true,
enableSideBySideSeriesPlacement: true,
legend: const Legend(
isVisible: true,
opacity: 0.7,
position: LegendPosition.bottom,
),
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
),
primaryXAxis: DateTimeAxis(
dateFormat: DateFormat.MMMd('ru'),
axisLine: AxisLine(
width: 1,
),
),
primaryYAxis: NumericAxis(
labelFormat: '{value} кг',
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
);
}
List<CartesianSeries<ProfileModel.ChartPoint, DateTime>> _getSplineSeries() {
return <CartesianSeries<ProfileModel.ChartPoint, DateTime>>[
SplineSeries<ProfileModel.ChartPoint, DateTime>(
markerSettings: MarkerSettings(
isVisible: true,
color: Colors.blue,
height: 12,
width: 12,
),
dataLabelSettings: DataLabelSettings(
labelAlignment: ChartDataLabelAlignment.top,
isVisible: true,
),
dataSource: chartPoints,
color: Colors.blue,
name: 'ИМТ',
xValueMapper: (ProfileModel.ChartPoint value, int index) => value.createdAt,
yValueMapper: (ProfileModel.ChartPoint value, int index) => double.parse(value.bmi),
),
];
}
}

View File

@@ -0,0 +1,69 @@
import 'package:eatvio_app/features/profile/models/profile_model.dart' as ProfileModel;
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:intl/intl.dart';
class WeightChartWidget extends StatelessWidget {
final List<ProfileModel.ChartPoint> chartPoints;
const WeightChartWidget({
super.key,
required this.chartPoints,
});
@override
Widget build(BuildContext context) {
return SfCartesianChart(
margin: EdgeInsets.zero,
enableAxisAnimation: true,
enableSideBySideSeriesPlacement: true,
legend: const Legend(
isVisible: true,
opacity: 0.7,
position: LegendPosition.bottom,
),
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
),
primaryXAxis: DateTimeAxis(
dateFormat: DateFormat.MMMd('ru'),
axisLine: AxisLine(
width: 1,
),
),
primaryYAxis: NumericAxis(
labelFormat: '{value} кг',
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
);
}
List<CartesianSeries<ProfileModel.ChartPoint, DateTime>> _getSplineSeries() {
return <CartesianSeries<ProfileModel.ChartPoint, DateTime>>[
SplineSeries<ProfileModel.ChartPoint, DateTime>(
markerSettings: MarkerSettings(
isVisible: true,
color: Colors.blue,
height: 12,
width: 12,
),
dataLabelSettings: DataLabelSettings(
labelAlignment: ChartDataLabelAlignment.top,
isVisible: true,
),
dataSource: chartPoints,
color: Colors.blue,
name: 'Вес',
xValueMapper: (ProfileModel.ChartPoint value, int index) => value.createdAt,
yValueMapper: (ProfileModel.ChartPoint value, int index) => value.weight,
),
];
}
}

View File

@@ -6,11 +6,51 @@ class ProfileRepository {
ProfileRepository({required this.profileService});
Future<Profile> getProfileBySlug(String slug) async {
Future<ProfileModel> getProfileBySlug(String slug) async {
try {
return await profileService.getProfileBySlug(slug: slug);
} catch (e) {
rethrow;
}
}
Future<ProfileModel> getMyProfile() async {
try {
return await profileService.getMyProfile();
} catch (e) {
rethrow;
}
}
Future<Circumference> addCircumference({
required int chestCircumference,
required int waistCircumference,
required int hipCircumference,
}) async {
try {
return (await profileService.addCircumference(
chestCircumference: chestCircumference,
waistCircumference: waistCircumference,
hipCircumference: hipCircumference,
))
.values
.first;
} catch (e) {
rethrow;
}
}
Future<ChartPoint> addWeight({
required int weight,
}) async {
try {
return (await profileService.addWeight(
weight: weight,
))
.values
.first;
} catch (e) {
rethrow;
}
}
}

View File

@@ -9,7 +9,22 @@ abstract class ProfileService {
factory ProfileService(Dio dio, {String baseUrl}) = _ProfileService;
@GET('/api/profile/show/{slug}')
Future<Profile> getProfileBySlug({
Future<ProfileModel> getProfileBySlug({
@Path() required String slug,
});
@GET('/api/profile/index')
Future<ProfileModel> getMyProfile();
@POST('/api/profile/addCircumference')
Future<Map<String, Circumference>> addCircumference({
@Part(name: 'chest_circumference') required int chestCircumference,
@Part(name: 'waist_circumference') required int waistCircumference,
@Part(name: 'hip_circumference') required int hipCircumference,
});
@POST('/api/profile/addWeight')
Future<Map<String, ChartPoint>> addWeight({
@Part() required int weight,
});
}

View File

@@ -22,12 +22,12 @@ class _ProfileService implements ProfileService {
final ParseErrorLogger? errorLogger;
@override
Future<Profile> getProfileBySlug({required String slug}) async {
Future<ProfileModel> getProfileBySlug({required String slug}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options = _setStreamType<Profile>(Options(
final _options = _setStreamType<ProfileModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
@@ -44,9 +44,130 @@ class _ProfileService implements ProfileService {
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Profile _value;
late ProfileModel _value;
try {
_value = Profile.fromJson(_result.data!);
_value = ProfileModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@override
Future<ProfileModel> getMyProfile() async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options = _setStreamType<ProfileModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/profile/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late ProfileModel _value;
try {
_value = ProfileModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@override
Future<Map<String, Circumference>> addCircumference({
required int chestCircumference,
required int waistCircumference,
required int hipCircumference,
}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = FormData();
_data.fields.add(MapEntry(
'chest_circumference',
chestCircumference.toString(),
));
_data.fields.add(MapEntry(
'waist_circumference',
waistCircumference.toString(),
));
_data.fields.add(MapEntry(
'hip_circumference',
hipCircumference.toString(),
));
final _options = _setStreamType<Map<String, Circumference>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/profile/addCircumference',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, Circumference> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, Circumference.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@override
Future<Map<String, ChartPoint>> addWeight({required int weight}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = FormData();
_data.fields.add(MapEntry(
'weight',
weight.toString(),
));
final _options = _setStreamType<Map<String, ChartPoint>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/profile/addWeight',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, ChartPoint> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, ChartPoint.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;

View File

@@ -24,12 +24,8 @@ mixin _$Ingredient {
String get unit => throw _privateConstructorUsedError;
String get portion => throw _privateConstructorUsedError;
/// Serializes this Ingredient to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$IngredientCopyWith<Ingredient> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -53,8 +49,6 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -98,8 +92,6 @@ class __$$IngredientImplCopyWithImpl<$Res>
_$IngredientImpl _value, $Res Function(_$IngredientImpl) _then)
: super(_value, _then);
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -155,13 +147,11 @@ class _$IngredientImpl implements _Ingredient {
(identical(other.portion, portion) || other.portion == portion));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, name, unit, portion);
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$IngredientImplCopyWith<_$IngredientImpl> get copyWith =>
@@ -190,11 +180,8 @@ abstract class _Ingredient implements Ingredient {
String get unit;
@override
String get portion;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$IngredientImplCopyWith<_$IngredientImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -30,12 +30,8 @@ mixin _$RecipeModel {
String? get image => throw _privateConstructorUsedError;
int? get cooking_time => throw _privateConstructorUsedError;
/// Serializes this RecipeModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$RecipeModelCopyWith<RecipeModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -68,8 +64,6 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -152,8 +146,6 @@ class __$$RecipeModelImplCopyWithImpl<$Res>
_$RecipeModelImpl _value, $Res Function(_$RecipeModelImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -287,7 +279,7 @@ class _$RecipeModelImpl implements _RecipeModel {
other.cooking_time == cooking_time));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -301,9 +293,7 @@ class _$RecipeModelImpl implements _RecipeModel {
image,
cooking_time);
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RecipeModelImplCopyWith<_$RecipeModelImpl> get copyWith =>
@@ -350,11 +340,8 @@ abstract class _RecipeModel implements RecipeModel {
String? get image;
@override
int? get cooking_time;
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RecipeModelImplCopyWith<_$RecipeModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,12 +23,8 @@ mixin _$Step {
String? get image => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
/// Serializes this Step to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$StepCopyWith<Step> get copyWith => throw _privateConstructorUsedError;
}
@@ -50,8 +46,6 @@ class _$StepCopyWithImpl<$Res, $Val extends Step>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -88,8 +82,6 @@ class __$$StepImplCopyWithImpl<$Res>
__$$StepImplCopyWithImpl(_$StepImpl _value, $Res Function(_$StepImpl) _then)
: super(_value, _then);
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -137,13 +129,11 @@ class _$StepImpl implements _Step {
other.description == description));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, image, description);
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$StepImplCopyWith<_$StepImpl> get copyWith =>
@@ -167,11 +157,8 @@ abstract class _Step implements Step {
String? get image;
@override
String? get description;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$StepImplCopyWith<_$StepImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -147,9 +147,6 @@ class _$RecipeCreateStateCopyWithImpl<$Res, $Val extends RecipeCreateState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -166,9 +163,6 @@ class __$$RecipeCreateStateImplCopyWithImpl<$Res>
__$$RecipeCreateStateImplCopyWithImpl(_$RecipeCreateStateImpl _value,
$Res Function(_$RecipeCreateStateImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -349,9 +343,6 @@ class __$$RecipeCreateStateLoadingImplCopyWithImpl<$Res>
_$RecipeCreateStateLoadingImpl _value,
$Res Function(_$RecipeCreateStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -560,8 +551,6 @@ class __$$RecipeCreateStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$RecipeCreateStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -670,8 +659,6 @@ class __$$RecipeCreateStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$RecipeModelCopyWith<$Res>? get recipe {
@@ -684,8 +671,6 @@ class __$$RecipeCreateStateLoadedImplCopyWithImpl<$Res>
});
}
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SelectionPopupModelCopyWith<$Res> get selectedType {
@@ -694,8 +679,6 @@ class __$$RecipeCreateStateLoadedImplCopyWithImpl<$Res>
});
}
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SelectionPopupModelCopyWith<$Res> get selectedCookingTime {
@@ -705,8 +688,6 @@ class __$$RecipeCreateStateLoadedImplCopyWithImpl<$Res>
});
}
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SelectionPopupModelCopyWith<$Res> get selectedStatus {
@@ -906,9 +887,7 @@ class _$RecipeCreateStateLoadedImpl implements RecipeCreateStateLoaded {
selectedStatus
]);
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RecipeCreateStateLoadedImplCopyWith<_$RecipeCreateStateLoadedImpl>
@@ -1157,10 +1136,7 @@ abstract class RecipeCreateStateLoaded implements RecipeCreateState {
SelectionPopupModel get selectedType;
SelectionPopupModel get selectedCookingTime;
SelectionPopupModel get selectedStatus;
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RecipeCreateStateLoadedImplCopyWith<_$RecipeCreateStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -1184,8 +1160,6 @@ class __$$RecipeCreateStateErrorImplCopyWithImpl<$Res>
$Res Function(_$RecipeCreateStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1225,9 +1199,7 @@ class _$RecipeCreateStateErrorImpl implements RecipeCreateStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RecipeCreateStateErrorImplCopyWith<_$RecipeCreateStateErrorImpl>
@@ -1377,10 +1349,7 @@ abstract class RecipeCreateStateError implements RecipeCreateState {
_$RecipeCreateStateErrorImpl;
String get errorMessage;
/// Create a copy of RecipeCreateState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RecipeCreateStateErrorImplCopyWith<_$RecipeCreateStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -24,12 +24,8 @@ mixin _$LocationModel {
@JsonKey(name: 'response_body')
String get responseBody => throw _privateConstructorUsedError;
/// Serializes this LocationModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of LocationModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$LocationModelCopyWith<LocationModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -55,8 +51,6 @@ class _$LocationModelCopyWithImpl<$Res, $Val extends LocationModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of LocationModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -97,8 +91,6 @@ class __$$LocationModelImplCopyWithImpl<$Res>
_$LocationModelImpl _value, $Res Function(_$LocationModelImpl) _then)
: super(_value, _then);
/// Create a copy of LocationModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -157,14 +149,12 @@ class _$LocationModelImpl implements _LocationModel {
other.responseBody == responseBody));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_locations), responseBody);
/// Create a copy of LocationModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$LocationModelImplCopyWith<_$LocationModelImpl> get copyWith =>
@@ -192,11 +182,8 @@ abstract class _LocationModel implements LocationModel {
@override
@JsonKey(name: 'response_body')
String get responseBody;
/// Create a copy of LocationModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$LocationModelImplCopyWith<_$LocationModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -18,9 +18,7 @@ final _privateConstructorUsedError = UnsupportedError(
mixin _$RegistrationState {
UserRegistrationSheet get sheet => throw _privateConstructorUsedError;
/// Create a copy of RegistrationState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
$RegistrationStateCopyWith<RegistrationState> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -46,8 +44,6 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RegistrationState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -61,8 +57,6 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState>
) as $Val);
}
/// Create a copy of RegistrationState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserRegistrationSheetCopyWith<$Res> get sheet {
@@ -94,8 +88,6 @@ class __$$RegistrationStateImplCopyWithImpl<$Res>
$Res Function(_$RegistrationStateImpl) _then)
: super(_value, _then);
/// Create a copy of RegistrationState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -134,9 +126,7 @@ class _$RegistrationStateImpl implements _RegistrationState {
@override
int get hashCode => Object.hash(runtimeType, sheet);
/// Create a copy of RegistrationState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith =>
@@ -150,11 +140,8 @@ abstract class _RegistrationState implements RegistrationState {
@override
UserRegistrationSheet get sheet;
/// Create a copy of RegistrationState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(ignore: true)
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/constants/constants.dart';
import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_cubit.dart';
import 'package:eatvio_app/features/calendar/repositories/calendar_repository.dart';
import 'package:eatvio_app/features/calendar/services/calendar_service.dart';
@@ -45,6 +46,7 @@ Future<void> init() async {
sl.registerFactory<DiaryBloc>(() => DiaryBloc(diaryRepository: sl()));
sl.registerFactory<CalendarCubit>(() => CalendarCubit(calendarRepository: sl()));
sl.registerFactory<ProfileCubit>(() => ProfileCubit(profileRepository: sl()));
sl.registerFactory<ProfileAvatarCubit>(() => ProfileAvatarCubit(profileRepository: sl()));
sl.registerFactory<RecipeCreateCubit>(() => RecipeCreateCubit(recipeRepository: sl()));
sl.registerFactory<DietsCubit>(() => DietsCubit(feedRepository: sl()));
sl.registerFactory<CommentsCubit>(() => CommentsCubit(feedRepository: sl()));

View File

@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
import 'package:eatvio_app/core/initialization_cubit/initialization_state.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_cubit.dart';
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
@@ -17,11 +18,8 @@ import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_prof
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
import 'package:path_provider/path_provider.dart';
import 'core/app_export.dart';
var globalMessengerKey = GlobalKey<ScaffoldMessengerState>();
@@ -29,15 +27,11 @@ var globalMessengerKey = GlobalKey<ScaffoldMessengerState>();
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await di.init();
final appDocumentDir = await getApplicationDocumentsDirectory();
final path = appDocumentDir.path;
await Hive.initFlutter(path);
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
DeviceOrientation.portraitUp,
]);
await PrefUtils().init();
initializeDateFormatting().then((_) => runApp(MyApp()));
}
@@ -49,7 +43,7 @@ class MyApp extends StatelessWidget {
BlocProvider<InitializationCubit>(create: (context) => sl<InitializationCubit>()),
BlocProvider<NewMessagesCubit>(create: (context) => sl<NewMessagesCubit>()),
BlocProvider<NotificationsCubit>(create: (context) => sl<NotificationsCubit>()),
BlocProvider<ThemeBloc>(create: (context) => ThemeBloc(ThemeState(themeType: PrefUtils().getThemeData()))),
BlocProvider<ProfileAvatarCubit>(create: (context) => sl<ProfileAvatarCubit>()..getMyProfile()),
BlocProvider<FeedCubit>(create: (context) => sl<FeedCubit>()..loadFeedBlogPostList()),
BlocProvider<RecipesCubit>(create: (context) => sl<RecipesCubit>()..loadRecipesList()),
BlocProvider<DietsCubit>(create: (context) => sl<DietsCubit>()..loadDiets()),
@@ -61,31 +55,27 @@ class MyApp extends StatelessWidget {
],
child: BlocListener<InitializationCubit, InitializationState>(
listener: (BuildContext context, InitializationState state) {},
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return KeyboardDismisser(
gestures: [
GestureType.onTap,
GestureType.onPanUpdateDownDirection,
],
child: MaterialApp.router(
theme: theme,
routerConfig: AppRouter.appRouter,
debugShowCheckedModeBanner: false,
localizationsDelegates: [
AppLocalizationDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
Locale(
'ru',
),
],
child: KeyboardDismisser(
gestures: [
GestureType.onTap,
GestureType.onPanUpdateDownDirection,
],
child: MaterialApp.router(
theme: theme,
routerConfig: AppRouter.appRouter,
debugShowCheckedModeBanner: false,
localizationsDelegates: [
AppLocalizationDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
Locale(
'ru',
),
);
},
],
),
),
),
);

View File

@@ -6,7 +6,6 @@ import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import 'package:url_launcher/url_launcher.dart';
import 'package:validators/validators.dart';
@@ -126,7 +125,7 @@ class _AuthScreenState extends State<AuthScreen> {
height: 48,
width: MediaQuery.of(context).size.width - 32,
child: FloatingActionButton.extended(
heroTag: 'nextButtonRegistration',
heroTag: 'authButton',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,
@@ -167,9 +166,7 @@ class _AuthScreenState extends State<AuthScreen> {
print(response.statusCode);
if (response.statusCode == 200) {
var res = await jsonDecode(response.body);
final box = await Hive.openBox('token');
final token = res['token'];
box.put('token', token);
await TokenStorage.saveTokenInStorage(token);
GoRouter.of(context).go('/my-profile-screen');
} else {

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/diets/diet_create_screen/models/diet_create_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -25,9 +25,7 @@ class DietCreateBloc extends Bloc<DietCreateEvent, DietCreateState> {
DietCreateInitialEvent event,
Emitter<DietCreateState> emit,
) async {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
if (state is DietCreateLoadedState) {

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/diets/diet_edit_screen/models/diet_edit_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -26,16 +26,14 @@ class DietEditBloc extends Bloc<DietEditEvent, DietEditState> {
Emitter<DietEditState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final String? dietID = state.dietModelObj?.dietID;
final response = await http.get(
Uri.parse(baseUrl + '/api/diets/show/$dietID'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {

View File

@@ -3,11 +3,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/diets/diet_select_screen/models/diet_select_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
@@ -27,15 +27,13 @@ class DietSelectBloc extends Bloc<DietSelectEvent, DietSelectState> {
Emitter<DietSelectState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final response = await http.get(
Uri.parse(baseUrl + '/api/diets/index'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
print('Got response');

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/diets/diet_show_screen/models/diet_show_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -26,16 +26,14 @@ class DietBloc extends Bloc<DietEvent, DietState> {
Emitter<DietState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final String? dietID = state.dietModelObj?.dietID;
final response = await http.get(
Uri.parse(baseUrl + '/api/diets/show/$dietID'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {
@@ -62,16 +60,14 @@ class DietBloc extends Bloc<DietEvent, DietState> {
}
FutureOr<void> _deleteEntry(DeleteEntry event, Emitter<DietState> emit) async {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final int id = event.id;
final response = await http.post(
Uri.parse(baseUrl + '/api/diets/delete/$id'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {

View File

@@ -2,12 +2,12 @@ import 'dart:async';
import 'package:dio/dio.dart';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:eatvio_app/presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:image_picker/image_picker.dart';
import '/core/app_export.dart';
@@ -27,9 +27,7 @@ class BlogPostCreateBloc extends Bloc<BlogPostCreateEvent, BlogPostCreateState>
BlogPostCreateInitialEvent event,
Emitter<BlogPostCreateState> emit,
) async {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
if (state is BlogPostCreateLoadedState) {
@@ -46,7 +44,7 @@ class BlogPostCreateBloc extends Bloc<BlogPostCreateEvent, BlogPostCreateState>
} else {
emit(
BlogPostCreateLoadedState(
token: token,
token: await TokenStorage.getTokenFromStorage(),
title: TextEditingController(),
description: TextEditingController(),
youtubeURL: TextEditingController(),

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/feed/blog_post_edit_screen/models/blog_post_edit_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -26,16 +26,14 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
Emitter<BlogPostEditState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final String? blog_postID = state.blog_postModelObj?.blog_postID;
final response = await http.get(
Uri.parse(baseUrl + '/api/blogPosts/show/$blog_postID'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/glossary/glossary_screen/models/glossary_screen_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -26,15 +26,13 @@ class GlossaryBloc extends Bloc<GlossaryEvent, GlossaryState> {
Emitter<GlossaryState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final responseProductGroups = await http.get(
Uri.parse(baseUrl + '/api/glossaries/group/index'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (responseProductGroups.statusCode == 200) {
@@ -54,12 +52,12 @@ class GlossaryBloc extends Bloc<GlossaryEvent, GlossaryState> {
List<SelectionPopupModel> productGroupsModel = _fillProductGroups(dataProductGroups);
emit(
GlossaryLoadedState(
token: token,
token: await TokenStorage.getTokenFromStorage(),
productGroups: productGroupsModel,
productList: [],
),
);
await _getProductListById(token, emit, productGroupsModel[0].id);
await _getProductListById(await TokenStorage.getTokenFromStorage(), emit, productGroupsModel[0].id);
}
} else {
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/plans/plan_create_screen/models/plan_create_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -25,9 +25,7 @@ class PlanCreateBloc extends Bloc<PlanCreateEvent, PlanCreateState> {
PlanCreateInitialEvent event,
Emitter<PlanCreateState> emit,
) async {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
if (state is PlanCreateLoadedState) {

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/plans/plan_edit_screen/models/plan_edit_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -26,16 +26,14 @@ class PlanEditBloc extends Bloc<PlanEditEvent, PlanEditState> {
Emitter<PlanEditState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final String? planID = state.planModelObj?.planID;
final response = await http.get(
Uri.parse(baseUrl + '/api/plans/show/$planID'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {

View File

@@ -3,11 +3,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/plans/plan_select_screen/models/plan_select_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
@@ -27,9 +27,7 @@ class PlanSelectBloc extends Bloc<PlanSelectEvent, PlanSelectState> {
Emitter<PlanSelectState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final response = await http.get(

View File

@@ -2,11 +2,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/plans/plan_show_screen/models/plan_show_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import '/core/app_export.dart';
@@ -26,16 +26,14 @@ class PlanBloc extends Bloc<PlanEvent, PlanState> {
Emitter<PlanState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final String? planID = state.planModelObj?.planID;
final response = await http.get(
Uri.parse(baseUrl + '/api/plans/show/$planID'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {
@@ -62,16 +60,14 @@ class PlanBloc extends Bloc<PlanEvent, PlanState> {
}
FutureOr<void> _deleteEntry(DeleteEntry event, Emitter<PlanState> emit) async {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
final int id = event.id;
final response = await http.post(
Uri.parse(baseUrl + '/api/plans/delete/$id'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {

View File

@@ -3,11 +3,11 @@ import 'dart:async';
import 'dart:convert';
import 'package:eatvio_app/app_router.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
@@ -28,9 +28,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
Emitter<MyProfileState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
if (token == null) {
if (!await TokenStorage.haveTokenInStorage()) {
AppRouter.navigatorKey.currentContext?.goNamed('authScreen');
}
//final token =
@@ -38,7 +36,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
final response = await http.get(
Uri.parse(baseUrl + '/api/profile/index'),
headers: {
'Authorization': 'Bearer $token',
'Authorization': 'Bearer ${await TokenStorage.getTokenFromStorage()}',
},
);
if (response.statusCode == 200) {
@@ -48,10 +46,6 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
data.containsKey('userDetails') &&
data.containsKey('chartPoints') &&
data.containsKey('circumferences')) {
final avatarBox = await Hive.openBox('avatar');
final avatar = data['user']['profile_photo_path'];
print(avatar);
avatarBox.put('avatar', avatar);
if (state is MyProfileLoadedState) {
var currentState = state as MyProfileLoadedState;
var plans = []
@@ -69,7 +63,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
user: data['user'],
userDetails: data['userDetails'],
plans: plans,
token: token,
token: await TokenStorage.getTokenFromStorage(),
chestCircumferenceController: TextEditingController(),
waistCircumferenceController: TextEditingController(),
hipCircumferenceController: TextEditingController(),
@@ -172,7 +166,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
user: data['user'],
userDetails: data['userDetails'],
plans: plans,
token: token,
token: await TokenStorage.getTokenFromStorage(),
chestCircumferenceController: TextEditingController(),
waistCircumferenceController: TextEditingController(),
hipCircumferenceController: TextEditingController(),

View File

@@ -1,24 +1,23 @@
import 'dart:convert';
import 'dart:math';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider_plus/carousel_slider_plus.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:http/http.dart' as http;
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'bloc/my_profile_bloc.dart';
import 'models/my_profile_model.dart';
class MyProfileScreen extends StatelessWidget {
int valuteToInt(String value) {
// Преобразование строки в целое число
return int.tryParse(value) ?? 0; // Возвращает 0, если преобразование не удалось
}
static Widget builder(BuildContext context) {
return BlocProvider<MyProfileBloc>(
create: (context) => MyProfileBloc(
@@ -193,7 +192,7 @@ class MyProfileScreen extends StatelessWidget {
_buildCarousel(BuildContext contex, MyProfileLoadedState state) {
return CarouselSlider(
options: CarouselOptions(height: 370),
options: CarouselOptions(height: 340),
items: [1, 2, 3].map((chartType) {
return Builder(
builder: (BuildContext context) {
@@ -210,11 +209,11 @@ class MyProfileScreen extends StatelessWidget {
),
),
SizedBox(height: 50.v),
// _buildChart(
// context,
// state.chartPoints?.values.map<int>((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0],
// state.chartDates,
// ),
_buildChart(
context,
state.chartPoints?.values.map<int>((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0],
state.chartDates,
),
],
),
);
@@ -228,14 +227,14 @@ class MyProfileScreen extends StatelessWidget {
),
),
SizedBox(height: 50.v),
// _buildChart(
// context,
// _bodyMassIndex(
// state.chartPoints?.values.map<int>((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0],
// state.userDetails?['height'].toInt() ?? 160,
// ),
// state.chartDates,
// ),
_buildChart(
context,
_bodyMassIndex(
state.chartPoints?.values.map<int>((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0],
state.userDetails?['height'].toInt() ?? 160,
),
state.chartDates,
),
],
);
case 3: //График обхватов
@@ -250,7 +249,7 @@ class MyProfileScreen extends StatelessWidget {
),
),
SizedBox(height: 30.v),
// _buildCircumferenceChart(context, state.circumferences, state.chartDates),
_buildCircumferenceChart(context, state.circumferences, state.chartDates),
_buildChartLegend(),
],
),
@@ -296,34 +295,354 @@ class MyProfileScreen extends StatelessWidget {
);
}
// Widget _buildChart(BuildContext context, List<double> chartPoints, List<String>? dates) {
// // Проверяем, что у нас есть 4 элемента в обоих списках
// if (chartPoints.length != 4 || (dates != null && dates.length != 4)) {
// return Center(child: Text('Должно быть ровно 4 точки и 4 даты.'));
// }
_buildChart(BuildContext context, List<double> chartPoints, List<String>? dates) {
List<FlSpot> spots = [];
for (int i = 0; i < 4; i++) {
spots.add(
FlSpot((i * 10 / 10) + 1, chartPoints[i]),
);
}
// // Преобразуем данные в список точек для графика
// List<ChartData> chartData = List.generate(4, (index) {
// return ChartData(dates![index], chartPoints[index]);
// });
Widget bottomTitleWidgets(double value, TitleMeta meta, double chartWidth, List<String>? dates) {
if (value % 1 != 0) {
return Container();
}
final style = TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
fontSize: min(13, 13 * chartWidth / 300),
);
int index = value.toInt();
if (index >= 0 && index < dates!.length) {
// Проверка на допустимый индекс в массиве dates
String formattedDate = DateFormat('dd.MM').format(DateTime.parse(dates[index]));
return SideTitleWidget(
axisSide: meta.axisSide,
space: 16,
child: Text(formattedDate, style: style),
);
} else {
return Container();
}
}
// return Container(
// height: 300, // Задайте нужную высоту для графика
// child: SfCartesianChart(
// title: ChartTitle(text: 'График значений'),
// primaryXAxis: CategoryAxis(),
// series: <CartesianSeries<ChartData, String>>[
// // Изменяем на CartesianSeries
// LineSeries<ChartData, String>(
// dataSource: chartData,
// xValueMapper: (ChartData data, _) => data.date,
// yValueMapper: (ChartData data, _) => data.value,
// dataLabelSettings: DataLabelSettings(isVisible: true),
// ),
// ],
// ),
// );
// }
Widget leftTitleWidgets(double value, TitleMeta meta, double chartWidth) {
final style = TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
fontSize: min(18, 18 * chartWidth / 300),
);
return SideTitleWidget(
axisSide: meta.axisSide,
space: 16,
child: Text(meta.formattedValue, style: style),
);
}
return Padding(
padding: const EdgeInsets.only(
left: 12,
right: 20,
),
child: AspectRatio(
aspectRatio: 1,
child: LayoutBuilder(
builder: (context, constraints) {
return LineChart(
LineChartData(
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
maxContentWidth: 100,
// tooltipBgColor: Colors.black,
getTooltipItems: mapSpots(),
),
handleBuiltInTouches: true,
getTouchLineStart: (data, index) => 0,
),
lineBarsData: [
LineChartBarData(
color: Colors.pink,
spots: spots,
isCurved: true,
isStrokeCapRound: true,
barWidth: 3,
belowBarData: BarAreaData(
show: false,
),
dotData: const FlDotData(show: false),
),
],
minY: chartPoints.reduce((value, element) => value < element ? value : element),
maxY: chartPoints.reduce((value, element) => value > element ? value : element),
minX: 1,
maxX: 4,
titlesData: FlTitlesData(
leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) => leftTitleWidgets(value, meta, constraints.maxWidth),
reservedSize: 56,
),
drawBelowEverything: true,
),
rightTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) => bottomTitleWidgets(value, meta, constraints.maxWidth, dates),
reservedSize: 36,
interval: 1,
),
drawBelowEverything: true,
),
topTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
),
gridData: FlGridData(
show: true,
drawHorizontalLine: true,
drawVerticalLine: true,
horizontalInterval: 1.5,
verticalInterval: 5,
checkToShowHorizontalLine: valuteToInt(),
getDrawingHorizontalLine: (_) => FlLine(
color: Colors.blue.withOpacity(1),
dashArray: [8, 2],
strokeWidth: 0.8,
),
getDrawingVerticalLine: (_) => FlLine(
color: Colors.blue.withOpacity(1),
dashArray: [8, 2],
strokeWidth: 0.8,
),
checkToShowVerticalLine: valuteToInt(),
),
borderData: FlBorderData(show: false),
),
);
},
),
),
);
}
valuteToInt() {
return (value) {
return value.toInt() == 0;
};
}
List<LineTooltipItem?> Function(List<LineBarSpot>) mapSpots() {
return (touchedSpots) {
return touchedSpots.map((LineBarSpot touchedSpot) {
final textStyle = TextStyle(
color: touchedSpot.bar.gradient?.colors[0] ?? touchedSpot.bar.color,
fontWeight: FontWeight.bold,
fontSize: 14,
);
return LineTooltipItem(
'${touchedSpot.x}, ${touchedSpot.y.toStringAsFixed(2)}',
textStyle,
);
}).toList();
};
}
_buildCircumferenceChart(BuildContext context, chartPoints, List<String>? dates) {
// Определение осей графика
final chestCircumferences = chartPoints.values.map((e) => e['chest_circumference']).toList();
List<FlSpot> spotsChest = [];
for (int i = 0; i < 4; i++) {
chestCircumferences[i] = chestCircumferences[i] * 10 / 10;
spotsChest.add(
FlSpot((i * 10 / 10) + 1, chestCircumferences[i] * 10 / 10),
);
}
final waistCircumferences = chartPoints.values.map((e) => e['waist_circumference']).toList();
List<FlSpot> spotsWaist = [];
for (int i = 0; i < 4; i++) {
waistCircumferences[i] = waistCircumferences[i] * 10 / 10;
spotsWaist.add(
FlSpot((i * 10 / 10) + 1, waistCircumferences[i] * 10 / 10),
);
}
final hipCircumferences = chartPoints.values.map((e) => e['hip_circumference']).toList();
List<FlSpot> spotsHip = [];
for (int i = 0; i < 4; i++) {
hipCircumferences[i] = hipCircumferences[i] * 10 / 10;
spotsHip.add(
FlSpot((i * 10 / 10) + 1, hipCircumferences[i]),
);
}
final allCircumferences = [...chestCircumferences, ...hipCircumferences, ...waistCircumferences];
Widget bottomTitleWidgets(double value, TitleMeta meta, double chartWidth, List<String>? dates) {
if (value % 1 != 0) {
return Container();
}
final style = TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
fontSize: min(13, 13 * chartWidth / 300),
);
int index = value.toInt();
if (index >= 0 && index < dates!.length) {
// Проверка на допустимый индекс в массиве dates
String formattedDate = DateFormat('dd.MM').format(DateTime.parse(dates[index]));
return SideTitleWidget(
axisSide: meta.axisSide,
space: 16,
child: Text(formattedDate, style: style),
);
} else {
return Container();
}
}
Widget leftTitleWidgets(double value, TitleMeta meta, double chartWidth) {
final style = TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
fontSize: min(18, 18 * chartWidth / 300),
);
return SideTitleWidget(
axisSide: meta.axisSide,
space: 16,
child: Text(meta.formattedValue, style: style),
);
}
return Padding(
padding: const EdgeInsets.only(
left: 12,
right: 20,
),
child: AspectRatio(
aspectRatio: 1,
child: LayoutBuilder(
builder: (context, constraints) {
return LineChart(
LineChartData(
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
maxContentWidth: 100,
// tooltipBgColor: Colors.black,
getTooltipItems: mapTouchedSpots(),
),
handleBuiltInTouches: true,
getTouchLineStart: (data, index) => 0,
),
lineBarsData: [
LineChartBarData(
color: Colors.pink,
spots: spotsChest,
isCurved: true,
isStrokeCapRound: true,
barWidth: 3,
belowBarData: BarAreaData(
show: false,
),
dotData: const FlDotData(show: false),
),
LineChartBarData(
color: Colors.green,
spots: spotsWaist,
isCurved: true,
isStrokeCapRound: true,
barWidth: 3,
belowBarData: BarAreaData(
show: false,
),
dotData: const FlDotData(show: false),
),
LineChartBarData(
color: Colors.purple,
spots: spotsHip,
isCurved: true,
isStrokeCapRound: true,
barWidth: 3,
belowBarData: BarAreaData(
show: false,
),
dotData: const FlDotData(show: false),
),
],
minY: allCircumferences.reduce((value, element) => value < element ? value : element),
maxY: allCircumferences.reduce((value, element) => value > element ? value : element),
minX: 1,
maxX: 4,
titlesData: FlTitlesData(
leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) => leftTitleWidgets(value, meta, constraints.maxWidth),
reservedSize: 56,
),
drawBelowEverything: true,
),
rightTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) => bottomTitleWidgets(value, meta, constraints.maxWidth, dates),
reservedSize: 36,
interval: 1,
),
drawBelowEverything: true,
),
topTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
),
gridData: FlGridData(
show: true,
drawHorizontalLine: true,
drawVerticalLine: true,
horizontalInterval: 1.5,
verticalInterval: 5,
checkToShowHorizontalLine: valuteToInt(),
getDrawingHorizontalLine: (_) => FlLine(
color: Colors.blue.withOpacity(1),
dashArray: [8, 2],
strokeWidth: 0.8,
),
getDrawingVerticalLine: (_) => FlLine(
color: Colors.blue.withOpacity(1),
dashArray: [8, 2],
strokeWidth: 0.8,
),
checkToShowVerticalLine: valuteToInt(),
),
borderData: FlBorderData(show: false),
),
);
},
),
),
);
}
List<LineTooltipItem?> Function(List<LineBarSpot>) mapTouchedSpots() {
return (touchedSpots) {
return touchedSpots.map((LineBarSpot touchedSpot) {
final textStyle = TextStyle(
color: touchedSpot.bar.gradient?.colors[0] ?? touchedSpot.bar.color,
fontWeight: FontWeight.bold,
fontSize: 14,
);
return LineTooltipItem(
'${touchedSpot.x}, ${touchedSpot.y.toStringAsFixed(2)}',
textStyle,
);
}).toList();
};
}
/// Section Widget
_buildPlans(BuildContext context, List<dynamic>? plans, List<dynamic>? imagePaths, List<dynamic>? states) {
@@ -643,16 +962,3 @@ class MyProfileScreen extends StatelessWidget {
};
}
}
class ChartData {
final String date;
final double value;
ChartData(this.date, this.value);
valuteToInt() {
return (value) {
return value.toInt() == 0;
};
}
}

Some files were not shown because too many files have changed in this diff Show More