forked from eatvio/eatvio_app
feat(chat): add trailing comma rules
This commit is contained in:
@@ -27,7 +27,9 @@ dart_code_metrics:
|
||||
# maximum-nesting-level: 5
|
||||
# metrics-exclude:
|
||||
# - test/**
|
||||
# rules:
|
||||
linter:
|
||||
rules:
|
||||
require_trailing_commas: true
|
||||
# - newline-before-return
|
||||
# - no-boolean-literal-compare
|
||||
# - no-empty-block
|
||||
|
||||
@@ -19,7 +19,7 @@ class ProgressDialogUtils {
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
},);
|
||||
isProgressVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||
// This functions are responsible to make UI responsive across all the mobile devices.
|
||||
|
||||
MediaQueryData mediaQueryData = MediaQueryData.fromView(
|
||||
WidgetsBinding.instance.platformDispatcher.views.single);
|
||||
WidgetsBinding.instance.platformDispatcher.views.single,);
|
||||
|
||||
// These are the Viewport values of your Figma Design.
|
||||
// These are used in the code as a reference to create your UI Responsively.
|
||||
|
||||
@@ -71,12 +71,12 @@ class ChatSelectBloc extends Bloc<ChatSelectEvent, ChatSelectState> {
|
||||
emit(currentState.copyWith(
|
||||
chatSelectModelObj: currentState.chatSelectModelObj,
|
||||
chatRooms: currentState.chatRooms,
|
||||
));
|
||||
),);
|
||||
} else {
|
||||
emit(ChatSelectLoadedState(
|
||||
chatRooms: fillChatEntryList(data['chatRooms']),
|
||||
//chatRooms: [],
|
||||
));
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -75,7 +75,7 @@ class ChatEntryWidget extends StatelessWidget {
|
||||
chatEntryObj.dateText!,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 6.v),
|
||||
@@ -85,7 +85,7 @@ class ChatEntryWidget extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -26,7 +26,7 @@ class AppLocalization {
|
||||
return AppLocalization(Locale(
|
||||
'ru',
|
||||
'',
|
||||
)); // Возвращаем дефолтное значение или обработку ошибки
|
||||
),); // Возвращаем дефолтное значение или обработку ошибки
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:eatvio_app/app_router.dart';
|
||||
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/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_select_model.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
@@ -48,7 +47,9 @@ class MyApp extends StatelessWidget {
|
||||
BlocProvider<MyProfileBloc>(create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent())),
|
||||
BlocProvider<FeedBloc>(create: (context) => FeedBloc(FeedState(myProfileModelObj: FeedModel()))..add(FeedInitialEvent())),
|
||||
BlocProvider<DiaryEditBloc>(create: (context) => DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel()))..add(DiaryEditInitialEvent())),
|
||||
BlocProvider<ChatSelectBloc>(create: (context) => ChatSelectBloc(ChatSelectState(chatSelectModelObj: ChatSelectModel()))..add(ChatSelectInitialEvent()))
|
||||
BlocProvider<ChatSelectBloc>(
|
||||
create: (context) => ChatSelectBloc(ChatSelectState(chatSelectModelObj: ChatSelectModel()))..add(ChatSelectInitialEvent()),
|
||||
),
|
||||
],
|
||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||
builder: (context, state) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class AuthScreen extends StatelessWidget {
|
||||
selector: (state) => state.emailController,
|
||||
builder: (context, emailController) {
|
||||
return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done);
|
||||
}),
|
||||
},),
|
||||
SizedBox(height: 22.v),
|
||||
Text("password".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
@@ -61,7 +61,7 @@ class AuthScreen extends StatelessWidget {
|
||||
obscureText: true,
|
||||
controller: passwordController,
|
||||
);
|
||||
}),
|
||||
},),
|
||||
SizedBox(height: 50.v),
|
||||
NextStepButton(
|
||||
text: "no_account".tr.toUpperCase(),
|
||||
@@ -86,9 +86,9 @@ class AuthScreen extends StatelessWidget {
|
||||
text: "authentificate".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapAuth(state, context));
|
||||
}),
|
||||
]))));
|
||||
onPressed: onTapAuth(state, context),);
|
||||
},),
|
||||
],),),),);
|
||||
}
|
||||
|
||||
onTapAuth(AuthState state, BuildContext context) {
|
||||
@@ -100,7 +100,7 @@ class AuthScreen extends StatelessWidget {
|
||||
'password': state.passwordController!.text,
|
||||
};
|
||||
final response = await http.post(Uri.parse(dotenv.env['SERVER_ROOT']! + '/login'),
|
||||
headers: {'Content-Type': 'application/json'}, body: json.encode(credentials), encoding: utf8);
|
||||
headers: {'Content-Type': 'application/json'}, body: json.encode(credentials), encoding: utf8,);
|
||||
print(response.statusCode);
|
||||
if (response.statusCode == 200) {
|
||||
var res = await jsonDecode(response.body);
|
||||
|
||||
@@ -29,15 +29,15 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
on<AddPortionEvent>(_addPortion); //пользователь нажимает "Добавить продукт"
|
||||
on<RemovePortionEvent>(_removePortion);
|
||||
on<RemoveImageEvent>(
|
||||
_removeImage); // пользователь нажимает на крестик около продукта
|
||||
_removeImage,); // пользователь нажимает на крестик около продукта
|
||||
on<UploadImages>(_uploadImages); //пользователь нажимает "Добавить фото"
|
||||
on<AddComment>(_addComment); //пользователь нажимает "Добавить комментарий"
|
||||
on<ProductInput>(
|
||||
_inputProduct); //пользователь нажимает "Добавить комментарий"
|
||||
_inputProduct,); //пользователь нажимает "Добавить комментарий"
|
||||
on<FinishDay>(_finishDay); //пользователь нажимает "Добавить комментарий"
|
||||
on<SendModeration>(_sendModeration);
|
||||
on<RefreshEvent>(
|
||||
reloadScreen); //пользователь нажимает "Добавить комментарий"
|
||||
reloadScreen,); //пользователь нажимает "Добавить комментарий"
|
||||
on<ClearInput>(_clearInput);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
recommendedChartValues: currentState.recommendedChartValues,
|
||||
consumedChartValues: currentState.consumedChartValues,
|
||||
autocompleteList: currentState.autocompleteList,
|
||||
diaryEditModelObj: currentState.diaryEditModelObj));
|
||||
diaryEditModelObj: currentState.diaryEditModelObj,),);
|
||||
} else {
|
||||
// Если текущее состояние - начальное, создаем новое загруженное состояние
|
||||
final List<SelectionPopupModel> meals =
|
||||
@@ -97,7 +97,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
emit(DiaryEditLoadedState(
|
||||
currentMeal: meals[0],
|
||||
portionController: SelectionPopupModel(
|
||||
id: 0, title: "порций", isSelected: true),
|
||||
id: 0, title: "порций", isSelected: true,),
|
||||
wakeupExpanded: true,
|
||||
moodExpanded: true,
|
||||
moderationExpanded: false,
|
||||
@@ -125,7 +125,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
diaryDate: diaryDate,
|
||||
autocompleteList: [],
|
||||
diaryEditModelObj: state.diaryEditModelObj
|
||||
?.copyWith(mealList: meals, portionList: fillPortions())));
|
||||
?.copyWith(mealList: meals, portionList: fillPortions()),),);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -177,10 +177,10 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
fetchChartValues(
|
||||
String token, int diaryID, Emitter<DiaryEditState> emit) async {
|
||||
String token, int diaryID, Emitter<DiaryEditState> emit,) async {
|
||||
final responseChart = await http.get(
|
||||
Uri.parse(
|
||||
dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/dailyNutritionData/'),
|
||||
dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/dailyNutritionData/',),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer $token',
|
||||
@@ -250,7 +250,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
final String diaryDate = diary['date'] ?? DateTime.now().toString();
|
||||
final responseChart = await http.get(
|
||||
Uri.parse(dotenv.env['SERVER_ROOT']! +
|
||||
'/diary/$diaryId/dailyNutritionData/'),
|
||||
'/diary/$diaryId/dailyNutritionData/',),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer $token',
|
||||
@@ -258,7 +258,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
);
|
||||
if (responseChart.statusCode == 200) {
|
||||
final recommendedChartValues = jsonDecode(
|
||||
responseChart.body)['dailyNutritionRecommendation'];
|
||||
responseChart.body,)['dailyNutritionRecommendation'];
|
||||
final consumedChartValues =
|
||||
jsonDecode(responseChart.body)['dailyNutritionIntake'];
|
||||
final List<SelectionPopupModel> meals =
|
||||
@@ -266,10 +266,10 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
try {
|
||||
await Future(() => emit(DiaryEditLoadedState(
|
||||
diaryEditModelObj: state.diaryEditModelObj?.copyWith(
|
||||
mealList: meals, portionList: fillPortions()),
|
||||
mealList: meals, portionList: fillPortions(),),
|
||||
currentMeal: meals[0],
|
||||
portionController: SelectionPopupModel(
|
||||
id: 0, title: "порций", isSelected: true),
|
||||
id: 0, title: "порций", isSelected: true,),
|
||||
wakeupExpanded: true,
|
||||
moodExpanded: true,
|
||||
moderationExpanded: false,
|
||||
@@ -301,7 +301,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
diaryDate: diaryDate,
|
||||
isLoading: false,
|
||||
autocompleteList: [],
|
||||
)));
|
||||
),),);
|
||||
|
||||
print("Updated");
|
||||
} catch (e) {
|
||||
@@ -312,11 +312,11 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
} else {
|
||||
emit(DiaryEditErrorState(
|
||||
'Ошибка при декодировании данных дневника'));
|
||||
'Ошибка при декодировании данных дневника',),);
|
||||
}
|
||||
} else {
|
||||
emit(
|
||||
DiaryEditErrorState('Некоторые необходимые данные отсутствуют.'));
|
||||
DiaryEditErrorState('Некоторые необходимые данные отсутствуют.'),);
|
||||
}
|
||||
} else {
|
||||
emit(DiaryEditErrorState('Ошибка сервера: ${response.statusCode}'));
|
||||
@@ -327,7 +327,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
Future<void> _changeSatiety(
|
||||
ChangeSatiety event, Emitter<DiaryEditState> emit) async {
|
||||
ChangeSatiety event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
var updatedState =
|
||||
@@ -338,7 +338,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
currentState.token,
|
||||
event.selectedElement,
|
||||
currentState.currentMeal?.id,
|
||||
currentState.diaryId);
|
||||
currentState.diaryId,);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
updatedState.selectedSatiety = event.selectedElement;
|
||||
@@ -364,12 +364,12 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<void> _changeMood(
|
||||
ChangeMood event, Emitter<DiaryEditState> emit) async {
|
||||
ChangeMood event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
var updatedState =
|
||||
@@ -380,11 +380,11 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
currentState.token,
|
||||
event.selectedElement,
|
||||
currentState.currentMeal?.id,
|
||||
currentState.diaryId);
|
||||
currentState.diaryId,);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print(
|
||||
'Mood change success! meal_id: ${currentState.currentMeal?.id}, mood: ${event.selectedElement}');
|
||||
'Mood change success! meal_id: ${currentState.currentMeal?.id}, mood: ${event.selectedElement}',);
|
||||
updatedState.selectedMood = event.selectedElement;
|
||||
emit(updatedState); // Передаем обновленное состояние в emit
|
||||
}
|
||||
@@ -409,17 +409,17 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
FutureOr<void> _changeWakeup(
|
||||
WakeupEvent event, Emitter<DiaryEditState> emit) async {
|
||||
WakeupEvent event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
var response = await sendWakeupData(
|
||||
currentState.token, event.selectedTime, currentState.diaryId);
|
||||
currentState.token, event.selectedTime, currentState.diaryId,);
|
||||
if (response.statusCode == 200) {
|
||||
await reloadScreen(event, emit);
|
||||
var updatedState =
|
||||
@@ -432,11 +432,11 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _changeRetire(
|
||||
RetireEvent event, Emitter<DiaryEditState> emit) async {
|
||||
RetireEvent event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
var response = await sendRetireData(
|
||||
currentState.token, event.selectedTime, currentState.diaryId);
|
||||
currentState.token, event.selectedTime, currentState.diaryId,);
|
||||
if (response.statusCode == 200) {
|
||||
await reloadScreen(event, emit);
|
||||
var updatedState =
|
||||
@@ -467,13 +467,13 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<http.Response> sendRetireData(
|
||||
String? token, TimeOfDay retire, int diaryID) async {
|
||||
String? token, TimeOfDay retire, int diaryID,) async {
|
||||
String url = dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/retire/fill';
|
||||
final formatter = DateFormat('HH:mm');
|
||||
final retireString =
|
||||
@@ -488,13 +488,13 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
FutureOr<void> _changeMealTime(
|
||||
ChangeMealTime event, Emitter<DiaryEditState> emit) async {
|
||||
ChangeMealTime event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
var updatedState = currentState.copyWith(mealTimeController: event.time);
|
||||
@@ -522,18 +522,18 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
FutureOr<void> _changeMeal(
|
||||
ChangeMeal event, Emitter<DiaryEditState> emit) async {
|
||||
ChangeMeal event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
final meal = currentState.meals?.firstWhere(
|
||||
(meal) => meal['id'] == event.value.id,
|
||||
orElse: () => null);
|
||||
orElse: () => null,);
|
||||
int? id = event.value.id;
|
||||
print(meal['photos']);
|
||||
DiaryEditLoadedState updatedState = currentState.copyWith(
|
||||
@@ -542,7 +542,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
photos: meal['photos'],
|
||||
mealTimeController: toTime(meal['time'] ?? "1$id:00"),
|
||||
selectedMood: meal['mood'],
|
||||
selectedSatiety: meal['satiety']);
|
||||
selectedSatiety: meal['satiety'],);
|
||||
print(updatedState.photos);
|
||||
emit(updatedState);
|
||||
}
|
||||
@@ -550,7 +550,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
|
||||
|
||||
FutureOr<void> _clearInput(
|
||||
ClearInput event, Emitter<DiaryEditState> emit) {
|
||||
ClearInput event, Emitter<DiaryEditState> emit,) {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
DiaryEditLoadedState updatedState = currentState.copyWith(
|
||||
@@ -560,7 +560,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _changePortion(
|
||||
ChangePortion event, Emitter<DiaryEditState> emit) {
|
||||
ChangePortion event, Emitter<DiaryEditState> emit,) {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
DiaryEditLoadedState updatedState = currentState.copyWith(
|
||||
@@ -571,7 +571,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _toggleMood(
|
||||
ToggleMoodExpandedEvent event, Emitter<DiaryEditState> emit) {
|
||||
ToggleMoodExpandedEvent event, Emitter<DiaryEditState> emit,) {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
|
||||
@@ -581,7 +581,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _toggleWakeup(
|
||||
ToggleWakeupExpandedEvent event, Emitter<DiaryEditState> emit) {
|
||||
ToggleWakeupExpandedEvent event, Emitter<DiaryEditState> emit,) {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
|
||||
@@ -591,7 +591,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _addPortion(
|
||||
AddPortionEvent event, Emitter<DiaryEditState> emit) async {
|
||||
AddPortionEvent event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
|
||||
@@ -609,13 +609,13 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
await reloadScreen(event, emit);
|
||||
} else {
|
||||
print(
|
||||
'Failed to add portion. Status Code: ${response.statusCode} ${response.body}');
|
||||
'Failed to add portion. Status Code: ${response.statusCode} ${response.body}',);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<http.Response> sendPortionData(String? token, String? name,
|
||||
String portion, int? quantity, int? mealID, int diaryID) async {
|
||||
String portion, int? quantity, int? mealID, int diaryID,) async {
|
||||
String url =
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealID/portions/create';
|
||||
|
||||
@@ -639,14 +639,14 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
Future<void> _inputProduct(
|
||||
ProductInput event, Emitter<DiaryEditState> emit) async {
|
||||
ProductInput event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
String? token = currentState.token;
|
||||
|
||||
final Map<String, dynamic> credentials = {'name': event.input};
|
||||
final uri = Uri.parse(
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/product_nutritional_values/filter?${Uri(queryParameters: credentials).query}');
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/product_nutritional_values/filter?${Uri(queryParameters: credentials).query}',);
|
||||
|
||||
final response = await http.get(
|
||||
uri,
|
||||
@@ -679,7 +679,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
Future<void> _removePortion(
|
||||
RemovePortionEvent event, Emitter<DiaryEditState> emit) async {
|
||||
RemovePortionEvent event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
|
||||
@@ -697,13 +697,13 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
await reloadScreen(event, emit);
|
||||
} else {
|
||||
print(
|
||||
'Failed to add portion. Status Code: ${response.statusCode} ${response.body}');
|
||||
'Failed to add portion. Status Code: ${response.statusCode} ${response.body}',);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<http.Response> sendRemovePortion(
|
||||
String? token, int? portionID, int? mealID, int diaryID) async {
|
||||
String? token, int? portionID, int? mealID, int diaryID,) async {
|
||||
String url =
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealID/portions/$portionID/delete';
|
||||
|
||||
@@ -720,7 +720,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _removeImage(
|
||||
RemoveImageEvent event, Emitter<DiaryEditState> emit) async {
|
||||
RemoveImageEvent event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
|
||||
@@ -736,13 +736,13 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
await reloadScreen(event, emit);
|
||||
} else {
|
||||
print(
|
||||
'Failed to remove photo. Status Code: ${response.statusCode} ${response.body}');
|
||||
'Failed to remove photo. Status Code: ${response.statusCode} ${response.body}',);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<http.Response> sendRemovePhoto(String? token, String? path,
|
||||
String? photoID, int? mealID, int diaryID) async {
|
||||
String? photoID, int? mealID, int diaryID,) async {
|
||||
String url =
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealID/photo/delete';
|
||||
final Map<String, dynamic> credentials = {
|
||||
@@ -781,7 +781,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
Future<http.Response> sendFinishDay(String? token, int diaryID,
|
||||
TimeOfDay? wakeup, TimeOfDay? retire, String? comment) async {
|
||||
TimeOfDay? wakeup, TimeOfDay? retire, String? comment,) async {
|
||||
final formatter = DateFormat('HH:mm');
|
||||
final wakeupString =
|
||||
formatter.format(DateTime(2022, 1, 1, wakeup!.hour, wakeup.minute));
|
||||
@@ -810,19 +810,19 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
Future<void> _uploadImages(
|
||||
UploadImages event, Emitter<DiaryEditState> emit) async {
|
||||
UploadImages event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
|
||||
emit(currentState.copyWith(isLoading: true));
|
||||
await uploadImageToServer(event.image.path, currentState.diaryId,
|
||||
currentState.currentMeal!.id!, currentState.token);
|
||||
currentState.currentMeal!.id!, currentState.token,);
|
||||
await reloadScreen(event, emit);
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> uploadImageToServer(
|
||||
String imagePath, int diaryID, int mealId, String? token) async {
|
||||
String imagePath, int diaryID, int mealId, String? token,) async {
|
||||
String url =
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/$diaryID/meal/$mealId/photo/upload';
|
||||
|
||||
@@ -841,12 +841,12 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
return imageUrl;
|
||||
} else {
|
||||
throw Exception(
|
||||
'Failed to upload image. Status code: ${streamedResponse.statusCode}}');
|
||||
'Failed to upload image. Status code: ${streamedResponse.statusCode}}',);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _sendModeration(
|
||||
SendModeration event, Emitter<DiaryEditState> emit) async {
|
||||
SendModeration event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
final response = await _sendModerationData(
|
||||
@@ -871,9 +871,9 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
String proteins_on_100gr,
|
||||
String fats_on_100gr,
|
||||
String carbohydrates_on_100gr,
|
||||
String? token) async {
|
||||
String? token,) async {
|
||||
final Uri url = Uri.parse(
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/product_nutritional_values/sendToModeration');
|
||||
'${dotenv.env['SERVER_ROOT']!}/diary/product_nutritional_values/sendToModeration',);
|
||||
final Uri serverURL = Uri.parse('${dotenv.env['SERVER_ROOT']!}');
|
||||
String host = serverURL.host;
|
||||
final Map<String, String> credentials = {
|
||||
@@ -901,12 +901,12 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
return response;
|
||||
} else {
|
||||
throw Exception(
|
||||
'Failed to send a product for moderation ${response.statusCode}');
|
||||
'Failed to send a product for moderation ${response.statusCode}',);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _addComment(
|
||||
AddComment event, Emitter<DiaryEditState> emit) async {
|
||||
AddComment event, Emitter<DiaryEditState> emit,) async {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
var updatedState = currentState.copyWith(
|
||||
@@ -915,7 +915,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
|
||||
// Отправляем данные по HTTP маршруту и ждем ответ
|
||||
var response = await sendCommentData(
|
||||
currentState.token, event.comment, currentState.diaryId);
|
||||
currentState.token, event.comment, currentState.diaryId,);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
emit(updatedState); // Передаем обновленное состояние в emit
|
||||
@@ -924,7 +924,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
|
||||
Future<http.Response> sendCommentData(
|
||||
String? token, String comment, int diaryID) async {
|
||||
String? token, String comment, int diaryID,) async {
|
||||
String url = dotenv.env['SERVER_ROOT']! + '/diary/$diaryID/retire/fill';
|
||||
final Map<String, dynamic> credentials = {
|
||||
'comment': comment,
|
||||
@@ -936,7 +936,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class SendModeration extends DiaryEditEvent {
|
||||
required this.energyOn100gr,
|
||||
required this.proteinsOn100gr,
|
||||
required this.fatsOn100gr,
|
||||
required this.carbohydratesOn100gr});
|
||||
required this.carbohydratesOn100gr,});
|
||||
String name;
|
||||
String energyOn100gr;
|
||||
String proteinsOn100gr;
|
||||
|
||||
@@ -47,7 +47,7 @@ class DiaryEditLoadedState extends DiaryEditState {
|
||||
required this.selectedSatiety,
|
||||
required this.moderationExpanded,
|
||||
required this.wakeupExpanded,
|
||||
required this.moodExpanded})
|
||||
required this.moodExpanded,})
|
||||
: super(diaryEditModelObj: null);
|
||||
|
||||
DiaryEditModel? diaryEditModelObj;
|
||||
@@ -109,7 +109,7 @@ class DiaryEditLoadedState extends DiaryEditState {
|
||||
moderationExpanded,
|
||||
isLoading,
|
||||
isAdded,
|
||||
currentMeal
|
||||
currentMeal,
|
||||
];
|
||||
DiaryEditLoadedState copyWith({
|
||||
DiaryEditModel? diaryEditModelObj,
|
||||
@@ -174,7 +174,7 @@ class DiaryEditLoadedState extends DiaryEditState {
|
||||
moderationExpanded: moderationExpanded ?? this.moderationExpanded,
|
||||
moodExpanded: moodExpanded ?? this.moodExpanded,
|
||||
isAdded: isAdded ?? this.isAdded,
|
||||
isLoading: isLoading ?? this.isLoading);
|
||||
isLoading: isLoading ?? this.isLoading,);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<DiaryEditBloc>(
|
||||
create: (context) => DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel()))..add(DiaryEditInitialEvent()), child: DiaryEditScreen());
|
||||
create: (context) => DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel()))..add(DiaryEditInitialEvent()), child: DiaryEditScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -221,7 +221,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
Icon(
|
||||
Icons.photo_library,
|
||||
color: appTheme.blueGray300,
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -332,7 +332,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
defaultValue: diaryEditModelObj?.mealList[0],
|
||||
onChanged: changeMeal(context, state),
|
||||
);
|
||||
})),
|
||||
},),),
|
||||
SizedBox(height: 20.v),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.h),
|
||||
@@ -381,7 +381,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
},),
|
||||
),
|
||||
SizedBox(height: 20.v),
|
||||
if (state.moderationExpanded)
|
||||
@@ -492,9 +492,9 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
return Container(); // Возвращаем пустой контейнер, если состояние не является DiaryEditLoadedState
|
||||
}
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
));
|
||||
),);
|
||||
}
|
||||
|
||||
openCaloriesDialog(BuildContext context, DiaryEditLoadedState state) {
|
||||
@@ -543,7 +543,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: triggerModeration(context, state.productNameController!.text, state.caloriesController!.text, state.proteinsController!.text,
|
||||
state.fatsController!.text, state.carbsController!.text, dialogContext),
|
||||
state.fatsController!.text, state.carbsController!.text, dialogContext,),
|
||||
child: Text('Отправить'),
|
||||
),
|
||||
],
|
||||
@@ -553,11 +553,11 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
triggerModeration(BuildContext context, String name, String energyOn100gr, String proteinsOn100gr, String fatsOn100gr, String carbohydratesOn100gr,
|
||||
BuildContext dialogContext) {
|
||||
BuildContext dialogContext,) {
|
||||
return () {
|
||||
// Call function to send moderation with the entered values
|
||||
context.read<DiaryEditBloc>().add(SendModeration(
|
||||
name: name, energyOn100gr: energyOn100gr, proteinsOn100gr: proteinsOn100gr, fatsOn100gr: fatsOn100gr, carbohydratesOn100gr: carbohydratesOn100gr));
|
||||
name: name, energyOn100gr: energyOn100gr, proteinsOn100gr: proteinsOn100gr, fatsOn100gr: fatsOn100gr, carbohydratesOn100gr: carbohydratesOn100gr,),);
|
||||
Navigator.of(dialogContext).pop(); // Dismiss the dialog
|
||||
};
|
||||
}
|
||||
@@ -647,7 +647,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
portion['product_name'].length > 8 ? portion['product_name'].substring(0, 8) : portion['product_name'],
|
||||
style: CustomTextStyles.titleMedium16,
|
||||
)),
|
||||
),),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.h,
|
||||
@@ -667,7 +667,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
Icons.close,
|
||||
color: appTheme.blueGray300,
|
||||
),
|
||||
)),
|
||||
),),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -783,26 +783,26 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
BarChartRodData(
|
||||
toY: consumedValues[0] / recommendedValues[0] * 100,
|
||||
color: checkConsumedValues([recommendedValues[0]], [consumedValues[1]]) ? Colors.red : Colors.blue,
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
BarChartGroupData(x: 1, barRods: [
|
||||
BarChartRodData(
|
||||
toY: consumedValues[1] / recommendedValues[1] * 100,
|
||||
color: checkConsumedValues([recommendedValues[1]], [consumedValues[1]]) ? Colors.red : Colors.blue,
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
BarChartGroupData(x: 2, barRods: [
|
||||
BarChartRodData(
|
||||
toY: consumedValues[2] / recommendedValues[2] * 100,
|
||||
color: checkConsumedValues([recommendedValues[2]], [consumedValues[2]]) ? Colors.red : Colors.blue,
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
BarChartGroupData(x: 3, barRods: [
|
||||
BarChartRodData(
|
||||
toY: consumedValues[3] / recommendedValues[3] * 100,
|
||||
color: checkConsumedValues([recommendedValues[3]], [consumedValues[3]]) ? Colors.red : Colors.blue,
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -909,7 +909,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
Text(
|
||||
"*Превышенная суточная норма",
|
||||
style: theme.textTheme.labelLarge,
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -1147,7 +1147,7 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
// Остальные элементы шкалы
|
||||
],
|
||||
),
|
||||
]));
|
||||
],),);
|
||||
}
|
||||
|
||||
changeMood(BuildContext context, int satiety) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ class DietCreateScreen extends StatelessWidget {
|
||||
final dietID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<DietCreateBloc>(
|
||||
create: (context) => DietCreateBloc(DietCreateState(dietModelObj: DietCreateModel(dietID: dietID.toString())))..add(DietCreateInitialEvent()),
|
||||
child: DietCreateScreen());
|
||||
child: DietCreateScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -80,10 +80,10 @@ class DietCreateScreen extends StatelessWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () => context.read<DietCreateBloc>().add(CreateDiet()),
|
||||
child: Text('Создать'),
|
||||
)
|
||||
]),
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
),
|
||||
],),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -49,13 +49,13 @@ class DietEditBloc extends Bloc<DietEditEvent, DietEditState> {
|
||||
diet: currentState.diet,
|
||||
name: currentState.name,
|
||||
duration: currentState.duration,
|
||||
details: currentState.details));
|
||||
details: currentState.details,),);
|
||||
} else {
|
||||
emit(DietEditLoadedState(
|
||||
diet: data,
|
||||
name: TextEditingController(text: data['name']),
|
||||
details: TextEditingController(text: data['details']),
|
||||
duration: TextEditingController(text: data['duration'])));
|
||||
duration: TextEditingController(text: data['duration']),),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -23,7 +23,7 @@ class DietEditState extends Equatable {
|
||||
|
||||
class DietEditLoadedState extends DietEditState {
|
||||
DietEditLoadedState(
|
||||
{this.dietModelObj, this.diet, this.name, this.details, this.duration});
|
||||
{this.dietModelObj, this.diet, this.name, this.details, this.duration,});
|
||||
|
||||
DietEditModel? dietModelObj;
|
||||
Map<String, dynamic>? diet;
|
||||
|
||||
@@ -12,7 +12,7 @@ class DietEditScreen extends StatelessWidget {
|
||||
final dietID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<DietEditBloc>(
|
||||
create: (context) => DietEditBloc(DietEditState(dietModelObj: DietEditModel(dietID: dietID.toString())))..add(DietEditInitialEvent()),
|
||||
child: DietEditScreen());
|
||||
child: DietEditScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -98,10 +98,10 @@ class DietEditScreen extends StatelessWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () => context.read<DietEditBloc>().add(EditDiet()),
|
||||
child: Text('Сохранить'),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -50,12 +50,12 @@ class DietSelectBloc extends Bloc<DietSelectEvent, DietSelectState> {
|
||||
emit((currentState).copyWith(
|
||||
posts: data,
|
||||
myProfileModelObj: currentState.myProfileModelObj,
|
||||
));
|
||||
),);
|
||||
} else {
|
||||
print('Got unloaded');
|
||||
emit(DietSelectLoadedState(
|
||||
posts: data,
|
||||
));
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:flutter/material.dart';
|
||||
class DietSelectScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<DietSelectBloc>(
|
||||
create: (context) => DietSelectBloc(DietSelectState(myProfileModelObj: DietSelectModel()))..add(DietSelectInitialEvent()), child: DietSelectScreen());
|
||||
create: (context) => DietSelectBloc(DietSelectState(myProfileModelObj: DietSelectModel()))..add(DietSelectInitialEvent()), child: DietSelectScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -95,14 +95,14 @@ class DietSelectScreen extends StatelessWidget {
|
||||
onTap: () => GoRouter.of(context).goNamed('dietCreateScreen'),
|
||||
child: Icon(Icons.create_outlined),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
_buildDietList(context, state)
|
||||
_buildDietList(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -161,7 +161,7 @@ class DietSelectScreen extends StatelessWidget {
|
||||
),
|
||||
child: Icon(Icons.edit),
|
||||
),
|
||||
));
|
||||
),);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class DietScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context) {
|
||||
final dietID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<DietBloc>(
|
||||
create: (context) => DietBloc(DietState(dietModelObj: DietModel(dietID: dietID.toString())))..add(DietInitialEvent()), child: DietScreen());
|
||||
create: (context) => DietBloc(DietState(dietModelObj: DietModel(dietID: dietID.toString())))..add(DietInitialEvent()), child: DietScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -104,9 +104,9 @@ class DietScreen extends StatelessWidget {
|
||||
child: Text('Удалить'),
|
||||
),
|
||||
],
|
||||
)
|
||||
]),
|
||||
)
|
||||
),
|
||||
],),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -37,18 +37,18 @@ class BlogPostCreateBloc
|
||||
title: currentState.title,
|
||||
description: currentState.description,
|
||||
youtube_url: currentState.youtube_url,
|
||||
token: currentState.token));
|
||||
token: currentState.token,),);
|
||||
} else {
|
||||
emit(BlogPostCreateLoadedState(
|
||||
token: token,
|
||||
title: TextEditingController(),
|
||||
description: TextEditingController(),
|
||||
youtube_url: TextEditingController()));
|
||||
youtube_url: TextEditingController(),),);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _createBlogPost(
|
||||
CreateBlogPost event, Emitter<BlogPostCreateState> emit) async {
|
||||
CreateBlogPost event, Emitter<BlogPostCreateState> emit,) async {
|
||||
if (state is BlogPostCreateLoadedState) {
|
||||
var currentState = state as BlogPostCreateLoadedState;
|
||||
|
||||
@@ -62,7 +62,7 @@ class BlogPostCreateBloc
|
||||
AppRouter.navigatorKey.currentContext?.goNamed('feedScreen');
|
||||
} else {
|
||||
print(
|
||||
'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}');
|
||||
'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}',);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class BlogPostCreateLoadedState extends BlogPostCreateState {
|
||||
this.blog_postModelObj,
|
||||
this.title,
|
||||
this.description,
|
||||
this.youtube_url});
|
||||
this.youtube_url,});
|
||||
|
||||
BlogPostCreateModel? blog_postModelObj;
|
||||
TextEditingController? title;
|
||||
@@ -42,7 +42,7 @@ class BlogPostCreateLoadedState extends BlogPostCreateState {
|
||||
TextEditingController? title,
|
||||
TextEditingController? description,
|
||||
TextEditingController? youtube_url,
|
||||
String? token}) {
|
||||
String? token,}) {
|
||||
return BlogPostCreateLoadedState(
|
||||
blog_postModelObj: blog_postModelObj ?? this.blog_postModelObj,
|
||||
title: title ?? this.title,
|
||||
|
||||
@@ -13,7 +13,7 @@ class BlogPostCreateScreen extends StatelessWidget {
|
||||
return BlocProvider<BlogPostCreateBloc>(
|
||||
create: (context) => BlogPostCreateBloc(BlogPostCreateState(blog_postModelObj: BlogPostCreateModel(blog_postID: blog_postID.toString())))
|
||||
..add(BlogPostCreateInitialEvent()),
|
||||
child: BlogPostCreateScreen());
|
||||
child: BlogPostCreateScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -100,7 +100,7 @@ class BlogPostCreateScreen extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -49,13 +49,13 @@ class BlogPostEditBloc extends Bloc<BlogPostEditEvent, BlogPostEditState> {
|
||||
blog_post: currentState.blog_post,
|
||||
title: currentState.title,
|
||||
description: currentState.description,
|
||||
youtube_url: currentState.youtube_url));
|
||||
youtube_url: currentState.youtube_url,),);
|
||||
} else {
|
||||
emit(BlogPostEditLoadedState(
|
||||
blog_post: data,
|
||||
title: TextEditingController(text: data['title']),
|
||||
description: TextEditingController(text: data['description']),
|
||||
youtube_url: TextEditingController(text: data['youtube_url'])));
|
||||
youtube_url: TextEditingController(text: data['youtube_url']),),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -27,7 +27,7 @@ class BlogPostEditLoadedState extends BlogPostEditState {
|
||||
this.blog_post,
|
||||
this.title,
|
||||
this.description,
|
||||
this.youtube_url});
|
||||
this.youtube_url,});
|
||||
|
||||
BlogPostEditModel? blog_postModelObj;
|
||||
Map<String, dynamic>? blog_post;
|
||||
|
||||
@@ -12,7 +12,7 @@ class BlogPostEditScreen extends StatelessWidget {
|
||||
return BlocProvider<BlogPostEditBloc>(
|
||||
create: (context) =>
|
||||
BlogPostEditBloc(BlogPostEditState(blog_postModelObj: BlogPostEditModel(blog_postID: blog_postID.toString())))..add(BlogPostEditInitialEvent()),
|
||||
child: BlogPostEditScreen());
|
||||
child: BlogPostEditScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -106,10 +106,10 @@ class BlogPostEditScreen extends StatelessWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () => context.read<BlogPostEditBloc>().add(EditBlogPost()),
|
||||
child: Text('Сохранить'),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -50,14 +50,14 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
blog_post: currentState.blog_post,
|
||||
author: currentState.author,
|
||||
comments: currentState.comments,
|
||||
token: currentState.token));
|
||||
token: currentState.token,),);
|
||||
} else {
|
||||
emit(BlogPostLoadedState(
|
||||
blog_post: data,
|
||||
token: token,
|
||||
commentController: TextEditingController(),
|
||||
author: await _fetchAuthor(data['id']),
|
||||
comments: fillCommentList(await _fetchComments(data['id']))));
|
||||
comments: fillCommentList(await _fetchComments(data['id'])),),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
@@ -74,15 +74,15 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _createComment(
|
||||
CreateComment event, Emitter<BlogPostState> emit) async {
|
||||
CreateComment event, Emitter<BlogPostState> emit,) async {
|
||||
if (state is BlogPostLoadedState) {
|
||||
var currentState = state as BlogPostLoadedState;
|
||||
// Отправляем данные по HTTP маршруту и ждем ответ
|
||||
var response = await _sendCommentData(
|
||||
currentState.token, event.body, currentState.blog_post?['id']);
|
||||
currentState.token, event.body, currentState.blog_post?['id'],);
|
||||
if (response.statusCode == 200) {
|
||||
var updatedComments = fillCommentList(
|
||||
await _fetchComments(currentState.blog_post?['id']));
|
||||
await _fetchComments(currentState.blog_post?['id']),);
|
||||
var updatedState = currentState.copyWith(
|
||||
comments: updatedComments,
|
||||
commentController:
|
||||
@@ -94,7 +94,7 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _deleteEntry(
|
||||
DeleteEntry event, Emitter<BlogPostState> emit) async {
|
||||
DeleteEntry event, Emitter<BlogPostState> emit,) async {
|
||||
final box = await Hive.openBox('token');
|
||||
final token = box.get('token');
|
||||
if (token == null) {
|
||||
@@ -158,13 +158,13 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
username: comments[i]['name'],
|
||||
dateText: DateFormat('dd.MM')
|
||||
.format(DateTime.parse(comments[i]['updated_at'])),
|
||||
greetingText: comments[i]['body']));
|
||||
greetingText: comments[i]['body'],),);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
Future<http.Response> _sendCommentData(
|
||||
String? token, String body, int id) async {
|
||||
String? token, String body, int id,) async {
|
||||
String url = dotenv.env['SERVER_ROOT']! + '/feed/createComment/$id';
|
||||
final Map<String, dynamic> credentials = {
|
||||
'id': id,
|
||||
@@ -177,7 +177,7 @@ class BlogPostBloc extends Bloc<BlogPostEvent, BlogPostState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class BlogPostLoadedState extends BlogPostState {
|
||||
this.author,
|
||||
this.comments,
|
||||
this.token,
|
||||
this.commentController});
|
||||
this.commentController,});
|
||||
|
||||
BlogPostModel? blog_postModelObj;
|
||||
Map<String, dynamic>? blog_post;
|
||||
@@ -44,14 +44,14 @@ class BlogPostLoadedState extends BlogPostState {
|
||||
Map<String, dynamic>? author,
|
||||
TextEditingController? commentController,
|
||||
String? token,
|
||||
List<dynamic>? comments}) {
|
||||
List<dynamic>? comments,}) {
|
||||
return BlogPostLoadedState(
|
||||
blog_postModelObj: blog_postModelObj ?? this.blog_postModelObj,
|
||||
blog_post: blog_post ?? this.blog_post,
|
||||
author: author ?? this.author,
|
||||
comments: comments ?? this.comments,
|
||||
token: token ?? this.token,
|
||||
commentController: commentController ?? this.commentController);
|
||||
commentController: commentController ?? this.commentController,);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ class BlogPostScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
DateFormat('dd.MM.yyyy').format(DateTime.parse(state.blog_post?['updated_at'])),
|
||||
style: theme.textTheme.bodyMedium,
|
||||
)),
|
||||
),),
|
||||
SizedBox(height: 16.0),
|
||||
Row(children: [
|
||||
Padding(
|
||||
@@ -210,8 +210,8 @@ class BlogPostScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Нравится",
|
||||
style: CustomTextStyles.titleMediumSemiBold,
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
),
|
||||
Spacer(),
|
||||
Padding(
|
||||
@@ -224,10 +224,10 @@ class BlogPostScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Поделиться",
|
||||
style: CustomTextStyles.titleMediumSemiBold,
|
||||
)
|
||||
]))
|
||||
]),
|
||||
]),
|
||||
),
|
||||
],),),
|
||||
],),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ class BlogPostScreen extends StatelessWidget {
|
||||
),
|
||||
onPressed: () => context.read<BlogPostBloc>().add(CreateComment(state.commentController!.text)),
|
||||
// Установите прозрачный фон
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -9,7 +9,7 @@ class CommentModel {
|
||||
this.username,
|
||||
this.dateText,
|
||||
this.greetingText,
|
||||
required this.id}) {
|
||||
required this.id,}) {
|
||||
userImage = userImage ?? ImageConstant.imageNotFound;
|
||||
username = username;
|
||||
dateText = dateText;
|
||||
|
||||
@@ -82,7 +82,7 @@ class CommentWidget extends StatelessWidget {
|
||||
commentModelObj.dateText!,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -99,7 +99,7 @@ class CommentWidget extends StatelessWidget {
|
||||
imagePath: ImageConstant.imgSend,
|
||||
height: 30.v,
|
||||
width: 30.h,
|
||||
margin: EdgeInsets.only(left: 5)),
|
||||
margin: EdgeInsets.only(left: 5),),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -50,12 +50,12 @@ class FeedBloc extends Bloc<FeedEvent, FeedState> {
|
||||
emit((currentState).copyWith(
|
||||
posts: data,
|
||||
myProfileModelObj: currentState.myProfileModelObj,
|
||||
));
|
||||
),);
|
||||
} else {
|
||||
print('Got unloaded');
|
||||
emit(FeedLoadedState(
|
||||
posts: data,
|
||||
));
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -56,7 +56,7 @@ class FeedScreen extends StatelessWidget {
|
||||
SizedBox(height: 20),
|
||||
_buildMenu(context, state),
|
||||
SizedBox(height: 20),
|
||||
_buildBlogPostList(context, state)
|
||||
_buildBlogPostList(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -108,7 +108,7 @@ class FeedScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -235,8 +235,8 @@ class FeedScreen extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
"Комментировать",
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
),
|
||||
Spacer(),
|
||||
Row(children: [
|
||||
@@ -246,18 +246,18 @@ class FeedScreen extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
"Нравится",
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 4),
|
||||
child: Icon(Icons.share_outlined),
|
||||
),
|
||||
]),
|
||||
],),
|
||||
],
|
||||
),
|
||||
),
|
||||
]));
|
||||
],),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
|
||||
@@ -24,7 +24,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged})
|
||||
this.onChanged,})
|
||||
: super(
|
||||
key: key,
|
||||
);
|
||||
@@ -76,7 +76,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: searchViewWidget(context))
|
||||
child: searchViewWidget(context),)
|
||||
: searchViewWidget(context);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
SizedBox(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(Icons.search)),
|
||||
child: Icon(Icons.search),),
|
||||
),
|
||||
prefixIconConstraints: prefixConstraints ??
|
||||
BoxConstraints(
|
||||
|
||||
@@ -45,14 +45,14 @@ class GlossaryBloc extends Bloc<GlossaryEvent, GlossaryState> {
|
||||
glossaryModelObj: currentState.glossaryModelObj,
|
||||
token: currentState.token,
|
||||
productGroups: currentState.productGroups,
|
||||
productList: currentState.productList));
|
||||
productList: currentState.productList,),);
|
||||
} else {
|
||||
List<SelectionPopupModel> productGroupsModel =
|
||||
_fillProductGroups(dataProductGroups);
|
||||
emit(GlossaryLoadedState(
|
||||
token: token,
|
||||
productGroups: productGroupsModel,
|
||||
productList: []));
|
||||
productList: [],),);
|
||||
await _getProductListById(token, emit, productGroupsModel[0].id);
|
||||
}
|
||||
} else {
|
||||
@@ -62,7 +62,7 @@ class GlossaryBloc extends Bloc<GlossaryEvent, GlossaryState> {
|
||||
} else {
|
||||
// Статус ответа не равен 200, обрабатываем ошибку
|
||||
emit(GlossaryErrorState(
|
||||
'Ошибка сервера: ${responseProductGroups.statusCode}'));
|
||||
'Ошибка сервера: ${responseProductGroups.statusCode}',),);
|
||||
}
|
||||
} catch (e) {
|
||||
// Ошибка при декодировании JSON или другая ошибка выполнения
|
||||
@@ -71,7 +71,7 @@ class GlossaryBloc extends Bloc<GlossaryEvent, GlossaryState> {
|
||||
}
|
||||
|
||||
void _changeProductGroup(
|
||||
ChangeProductGroup event, Emitter<GlossaryState> emit) async {
|
||||
ChangeProductGroup event, Emitter<GlossaryState> emit,) async {
|
||||
if (state is GlossaryLoadedState) {
|
||||
var currentState = state as GlossaryLoadedState;
|
||||
await _getProductListById(currentState.token, emit, event.id);
|
||||
@@ -79,7 +79,7 @@ class GlossaryBloc extends Bloc<GlossaryEvent, GlossaryState> {
|
||||
}
|
||||
|
||||
Future<void> _getProductListById(
|
||||
token, Emitter<GlossaryState> emit, int? productGroupID) async {
|
||||
token, Emitter<GlossaryState> emit, int? productGroupID,) async {
|
||||
final responseProductList = await http.get(
|
||||
Uri.parse(dotenv.env['SERVER_ROOT']! + '/glossary/index/$productGroupID'),
|
||||
headers: {
|
||||
@@ -93,7 +93,7 @@ class GlossaryBloc extends Bloc<GlossaryEvent, GlossaryState> {
|
||||
emit(currentState.copyWith(
|
||||
glossaryModelObj: currentState.glossaryModelObj,
|
||||
productGroups: currentState.productGroups,
|
||||
productList: dataProductList));
|
||||
productList: dataProductList,),);
|
||||
} else {
|
||||
emit(GlossaryErrorState('Список продуктов некорректного формата'));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class GlossaryLoadedState extends GlossaryState {
|
||||
{this.glossaryModelObj,
|
||||
this.productGroups,
|
||||
this.productList,
|
||||
this.token});
|
||||
this.token,});
|
||||
|
||||
GlossaryModel? glossaryModelObj;
|
||||
String? token;
|
||||
@@ -39,7 +39,7 @@ class GlossaryLoadedState extends GlossaryState {
|
||||
{GlossaryModel? glossaryModelObj,
|
||||
String? token,
|
||||
List<SelectionPopupModel>? productGroups,
|
||||
List<dynamic>? productList}) {
|
||||
List<dynamic>? productList,}) {
|
||||
return GlossaryLoadedState(
|
||||
glossaryModelObj: glossaryModelObj ?? this.glossaryModelObj,
|
||||
productGroups: productGroups ?? this.productGroups,
|
||||
|
||||
@@ -14,7 +14,7 @@ class GlossaryScreen extends StatelessWidget {
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<GlossaryBloc>(
|
||||
create: (context) => GlossaryBloc(GlossaryState(glossaryModelObj: GlossaryModel()))..add(GlossaryInitialEvent()), child: GlossaryScreen());
|
||||
create: (context) => GlossaryBloc(GlossaryState(glossaryModelObj: GlossaryModel()))..add(GlossaryInitialEvent()), child: GlossaryScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -67,7 +67,7 @@ class GlossaryScreen extends StatelessWidget {
|
||||
SizedBox(height: 20),
|
||||
_buildMenu(context),
|
||||
SizedBox(height: 20),
|
||||
_buildProducts(context, state)
|
||||
_buildProducts(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -142,7 +142,7 @@ class GlossaryScreen extends StatelessWidget {
|
||||
children: List.generate(33, _fillAlphabet),
|
||||
),
|
||||
),
|
||||
]),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -196,8 +196,8 @@ class GlossaryScreen extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
_buildProductList(context, state)
|
||||
]),
|
||||
_buildProductList(context, state),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -259,22 +259,22 @@ class GlossaryScreen extends StatelessWidget {
|
||||
Column(children: [
|
||||
Text("Ккал - ${product['energy_on_100gr'].toString()}"),
|
||||
SizedBox(height: 8),
|
||||
Text("Белки - ${product['proteins_on_100gr'].toString()}")
|
||||
]),
|
||||
Text("Белки - ${product['proteins_on_100gr'].toString()}"),
|
||||
],),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 24.0),
|
||||
child: Column(children: [
|
||||
Text("Жиры - ${product['fats_on_100gr'].toString()}"),
|
||||
SizedBox(height: 8),
|
||||
Text("Углеводы - ${product['carbohydrates_on_100gr'].toString()}")
|
||||
]),
|
||||
)
|
||||
])
|
||||
Text("Углеводы - ${product['carbohydrates_on_100gr'].toString()}"),
|
||||
],),
|
||||
),
|
||||
],),
|
||||
],
|
||||
),
|
||||
),
|
||||
]));
|
||||
],),);
|
||||
}
|
||||
|
||||
Widget _fillAlphabet(int index) {
|
||||
|
||||
@@ -24,7 +24,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged})
|
||||
this.onChanged,})
|
||||
: super(
|
||||
key: key,
|
||||
);
|
||||
@@ -76,7 +76,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: searchViewWidget(context))
|
||||
child: searchViewWidget(context),)
|
||||
: searchViewWidget(context);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ class CustomSearchView extends StatelessWidget {
|
||||
SizedBox(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(Icons.search)),
|
||||
child: Icon(Icons.search),),
|
||||
),
|
||||
prefixIconConstraints: prefixConstraints ??
|
||||
BoxConstraints(
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ class PlanCreateScreen extends StatelessWidget {
|
||||
final planID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<PlanCreateBloc>(
|
||||
create: (context) => PlanCreateBloc(PlanCreateState(planModelObj: PlanCreateModel(planID: planID.toString())))..add(PlanCreateInitialEvent()),
|
||||
child: PlanCreateScreen());
|
||||
child: PlanCreateScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -81,9 +81,9 @@ class PlanCreateScreen extends StatelessWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () => context.read<PlanCreateBloc>().add(CreatePlan()),
|
||||
child: Text('Создать'),
|
||||
)
|
||||
]),
|
||||
)
|
||||
),
|
||||
],),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -49,13 +49,13 @@ class PlanEditBloc extends Bloc<PlanEditEvent, PlanEditState> {
|
||||
plan: currentState.plan,
|
||||
name: currentState.name,
|
||||
duration: currentState.duration,
|
||||
details: currentState.details));
|
||||
details: currentState.details,),);
|
||||
} else {
|
||||
emit(PlanEditLoadedState(
|
||||
plan: data,
|
||||
name: TextEditingController(text: data['name']),
|
||||
details: TextEditingController(text: data['details']),
|
||||
duration: TextEditingController(text: data['duration'].toString())));
|
||||
duration: TextEditingController(text: data['duration'].toString()),),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -23,7 +23,7 @@ class PlanEditState extends Equatable {
|
||||
|
||||
class PlanEditLoadedState extends PlanEditState {
|
||||
PlanEditLoadedState(
|
||||
{this.planModelObj, this.plan, this.name, this.details, this.duration});
|
||||
{this.planModelObj, this.plan, this.name, this.details, this.duration,});
|
||||
|
||||
PlanEditModel? planModelObj;
|
||||
Map<String, dynamic>? plan;
|
||||
|
||||
@@ -12,7 +12,7 @@ class PlanEditScreen extends StatelessWidget {
|
||||
final planID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<PlanEditBloc>(
|
||||
create: (context) => PlanEditBloc(PlanEditState(planModelObj: PlanEditModel(planID: planID.toString())))..add(PlanEditInitialEvent()),
|
||||
child: PlanEditScreen());
|
||||
child: PlanEditScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -98,10 +98,10 @@ class PlanEditScreen extends StatelessWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () => context.read<PlanEditBloc>().add(EditPlan()),
|
||||
child: Text('Сохранить'),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -47,12 +47,12 @@ class PlanSelectBloc extends Bloc<PlanSelectEvent, PlanSelectState> {
|
||||
emit((currentState).copyWith(
|
||||
posts: data,
|
||||
myProfileModelObj: currentState.myProfileModelObj,
|
||||
));
|
||||
),);
|
||||
} else {
|
||||
print('Got unloaded');
|
||||
emit(PlanSelectLoadedState(
|
||||
posts: data,
|
||||
));
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:flutter/material.dart';
|
||||
class PlanSelectScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<PlanSelectBloc>(
|
||||
create: (context) => PlanSelectBloc(PlanSelectState(myProfileModelObj: PlanSelectModel()))..add(PlanSelectInitialEvent()), child: PlanSelectScreen());
|
||||
create: (context) => PlanSelectBloc(PlanSelectState(myProfileModelObj: PlanSelectModel()))..add(PlanSelectInitialEvent()), child: PlanSelectScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -95,14 +95,14 @@ class PlanSelectScreen extends StatelessWidget {
|
||||
onTap: () => GoRouter.of(context).goNamed('planCreateScreen'),
|
||||
child: Icon(Icons.create_outlined),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
_buildPlanList(context, state)
|
||||
_buildPlanList(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -14,7 +14,7 @@ class PlanScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context) {
|
||||
final planID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<PlanBloc>(
|
||||
create: (context) => PlanBloc(PlanState(planModelObj: PlanModel(planID: planID.toString())))..add(PlanInitialEvent()), child: PlanScreen());
|
||||
create: (context) => PlanBloc(PlanState(planModelObj: PlanModel(planID: planID.toString())))..add(PlanInitialEvent()), child: PlanScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -104,9 +104,9 @@ class PlanScreen extends StatelessWidget {
|
||||
child: Text('Удалить'),
|
||||
),
|
||||
],
|
||||
)
|
||||
]),
|
||||
)
|
||||
),
|
||||
],),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -100,7 +100,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
selectedCountry: currentState.selectedCountry,
|
||||
selectedActivity: currentState.selectedActivity,
|
||||
myProfileModelObj: currentState.myProfileModelObj,
|
||||
));
|
||||
),);
|
||||
} else {
|
||||
var plans = []
|
||||
..addAll(data["finishedPlans"])
|
||||
@@ -135,7 +135,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
"0000-00-00 00:00:00",
|
||||
"0000-00-00 00:00:00",
|
||||
"0000-00-00 00:00:00",
|
||||
"0000-00-00 00:00:00"
|
||||
"0000-00-00 00:00:00",
|
||||
];
|
||||
for (int i = 0; i < data["circumferences"].length; i++) {
|
||||
dates[i] = data["circumferences"]['$i']["created_at"];
|
||||
@@ -147,7 +147,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
"user_id": 0,
|
||||
"weight": 0,
|
||||
"created_at": "0000-00-00 00:00:00",
|
||||
"updated_at": "0000-00-00 00:00:00"
|
||||
"updated_at": "0000-00-00 00:00:00",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
"waist_circumference": 0,
|
||||
"hip_circumference": 0,
|
||||
"created_at": "0000-00-00 00:00:00",
|
||||
"updated_at": "0000-00-00 00:00:00"
|
||||
"updated_at": "0000-00-00 00:00:00",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -180,17 +180,17 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
hypoFormController: data['userDetails']['has_hypo'].toString(),
|
||||
hyperFormController: data['userDetails']['has_hyper'].toString(),
|
||||
chestCircumferenceFormController: TextEditingController(
|
||||
text: data['userDetails']['chest_circumference']?.toString()),
|
||||
text: data['userDetails']['chest_circumference']?.toString(),),
|
||||
waistCircumferenceFormController: TextEditingController(
|
||||
text: data['userDetails']['waist_circumference']?.toString()),
|
||||
text: data['userDetails']['waist_circumference']?.toString(),),
|
||||
hipCircumferenceFormController: TextEditingController(
|
||||
text: data['userDetails']['hip_circumference']?.toString()),
|
||||
text: data['userDetails']['hip_circumference']?.toString(),),
|
||||
weightController: TextEditingController(
|
||||
text: data['userDetails']['weight']?.toString()),
|
||||
text: data['userDetails']['weight']?.toString(),),
|
||||
weightFormController: TextEditingController(
|
||||
text: data['userDetails']['weight']?.toString()),
|
||||
text: data['userDetails']['weight']?.toString(),),
|
||||
firstNameFormController: TextEditingController(
|
||||
text: data['userDetails']['first_name']),
|
||||
text: data['userDetails']['first_name'],),
|
||||
lastNameFormController:
|
||||
TextEditingController(text: data['userDetails']['last_name']),
|
||||
countryFormController:
|
||||
@@ -198,35 +198,35 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
cityFormController:
|
||||
TextEditingController(text: data['userDetails']['city']),
|
||||
heightFormController: TextEditingController(
|
||||
text: data['userDetails']['height']?.toString()),
|
||||
text: data['userDetails']['height']?.toString(),),
|
||||
upPressureFormController: TextEditingController(
|
||||
text: data['userDetails']['blood_pressure_up']?.toString()),
|
||||
text: data['userDetails']['blood_pressure_up']?.toString(),),
|
||||
downPressureFormController: TextEditingController(
|
||||
text: data['userDetails']['blood_pressure_down']?.toString()),
|
||||
text: data['userDetails']['blood_pressure_down']?.toString(),),
|
||||
allergiesFormController: TextEditingController(
|
||||
text: data['userDetails']['about_alergy']),
|
||||
text: data['userDetails']['about_alergy'],),
|
||||
pillsFormController: TextEditingController(
|
||||
text: data['userDetails']['about_taking_pils']),
|
||||
text: data['userDetails']['about_taking_pils'],),
|
||||
sportsFormController: TextEditingController(
|
||||
text: data['userDetails']['about_sport_hobbies']),
|
||||
text: data['userDetails']['about_sport_hobbies'],),
|
||||
favoriteFormController: TextEditingController(
|
||||
text: data['userDetails']['favorite_foods']),
|
||||
text: data['userDetails']['favorite_foods'],),
|
||||
unfavoriteFormController: TextEditingController(
|
||||
text: data['userDetails']['unfavorite_foods']),
|
||||
text: data['userDetails']['unfavorite_foods'],),
|
||||
additionalFormController: TextEditingController(
|
||||
text: data['userDetails']['additional_info']),
|
||||
text: data['userDetails']['additional_info'],),
|
||||
dateFormController:
|
||||
TextEditingController(text: data['userDetails']['birthdate']),
|
||||
selectedCity: data['userDetails']['city'],
|
||||
selectedCountry: data['userDetails']['country'],
|
||||
selectedActivity: determineActivityLevel(
|
||||
data['userDetails']['activity_coefficient']),
|
||||
));
|
||||
data['userDetails']['activity_coefficient'],),
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
emit(
|
||||
MyProfileErrorState('Некоторые необходимые данные отсутствуют.'));
|
||||
MyProfileErrorState('Некоторые необходимые данные отсутствуют.'),);
|
||||
}
|
||||
} else {
|
||||
// Статус ответа не равен 200, обрабатываем ошибку
|
||||
@@ -253,7 +253,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
} // колхоз, но свитчкейсы в дарте странно ведут себя при сравнении double
|
||||
|
||||
Future<void> _uploadAvatar(
|
||||
UploadAvatar event, Emitter<MyProfileState> emit) async {
|
||||
UploadAvatar event, Emitter<MyProfileState> emit,) async {
|
||||
if (state is MyProfileLoadedState) {
|
||||
var currentState = state as MyProfileLoadedState;
|
||||
|
||||
@@ -279,7 +279,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
return imageUrl;
|
||||
} else {
|
||||
throw Exception(
|
||||
'Failed to upload image. Status code: ${streamedResponse.statusCode} ${streamedResponse}}');
|
||||
'Failed to upload image. Status code: ${streamedResponse.statusCode} ${streamedResponse}}',);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class MyProfileLoadedState extends MyProfileState {
|
||||
this.additionalFormController,
|
||||
this.hypoFormController,
|
||||
this.hyperFormController,
|
||||
this.circumferences})
|
||||
this.circumferences,})
|
||||
: super(myProfileModelObj: null);
|
||||
|
||||
MyProfileModel? myProfileModelObj;
|
||||
|
||||
@@ -112,7 +112,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _buildCarousel(context, state)),
|
||||
child: _buildCarousel(context, state),),
|
||||
SizedBox(height: 15.v),
|
||||
if (!state.plans!.isEmpty)
|
||||
Container(
|
||||
@@ -137,7 +137,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
state.plans?.map((plan) => plan['name']).toList(),
|
||||
state.plans?.map((plan) => plan['image']).toList(),
|
||||
state.plans?.map((plan) => plan['state']).toList(),
|
||||
)),
|
||||
),),
|
||||
SizedBox(height: 5.v),
|
||||
],
|
||||
),
|
||||
@@ -212,8 +212,8 @@ class MyProfileScreen extends StatelessWidget {
|
||||
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,
|
||||
)
|
||||
]));
|
||||
),
|
||||
],),);
|
||||
case 2: // График ИМТ
|
||||
return Column(children: [
|
||||
Text(
|
||||
@@ -226,9 +226,9 @@ class MyProfileScreen extends StatelessWidget {
|
||||
_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),
|
||||
]);
|
||||
state.userDetails?['height'].toInt() ?? 160,),
|
||||
state.chartDates,),
|
||||
],);
|
||||
case 3: //График обхватов
|
||||
return GestureDetector(
|
||||
onTap: () => _editCircumference(context, state),
|
||||
@@ -241,8 +241,8 @@ class MyProfileScreen extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 30.v),
|
||||
_buildCircumferenceChart(context, state.circumferences, state.chartDates),
|
||||
_buildChartLegend()
|
||||
]));
|
||||
_buildChartLegend(),
|
||||
],),);
|
||||
default:
|
||||
return Text('text', style: TextStyle(fontSize: 16.0));
|
||||
}
|
||||
@@ -640,7 +640,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
child: Column(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 15.h),
|
||||
child: Text("plans_complete".tr, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900))),
|
||||
child: Text("plans_complete".tr, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900)),),
|
||||
SizedBox(height: 5.v),
|
||||
Container(
|
||||
decoration: AppDecoration.outlineBlueGray.copyWith(borderRadius: BorderRadiusStyle.roundedBorder5),
|
||||
@@ -683,12 +683,12 @@ class MyProfileScreen extends StatelessWidget {
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 1.v),
|
||||
child: Text(plans![i], style: CustomTextStyles.titleSmallBluegray800Bold)),
|
||||
child: Text(plans![i], style: CustomTextStyles.titleSmallBluegray800Bold),),
|
||||
Container(
|
||||
height: 19.v,
|
||||
width: 100.h,
|
||||
decoration: BoxDecoration(color: boxColor, borderRadius: BorderRadius.circular(5.h)))
|
||||
]))),
|
||||
decoration: BoxDecoration(color: boxColor, borderRadius: BorderRadius.circular(5.h)),),
|
||||
],),),),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
@@ -697,18 +697,18 @@ class MyProfileScreen extends StatelessWidget {
|
||||
dotenv.env['STORAGE_URL']! + imagePaths?[i],
|
||||
height: 25.adaptSize,
|
||||
width: 25.adaptSize,
|
||||
))),
|
||||
),),),
|
||||
Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Container(
|
||||
width: 70.h,
|
||||
margin: EdgeInsets.only(bottom: 14.h, right: 22.h),
|
||||
child: Text("$state".tr, maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall)))
|
||||
]));
|
||||
})),
|
||||
]))
|
||||
]))
|
||||
]));
|
||||
child: Text("$state".tr, maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall),),),
|
||||
],),);
|
||||
},),),
|
||||
],),),
|
||||
],),),
|
||||
],),);
|
||||
}
|
||||
|
||||
List<double> _bodyMassIndex(List<double> weightPoints, int height) {
|
||||
@@ -770,7 +770,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
),),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: onTapOk(context),
|
||||
@@ -781,7 +781,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
child: Text("Изменить",
|
||||
style: CustomTextStyles.titleMediumBlack.copyWith(
|
||||
color: Colors.blue,
|
||||
)),
|
||||
),),
|
||||
),
|
||||
],
|
||||
backgroundColor: Colors.white,
|
||||
@@ -862,7 +862,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
child: Text("Изменить",
|
||||
style: CustomTextStyles.titleMediumBlack.copyWith(
|
||||
color: Colors.blue,
|
||||
)),
|
||||
),),
|
||||
),
|
||||
],
|
||||
backgroundColor: Colors.white,
|
||||
|
||||
@@ -16,7 +16,7 @@ import 'package:flutter/material.dart';
|
||||
class MySettingsScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<MyProfileBloc>(
|
||||
create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()), child: MySettingsScreen());
|
||||
create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()), child: MySettingsScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -86,8 +86,8 @@ class MySettingsScreen extends StatelessWidget {
|
||||
),
|
||||
title: Padding(
|
||||
padding: EdgeInsets.only(left: 20.h),
|
||||
child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))])),
|
||||
)),
|
||||
child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))]),),
|
||||
),),
|
||||
SizedBox(height: 20),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
|
||||
@@ -42,7 +42,7 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
|
||||
video_url: currentState.video_url,
|
||||
steps: currentState.steps,
|
||||
stepDescriptions: currentState.stepDescriptions,
|
||||
tags: currentState.tags));
|
||||
tags: currentState.tags,),);
|
||||
} else {
|
||||
final Map<String, dynamic> step = {
|
||||
'description': '',
|
||||
@@ -55,12 +55,12 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
|
||||
video_url: TextEditingController(),
|
||||
tags: TextEditingController(),
|
||||
stepDescriptions: [TextEditingController()],
|
||||
steps: [step]));
|
||||
steps: [step],),);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _addStep(
|
||||
AddStep event, Emitter<RecipeCreateState> emit) async {
|
||||
AddStep event, Emitter<RecipeCreateState> emit,) async {
|
||||
if (state is RecipeCreateLoadedState) {
|
||||
var currentState = state as RecipeCreateLoadedState;
|
||||
|
||||
@@ -74,13 +74,13 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
|
||||
});
|
||||
updatedStepDescriptions!.add(TextEditingController());
|
||||
emit(currentState.copyWith(
|
||||
steps: updatedSteps, stepDescriptions: updatedStepDescriptions));
|
||||
steps: updatedSteps, stepDescriptions: updatedStepDescriptions,),);
|
||||
await _reloadScreen(event, emit);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _removeStep(
|
||||
RemoveStep event, Emitter<RecipeCreateState> emit) async {
|
||||
RemoveStep event, Emitter<RecipeCreateState> emit,) async {
|
||||
if (state is RecipeCreateLoadedState) {
|
||||
var currentState = state as RecipeCreateLoadedState;
|
||||
|
||||
@@ -91,13 +91,13 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
|
||||
updatedSteps!.removeAt(event.id);
|
||||
updatedStepDescriptions!.removeAt(event.id);
|
||||
emit(currentState.copyWith(
|
||||
steps: updatedSteps, stepDescriptions: updatedStepDescriptions));
|
||||
steps: updatedSteps, stepDescriptions: updatedStepDescriptions,),);
|
||||
await _reloadScreen(event, emit);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _createRecipe(
|
||||
CreateRecipe event, Emitter<RecipeCreateState> emit) async {
|
||||
CreateRecipe event, Emitter<RecipeCreateState> emit,) async {
|
||||
if (state is RecipeCreateLoadedState) {
|
||||
var currentState = state as RecipeCreateLoadedState;
|
||||
|
||||
@@ -112,13 +112,13 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
|
||||
AppRouter.navigatorKey.currentContext?.goNamed('recipeSelectScreen');
|
||||
} else {
|
||||
print(
|
||||
'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}');
|
||||
'Failed to create blog post. Status Code: ${response.statusCode} ${response.body}',);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<http.Response> sendRecipe(String? title, String? video_url,
|
||||
String? description, List<dynamic>? steps) async {
|
||||
String? description, List<dynamic>? steps,) async {
|
||||
String url = '${dotenv.env['SERVER_ROOT']!}/recipe/create';
|
||||
final Map<String, dynamic> credentials = {
|
||||
'title': title,
|
||||
@@ -141,7 +141,7 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
|
||||
}
|
||||
|
||||
FutureOr<void> _reloadScreen(
|
||||
RecipeCreateEvent? event, Emitter<RecipeCreateState> emit) async {
|
||||
RecipeCreateEvent? event, Emitter<RecipeCreateState> emit,) async {
|
||||
print('Reloading..');
|
||||
final box = await Hive.openBox('token');
|
||||
final token = box.get('token');
|
||||
@@ -158,7 +158,7 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
|
||||
video_url: currentState.video_url,
|
||||
steps: currentState.steps,
|
||||
stepDescriptions: currentState.stepDescriptions,
|
||||
tags: currentState.tags));
|
||||
tags: currentState.tags,),);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class RecipeCreateLoadedState extends RecipeCreateState {
|
||||
this.video_url,
|
||||
this.tags,
|
||||
this.stepDescriptions,
|
||||
this.steps});
|
||||
this.steps,});
|
||||
|
||||
RecipeCreateModel? recipeModelObj;
|
||||
String? token;
|
||||
@@ -49,7 +49,7 @@ class RecipeCreateLoadedState extends RecipeCreateState {
|
||||
video_url,
|
||||
steps,
|
||||
tags,
|
||||
stepDescriptions
|
||||
stepDescriptions,
|
||||
];
|
||||
RecipeCreateLoadedState copyWith({
|
||||
RecipeCreateModel? recipeModelObj,
|
||||
@@ -69,7 +69,7 @@ class RecipeCreateLoadedState extends RecipeCreateState {
|
||||
token: token ?? this.token,
|
||||
steps: steps ?? this.steps,
|
||||
tags: tags ?? this.tags,
|
||||
stepDescriptions: stepDescriptions ?? this.stepDescriptions);
|
||||
stepDescriptions: stepDescriptions ?? this.stepDescriptions,);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class RecipeCreateScreen extends StatelessWidget {
|
||||
return BlocProvider<RecipeCreateBloc>(
|
||||
create: (context) =>
|
||||
RecipeCreateBloc(RecipeCreateState(recipeModelObj: RecipeCreateModel(recipeID: recipeID.toString())))..add(RecipeCreateInitialEvent()),
|
||||
child: RecipeCreateScreen());
|
||||
child: RecipeCreateScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -73,9 +73,9 @@ class RecipeCreateScreen extends StatelessWidget {
|
||||
children: steps,
|
||||
),
|
||||
SizedBox(height: 20.v),
|
||||
_buildAdditional(context, state)
|
||||
]),
|
||||
)));
|
||||
_buildAdditional(context, state),
|
||||
],),
|
||||
),),);
|
||||
}
|
||||
|
||||
_buldAppBar(BuildContext context) {
|
||||
@@ -105,7 +105,7 @@ class RecipeCreateScreen extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
child: AppbarSubtitle(
|
||||
text: "Добавление рецепта",
|
||||
)),
|
||||
),),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -164,7 +164,7 @@ class RecipeCreateScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
]),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ class RecipeCreateScreen extends StatelessWidget {
|
||||
Icon(
|
||||
Icons.photo_library,
|
||||
color: appTheme.blueGray300,
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -318,7 +318,7 @@ class RecipeCreateScreen extends StatelessWidget {
|
||||
text: "x",
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
),
|
||||
]),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ class RecipeCreateScreen extends StatelessWidget {
|
||||
text: "Добавить рецепт",
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
),
|
||||
]),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class RecipeEditBloc extends Bloc<RecipeEditEvent, RecipeEditState> {
|
||||
video_url: currentState.video_url,
|
||||
steps: currentState.steps,
|
||||
stepDescriptions: currentState.stepDescriptions,
|
||||
tags: currentState.tags));
|
||||
tags: currentState.tags,),);
|
||||
} else {
|
||||
final Map<String, dynamic> defaultStep = {
|
||||
'description': '',
|
||||
@@ -85,7 +85,7 @@ class RecipeEditBloc extends Bloc<RecipeEditEvent, RecipeEditState> {
|
||||
tags: await _fetchTags(data['id']),
|
||||
stepDescriptions: stepDescriptions,
|
||||
steps: steps,
|
||||
));
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
@@ -171,7 +171,7 @@ class RecipeEditBloc extends Bloc<RecipeEditEvent, RecipeEditState> {
|
||||
'steps':
|
||||
'[{"image": "steps/bT91V52zY2hIkjZezUxO4jW4njfhDfCe2PcMxciZ.jpg", "description": "Excepturi fuga sed quaerat impedit facere recusandae. Nihil exercitationem architecto accusantium ut. Qui consequuntur rerum quam asperiores repellendus molestias."}, {"image": "steps/7vaLlotrw65NXbqaD0dK4OTLVyxMgmB9wL3xBzg3.jpg", "description": "Sit hic sint ullam qui. Odit nihil possimus quo id itaque nisi non."}, {"image": "steps/et7cKUsnQkegcRAE72TS0mfAf2jLJXW93QDAGfjz.jpg", "description": "Ab dolores qui voluptatem sed quasi vero. Culpa minus optio in voluptatibus aut corrupti. Dolor expedita minus aut nesciunt quos quibusdam rerum."}, {"image": "steps/260401J6r71r9kuUt694VcsuMMQKTlQMrlIwfaKo.jpg", "description": "Eos dolores corrupti cupiditate aut. Nam nesciunt eveniet eos nam vitae ut. Quibusdam ab commodi ut natus. Nisi earum porro quidem et eligendi iste doloribus."}, {"image": "steps/Ol10BkOFeZ9EG4BAShgB1wnVwtCimoUMcSNDh2EB.jpg", "description": "Consectetur optio porro nobis voluptas quibusdam. Consequatur dolor dolorem laboriosam magnam iste atque."}, {"image": "steps/8PanRq2aWWdXG1xCYkRyJ0M3Z39y6jMPfnHCqlVi.jpg", "description": "A optio porro eligendi ullam. Sed numquam ullam quasi aperiam inventore corrupti enim. Alias id et consequatur perferendis. Ullam consequatur incidunt nesciunt ut et aut."}, {"image": "steps/19U2sYSGDkprS3L8SIFT3xz59OwQJ5xs0A8etZjr.jpg", "description": "In doloribus vel voluptas dolorum. Temporibus iusto est repellat quo sed. Perspiciatis enim sit beatae in dolor ut. Quis ad qui eligendi nisi. Est suscipit dolore ratione dolores suscipit molestiae."}, {"image": "steps/CRxJtjgQw84kG3teJVtl9GqwWUQ1WKpvOeBbwf9a.jpg", "description": "Aut quia maiores et aut. Quidem ab voluptates blanditiis. Est quam quia repellat exercitationem rerum et iste mollitia. Et sed dolores tempore nam et similique qui."}, {"image": "steps/NoG9rHtvHNLrYI2LujURT3DMQCmEe68UbpiXco2y.jpg", "description": "Nam et dolorum delectus. Labore fuga asperiores nam cumque sit. Eum hic officiis ea asperiores qui. Soluta totam enim quasi explicabo sed aut."}]',
|
||||
'ingredients':
|
||||
'[{"name": "Cheeseburger", "unit": "pcs", "portion": 336}, {"name": "Little Cheeseburger", "unit": "gr", "portion": 623}, {"name": "Bacon Burger", "unit": "ml", "portion": 713}, {"name": "Little Bacon Burger", "unit": "pcs", "portion": 160}, {"name": "Hamburger", "unit": "tablespoon", "portion": 390}, {"name": "Bacon Cheese Dog", "unit": "teespons", "portion": 295}, {"name": "Hamburger", "unit": "pcs", "portion": 813}, {"name": "Cheeseburger", "unit": "gr", "portion": 951}]'
|
||||
'[{"name": "Cheeseburger", "unit": "pcs", "portion": 336}, {"name": "Little Cheeseburger", "unit": "gr", "portion": 623}, {"name": "Bacon Burger", "unit": "ml", "portion": 713}, {"name": "Little Bacon Burger", "unit": "pcs", "portion": 160}, {"name": "Hamburger", "unit": "tablespoon", "portion": 390}, {"name": "Bacon Cheese Dog", "unit": "teespons", "portion": 295}, {"name": "Hamburger", "unit": "pcs", "portion": 813}, {"name": "Cheeseburger", "unit": "gr", "portion": 951}]',
|
||||
};
|
||||
|
||||
var response = await http.post(
|
||||
@@ -222,7 +222,7 @@ class RecipeEditBloc extends Bloc<RecipeEditEvent, RecipeEditState> {
|
||||
video_url: currentState.video_url,
|
||||
steps: currentState.steps,
|
||||
stepDescriptions: currentState.stepDescriptions,
|
||||
tags: currentState.tags));
|
||||
tags: currentState.tags,),);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class RecipeEditLoadedState extends RecipeEditState {
|
||||
this.tagsController,
|
||||
this.stepDescriptions,
|
||||
this.tags,
|
||||
this.steps});
|
||||
this.steps,});
|
||||
|
||||
RecipeEditModel? recipeModelObj;
|
||||
Map<String, dynamic>? recipe;
|
||||
|
||||
@@ -19,7 +19,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
final recipeID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<RecipeEditBloc>(
|
||||
create: (context) => RecipeEditBloc(RecipeEditState(recipeModelObj: RecipeEditModel(recipeID: recipeID.toString())))..add(RecipeEditInitialEvent()),
|
||||
child: RecipeEditScreen());
|
||||
child: RecipeEditScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -76,7 +76,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
children: steps,
|
||||
),
|
||||
SizedBox(height: 20.v),
|
||||
_buildAdditional(context, state)
|
||||
_buildAdditional(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -112,7 +112,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
child: AppbarSubtitle(
|
||||
text: "Редактирование рецепта",
|
||||
)),
|
||||
),),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
]),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
Icon(
|
||||
Icons.photo_library,
|
||||
color: appTheme.blueGray300,
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -348,7 +348,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
text: "x",
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
),
|
||||
]),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ class RecipeEditScreen extends StatelessWidget {
|
||||
text: "Добавить рецепт",
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
),
|
||||
]),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ class RecipeSelectBloc extends Bloc<RecipeSelectEvent, RecipeSelectState> {
|
||||
emit((currentState).copyWith(
|
||||
posts: data,
|
||||
myProfileModelObj: currentState.myProfileModelObj,
|
||||
));
|
||||
),);
|
||||
} else {
|
||||
print('Got unloaded');
|
||||
emit(RecipeSelectLoadedState(
|
||||
posts: data,
|
||||
));
|
||||
),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
|
||||
@@ -14,7 +14,7 @@ class RecipeSelectScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<RecipeSelectBloc>(
|
||||
create: (context) => RecipeSelectBloc(RecipeSelectState(myProfileModelObj: RecipeSelectModel()))..add(RecipeSelectInitialEvent()),
|
||||
child: RecipeSelectScreen());
|
||||
child: RecipeSelectScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -94,7 +94,7 @@ class RecipeSelectScreen extends StatelessWidget {
|
||||
onTap: () => GoRouter.of(context).goNamed('recipeCreateScreen'),
|
||||
child: Icon(Icons.create_outlined),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -160,7 +160,7 @@ class RecipeSelectScreen extends StatelessWidget {
|
||||
),
|
||||
child: Icon(Icons.edit),
|
||||
),
|
||||
));
|
||||
),);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class RecipeBloc extends Bloc<RecipeEvent, RecipeState> {
|
||||
commentController: currentState.commentController,
|
||||
comments: currentState.comments,
|
||||
steps: currentState.steps,
|
||||
author: currentState.author));
|
||||
author: currentState.author,),);
|
||||
} else {
|
||||
emit(RecipeLoadedState(
|
||||
token: token,
|
||||
@@ -63,7 +63,7 @@ class RecipeBloc extends Bloc<RecipeEvent, RecipeState> {
|
||||
author: await _fetchAuthor(data['id']),
|
||||
comments: fillCommentList(await _fetchComments(data['id'])),
|
||||
tags: await _fetchTags(data['id']),
|
||||
commentController: TextEditingController()));
|
||||
commentController: TextEditingController(),),);
|
||||
}
|
||||
} else {
|
||||
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
|
||||
@@ -176,7 +176,7 @@ class RecipeBloc extends Bloc<RecipeEvent, RecipeState> {
|
||||
userImage: comments[i]['profile_photo_path'],
|
||||
username: comments[i]['name'],
|
||||
dateText: DateFormat('dd.MM').format(DateTime.parse(comments[i]['updated_at'])),
|
||||
greetingText: comments[i]['body']));
|
||||
greetingText: comments[i]['body'],),);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ class RecipeBloc extends Bloc<RecipeEvent, RecipeState> {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
body: json.encode(credentials),
|
||||
encoding: utf8);
|
||||
encoding: utf8,);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class RecipeLoadedState extends RecipeState {
|
||||
this.token,
|
||||
this.commentController,
|
||||
this.tags,
|
||||
this.steps});
|
||||
this.steps,});
|
||||
|
||||
RecipeModel? recipeModelObj;
|
||||
Map<String, dynamic>? recipe;
|
||||
@@ -48,7 +48,7 @@ class RecipeLoadedState extends RecipeState {
|
||||
comments,
|
||||
token,
|
||||
commentController,
|
||||
steps
|
||||
steps,
|
||||
];
|
||||
RecipeLoadedState copyWith(
|
||||
{RecipeModel? recipeModelObj,
|
||||
@@ -58,7 +58,7 @@ class RecipeLoadedState extends RecipeState {
|
||||
String? token,
|
||||
List<dynamic>? tags,
|
||||
List<dynamic>? steps,
|
||||
List<dynamic>? comments}) {
|
||||
List<dynamic>? comments,}) {
|
||||
return RecipeLoadedState(
|
||||
recipeModelObj: recipeModelObj ?? this.recipeModelObj,
|
||||
recipe: recipe ?? this.recipe,
|
||||
|
||||
@@ -18,7 +18,7 @@ class RecipeScreen extends StatelessWidget {
|
||||
final recipeID = ModalRoute.of(context)!.settings.arguments;
|
||||
return BlocProvider<RecipeBloc>(
|
||||
create: (context) => RecipeBloc(RecipeState(recipeModelObj: RecipeModel(recipeID: recipeID.toString())))..add(RecipeInitialEvent()),
|
||||
child: RecipeScreen());
|
||||
child: RecipeScreen(),);
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -77,7 +77,7 @@ class RecipeScreen extends StatelessWidget {
|
||||
_buildCommentSection(context, state),
|
||||
],
|
||||
),
|
||||
));
|
||||
),);
|
||||
}
|
||||
|
||||
_buildHeaderRow(BuildContext context, RecipeLoadedState state) {
|
||||
@@ -195,7 +195,7 @@ class RecipeScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
DateFormat('dd.MM.yyyy').format(DateTime.parse(state.recipe?['updated_at'])),
|
||||
style: theme.textTheme.bodyMedium,
|
||||
)),
|
||||
),),
|
||||
SizedBox(height: 16.0),
|
||||
_buildTags(state.tags),
|
||||
SizedBox(height: 16.0),
|
||||
@@ -210,8 +210,8 @@ class RecipeScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Нравится",
|
||||
style: CustomTextStyles.titleMediumSemiBold,
|
||||
)
|
||||
]),
|
||||
),
|
||||
],),
|
||||
),
|
||||
Spacer(),
|
||||
Padding(
|
||||
@@ -224,10 +224,10 @@ class RecipeScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Поделиться",
|
||||
style: CustomTextStyles.titleMediumSemiBold,
|
||||
)
|
||||
]))
|
||||
]),
|
||||
]),
|
||||
),
|
||||
],),),
|
||||
],),
|
||||
],),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ class RecipeScreen extends StatelessWidget {
|
||||
),
|
||||
onPressed: () => context.read<RecipeBloc>().add(CreateComment(state.commentController!.text)),
|
||||
// Установите прозрачный фон
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -400,7 +400,7 @@ class RecipeScreen extends StatelessWidget {
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -451,8 +451,8 @@ class RecipeScreen extends StatelessWidget {
|
||||
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
Text(state.steps?[i]['description'])
|
||||
]),
|
||||
Text(state.steps?[i]['description']),
|
||||
],),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class CommentWidget extends StatelessWidget {
|
||||
commentModelObj.dateText!,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -99,7 +99,7 @@ class CommentWidget extends StatelessWidget {
|
||||
imagePath: ImageConstant.imgSend,
|
||||
height: 30.v,
|
||||
width: 30.h,
|
||||
margin: EdgeInsets.only(left: 5)),
|
||||
margin: EdgeInsets.only(left: 5),),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -23,7 +23,7 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
create: (context) =>
|
||||
AdditionalInformationBloc(AdditionalInformationState(additionalInformationModelObj: AdditionalInformationModel(userRegistrationSheet: sheet)))
|
||||
..add(AdditionalInformationInitialEvent()),
|
||||
child: AdditionalInformationScreen());
|
||||
child: AdditionalInformationScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -42,11 +42,11 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 1, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 1, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 20.v),
|
||||
SizedBox(height: 73.v),
|
||||
_buildTextFormField(context),
|
||||
@@ -56,9 +56,9 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
text: "finish".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapFinish(state, context));
|
||||
}),
|
||||
])));
|
||||
onPressed: onTapFinish(state, context),);
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapFinish(AdditionalInformationState state, BuildContext context) {
|
||||
@@ -67,7 +67,7 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
sheet.additionalInfo = state.editTextController!.text;
|
||||
|
||||
final response = await http.post(Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'),
|
||||
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, body: jsonEncode(sheet.toJson()), encoding: utf8);
|
||||
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, body: jsonEncode(sheet.toJson()), encoding: utf8,);
|
||||
|
||||
var res = await jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
@@ -88,7 +88,7 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
onTapBack(BuildContext context) {
|
||||
@@ -110,7 +110,7 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
width: 294.h,
|
||||
margin: EdgeInsets.only(left: 24.h, right: 23.h),
|
||||
child: Text("enter_additional_information".tr,
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: CustomTextStyles.titleMediumSegoeUI)),
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: CustomTextStyles.titleMediumSegoeUI,),),
|
||||
SizedBox(height: 10.v),
|
||||
BlocSelector<AdditionalInformationBloc, AdditionalInformationState, TextEditingController?>(
|
||||
selector: (state) => state.editTextController,
|
||||
@@ -119,10 +119,10 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
controller: editTextController,
|
||||
hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни",
|
||||
textInputAction: TextInputAction.done,
|
||||
maxLines: 8);
|
||||
})
|
||||
]))
|
||||
]));
|
||||
maxLines: 8,);
|
||||
},),
|
||||
],),),
|
||||
],),);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
@@ -139,7 +139,7 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
title: const Text('Ошибка'),
|
||||
content: Text(text),
|
||||
actions: [TextButton(onPressed: onTapOk(context), child: const Text('Ok'))],
|
||||
));
|
||||
),);
|
||||
}
|
||||
|
||||
onTapOk(BuildContext context) {
|
||||
|
||||
@@ -17,7 +17,7 @@ class AllergiesScreen extends StatefulWidget {
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<AllergiesBloc>(
|
||||
create: (context) => AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))..add(AllergiesInitialEvent()),
|
||||
child: AllergiesScreen());
|
||||
child: AllergiesScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -41,11 +41,11 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.76, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.76, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 22.v),
|
||||
Text("allergies_presence".tr, style: theme.textTheme.headlineSmall),
|
||||
Spacer(flex: 36),
|
||||
@@ -56,15 +56,15 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
BlocBuilder<AllergiesBloc, AllergiesState>(builder: (context, state) {
|
||||
return GestureDetector(
|
||||
onTap: onTapSkip(state, context),
|
||||
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
|
||||
);
|
||||
}),
|
||||
])));
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapSkip(AllergiesState state, BuildContext context) {
|
||||
@@ -89,7 +89,7 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
onTapBack(BuildContext context) {
|
||||
@@ -107,9 +107,9 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
|
||||
selector: (state) => state.enterInformationController,
|
||||
builder: (context, enterInformationController) {
|
||||
return CustomTextFormField(
|
||||
controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8);
|
||||
})
|
||||
]);
|
||||
controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8,);
|
||||
},),
|
||||
],);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
|
||||
@@ -15,7 +15,7 @@ class AppNavigationScreen extends StatefulWidget {
|
||||
return BlocProvider<AppNavigationBloc>(
|
||||
create: (context) => AppNavigationBloc(AppNavigationState(
|
||||
appNavigationModelObj: AppNavigationModel(),
|
||||
))
|
||||
),)
|
||||
..add(AppNavigationInitialEvent()),
|
||||
child: AppNavigationScreen(),
|
||||
);
|
||||
|
||||
@@ -53,9 +53,9 @@ class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
upPressureController: TextEditingController(),
|
||||
downPressureController: TextEditingController()));
|
||||
downPressureController: TextEditingController(),),);
|
||||
emit(state.copyWith(
|
||||
bloodPressureModelObj: state.bloodPressureModelObj
|
||||
?.copyWith(dropdownItemList: fillDropdownItemList())));
|
||||
?.copyWith(dropdownItemList: fillDropdownItemList()),),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class BloodPressureScreen extends StatefulWidget {
|
||||
return BlocProvider<BloodPressureBloc>(
|
||||
create: (context) =>
|
||||
BloodPressureBloc(BloodPressureState(bloodPressureModelObj: BloodPressureModel(userRegistrationSheet: sheet)))..add(BloodPressureInitialEvent()),
|
||||
child: BloodPressureScreen());
|
||||
child: BloodPressureScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -66,7 +66,7 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
SizedBox(
|
||||
width: 224.h,
|
||||
child: Text("your_blood_pressure".tr,
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)),
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall,),),
|
||||
SizedBox(height: 21.v),
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 1.h),
|
||||
@@ -78,8 +78,8 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
selector: (state) => state.upPressureController,
|
||||
builder: (context, upPressureController) {
|
||||
return CustomTextFormField(inputFormatters: [digitsOnly], controller: upPressureController, hintText: "90".tr);
|
||||
})
|
||||
])),
|
||||
},),
|
||||
],),),
|
||||
SizedBox(height: 21.v),
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 1.h),
|
||||
@@ -91,8 +91,8 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
selector: (state) => state.downPressureController,
|
||||
builder: (context, downPressureController) {
|
||||
return CustomTextFormField(inputFormatters: [digitsOnly], controller: downPressureController, hintText: "90".tr);
|
||||
})
|
||||
])),
|
||||
},),
|
||||
],),),
|
||||
SizedBox(height: 22.v),
|
||||
Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 2.v),
|
||||
@@ -105,11 +105,11 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
icon: Container(
|
||||
margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),),
|
||||
hintText: "Не выбрано".tr,
|
||||
items: bloodPressureModelObj?.dropdownItemList ?? [],
|
||||
onChanged: onChangeHyper(context));
|
||||
})),
|
||||
onChanged: onChangeHyper(context),);
|
||||
},),),
|
||||
SizedBox(height: 22.v),
|
||||
Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 2.v),
|
||||
@@ -122,26 +122,26 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
icon: Container(
|
||||
margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),),
|
||||
hintText: "Не выбрано".tr,
|
||||
items: bloodPressureModelObj?.dropdownItemList ?? [],
|
||||
onChanged: onChangeHypo(context));
|
||||
})),
|
||||
onChanged: onChangeHypo(context),);
|
||||
},),),
|
||||
Spacer(),
|
||||
BlocBuilder<BloodPressureBloc, BloodPressureState>(builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
BlocBuilder<BloodPressureBloc, BloodPressureState>(builder: (context, state) {
|
||||
return GestureDetector(
|
||||
onTap: onTapSkip(state, context),
|
||||
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
|
||||
);
|
||||
}),
|
||||
])));
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapSkip(BloodPressureState state, BuildContext context) {
|
||||
@@ -208,7 +208,7 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m
|
||||
class BloodPressureModel extends Equatable {
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
BloodPressureModel(
|
||||
{required this.userRegistrationSheet, this.dropdownItemList = const []});
|
||||
{required this.userRegistrationSheet, this.dropdownItemList = const [],});
|
||||
|
||||
List<SelectionPopupModel> dropdownItemList;
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@ class BodyCircumferencesBloc
|
||||
emit(state.copyWith(
|
||||
chestCircumferenceController: TextEditingController(),
|
||||
waistCircumferenceController: TextEditingController(),
|
||||
hipCircumferenceController: TextEditingController()));
|
||||
hipCircumferenceController: TextEditingController(),),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@ class BodyCircumferencesScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.40, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.40, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 39.v),
|
||||
Text("initial_measurements".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 93.v),
|
||||
@@ -56,8 +56,8 @@ class BodyCircumferencesScreen extends StatelessWidget {
|
||||
selector: (state) => state.chestCircumferenceController,
|
||||
builder: (context, chestCircumferenceController) {
|
||||
return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr);
|
||||
})
|
||||
]),
|
||||
},),
|
||||
],),
|
||||
SizedBox(height: 19.v),
|
||||
Text("waist_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
@@ -65,7 +65,7 @@ class BodyCircumferencesScreen extends StatelessWidget {
|
||||
selector: (state) => state.waistCircumferenceController,
|
||||
builder: (context, waistCircumferenceController) {
|
||||
return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr);
|
||||
}),
|
||||
},),
|
||||
SizedBox(height: 21.v),
|
||||
Text("hip_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
@@ -73,17 +73,17 @@ class BodyCircumferencesScreen extends StatelessWidget {
|
||||
selector: (state) => state.hipCircumferenceController,
|
||||
builder: (context, hipCircumferenceController) {
|
||||
return CustomTextFormField(
|
||||
inputFormatters: [digitsOnly], controller: hipCircumferenceController, hintText: "90".tr, textInputAction: TextInputAction.done);
|
||||
}),
|
||||
inputFormatters: [digitsOnly], controller: hipCircumferenceController, hintText: "90".tr, textInputAction: TextInputAction.done,);
|
||||
},),
|
||||
Spacer(),
|
||||
BlocBuilder<BodyCircumferencesBloc, BodyCircumferencesState>(builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
])));
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapContinue(BodyCircumferencesState state, BuildContext context) {
|
||||
@@ -133,7 +133,7 @@ class BodyCircumferencesScreen extends StatelessWidget {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
|
||||
@@ -19,7 +19,7 @@ class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
|
||||
emit(state.copyWith(
|
||||
cityOfLivingModelObj: state.cityOfLivingModelObj?.copyWith(
|
||||
dropdownItemList: fillDropdownItemList(),
|
||||
)));
|
||||
),),);
|
||||
}
|
||||
|
||||
_changeDropDown(
|
||||
|
||||
@@ -1142,7 +1142,7 @@ class CityOfLivingScreen extends StatelessWidget {
|
||||
"Ярцево",
|
||||
"Ясногорск",
|
||||
"Ясный",
|
||||
"Яхрома"
|
||||
"Яхрома",
|
||||
];
|
||||
return Scaffold(
|
||||
appBar: _buildAppBar(context),
|
||||
@@ -1157,11 +1157,11 @@ class CityOfLivingScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.32, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.32, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 39.v),
|
||||
Text("place_of_living".tr, style: theme.textTheme.headlineSmall),
|
||||
Spacer(flex: 34),
|
||||
@@ -1174,11 +1174,11 @@ class CityOfLivingScreen extends StatelessWidget {
|
||||
icon: Container(
|
||||
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),),
|
||||
hintText: "Не выбрано".tr,
|
||||
items: cityOfLivingModelObj?.dropdownItemList ?? [],
|
||||
onChanged: onDropDownChange(context));
|
||||
}),
|
||||
onChanged: onDropDownChange(context),);
|
||||
},),
|
||||
SizedBox(height: 22.v),
|
||||
Text("Населенный пункт", style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 2.v),
|
||||
@@ -1228,16 +1228,16 @@ class CityOfLivingScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
},),
|
||||
Spacer(flex: 65),
|
||||
BlocBuilder<CityOfLivingBloc, CityOfLivingState>(builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
])));
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapContinue(CityOfLivingState state, BuildContext context) {
|
||||
@@ -1260,7 +1260,7 @@ class CityOfLivingScreen extends StatelessWidget {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
|
||||
@@ -1128,7 +1128,7 @@ class CityOfLivingModel extends Equatable {
|
||||
"Ярцево",
|
||||
"Ясногорск",
|
||||
"Ясный",
|
||||
"Яхрома"
|
||||
"Яхрома",
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -19,6 +19,6 @@ class CredentialsBloc extends Bloc<CredentialsEvent, CredentialsState> {
|
||||
emailController: TextEditingController(),
|
||||
nameController: TextEditingController(),
|
||||
passwordController: TextEditingController(),
|
||||
passwordConfirmationController: TextEditingController()));
|
||||
passwordConfirmationController: TextEditingController(),),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ class CredentialsScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.05, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.05, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 39.v),
|
||||
Text("user_registration".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 16.v),
|
||||
@@ -54,7 +54,7 @@ class CredentialsScreen extends StatelessWidget {
|
||||
selector: (state) => state.emailController,
|
||||
builder: (context, emailController) {
|
||||
return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done);
|
||||
}),
|
||||
},),
|
||||
SizedBox(height: 22.v),
|
||||
Text("username".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
@@ -62,7 +62,7 @@ class CredentialsScreen extends StatelessWidget {
|
||||
selector: (state) => state.nameController,
|
||||
builder: (context, nameController) {
|
||||
return CustomTextFormField(controller: nameController, textInputAction: TextInputAction.done);
|
||||
}),
|
||||
},),
|
||||
SizedBox(height: 19.v),
|
||||
Text("password".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
@@ -73,7 +73,7 @@ class CredentialsScreen extends StatelessWidget {
|
||||
obscureText: true,
|
||||
controller: passwordController,
|
||||
);
|
||||
}),
|
||||
},),
|
||||
SizedBox(height: 21.v),
|
||||
Text("password_confirmation".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
@@ -81,16 +81,16 @@ class CredentialsScreen extends StatelessWidget {
|
||||
selector: (state) => state.passwordConfirmationController,
|
||||
builder: (context, passwordConfirmationController) {
|
||||
return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done);
|
||||
}),
|
||||
},),
|
||||
Spacer(),
|
||||
BlocBuilder<CredentialsBloc, CredentialsState>(builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
])));
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapContinue(CredentialsState state, BuildContext context) {
|
||||
|
||||
@@ -49,11 +49,11 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.24, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.24, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 38.v),
|
||||
Text("date_of_birth".tr, style: theme.textTheme.headlineSmall),
|
||||
Spacer(flex: 39),
|
||||
@@ -64,10 +64,10 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
])));
|
||||
});
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
],),),);
|
||||
},);
|
||||
}
|
||||
|
||||
onTapContinue(DateOfBirthState state, BuildContext context) {
|
||||
@@ -85,7 +85,7 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
@@ -107,9 +107,9 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: onTapCalendar(context),
|
||||
child: Text('${selectedDate.day}.${selectedDate.month}.${selectedDate.year}', style: theme.textTheme.titleMedium))),
|
||||
SizedBox(height: 6.v)
|
||||
]));
|
||||
child: Text('${selectedDate.day}.${selectedDate.month}.${selectedDate.year}', style: theme.textTheme.titleMedium),),),
|
||||
SizedBox(height: 6.v),
|
||||
],),);
|
||||
}
|
||||
|
||||
onTapCalendar(BuildContext context) {
|
||||
|
||||
@@ -17,6 +17,6 @@ class FavoriteFoodsBloc extends Bloc<FavoriteFoodsEvent, FavoriteFoodsState> {
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
favoriteFoodsController: TextEditingController(),
|
||||
unfavoriteFoodsController: TextEditingController()));
|
||||
unfavoriteFoodsController: TextEditingController(),),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class FavoriteFoodsScreen extends StatefulWidget {
|
||||
return BlocProvider<FavoriteFoodsBloc>(
|
||||
create: (context) =>
|
||||
FavoriteFoodsBloc(FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel(userRegistrationSheet: sheet)))..add(FavoriteFoodsInitialEvent()),
|
||||
child: FavoriteFoodsScreen());
|
||||
child: FavoriteFoodsScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -42,17 +42,17 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.90, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.90, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 19.v),
|
||||
Container(
|
||||
width: 327.h,
|
||||
margin: EdgeInsets.only(left: 8.h, right: 7.h),
|
||||
child: Text("favorite_unfavorite_foods".tr,
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)),
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall,),),
|
||||
SizedBox(height: 13.v),
|
||||
_buildTextFormFieldFav(context),
|
||||
SizedBox(height: 12.v),
|
||||
@@ -63,15 +63,15 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 40.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(builder: (context, state) {
|
||||
return GestureDetector(
|
||||
onTap: onTapSkip(state, context),
|
||||
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
|
||||
);
|
||||
}),
|
||||
])));
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapSkip(FavoriteFoodsState state, BuildContext context) {
|
||||
@@ -97,7 +97,7 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
@@ -115,8 +115,8 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
selector: (state) => state.favoriteFoodsController,
|
||||
builder: (context, favoriteFoodsController) {
|
||||
return CustomTextFormField(controller: favoriteFoodsController, hintText: "enter_information".tr, maxLines: 7);
|
||||
})
|
||||
]);
|
||||
},),
|
||||
],);
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
@@ -128,9 +128,9 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
selector: (state) => state.unfavoriteFoodsController,
|
||||
builder: (context, unfavoriteFoodsController) {
|
||||
return CustomTextFormField(
|
||||
controller: unfavoriteFoodsController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 7);
|
||||
})
|
||||
]);
|
||||
controller: unfavoriteFoodsController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 7,);
|
||||
},),
|
||||
],);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
|
||||
@@ -18,7 +18,7 @@ class FavoriteSportsScreen extends StatefulWidget {
|
||||
return BlocProvider<FavoriteSportsBloc>(
|
||||
create: (context) => FavoriteSportsBloc(FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel(userRegistrationSheet: sheet)))
|
||||
..add(FavoriteSportsInitialEvent()),
|
||||
child: FavoriteSportsScreen());
|
||||
child: FavoriteSportsScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -42,11 +42,11 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.83, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.83, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 38.v),
|
||||
Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall),
|
||||
Spacer(flex: 32),
|
||||
@@ -57,15 +57,15 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapContinue(state, context));
|
||||
}),
|
||||
onPressed: onTapContinue(state, context),);
|
||||
},),
|
||||
BlocBuilder<FavoriteSportsBloc, FavoriteSportsState>(builder: (context, state) {
|
||||
return GestureDetector(
|
||||
onTap: onTapSkip(state, context),
|
||||
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
|
||||
);
|
||||
}),
|
||||
])));
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapSkip(FavoriteSportsState state, BuildContext context) {
|
||||
@@ -89,7 +89,7 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
@@ -111,9 +111,9 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
||||
hintText:
|
||||
"Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!",
|
||||
textInputAction: TextInputAction.done,
|
||||
maxLines: 8);
|
||||
})
|
||||
]);
|
||||
maxLines: 8,);
|
||||
},),
|
||||
],);
|
||||
}
|
||||
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
|
||||
@@ -20,7 +20,7 @@ class GenderScreen extends StatefulWidget {
|
||||
genderModelObj: GenderModel(userRegistrationSheet: sheet),
|
||||
),
|
||||
)..add(GenderInitialEvent()),
|
||||
child: GenderScreen());
|
||||
child: GenderScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -45,11 +45,11 @@ class _GenderScreenState extends State<GenderScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.16, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.16, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 36.v),
|
||||
Text("your_gender".tr, style: theme.textTheme.headlineSmall),
|
||||
RadioListTile(
|
||||
@@ -80,10 +80,10 @@ class _GenderScreenState extends State<GenderScreen> {
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapNext(state, context));
|
||||
}),
|
||||
])));
|
||||
});
|
||||
onPressed: onTapNext(state, context),);
|
||||
},),
|
||||
],),),);
|
||||
},);
|
||||
}
|
||||
|
||||
onTapNext(GenderState state, BuildContext context) {
|
||||
|
||||
@@ -12,7 +12,7 @@ class GenderModel extends Equatable {
|
||||
GenderModel copyWith({UserRegistrationSheet? userRegistrationSheet, gender}) {
|
||||
return GenderModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet);
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -17,6 +17,6 @@ class HeightBloc extends Bloc<HeightEvent, HeightState> {
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
heightModelObj: state.heightModelObj?.copyWith(),
|
||||
heightController: state.heightController));
|
||||
heightController: state.heightController,),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class HeightScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<HeightBloc>(
|
||||
create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()),
|
||||
child: HeightScreen());
|
||||
child: HeightScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -79,7 +79,7 @@ class HeightScreen extends StatelessWidget {
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
],
|
||||
);
|
||||
})
|
||||
},),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -119,7 +119,7 @@ class HeightScreen extends StatelessWidget {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m
|
||||
class HeightModel extends Equatable {
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
HeightModel(
|
||||
{this.dropdownItemList = const [], required this.userRegistrationSheet});
|
||||
{this.dropdownItemList = const [], required this.userRegistrationSheet,});
|
||||
|
||||
List<SelectionPopupModel> dropdownItemList;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class LanguageSelectBloc
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
languageSelectModelObj: state.languageSelectModelObj
|
||||
?.copyWith(dropdownItemList: fillDropdownItemList())));
|
||||
?.copyWith(dropdownItemList: fillDropdownItemList()),),);
|
||||
}
|
||||
|
||||
_changeDropDown(
|
||||
|
||||
@@ -87,7 +87,7 @@ class LanguageSelectScreen extends StatelessWidget {
|
||||
items: languageSelectModelObj?.dropdownItemList ?? [],
|
||||
onChanged: (value) => _onDropDownChanged(context, value),
|
||||
);
|
||||
}),
|
||||
},),
|
||||
Spacer(flex: 63),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -18,7 +18,7 @@ class MedicineIntakeScreen extends StatefulWidget {
|
||||
return BlocProvider<MedicineIntakeBloc>(
|
||||
create: (context) => MedicineIntakeBloc(MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel(userRegistrationSheet: sheet)))
|
||||
..add(MedicineIntakeInitialEvent()),
|
||||
child: MedicineIntakeScreen());
|
||||
child: MedicineIntakeScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -43,17 +43,17 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.69, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.69, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 20.v),
|
||||
Container(
|
||||
width: 271.h,
|
||||
margin: EdgeInsets.only(left: 35.h, right: 36.h),
|
||||
child: Text("do_you_take_pills".tr,
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)),
|
||||
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall,),),
|
||||
SizedBox(height: 86.v),
|
||||
_buildTextFormField(context),
|
||||
Spacer(),
|
||||
@@ -62,15 +62,15 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapNext(state, context));
|
||||
}),
|
||||
onPressed: onTapNext(state, context),);
|
||||
},),
|
||||
BlocBuilder<MedicineIntakeBloc, MedicineIntakeState>(builder: (context, state) {
|
||||
return GestureDetector(
|
||||
onTap: onTapSkip(state, context),
|
||||
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
|
||||
);
|
||||
}),
|
||||
])));
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
onTapSkip(MedicineIntakeState state, BuildContext context) {
|
||||
@@ -101,7 +101,7 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
@@ -119,9 +119,9 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
||||
selector: (state) => state.enterInformationController,
|
||||
builder: (context, enterInformationController) {
|
||||
return CustomTextFormField(
|
||||
controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8);
|
||||
})
|
||||
]);
|
||||
controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8,);
|
||||
},),
|
||||
],);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
|
||||
@@ -17,6 +17,6 @@ class NameBloc extends Bloc<NameEvent, NameState> {
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
firstNameController: TextEditingController(),
|
||||
lastNameController: TextEditingController()));
|
||||
lastNameController: TextEditingController(),),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class NameScreen extends StatelessWidget {
|
||||
nameModelObj: NameModel(userRegistrationSheet: sheet),
|
||||
),
|
||||
)..add(NameInitialEvent()),
|
||||
child: NameScreen());
|
||||
child: NameScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -42,11 +42,11 @@ class NameScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
|
||||
border: Border.all(color: theme.colorScheme.primary, width: 1.h),),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.1, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
|
||||
value: 0.1, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),),),),
|
||||
SizedBox(height: 39.v),
|
||||
Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 93.v),
|
||||
@@ -56,7 +56,7 @@ class NameScreen extends StatelessWidget {
|
||||
selector: (state) => state.firstNameController,
|
||||
builder: (context, firstNameController) {
|
||||
return CustomTextFormField(controller: firstNameController, textInputAction: TextInputAction.done);
|
||||
}),
|
||||
},),
|
||||
SizedBox(height: 19.v),
|
||||
Text("last_name".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
@@ -66,7 +66,7 @@ class NameScreen extends StatelessWidget {
|
||||
return CustomTextFormField(
|
||||
controller: lastNameController,
|
||||
);
|
||||
}),
|
||||
},),
|
||||
Spacer(),
|
||||
BlocBuilder<NameBloc, NameState>(builder: (context, state) {
|
||||
return NextStepButton(
|
||||
@@ -75,8 +75,8 @@ class NameScreen extends StatelessWidget {
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () => _onTapNext(context, state), // Assign callback function here
|
||||
);
|
||||
}),
|
||||
])));
|
||||
},),
|
||||
],),),);
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
@@ -84,9 +84,9 @@ class NameScreen extends StatelessWidget {
|
||||
return CustomAppBar(
|
||||
leadingWidth: 29.h,
|
||||
leading: AppbarLeadingImage(
|
||||
imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: () => onTapArrowLeft(context)),
|
||||
imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: () => onTapArrowLeft(context),),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
|
||||
@@ -11,7 +11,7 @@ class SplashScreen extends StatelessWidget {
|
||||
create: (context) =>
|
||||
SplashBloc(SplashState(splashModelObj: SplashModel()))
|
||||
..add(SplashInitialEvent()),
|
||||
child: SplashScreen());
|
||||
child: SplashScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -29,8 +29,8 @@ class SplashScreen extends StatelessWidget {
|
||||
CustomImageView(
|
||||
imagePath: ImageConstant.img2456927096976,
|
||||
height: 137.adaptSize,
|
||||
width: 137.adaptSize)
|
||||
]))));
|
||||
});
|
||||
width: 137.adaptSize,),
|
||||
],),),),);
|
||||
},);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ class WeightBloc extends Bloc<WeightEvent, WeightState> {
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
weightModelObj: state.weightModelObj?.copyWith(),
|
||||
weightController: state.weightController));
|
||||
weightController: state.weightController,),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m
|
||||
class WeightModel extends Equatable {
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
WeightModel(
|
||||
{this.dropdownItemList = const [], required this.userRegistrationSheet});
|
||||
{this.dropdownItemList = const [], required this.userRegistrationSheet,});
|
||||
|
||||
List<SelectionPopupModel> dropdownItemList;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class WeightScreen extends StatelessWidget {
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<WeightBloc>(
|
||||
create: (context) => WeightBloc(WeightState(weightModelObj: WeightModel(userRegistrationSheet: sheet)))..add(WeightInitialEvent()),
|
||||
child: WeightScreen());
|
||||
child: WeightScreen(),);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -78,7 +78,7 @@ class WeightScreen extends StatelessWidget {
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
],
|
||||
);
|
||||
})
|
||||
},),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -118,7 +118,7 @@ class WeightScreen extends StatelessWidget {
|
||||
leading:
|
||||
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),);
|
||||
}
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
|
||||
@@ -9,12 +9,12 @@ class ThemeHelper {
|
||||
|
||||
// A map of custom color themes supported by the app
|
||||
Map<String, PrimaryColors> _supportedCustomColor = {
|
||||
'primary': PrimaryColors()
|
||||
'primary': PrimaryColors(),
|
||||
};
|
||||
|
||||
// A map of color schemes supported by the app
|
||||
Map<String, ColorScheme> _supportedColorScheme = {
|
||||
'primary': ColorSchemes.primaryColorScheme
|
||||
'primary': ColorSchemes.primaryColorScheme,
|
||||
};
|
||||
|
||||
/// Returns the primary colors for the current theme.
|
||||
@@ -22,7 +22,7 @@ class ThemeHelper {
|
||||
//throw exception to notify given theme is not found or not generated by the generator
|
||||
if (!_supportedCustomColor.containsKey(_appTheme)) {
|
||||
throw Exception(
|
||||
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner");
|
||||
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner",);
|
||||
}
|
||||
//return theme from map
|
||||
|
||||
@@ -34,7 +34,7 @@ class ThemeHelper {
|
||||
//throw exception to notify given theme is not found or not generated by the generator
|
||||
if (!_supportedColorScheme.containsKey(_appTheme)) {
|
||||
throw Exception(
|
||||
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner");
|
||||
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner",);
|
||||
}
|
||||
//return theme from map
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
child: CustomNavigationMenu(),
|
||||
)
|
||||
),
|
||||
],
|
||||
position: RelativeRect.fromLTRB(size.width, size.height, 0, 0),
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ class _AboutListState extends State<AboutList> {
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight: FontWeight.bold,),
|
||||
),
|
||||
Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down),
|
||||
],
|
||||
@@ -39,7 +39,7 @@ class _AboutListState extends State<AboutList> {
|
||||
padding: const EdgeInsets.only(left: 16.0),
|
||||
child: Column(
|
||||
//children: widget.items.map((item) => Text(item)).toList(),
|
||||
children: [Text(widget.items.join('\n'))]),
|
||||
children: [Text(widget.items.join('\n'))],),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
|
||||
@@ -39,7 +39,7 @@ class _ExpandableListState extends State<ExpandableList> {
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight: FontWeight.bold,),
|
||||
),
|
||||
Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down),
|
||||
],
|
||||
@@ -66,7 +66,7 @@ class _ExpandableListState extends State<ExpandableList> {
|
||||
// Другие состояния, если они есть.
|
||||
return Container(); // Пустой контейнер для необработанных состояний.
|
||||
}
|
||||
}),
|
||||
},),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
@@ -122,7 +122,7 @@ class _ExpandableListState extends State<ExpandableList> {
|
||||
'низкий (1-3 тренировки в неделю по 20 мин)',
|
||||
'умеренный (3-4 тренировки в неделю по 30-60 мин)',
|
||||
'высокий (5-7 тренировок по 30-60 мин)',
|
||||
'экстремальный (несколько интенсивных тренировок в день)'
|
||||
'экстремальный (несколько интенсивных тренировок в день)',
|
||||
];
|
||||
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
|
||||
return Column(children: [
|
||||
@@ -137,7 +137,7 @@ class _ExpandableListState extends State<ExpandableList> {
|
||||
TextField(
|
||||
decoration: InputDecoration(labelText: 'date_of_birth'.tr),
|
||||
controller: state.dateFormController,
|
||||
onTap: inputTime(context, state)),
|
||||
onTap: inputTime(context, state),),
|
||||
DropdownButtonFormField<String>(
|
||||
value: state.selectedCountry,
|
||||
hint: Text(state.selectedCountry ?? "Не выбрано"),
|
||||
@@ -166,37 +166,37 @@ class _ExpandableListState extends State<ExpandableList> {
|
||||
controller: state.weightFormController,
|
||||
decoration: InputDecoration(labelText: 'weight_measurements'.tr),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly]),
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly],),
|
||||
TextField(
|
||||
controller: state.heightFormController,
|
||||
decoration: InputDecoration(labelText: 'height_measurements'.tr),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly]),
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly],),
|
||||
TextField(
|
||||
controller: state.chestCircumferenceFormController,
|
||||
decoration: InputDecoration(labelText: 'chest_circumference'.tr),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly]),
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly],),
|
||||
TextField(
|
||||
controller: state.waistCircumferenceFormController,
|
||||
decoration: InputDecoration(labelText: 'waist_circumference'.tr),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly]),
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly],),
|
||||
TextField(
|
||||
controller: state.hipCircumferenceFormController,
|
||||
decoration: InputDecoration(labelText: 'hip_circumference'.tr),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly]),
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly],),
|
||||
TextField(
|
||||
controller: state.upPressureFormController,
|
||||
decoration: InputDecoration(labelText: 'up_pressure'.tr),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly]),
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly],),
|
||||
TextField(
|
||||
controller: state.downPressureFormController,
|
||||
decoration: InputDecoration(labelText: 'down_pressure'.tr),
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly]),
|
||||
inputFormatters: <TextInputFormatter>[digitsOnly],),
|
||||
TextField(
|
||||
controller: state.allergiesFormController,
|
||||
decoration: InputDecoration(labelText: 'allergies_presence'.tr),
|
||||
@@ -259,8 +259,8 @@ class _ExpandableListState extends State<ExpandableList> {
|
||||
onPressed: () => sendProfileData(state),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
text: "save".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(top: 20.h, bottom: 20.h)),
|
||||
]);
|
||||
margin: EdgeInsets.only(top: 20.h, bottom: 20.h),),
|
||||
],);
|
||||
}
|
||||
|
||||
sendData(MyProfileLoadedState state) {
|
||||
@@ -382,7 +382,7 @@ class _ExpandableListState extends State<ExpandableList> {
|
||||
}
|
||||
|
||||
Future<http.Response> _sendHttpRequest(
|
||||
Map<String, dynamic> profileData, String apiUrl, String? token) {
|
||||
Map<String, dynamic> profileData, String apiUrl, String? token,) {
|
||||
return http.post(
|
||||
Uri.parse(apiUrl),
|
||||
body: json.encode(profileData),
|
||||
|
||||
@@ -30,7 +30,7 @@ class _HyperState extends State<HyperSwitch> {
|
||||
Text(
|
||||
widget.title,
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold),
|
||||
color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold,),
|
||||
),
|
||||
Switch(
|
||||
value: switchValue,
|
||||
|
||||
@@ -30,7 +30,7 @@ class _HypoState extends State<HypoSwitch> {
|
||||
Text(
|
||||
widget.title,
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold),
|
||||
color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold,),
|
||||
),
|
||||
Switch(
|
||||
value: switchValue,
|
||||
|
||||
@@ -45,7 +45,7 @@ class CustomIconButton extends StatelessWidget {
|
||||
color: Colors.black,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(9)),
|
||||
border: const Border.fromBorderSide(
|
||||
BorderSide(color: Colors.blueGrey, width: 1)),
|
||||
BorderSide(color: Colors.blueGrey, width: 1),),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user