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

@@ -18,12 +18,12 @@ class AddItemButton extends StatelessWidget {
color: appTheme.blueA400,
shape: BoxShape.circle,
),
width: 40,
height: 40,
child: Icon(
Icons.add_rounded,
color: appTheme.gray100,
),
width: 40,
height: 40,
),
);
}

View File

@@ -3,7 +3,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
class AnimatedOptionButton extends StatelessWidget {
const AnimatedOptionButton({required this.text, required this.isSelected, required this.onTap, this.textStyle});
const AnimatedOptionButton({super.key, required this.text, required this.isSelected, required this.onTap, this.textStyle});
final String text;
final bool isSelected;
final void Function() onTap;

View File

@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
class BaseButton extends StatelessWidget {
BaseButton({
Key? key,
const BaseButton({
super.key,
required this.text,
this.onPressed,
this.buttonStyle,
@@ -12,9 +12,7 @@ class BaseButton extends StatelessWidget {
this.width,
this.margin,
this.alignment,
}) : super(
key: key,
);
});
final String text;

View File

@@ -32,7 +32,7 @@ Future<void> showBottomSheetWithBlur({
child: Container(
height: height,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),

View File

@@ -15,31 +15,31 @@ class CpfcContainer extends StatelessWidget {
final s = S.of(context);
return Container(
color: appTheme.cardBackground,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Text('${calories.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(calories.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.calories, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),
Column(
children: [
Text('${proteins.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(proteins.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.proteins, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),
Column(
children: [
Text('${fats.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(fats.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.fats, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),
Column(
children: [
Text('${carbohydrates.toStringAsFixed(roundDigit)}', style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(carbohydrates.toStringAsFixed(roundDigit), style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
Text(s.carbohydrates, style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
),

View File

@@ -2,7 +2,7 @@ import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.d
import 'package:flutter/material.dart';
class CustomDropDown extends StatelessWidget {
const CustomDropDown({
const CustomDropDown({super.key,
this.alignment,
this.width,
this.focusNode,
@@ -59,7 +59,7 @@ class CustomDropDown extends StatelessWidget {
_buildDropDownWidget(BuildContext context) {
return DropdownButtonFormField<SelectionPopupModel>(
focusNode: focusNode ?? FocusNode(),
icon: Icon(Icons.keyboard_arrow_down_rounded),
icon: const Icon(Icons.keyboard_arrow_down_rounded),
autofocus: autofocus!,
value: value,
isDense: true,
@@ -70,7 +70,7 @@ class CustomDropDown extends StatelessWidget {
child: Text(
item.title,
style: hintStyle ??
TextStyle(
const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.black,
@@ -90,7 +90,7 @@ class CustomDropDown extends StatelessWidget {
InputDecoration _buildInputDecoration(BuildContext context) {
return InputDecoration(
labelStyle: TextStyle(
labelStyle: const TextStyle(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.w400,
@@ -108,19 +108,19 @@ class CustomDropDown extends StatelessWidget {
suffixIcon: suffix,
isDense: true,
suffixIconConstraints: suffixConstraints,
contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12),
fillColor: Color(0xFFF6F6F6),
contentPadding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
fillColor: const Color(0xFFF6F6F6),
filled: filled,
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(20)),
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(20)),
enabledBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(20)),
focusedBorder: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide.none,
),
);

View File

@@ -3,32 +3,21 @@ import 'package:eatvio_app/core/widgets/base_button.dart';
import 'package:flutter/material.dart';
class CustomOutlinedButton extends BaseButton {
CustomOutlinedButton({
Key? key,
const CustomOutlinedButton({super.key,
this.decoration,
this.leftIcon,
this.rightIcon,
this.label,
VoidCallback? onPressed,
ButtonStyle? buttonStyle,
TextStyle? buttonTextStyle,
bool? isDisabled,
Alignment? alignment,
double? height,
double? width,
EdgeInsets? margin,
required String text,
}) : super(
text: text,
onPressed: onPressed,
buttonStyle: buttonStyle,
isDisabled: isDisabled,
buttonTextStyle: buttonTextStyle,
height: height,
alignment: alignment,
width: width,
margin: margin,
);
super.onPressed,
super.buttonStyle,
super.buttonTextStyle,
super.isDisabled,
super.alignment,
super.height,
super.width,
super.margin,
required super.text,
});
final BoxDecoration? decoration;
final Widget? leftIcon;
@@ -41,8 +30,8 @@ class CustomOutlinedButton extends BaseButton {
return Align(
alignment: alignment ?? Alignment.center,
child: Container(
height: this.height ?? 30,
width: this.width ?? double.maxFinite,
height: height ?? 30,
width: width ?? double.maxFinite,
margin: margin,
decoration: decoration,
child: OutlinedButton(
@@ -52,12 +41,12 @@ class CustomOutlinedButton extends BaseButton {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
leftIcon ?? SizedBox.shrink(),
leftIcon ?? const SizedBox.shrink(),
Text(
text,
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
),
rightIcon ?? SizedBox.shrink(),
rightIcon ?? const SizedBox.shrink(),
],
),
),
@@ -65,8 +54,8 @@ class CustomOutlinedButton extends BaseButton {
);
} else {
return Container(
height: this.height ?? 30,
width: this.width ?? double.maxFinite,
height: height ?? 30,
width: width ?? double.maxFinite,
margin: margin,
decoration: decoration,
child: OutlinedButton(
@@ -76,12 +65,12 @@ class CustomOutlinedButton extends BaseButton {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
leftIcon ?? SizedBox.shrink(),
leftIcon ?? const SizedBox.shrink(),
Text(
text,
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
),
rightIcon ?? SizedBox.shrink(),
rightIcon ?? const SizedBox.shrink(),
],
),
),

View File

@@ -19,7 +19,7 @@ class CustomSearchBar extends StatelessWidget {
textCapitalization: TextCapitalization.sentences,
controller: searchController,
autofocus: false,
style: TextStyle(
style: const TextStyle(
fontSize: 12,
),
onChanged: onChanged,
@@ -38,7 +38,7 @@ class CustomSearchBar extends StatelessWidget {
)
: null,
isDense: false,
contentPadding: enableIcon ? EdgeInsets.all(8) : EdgeInsets.only(top: 8, left: 16, right: 8, bottom: 8),
contentPadding: enableIcon ? const EdgeInsets.all(8) : const EdgeInsets.only(top: 8, left: 16, right: 8, bottom: 8),
fillColor: backgroundColor ?? appTheme.gray100,
filled: true,
border: OutlineInputBorder(

View File

@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class CustomTextFormField extends StatelessWidget {
CustomTextFormField({
const CustomTextFormField({
this.alignment,
this.width,
this.controller,
@@ -97,9 +97,9 @@ class CustomTextFormField extends StatelessWidget {
maxLength: maxLength,
onChanged: onChanged,
controller: controller,
focusNode: focusNode ?? null,
focusNode: focusNode,
autofocus: autofocus,
style: TextStyle(fontSize: 16, color: Colors.black, fontWeight: FontWeight.w500),
style: const TextStyle(fontSize: 16, color: Colors.black, fontWeight: FontWeight.w500),
obscureText: obscureText!,
textInputAction: textInputAction,
maxLines: maxLines,
@@ -110,16 +110,16 @@ class CustomTextFormField extends StatelessWidget {
counter: counter,
suffixText: suffixText,
hintText: hintText ?? "",
hintStyle: hintStyle ?? TextStyle(fontSize: 16, color: Color(0xFF323F4B).withAlpha((255 / 2).toInt()), fontWeight: FontWeight.w500),
hintStyle: hintStyle ?? TextStyle(fontSize: 16, color: const Color(0xFF323F4B).withAlpha((255 / 2).toInt()), fontWeight: FontWeight.w500),
prefixIcon: prefix,
prefixIconConstraints: prefixConstraints,
suffixIcon: suffix,
floatingLabelBehavior: FloatingLabelBehavior.always,
suffixStyle: textStyle ?? TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B)),
suffixStyle: textStyle ?? const TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B)),
suffixIconConstraints: suffixConstraints,
isDense: false,
contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 12),
fillColor: Color(0xFFF6F6F6),
contentPadding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
fillColor: const Color(0xFFF6F6F6),
filled: true,
border:
borderDecoration ??

View File

@@ -24,34 +24,36 @@ class _DataErrorWidgetState extends State<DataErrorWidget> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset('assets/icons/cloud.svg'),
SizedBox(height: 30),
const SizedBox(height: 30),
Text(s.something_went_wrong, style: TextStyles.textLSemibold.copyWith(color: appTheme.black)),
SizedBox(height: 12),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Text(s.can_not_load_data_please_try_again, style: TextStyles.textSMedium.copyWith(color: appTheme.black), textAlign: TextAlign.center),
),
SizedBox(height: 20),
const SizedBox(height: 20),
isLoading
? Loader()
? const Loader()
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: CustomOutlinedButton(
text: s.try_again,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(side: WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
onPressed: () async {
setState(() {
isLoading = true;
});
await widget.onReload();
setState(() {
isLoading = false;
});
},
padding: const EdgeInsets.symmetric(horizontal: 16),
child: CustomOutlinedButton(
text: s.try_again,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
onPressed: () async {
setState(() {
isLoading = true;
});
await widget.onReload();
if (context.mounted) {
setState(() {
isLoading = false;
});
}
},
),
),
),
],
);
}

View File

@@ -18,7 +18,7 @@ class FeedIconButton extends StatelessWidget {
onTap: onTap ?? () {},
borderRadius: BorderRadius.circular(16),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
color: backgroundColor ?? appTheme.gray100,
borderRadius: BorderRadius.circular(16),
@@ -35,7 +35,7 @@ class FeedIconButton extends StatelessWidget {
color: iconColor ?? appTheme.gray600,
),
if (text != null) ...[
SizedBox(width: 8),
const SizedBox(width: 8),
Text(
text!,
style: TextStyles.textSMedium.copyWith(

View File

@@ -55,18 +55,18 @@ class InfoRow extends StatelessWidget {
width: 13.3,
height: 13.3,
),
SizedBox(width: 4),
const SizedBox(width: 4),
Text(
switch (type) {
ProductType.diet => '${diet?.duration} ${getDayForm(diet?.duration ?? 7, s)}',
ProductType.plan => '${plan?.duration} ${getDayForm(plan?.duration ?? 7, s)}',
ProductType.recipe => '${timeTitle ?? ''}',
ProductType.recipe => timeTitle ?? '',
},
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
],
),
SizedBox(width: 12),
const SizedBox(width: 12),
InfoBouble(
backgroundColor: itemsBackgroundColor,
children: [
@@ -79,18 +79,18 @@ class InfoRow extends StatelessWidget {
width: 13.3,
height: 13.3,
),
SizedBox(width: 4),
const SizedBox(width: 4),
Text(
switch (type) {
ProductType.diet => '80 человек прошли',
ProductType.plan => '80 человек прошли',
ProductType.recipe => (recipe?.calories.toStringAsFixed(0) ?? '0') + ' ккал',
ProductType.recipe => '${recipe?.calories.toStringAsFixed(0) ?? '0'} ккал',
},
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
],
),
SizedBox(width: 12),
const SizedBox(width: 12),
if (type == ProductType.recipe)
InfoBouble(
backgroundColor: itemsBackgroundColor,
@@ -100,7 +100,7 @@ class InfoRow extends StatelessWidget {
width: 13.3,
height: 13.3,
),
SizedBox(width: 4),
const SizedBox(width: 4),
Text(
'${recipe?.steps?.length ?? 0} ${getStepForm(recipe?.steps?.length ?? 0)}',
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),

View File

@@ -18,7 +18,7 @@ class ItemWidget extends StatelessWidget {
width: iconSize,
height: iconSize,
),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(
child: Text(
text,

View File

@@ -6,7 +6,7 @@ class Loader extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
return const Center(
child: SizedBox(
height: 32,
width: 32,

View File

@@ -23,10 +23,10 @@ class MainBackgroundBouble extends StatelessWidget {
boxShadow: enableShadow
? [
BoxShadow(
color: Color(0x00000000).withValues(alpha: 0.2),
color: const Color(0x00000000).withValues(alpha: 0.2),
spreadRadius: 0,
blurRadius: 32,
offset: Offset(0, 0),
offset: const Offset(0, 0),
),
]
: null,

View File

@@ -0,0 +1,94 @@
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/utils/localization_utils.dart';
import 'package:eatvio_app/core/widgets/custom_divider.dart';
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/core/widgets/item_widget.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
class OptionWidget extends StatelessWidget {
const OptionWidget({super.key, required this.option, this.disableDuration = false});
final PacketOptions? option;
final bool disableDuration;
@override
Widget build(BuildContext context) {
if (option == null) {
return const SizedBox.shrink();
}
return MainBackgroundBouble(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 16),
Text(
option?.short ?? '',
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
const SizedBox(height: 12),
Text(
option?.description ?? '',
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
),
const SizedBox(height: 12),
if (!disableDuration) ...[
const _OptionDurationWidget(duration: 7),
const SizedBox(height: 16),
],
const CustomDivider(),
const SizedBox(height: 16),
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) => const SizedBox(height: 12),
itemBuilder: (context, index) => ItemWidget(text: option?.items[index] ?? ''),
itemCount: option?.items.length ?? 0,
shrinkWrap: true,
),
],
),
);
}
}
class _OptionDurationWidget extends StatelessWidget {
const _OptionDurationWidget({required this.duration});
final int duration;
@override
Widget build(BuildContext context) {
final s = S.of(context);
return Container(
decoration: BoxDecoration(borderRadius: BorderRadius.circular(4), color: appTheme.cardBackground),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Container(
width: 4,
height: 20,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: const BorderRadius.only(
topRight: Radius.circular(100),
bottomRight: Radius.circular(100),
),
),
),
),
const SizedBox(
width: 12,
),
Text(
'${s.option_duration} $duration ${getDayForm(duration, s)}',
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
),
const SizedBox(
width: 12,
),
],
),
);
}
}

View File

@@ -17,7 +17,7 @@ void showErrorDialog(BuildContext context, {String? title, String? description})
child: Container(
decoration: BoxDecoration(
color: appTheme.whiteA700,
borderRadius: BorderRadius.all(Radius.circular(20)),
borderRadius: const BorderRadius.all(Radius.circular(20)),
boxShadow: [BoxShadow(color: appTheme.dialogShadow, blurRadius: 32)],
),
width: MediaQuery.sizeOf(context).width,
@@ -27,12 +27,12 @@ void showErrorDialog(BuildContext context, {String? title, String? description})
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 20),
const SizedBox(height: 20),
Text(
title ?? s.some_error_occurred,
style: TextStyles.textLSemibold.copyWith(color: appTheme.black, decoration: TextDecoration.none),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.only(right: 72),
child: Text(
@@ -47,7 +47,7 @@ void showErrorDialog(BuildContext context, {String? title, String? description})
child: Text(s.ok, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
],
),
),

View File

@@ -15,11 +15,11 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
final s = S.of(context);
return Column(
children: [
SizedBox(
const SizedBox(
height: 20,
),
BottomSheetHandlerBar(),
SizedBox(
const BottomSheetHandlerBar(),
const SizedBox(
height: 20,
),
Text(
@@ -30,7 +30,7 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
'опубликованна',
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(
const SizedBox(
height: 20,
),
Padding(
@@ -43,12 +43,12 @@ class SuccessPublishedDietBottomSheet extends StatelessWidget {
height: 52,
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
),
),
SizedBox(
const SizedBox(
height: 20,
),
],

View File

@@ -15,11 +15,11 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget {
final s = S.of(context);
return Column(
children: [
SizedBox(
const SizedBox(
height: 20,
),
BottomSheetHandlerBar(),
SizedBox(
const BottomSheetHandlerBar(),
const SizedBox(
height: 20,
),
Text(
@@ -30,7 +30,7 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget {
'"$title" ${s.successfully_published}',
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
SizedBox(
const SizedBox(
height: 20,
),
Padding(
@@ -43,12 +43,12 @@ class SuccessPublishedRecipeBottomSheet extends StatelessWidget {
height: 52,
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(
side: WidgetStatePropertyAll(BorderSide.none),
side: const WidgetStatePropertyAll(BorderSide.none),
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
),
),
),
SizedBox(
const SizedBox(
height: 20,
),
],