forked from eatvio/eatvio_app
feat(order info): added order info screen
This commit is contained in:
@@ -7,14 +7,16 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class AuthorCard extends StatelessWidget {
|
||||
const AuthorCard({super.key, required this.author, required this.title});
|
||||
const AuthorCard({super.key, required this.author, required this.title, this.backgroundColor, this.titleStyle});
|
||||
final Author author;
|
||||
final String title;
|
||||
final Color? backgroundColor;
|
||||
final TextStyle? titleStyle;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.cardBackground),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: backgroundColor ?? appTheme.cardBackground),
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
@@ -42,7 +44,7 @@ class AuthorCard extends StatelessWidget {
|
||||
),
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyles.textSSemibold.copyWith(
|
||||
style: titleStyle ?? TextStyles.textSSemibold.copyWith(
|
||||
color: appTheme.gray,
|
||||
),
|
||||
),
|
||||
@@ -55,7 +57,7 @@ class AuthorCard extends StatelessWidget {
|
||||
color: appTheme.black,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
const SizedBox(width: 10),
|
||||
if (author.authorPlaceInRating != null)
|
||||
InfoBouble(
|
||||
radius: 12,
|
||||
|
||||
@@ -34,13 +34,13 @@ class _CalendarWidgetState extends State<CalendarWidget> {
|
||||
final dateFormatter = DateFormat('MMMM', 'ru_RU');
|
||||
return Center(
|
||||
child: Text(
|
||||
'${dateFormatter.format(day).capitalize()}',
|
||||
dateFormatter.format(day).capitalize(),
|
||||
style: TextStyle(color: appTheme.black, fontSize: 16, fontWeight: FontWeight.w400),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
headerStyle: HeaderStyle(
|
||||
headerStyle: const HeaderStyle(
|
||||
titleCentered: true,
|
||||
formatButtonVisible: false,
|
||||
leftChevronVisible: false,
|
||||
|
||||
@@ -18,9 +18,9 @@ class CancelDietBottomSheet extends StatelessWidget {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 4),
|
||||
BottomSheetHandlerBar(),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 4),
|
||||
const BottomSheetHandlerBar(),
|
||||
const SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 25.0),
|
||||
child: Text(
|
||||
@@ -32,12 +32,13 @@ class CancelDietBottomSheet extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28),
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28),
|
||||
child: CustomOutlinedButton(
|
||||
onPressed: () async {
|
||||
if (title != null) {
|
||||
final result = await aboutDietCubit.cancelDiet();
|
||||
if (result) {
|
||||
if (!context.mounted) return;
|
||||
Navigator.pop(context);
|
||||
showSuccessToast('предыдущая диета отменена');
|
||||
showModalBottomSheet(
|
||||
@@ -48,16 +49,19 @@ class CancelDietBottomSheet extends StatelessWidget {
|
||||
);
|
||||
} else {
|
||||
showErrorToast('Не удалось отменить диету');
|
||||
if (!context.mounted) return;
|
||||
Navigator.pop(context);
|
||||
}
|
||||
} else {
|
||||
final result = await aboutDietCubit.cancelDiet();
|
||||
if (result) {
|
||||
showSuccessToast('Диета отменена');
|
||||
if (!context.mounted) return;
|
||||
Navigator.pop(context);
|
||||
aboutDietCubit.clearStartedDietsState();
|
||||
} else {
|
||||
showErrorToast('Не удалось отменить диету');
|
||||
if (!context.mounted) return;
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +73,7 @@ class CancelDietBottomSheet extends StatelessWidget {
|
||||
),
|
||||
buttonStyle: ButtonStyle(
|
||||
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
|
||||
side: WidgetStatePropertyAll(BorderSide.none),
|
||||
side: const WidgetStatePropertyAll(BorderSide.none),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -10,10 +10,10 @@ class ExpandableText extends StatefulWidget {
|
||||
final String text;
|
||||
final int maxLines;
|
||||
|
||||
ExpandableText({required this.text, this.maxLines = 3});
|
||||
const ExpandableText({super.key, required this.text, this.maxLines = 3});
|
||||
|
||||
@override
|
||||
_ExpandableTextState createState() => _ExpandableTextState();
|
||||
State<ExpandableText> createState() => _ExpandableTextState();
|
||||
}
|
||||
|
||||
class _ExpandableTextState extends State<ExpandableText> {
|
||||
|
||||
@@ -10,7 +10,7 @@ class InfoBouble extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: padding ?? EdgeInsets.symmetric(horizontal: 12, vertical: 8.5),
|
||||
padding: padding ?? const EdgeInsets.symmetric(horizontal: 12, vertical: 8.5),
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? appTheme.gray50,
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
|
||||
@@ -25,6 +25,7 @@ class MoreOptions extends StatelessWidget {
|
||||
final s = S.of(context);
|
||||
return MainBackgroundBouble(
|
||||
enableShadow: true,
|
||||
width: 272,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||
child: Column(
|
||||
@@ -45,13 +46,13 @@ class MoreOptions extends StatelessWidget {
|
||||
color: appTheme.black,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
SvgPicture.asset('assets/icons/copy2.svg', width: 16, height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12.0),
|
||||
child: CustomDivider(),
|
||||
),
|
||||
GestureDetector(
|
||||
@@ -74,13 +75,13 @@ class MoreOptions extends StatelessWidget {
|
||||
color: appTheme.black,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
SvgPicture.asset('assets/icons/share2.svg', width: 16, height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12.0),
|
||||
child: CustomDivider(),
|
||||
),
|
||||
GestureDetector(
|
||||
@@ -107,7 +108,7 @@ class MoreOptions extends StatelessWidget {
|
||||
color: appTheme.black,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
SvgPicture.asset('assets/icons/complain.svg', width: 16, height: 20),
|
||||
],
|
||||
),
|
||||
@@ -115,7 +116,6 @@ class MoreOptions extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
width: 272,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,16 +25,16 @@ class _StartDietBottomSheetState extends State<StartDietBottomSheet> {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 4),
|
||||
BottomSheetHandlerBar(),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 4),
|
||||
const BottomSheetHandlerBar(),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
s.startDiet,
|
||||
style: TextStyles.headingXLSemibold.copyWith(
|
||||
color: appTheme.black,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
const SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 25.0),
|
||||
child: Text(
|
||||
@@ -45,25 +45,27 @@ class _StartDietBottomSheetState extends State<StartDietBottomSheet> {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
const SizedBox(height: 12),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: CustomDivider(),
|
||||
),
|
||||
CalendarWidget(
|
||||
startDate: startDate,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28),
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28),
|
||||
child: CustomOutlinedButton(
|
||||
onPressed: () async {
|
||||
final result = await widget.aboutDietCubit.startDiet(startDate[0]);
|
||||
if (result) {
|
||||
showSuccessToast('Диета успешно начата');
|
||||
showSuccessToast('Диета успешно начата');
|
||||
if (!context.mounted) return;
|
||||
Navigator.pop(context);
|
||||
widget.aboutDietCubit.emitCurrentStartedDietsState();
|
||||
} else {
|
||||
showErrorToast('Не удалось начать диету');
|
||||
showErrorToast('Не удалось начать диету');
|
||||
if (!context.mounted) return;
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
@@ -74,7 +76,7 @@ class _StartDietBottomSheetState extends State<StartDietBottomSheet> {
|
||||
),
|
||||
buttonStyle: ButtonStyle(
|
||||
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
|
||||
side: WidgetStatePropertyAll(BorderSide.none),
|
||||
side: const WidgetStatePropertyAll(BorderSide.none),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -144,7 +144,7 @@ class _TypeBadgesState extends State<TypeBadges> {
|
||||
onClose: closeOverlay,
|
||||
child: PortalTarget(
|
||||
visible: overlaysVisibilityState[index],
|
||||
anchor: Aligned(
|
||||
anchor: const Aligned(
|
||||
shiftToWithinBound: AxisFlag(x: true, y: true),
|
||||
follower: Alignment.topRight,
|
||||
target: Alignment.bottomRight,
|
||||
@@ -202,13 +202,13 @@ class _InfoOverlayEntry extends StatelessWidget {
|
||||
|
||||
final String title;
|
||||
final String description;
|
||||
final assetPath;
|
||||
final String assetPath;
|
||||
final void Function() onClose;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MainBackgroundBouble(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
width: 343,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -220,7 +220,7 @@ class _InfoOverlayEntry extends StatelessWidget {
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -233,7 +233,7 @@ class _InfoOverlayEntry extends StatelessWidget {
|
||||
color: appTheme.black,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
description,
|
||||
softWrap: true,
|
||||
@@ -261,11 +261,10 @@ class _InfoOverlayEntry extends StatelessWidget {
|
||||
|
||||
class _Barrier extends StatelessWidget {
|
||||
const _Barrier({
|
||||
Key? key,
|
||||
required this.onClose,
|
||||
required this.visible,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final VoidCallback onClose;
|
||||
|
||||
Reference in New Issue
Block a user