feat(order info): added order info screen

This commit is contained in:
Username1548
2025-04-04 20:21:31 +07:00
parent 9715f4cac9
commit 748484cf8f
387 changed files with 16171 additions and 18199 deletions

View File

@@ -25,7 +25,7 @@ class _AddProductButtonWidgetState extends State<AddProductButtonWidget> {
return showModalBottomSheet(
useRootNavigator: true,
context: context,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
),
isScrollControlled: true,
@@ -45,16 +45,16 @@ class _AddProductButtonWidgetState extends State<AddProductButtonWidget> {
onTap: () => addProductInMeal(state),
borderRadius: BorderRadius.circular(20),
child: Ink(
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
width: MediaQuery.of(context).size.width - 32,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(20),
),
child: Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text(
child: const Text(
'Добавить',
style: TextStyle(
color: Colors.white,

View File

@@ -66,7 +66,7 @@ class _AddProductModalState extends State<AddProductModal> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Добавление блюда',
style: TextStyle(
fontSize: 20,
@@ -87,7 +87,7 @@ class _AddProductModalState extends State<AddProductModal> {
onChanged: (query) {
EasyDebounce.debounce(
'glossary-search',
Duration(milliseconds: 250),
const Duration(milliseconds: 250),
() async {
selectedGlossary = null;
if (query.isEmpty) {
@@ -124,7 +124,7 @@ class _AddProductModalState extends State<AddProductModal> {
),
glossariesList.isEmpty ? const SizedBox(height: 16) : const SizedBox.shrink(),
Container(
constraints: BoxConstraints(
constraints: const BoxConstraints(
maxHeight: 256,
),
child: ListView.separated(
@@ -146,7 +146,7 @@ class _AddProductModalState extends State<AddProductModal> {
),
title: Text(
glossariesList[i].name,
style: TextStyle(
style: const TextStyle(
height: 1,
),
),
@@ -163,12 +163,12 @@ class _AddProductModalState extends State<AddProductModal> {
Icons.add_rounded,
color: Colors.grey.shade400,
),
contentPadding: EdgeInsets.only(left: 12),
contentPadding: const EdgeInsets.only(left: 12),
);
},
itemCount: glossariesList.length,
separatorBuilder: (BuildContext context, int index) {
return CustomDivider();
return const CustomDivider();
},
),
),
@@ -190,9 +190,9 @@ class _AddProductModalState extends State<AddProductModal> {
height: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
),
child: Icon(
child: const Icon(
Icons.delete_outline_rounded,
color: Colors.red,
),
@@ -259,7 +259,7 @@ class _AddProductModalState extends State<AddProductModal> {
child: Center(
child: Text(
widget.portion == null ? 'Добавить' : 'Сохранить',
style: TextStyle(
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white,

View File

@@ -40,7 +40,7 @@ class _CalendarWidgetState extends State<CalendarWidget> {
locale: 'ru_RU',
startingDayOfWeek: StartingDayOfWeek.monday,
calendarFormat: _calendarFormat,
headerStyle: HeaderStyle(
headerStyle: const HeaderStyle(
titleCentered: true,
formatButtonVisible: false,
leftChevronVisible: false,
@@ -69,11 +69,11 @@ class _CalendarWidgetState extends State<CalendarWidget> {
}
},
calendarStyle: CalendarStyle(
weekendDecoration: BoxDecoration(
weekendDecoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
defaultDecoration: BoxDecoration(
defaultDecoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
@@ -81,7 +81,7 @@ class _CalendarWidgetState extends State<CalendarWidget> {
color: appTheme.blueA400,
shape: BoxShape.circle,
),
todayTextStyle: TextStyle(
todayTextStyle: const TextStyle(
color: Colors.black,
),
todayDecoration: BoxDecoration(

View File

@@ -6,6 +6,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncfusion_flutter_gauges/gauges.dart';
class CaloriesChartWidget extends StatelessWidget {
const CaloriesChartWidget({super.key});
@override
Widget build(BuildContext context) {
return BlocBuilder<DiaryCubit, DiaryState>(
@@ -26,7 +28,7 @@ class CaloriesChartWidget extends StatelessWidget {
onTap: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
builder: (context) => const AlertDialog(
content: Text(
'График отображает сколько калорий вам нужно ежедневно для похуденияи поддержания веса, согласно формуле Харриса-Бенедикта.\nИзменить коэффициент физической нагрузки можно в настройках.',
style: TextStyle(
@@ -60,7 +62,7 @@ class CaloriesChartWidget extends StatelessWidget {
radiusFactor: 0.7,
showAxisLine: false,
pointers: <GaugePointer>[
RangePointer(
const RangePointer(
value: 100,
width: 0.16,
animationDuration: 2000,
@@ -79,7 +81,7 @@ class CaloriesChartWidget extends StatelessWidget {
enableAnimation: true,
cornerStyle: CornerStyle.bothCurve,
),
RangePointer(
const RangePointer(
value: 100,
width: 0.16,
animationDuration: 2000,
@@ -100,7 +102,7 @@ class CaloriesChartWidget extends StatelessWidget {
cornerStyle: CornerStyle.bothCurve,
pointerOffset: -0.18,
),
RangePointer(
const RangePointer(
value: 100,
width: 0.16,
animationDuration: 2000,
@@ -121,7 +123,7 @@ class CaloriesChartWidget extends StatelessWidget {
cornerStyle: CornerStyle.bothCurve,
pointerOffset: -0.36,
),
RangePointer(
const RangePointer(
value: 100,
width: 0.16,
animationDuration: 2000,
@@ -147,7 +149,7 @@ class CaloriesChartWidget extends StatelessWidget {
GaugeAnnotation(
widget: Transform.rotate(
angle: 30.1,
child: Text(
child: const Text(
'Углеводы',
style: TextStyle(
color: Colors.white,
@@ -161,7 +163,7 @@ class CaloriesChartWidget extends StatelessWidget {
GaugeAnnotation(
widget: Transform.rotate(
angle: 30,
child: Text(
child: const Text(
'Жиры',
style: TextStyle(
color: Colors.white,
@@ -175,7 +177,7 @@ class CaloriesChartWidget extends StatelessWidget {
GaugeAnnotation(
widget: Transform.rotate(
angle: 30,
child: Text(
child: const Text(
'Белки',
style: TextStyle(
color: Colors.white,
@@ -189,7 +191,7 @@ class CaloriesChartWidget extends StatelessWidget {
GaugeAnnotation(
widget: Transform.rotate(
angle: 30,
child: Text(
child: const Text(
'Калории',
style: TextStyle(
color: Colors.white,
@@ -246,7 +248,7 @@ class CaloriesChartWidget extends StatelessWidget {
children: [
Text(
title,
style: TextStyle(
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Color(0xFF323F4B),
@@ -254,7 +256,7 @@ class CaloriesChartWidget extends StatelessWidget {
),
Text(
value,
style: TextStyle(
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Color(0xFF323F4B),

View File

@@ -22,7 +22,7 @@ class _CommentForConsultantWidgetState extends State<CommentForConsultantWidget>
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
const Text(
'Дополнительная информация для консультанта',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Color(0xFF323F4B), height: 1),
@@ -30,7 +30,7 @@ class _CommentForConsultantWidgetState extends State<CommentForConsultantWidget>
const SizedBox(height: 12),
CustomTextFormField(
onChanged: (value) {
EasyDebounce.debounce('client-typing', Duration(seconds: 3), () => context.read<DiaryCubit>().fillComment(value));
EasyDebounce.debounce('client-typing', const Duration(seconds: 3), () => context.read<DiaryCubit>().fillComment(value));
},
hintText: 'Укажите дополнительную информацию',
minLines: 4,

View File

@@ -26,13 +26,13 @@ class _FinishDayButtonWidgetState extends State<FinishDayButtonWidget> {
),
borderRadius: BorderRadius.circular(20),
child: Ink(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
width: MediaQuery.of(context).size.width - 16,
decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(20)),
child: Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text('Закончить день', style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600)),
child: const Text('Закончить день', style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600)),
),
),
);

View File

@@ -52,7 +52,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Добавление нового продукта',
textAlign: TextAlign.center,
style: TextStyle(
@@ -62,7 +62,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
),
),
const SizedBox(height: 16),
Text(
const Text(
'Оу... а у нас нет в базе калорийности такого продукта. Если вы знаете, давайте её запишем?',
textAlign: TextAlign.center,
style: TextStyle(
@@ -83,13 +83,13 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
borderRadius: BorderRadius.circular(20),
child: Ink(
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
color: const Color(0xFFF6F6F6),
borderRadius: BorderRadius.circular(20),
),
child: Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text(
child: const Text(
'В другой раз',
style: TextStyle(
color: Color(0xFF6D6F71),
@@ -116,9 +116,9 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
borderRadius: BorderRadius.circular(20),
),
child: Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text(
child: const Text(
'Записать',
style: TextStyle(
color: Colors.white,
@@ -139,11 +139,11 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
_success() {
return Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Продукт успешно отправлен\nна модерацию',
textAlign: TextAlign.center,
style: TextStyle(
@@ -170,9 +170,9 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
borderRadius: BorderRadius.circular(20),
),
child: Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text(
child: const Text(
'Закрыть',
style: TextStyle(
color: Colors.white,
@@ -195,7 +195,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Добавление нового продукта',
textAlign: TextAlign.center,
style: TextStyle(
@@ -205,7 +205,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
),
),
const SizedBox(height: 16),
Text(
const Text(
'Если у вас данные по нему\nпросим заполнить значения на 100гр.',
textAlign: TextAlign.center,
style: TextStyle(
@@ -227,7 +227,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
child: CustomTextFormField(
hintText: 'Калории',
controller: energyController,
keyboardType: TextInputType.numberWithOptions(decimal: true),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
),
),
const SizedBox(width: 8),
@@ -235,7 +235,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
child: CustomTextFormField(
hintText: 'Белки',
controller: proteinsController,
keyboardType: TextInputType.numberWithOptions(decimal: true),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
),
),
],
@@ -248,7 +248,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
child: CustomTextFormField(
hintText: 'Жиры',
controller: fatsController,
keyboardType: TextInputType.numberWithOptions(decimal: true),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
),
),
const SizedBox(width: 8),
@@ -256,7 +256,7 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
child: CustomTextFormField(
hintText: 'Углеводы',
controller: carbohydratesController,
keyboardType: TextInputType.numberWithOptions(decimal: true),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
),
),
],
@@ -278,15 +278,15 @@ class _GlossaryModerationRequestModalWidgetState extends State<GlossaryModeratio
},
borderRadius: BorderRadius.circular(20),
child: Ink(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(20),
),
child: Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text(
child: const Text(
'Сохранить',
style: TextStyle(
color: Colors.white,

View File

@@ -32,13 +32,13 @@ class _MealButtonWidgetState extends State<MealButtonWidget> {
height: 32,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: state.selectedMeal == widget.mealNumber ? appTheme.blueA400 : Color(0xFFF1F2F6),
color: state.selectedMeal == widget.mealNumber ? appTheme.blueA400 : const Color(0xFFF1F2F6),
),
child: Center(
child: Text(
'${widget.mealNumber}',
style: TextStyle(
color: state.selectedMeal == widget.mealNumber ? Colors.white : Color(0xFF6D6F71),
color: state.selectedMeal == widget.mealNumber ? Colors.white : const Color(0xFF6D6F71),
fontSize: 16,
fontWeight: FontWeight.w600,
),

View File

@@ -20,8 +20,8 @@ class _MealWidgetState extends State<MealWidget> {
return Material(
borderRadius: BorderRadius.circular(20),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16),
child: const Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -33,7 +33,7 @@ class _MealWidgetState extends State<MealWidget> {
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 16),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -44,17 +44,17 @@ class _MealWidgetState extends State<MealWidget> {
MealButtonWidget(mealNumber: 5),
],
),
const SizedBox(height: 12),
SizedBox(height: 12),
TimeOfMealPickerWidget(),
const SizedBox(height: 12),
SizedBox(height: 12),
ProductsListWidget(),
const SizedBox(height: 12),
SizedBox(height: 12),
AddProductButtonWidget(),
const SizedBox(height: 12),
SizedBox(height: 12),
PhotoGalleryWidget(),
const SizedBox(height: 12),
SizedBox(height: 12),
SatietyRatingWidget(),
const SizedBox(height: 12),
SizedBox(height: 12),
MoodRatingWidget(),
],
),

View File

@@ -7,6 +7,8 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_svg/flutter_svg.dart';
class MoodRatingWidget extends StatefulWidget {
const MoodRatingWidget({super.key});
@override
State<MoodRatingWidget> createState() => _MoodRatingWidgetState();
}
@@ -29,7 +31,7 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Ваше настроение после приёма пищи',
style: TextStyle(
fontSize: 16,
@@ -54,22 +56,22 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 1 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFC82222),
color: const Color(0xFFC82222),
border: currentSelectedRating == 1
? Border.all(
width: 2,
color: Color(0xFFAA3333),
color: const Color(0xFFAA3333),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
borderRadius: currentSelectedRating == 1
? BorderRadius.horizontal(
? const BorderRadius.horizontal(
left: Radius.circular(8),
right: Radius.circular(2),
)
: BorderRadius.horizontal(
: const BorderRadius.horizontal(
left: Radius.circular(8),
),
),
@@ -78,13 +80,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 2 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFFF3E3E),
color: const Color(0xFFFF3E3E),
border: currentSelectedRating == 2
? Border.all(
width: 2,
color: Color(0xFF550000),
color: const Color(0xFF550000),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -95,13 +97,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 3 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFF8C926),
color: const Color(0xFFF8C926),
border: currentSelectedRating == 3
? Border.all(
width: 2,
color: Color(0xFF8C5D00),
color: const Color(0xFF8C5D00),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -112,13 +114,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 4 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFFFF3BF),
color: const Color(0xFFFFF3BF),
border: currentSelectedRating == 4
? Border.all(
width: 2,
color: Color(0xFFB5911B),
color: const Color(0xFFB5911B),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -129,13 +131,13 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 5 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFF62E833),
color: const Color(0xFF62E833),
border: currentSelectedRating == 5
? Border.all(
width: 2,
color: Color(0xFF276918),
color: const Color(0xFF276918),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -146,22 +148,22 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 6 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFF4DCE20),
color: const Color(0xFF4DCE20),
border: currentSelectedRating == 6
? Border.all(
width: 2,
color: Color(0xFF184D12),
color: const Color(0xFF184D12),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
borderRadius: currentSelectedRating == 6
? BorderRadius.horizontal(
? const BorderRadius.horizontal(
left: Radius.circular(2),
right: Radius.circular(8),
)
: BorderRadius.horizontal(
: const BorderRadius.horizontal(
right: Radius.circular(8),
),
),
@@ -174,7 +176,7 @@ class _MoodRatingWidgetState extends State<MoodRatingWidget> {
});
EasyDebounce.debounce(
'change-satiety',
Duration(milliseconds: 250),
const Duration(milliseconds: 250),
() {
context.read<DiaryCubit>().fillMood(diaryId: state.diary.id, mood: currentSelectedRating.toInt() - 1);
},

View File

@@ -39,14 +39,15 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
Navigator.of(context).pop();
final picker = ImagePicker();
XFile? image = await picker.pickImage(source: ImageSource.camera);
if (image != null)
if (image != null) {
diaryCubit.uploadPhotos(
files: [File(image.path)],
diaryId: diaryDay.id,
);
}
},
child: const Row(
children: const [
children: [
Icon(Icons.photo_camera),
SizedBox(width: 8),
Text('Фото'),
@@ -58,14 +59,15 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
Navigator.of(context).pop();
final picker = ImagePicker();
List<XFile>? images = await picker.pickMultiImage();
if (images.isNotEmpty)
if (images.isNotEmpty) {
diaryCubit.uploadPhotos(
files: images.map((f) => File(f.path)).toList(),
diaryId: diaryDay.id,
);
}
},
child: const Row(
children: const [
children: [
Icon(Icons.photo),
SizedBox(width: 8),
Text('Галерея'),
@@ -107,7 +109,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: CachedNetworkImage(
imageUrl: baseUrl + '/storage/' + state.diary.meals[mealIndex].photos[currentSelectedPhotoIndex].path,
imageUrl: '$baseUrl/storage/${state.diary.meals[mealIndex].photos[currentSelectedPhotoIndex].path}',
),
),
Padding(
@@ -128,7 +130,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
}
});
},
icon: Icon(
icon: const Icon(
Icons.close_rounded,
color: Colors.grey,
),
@@ -156,7 +158,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
width: 52,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFF1F2F6),
color: const Color(0xFFF1F2F6),
),
child: Icon(
Icons.add_rounded,
@@ -178,7 +180,7 @@ class _PhotoGalleryWidgetState extends State<PhotoGalleryWidget> {
height: 52,
width: 52,
child: CachedNetworkImage(
imageUrl: baseUrl + '/storage/' + state.diary.meals[mealIndex].photos[i].path,
imageUrl: '$baseUrl/storage/${state.diary.meals[mealIndex].photos[i].path}',
fit: BoxFit.fitWidth,
),
),

View File

@@ -29,15 +29,16 @@ class _ProductWidgetState extends State<ProductWidget> {
void initState() {
super.initState();
diaryCubit = context.read<DiaryCubit>();
portionName = widget.portion == 'gr' ? 'гр' : 'шт';
isEaten = widget.portion.portionState == PortionState.eaten_from_diet ? true : false;
portionName = widget.portion.portion == 'gr' ? 'гр' : 'шт';
isEaten = widget.portion.portionState == PortionState.eatenFromDiet ? true : false;
}
updateProductInMeal(DiaryStateLoaded state, PortionModel portion) {
return showModalBottomSheet(
useRootNavigator: true,
context: context,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
),
isScrollControlled: true,
@@ -54,14 +55,14 @@ class _ProductWidgetState extends State<ProductWidget> {
return BlocBuilder<DiaryCubit, DiaryState>(
builder: (context, state) {
if (state is DiaryStateLoaded) {
if (widget.portion.portionState == PortionState.eaten_deleted) {
if (widget.portion.portionState == PortionState.eatenDeleted) {
return DottedBorder(
dashPattern: [6, 6],
dashPattern: const [6, 6],
padding: EdgeInsets.zero,
borderPadding: EdgeInsets.zero,
borderType: BorderType.RRect,
radius: Radius.circular(20),
color: Color(0xFF6D6F71),
radius: const Radius.circular(20),
color: const Color(0xFF6D6F71),
child: ListTile(
onTap: () => diaryCubit.restore(
diaryId: state.diary.id,
@@ -72,19 +73,20 @@ class _ProductWidgetState extends State<ProductWidget> {
'assets/icons/revert_product.svg',
),
horizontalTitleGap: 0,
contentPadding: widget.portion.fromDiet ? EdgeInsets.only(right: 24, left: 4) : null,
contentPadding: widget.portion.fromDiet ? const EdgeInsets.only(right: 24, left: 4) : null,
title: Text(widget.portion.productName),
subtitle: Text('${widget.portion.quantity} ${widget.portion.portion == 'gr' ? 'гр' : 'шт'}'),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
tileColor: Color(0xFFF6FAFF03).withValues(alpha: 0.01),
// ignore: use_full_hex_values_for_flutter_colors
tileColor: const Color(0xfff6faff03).withValues(alpha: 0.01),
),
);
} else {
return ListTile(
onTap: () => updateProductInMeal(state, widget.portion),
trailing: Icon(Icons.more_vert_rounded),
trailing: const Icon(Icons.more_vert_rounded),
leading: widget.portion.fromDiet
? Transform.scale(
scale: 1.2,
@@ -112,20 +114,20 @@ class _ProductWidgetState extends State<ProductWidget> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
side: BorderSide(
side: const BorderSide(
color: Color(0xFF809CB9),
),
),
)
: null,
horizontalTitleGap: 0,
contentPadding: widget.portion.fromDiet ? EdgeInsets.only(right: 24, left: 4) : null,
contentPadding: widget.portion.fromDiet ? const EdgeInsets.only(right: 24, left: 4) : null,
title: Text(widget.portion.productName),
subtitle: Text('${widget.portion.quantity} ${widget.portion.portion == 'gr' ? 'гр' : 'шт'}'),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
tileColor: Color(0xFFF6FAFF),
tileColor: const Color(0xFFF6FAFF),
);
}
}

View File

@@ -7,6 +7,8 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_svg/flutter_svg.dart';
class SatietyRatingWidget extends StatefulWidget {
const SatietyRatingWidget({super.key});
@override
State<SatietyRatingWidget> createState() => _SatietyRatingWidgetState();
}
@@ -29,7 +31,7 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Ваша сытость после приёма пищи',
style: TextStyle(
fontSize: 16,
@@ -54,22 +56,22 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 1 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 1 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFC82222),
color: const Color(0xFFC82222),
border: currentSelectedRating == 1
? Border.all(
width: 2,
color: Color(0xFFAA3333),
color: const Color(0xFFAA3333),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
borderRadius: currentSelectedRating == 1
? BorderRadius.horizontal(
? const BorderRadius.horizontal(
left: Radius.circular(8),
right: Radius.circular(2),
)
: BorderRadius.horizontal(
: const BorderRadius.horizontal(
left: Radius.circular(8),
),
),
@@ -78,13 +80,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 2 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 2 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFFF3E3E),
color: const Color(0xFFFF3E3E),
border: currentSelectedRating == 2
? Border.all(
width: 2,
color: Color(0xFF550000),
color: const Color(0xFF550000),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -95,13 +97,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 3 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 3 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFF8C926),
color: const Color(0xFFF8C926),
border: currentSelectedRating == 3
? Border.all(
width: 2,
color: Color(0xFF8C5D00),
color: const Color(0xFF8C5D00),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -112,13 +114,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 4 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 4 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFFFFF3BF),
color: const Color(0xFFFFF3BF),
border: currentSelectedRating == 4
? Border.all(
width: 2,
color: Color(0xFFB5911B),
color: const Color(0xFFB5911B),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -129,13 +131,13 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 5 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 5 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFF62E833),
color: const Color(0xFF62E833),
border: currentSelectedRating == 5
? Border.all(
width: 2,
color: Color(0xFF276918),
color: const Color(0xFF276918),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
@@ -146,22 +148,22 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
return Container(
width: MediaQuery.of(context).size.width / 6,
height: 24,
margin: currentSelectedRating == 6 ? EdgeInsets.symmetric(horizontal: 2) : null,
margin: currentSelectedRating == 6 ? const EdgeInsets.symmetric(horizontal: 2) : null,
decoration: BoxDecoration(
color: Color(0xFF4DCE20),
color: const Color(0xFF4DCE20),
border: currentSelectedRating == 6
? Border.all(
width: 2,
color: Color(0xFF184D12),
color: const Color(0xFF184D12),
strokeAlign: BorderSide.strokeAlignOutside,
)
: null,
borderRadius: currentSelectedRating == 6
? BorderRadius.horizontal(
? const BorderRadius.horizontal(
left: Radius.circular(2),
right: Radius.circular(8),
)
: BorderRadius.horizontal(
: const BorderRadius.horizontal(
right: Radius.circular(8),
),
),
@@ -174,7 +176,7 @@ class _SatietyRatingWidgetState extends State<SatietyRatingWidget> {
});
EasyDebounce.debounce(
'change-satiety',
Duration(milliseconds: 250),
const Duration(milliseconds: 250),
() {
context.read<DiaryCubit>().fillSatiety(diaryId: state.diary.id, satiety: currentSelectedRating.toInt() - 1);
},

View File

@@ -57,7 +57,7 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: const Center(
child: Text(
'Сохранить',
style: TextStyle(
@@ -82,13 +82,13 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
if (state is DiaryStateLoaded) {
return Column(
children: [
CustomDivider(),
const CustomDivider(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
const Text(
'Время приема пищи',
style: TextStyle(
color: Color(0xFF323F4B),
@@ -103,14 +103,14 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
height: 32,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Color(0xFFF1F2F6),
color: const Color(0xFFF1F2F6),
),
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
state.diary.meals[state.selectedMeal - 1].time.substring(0, state.diary.meals[state.selectedMeal - 1].time.length - 3),
style: TextStyle(
style: const TextStyle(
color: Color(0xFF6D6F71),
fontSize: 17,
fontWeight: FontWeight.w500,
@@ -122,7 +122,7 @@ class _TimeOfMealPickerWidgetState extends State<TimeOfMealPickerWidget> {
],
),
),
CustomDivider(),
const CustomDivider(),
],
);
}

View File

@@ -73,7 +73,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: const Center(
child: Text(
'Сохранить',
style: TextStyle(
@@ -116,7 +116,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
children: [
SvgPicture.asset('assets/icons/wakeup.svg'),
const SizedBox(width: 8),
Text(
const Text(
'Подъём',
style: TextStyle(
fontSize: 16,
@@ -134,17 +134,17 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
height: 32,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Color(0xFFF1F2F6),
color: const Color(0xFFF1F2F6),
),
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
state.diary.wakeup.toString().substring(
0,
state.diary.wakeup.toString().length - 3,
),
style: TextStyle(
style: const TextStyle(
color: Color(0xFF6D6F71),
fontSize: 17,
fontWeight: FontWeight.w500,
@@ -175,7 +175,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
children: [
SvgPicture.asset('assets/icons/retire.svg'),
const SizedBox(width: 8),
Text(
const Text(
'Уход ко сну',
style: TextStyle(
fontSize: 16,
@@ -193,17 +193,17 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
height: 32,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Color(0xFFF1F2F6),
color: const Color(0xFFF1F2F6),
),
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
state.diary.retire.toString().substring(
0,
state.diary.retire.toString().length - 3,
),
style: TextStyle(
style: const TextStyle(
color: Color(0xFF6D6F71),
fontSize: 17,
fontWeight: FontWeight.w500,
@@ -221,7 +221,7 @@ class _WakeupAndRetireWidgetState extends State<WakeupAndRetireWidget> {
),
);
} else {
return SizedBox.shrink();
return const SizedBox.shrink();
}
},
);