diff --git a/.metadata b/.metadata
new file mode 100644
index 00000000..aa90aa80
--- /dev/null
+++ b/.metadata
@@ -0,0 +1,45 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: "ba393198430278b6595976de84fe170f553cc728"
+ channel: "stable"
+
+project_type: app
+
+# Tracks metadata for the flutter migrate command
+migration:
+ platforms:
+ - platform: root
+ create_revision: ba393198430278b6595976de84fe170f553cc728
+ base_revision: ba393198430278b6595976de84fe170f553cc728
+ - platform: android
+ create_revision: ba393198430278b6595976de84fe170f553cc728
+ base_revision: ba393198430278b6595976de84fe170f553cc728
+ - platform: ios
+ create_revision: ba393198430278b6595976de84fe170f553cc728
+ base_revision: ba393198430278b6595976de84fe170f553cc728
+ - platform: linux
+ create_revision: ba393198430278b6595976de84fe170f553cc728
+ base_revision: ba393198430278b6595976de84fe170f553cc728
+ - platform: macos
+ create_revision: ba393198430278b6595976de84fe170f553cc728
+ base_revision: ba393198430278b6595976de84fe170f553cc728
+ - platform: web
+ create_revision: ba393198430278b6595976de84fe170f553cc728
+ base_revision: ba393198430278b6595976de84fe170f553cc728
+ - platform: windows
+ create_revision: ba393198430278b6595976de84fe170f553cc728
+ base_revision: ba393198430278b6595976de84fe170f553cc728
+
+ # User provided section
+
+ # List of Local paths (relative to this file) that should be
+ # ignored by the migrate tool.
+ #
+ # Files that are not part of the templates will be ignored by default.
+ unmanaged_files:
+ - 'lib/main.dart'
+ - 'ios/Runner.xcodeproj/project.pbxproj'
diff --git a/android/app/src/main/kotlin/com/eatvioapp/eatvio_app/MainActivity.kt b/android/app/src/main/kotlin/com/eatvioapp/eatvio_app/MainActivity.kt
new file mode 100644
index 00000000..f3e4d58d
--- /dev/null
+++ b/android/app/src/main/kotlin/com/eatvioapp/eatvio_app/MainActivity.kt
@@ -0,0 +1,5 @@
+package com.eatvioapp.eatvio_app
+
+import io.flutter.embedding.android.FlutterActivity
+
+class MainActivity: FlutterActivity()
diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 00000000..f74085f3
--- /dev/null
+++ b/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 00000000..06952be7
--- /dev/null
+++ b/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/android/eatvio_app_android.iml b/android/eatvio_app_android.iml
new file mode 100644
index 00000000..18999696
--- /dev/null
+++ b/android/eatvio_app_android.iml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eatvio_app.iml b/eatvio_app.iml
new file mode 100644
index 00000000..f66303d5
--- /dev/null
+++ b/eatvio_app.iml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift
new file mode 100644
index 00000000..86a7c3b1
--- /dev/null
+++ b/ios/RunnerTests/RunnerTests.swift
@@ -0,0 +1,12 @@
+import Flutter
+import UIKit
+import XCTest
+
+class RunnerTests: XCTestCase {
+
+ func testExample() {
+ // If you add code to the Runner application, consider adding tests here.
+ // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
+ }
+
+}
diff --git a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart
index 85fa617e..b760ef84 100644
--- a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart
+++ b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart
@@ -18,8 +18,7 @@ class DiaryEditBloc extends Bloc {
on(_onInitialize);
on(_changeSatiety); // пользователь нажимает на шкалу сытости
on(_changeMood); // пользователь нажимает на шкалу настроения
- on(
- _changeMealTime); // пользователь изменяет время приема пиши
+ on(_changeMealTime); // пользовательяет времяа пиши
on(_changeMeal);
on(_changeWakeup); // пользователь выбирает время пробуждения
on(_changeRetire); // пользователь выбирает время отхода ко сну
@@ -44,7 +43,7 @@ class DiaryEditBloc extends Bloc {
) async {
try {
final token =
- "laravel_sanctum_1lPFtd9tpGmHYS243C4K7YF8BrVhxxgXm8cTmjuZda1da694";
+ "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
final response = await http.get(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/index'),
headers: {
@@ -52,14 +51,13 @@ class DiaryEditBloc extends Bloc {
'Authorization': 'Bearer $token',
},
);
-
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
if (data is Map && data.containsKey('id')) {
final int diaryId = data['id'];
try {
final response = await http.get(
- Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/show/$diaryId'),
+ Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/$diaryId/show/'),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $token',
@@ -143,7 +141,7 @@ class DiaryEditBloc extends Bloc {
}
} catch (e) {
// Ошибка при получении данных дневника
- emit(DiaryEditErrorState('Ошибка при получении данных дневника: $e'));
+ emit(DiaryEditErrorState('Ошибка при получении данных о дневнике: $e'));
}
}
@@ -151,7 +149,7 @@ class DiaryEditBloc extends Bloc {
print("Reloading...");
try {
final token =
- "laravel_sanctum_1lPFtd9tpGmHYS243C4K7YF8BrVhxxgXm8cTmjuZda1da694";
+ "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
final response = await http.get(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/index'),
@@ -167,7 +165,7 @@ class DiaryEditBloc extends Bloc {
final int diaryId = data['id'];
final diaryResponse = await http.get(
- Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/show/$diaryId'),
+ Uri.parse(dotenv.env['SERVER_ROOT']! + '/diary/$diaryId/show/'),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $token',
@@ -176,7 +174,6 @@ class DiaryEditBloc extends Bloc {
final diary = jsonDecode(diaryResponse.body)['diary'];
- print(diary);
if (diary is Map) {
final String diaryDate = diary['date'] ?? DateTime.now().toString();
// Продолжайте обработку данных дневника
@@ -545,7 +542,6 @@ class DiaryEditBloc extends Bloc {
.map((product) => product['name'])
.toList(),
);
- print(event.input.length);
if (event.input.length > 3) {
updatedState = updatedState.copyWith(moderationExpanded: true);
} else {
@@ -642,7 +638,6 @@ class DiaryEditBloc extends Bloc {
encoding: utf8,
);
- print(response.body);
return response;
}
@@ -665,11 +660,11 @@ class DiaryEditBloc extends Bloc {
String imagePath, int diaryID, int mealId, String? token) async {
String url =
'${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealId/photo/upload';
+ // 'https://eo6yh2uv84lm3p0.m.pipedream.net'; // Remove this line and uncomment the above line for actual server URL
var request = http.MultipartRequest('POST', Uri.parse(url));
- request.headers.addAll({
- 'Authorization': 'Bearer $token',
- });
+ request.headers['Authorization'] = 'Bearer $token';
+ request.headers['Content-Type'] = 'multipart/form-data';
request.files.add(await http.MultipartFile.fromPath('image', imagePath));
@@ -679,7 +674,7 @@ class DiaryEditBloc extends Bloc {
return imageUrl;
} else {
throw Exception(
- 'Failed to upload image. Status code: ${response.statusCode}');
+ 'Failed to upload image. Status code: ${response.statusCode}}');
}
}
@@ -687,7 +682,6 @@ class DiaryEditBloc extends Bloc {
SendModeration event, Emitter emit) async {
if (state is DiaryEditLoadedState) {
var currentState = state as DiaryEditLoadedState;
- print("sad");
final response = await _sendModerationData(
event.name,
event.energyOn100gr,
@@ -710,6 +704,8 @@ class DiaryEditBloc extends Bloc {
String? token) async {
String url =
'${dotenv.env['SERVER_ROOT']!}/diary/product_nutritional_values/sendToModeration';
+ var serverURL = Uri.parse('${dotenv.env['SERVER_ROOT']!}');
+ String host = serverURL.host;
final Map credentials = {
'name': name,
'energy_on_100gr': energy_on_100gr,
@@ -717,14 +713,16 @@ class DiaryEditBloc extends Bloc {
'fats_on_100gr': fats_on_100gr,
'carbohydrates_on_100gr': carbohydrates_on_100gr,
};
+ var bodyBytes = utf8.encode(json.encode(credentials));
var response = await http.post(
Uri.parse(url),
headers: {
'Content-Type': 'application/json',
+ 'Content-Length': '${bodyBytes.length}',
'Authorization': 'Bearer $token',
+ 'Host': host,
},
- body: json.encode(credentials),
- encoding: utf8,
+ body: bodyBytes,
);
if (response.statusCode == 200) {
return response;
diff --git a/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart b/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart
index fbee790c..43ff4259 100644
--- a/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart
+++ b/lib/presentation/diary/diary_edit_screen/diary_edit_screen.dart
@@ -33,9 +33,8 @@ class DiaryEditScreen extends StatelessWidget {
builder: (context, state) {
if (state is DiaryEditInitialState) {
// Это начальное состояние, данные ещё не загружены.
- return CircularProgressIndicator(
+ return Container(
color: Colors.white,
- backgroundColor: Colors.white,
);
} else if (state is DiaryEditLoadedState) {
// Данные загружены, можно строить экран.
@@ -757,37 +756,6 @@ class DiaryEditScreen extends StatelessWidget {
),
),
SizedBox(height: 8.v),
- Padding(
- padding: EdgeInsets.only(left: 4.h),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- "Калории",
- style: theme.textTheme.titleSmall,
- ),
- Padding(
- padding: EdgeInsets.only(left: 28.h),
- child: Text(
- "Белки",
- style: theme.textTheme.titleSmall,
- ),
- ),
- Spacer(),
- Text(
- "Жиры",
- style: theme.textTheme.titleSmall,
- ),
- Padding(
- padding: EdgeInsets.only(left: 25.h),
- child: Text(
- "Углеводы",
- style: theme.textTheme.titleSmall,
- ),
- ),
- ],
- ),
- ),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.only(
@@ -893,23 +861,6 @@ class DiaryEditScreen extends StatelessWidget {
);
}
- Widget newMethod(double value) {
- switch (value.toInt()) {
- case 0:
- return Text('Calories');
- case 1:
- return Text('Fat');
- case 2:
- return Text('Protein');
- case 3:
- return Text('Carbs');
- default:
- return Text('');
- }
- }
-
- buildBars(BuildContext context, DiaryEditLoadedState state) {}
-
/// Section Widget
_buildComment(BuildContext context, DiaryEditLoadedState state) {
return Container(
diff --git a/web/favicon.png b/web/favicon.png
new file mode 100644
index 00000000..8aaa46ac
Binary files /dev/null and b/web/favicon.png differ
diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png
new file mode 100644
index 00000000..b749bfef
Binary files /dev/null and b/web/icons/Icon-192.png differ
diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png
new file mode 100644
index 00000000..88cfd48d
Binary files /dev/null and b/web/icons/Icon-512.png differ
diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png
new file mode 100644
index 00000000..eb9b4d76
Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ
diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png
new file mode 100644
index 00000000..d69c5669
Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 00000000..5e43edb1
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ eatvio_app
+
+
+
+
+
+
+
+
+
+
diff --git a/web/manifest.json b/web/manifest.json
new file mode 100644
index 00000000..99d6563d
--- /dev/null
+++ b/web/manifest.json
@@ -0,0 +1,35 @@
+{
+ "name": "eatvio_app",
+ "short_name": "eatvio_app",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#0175C2",
+ "theme_color": "#0175C2",
+ "description": "A new Flutter project.",
+ "orientation": "portrait-primary",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "icons/Icon-192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-maskable-192.png",
+ "sizes": "192x192",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "icons/Icon-maskable-512.png",
+ "sizes": "512x512",
+ "type": "image/png",
+ "purpose": "maskable"
+ }
+ ]
+}