feat(plans): plan creating has been completed

This commit is contained in:
Username1548
2025-04-29 14:44:33 +07:00
parent c8b828bfe1
commit 0fcb2c1a0d
43 changed files with 1602 additions and 635 deletions

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart'
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/features/order_info/cubit/order_info_cubit.dart';
import 'package:eatvio_app/features/order_info/cubit/order_info_state.dart';
import 'package:eatvio_app/features/order_info/presentation/widgets/collect_charge_banner.dart';
import 'package:eatvio_app/features/order_info/presentation/widgets/payment_banner.dart';
import 'package:eatvio_app/features/order_info/presentation/widgets/plan_info.dart';
import 'package:eatvio_app/features/order_info/presentation/widgets/plan_props.dart';
@@ -61,7 +62,7 @@ class _InfoByOrderScreenContentState extends State<InfoByOrderScreenContent> {
builder: (context, state) {
final plan = state.chosenPlan;
if (state.isLoading) {
Scaffold(
return Scaffold(
appBar: AppBar(
title: Text(
s.infoAboutOrder,
@@ -113,7 +114,7 @@ class _InfoByOrderScreenContentState extends State<InfoByOrderScreenContent> {
planStatus = PlanStatusValues.paid;
} else if (widget.successfulPayment == false) {
planStatus = PlanStatusValues.paymentFailed;
} else if (plan.chosenPlanState == ChosenPlanStateEnum.statePaid) {
} else if (plan.chosenPlanState.isStateAfterPaidState()) {
planStatus = PlanStatusValues.paid;
} else {
planStatus = PlanStatusValues.pendingPayment;
@@ -134,6 +135,12 @@ class _InfoByOrderScreenContentState extends State<InfoByOrderScreenContent> {
body: SingleChildScrollView(
child: Column(
children: [
if (plan.chosenPlanState == ChosenPlanStateEnum.stateDone) ...[
CollectChargeBanner(
chosenPlan: plan,
price: chosenOption?.price ?? 0,
)
],
if (widget.successfulPayment != null) ...[
const SizedBox(height: 8),
PaymentBanner(
@@ -148,7 +155,10 @@ class _InfoByOrderScreenContentState extends State<InfoByOrderScreenContent> {
backgroundColor: appTheme.whiteA700,
),
const SizedBox(height: 8),
PlanProps(planDuration: plan.plan.duration, planPrice: chosenOption?.price.toDouble() ?? 0, planStatus: planStatus),
PlanProps(
planDuration: plan.plan.duration,
planPrice: chosenOption?.price ?? 0,
planStatus: planStatus),
const SizedBox(height: 8),
PlanInfo(
title: plan.plan.name,

View File

@@ -0,0 +1,72 @@
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
import 'package:eatvio_app/features/my_finance/presentation/pages/card_settings.dart';
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class CollectChargeBanner extends StatelessWidget {
const CollectChargeBanner({super.key, required this.chosenPlan, required this.price});
final ChosenPlanModel chosenPlan;
final double price;
@override
Widget build(BuildContext context) {
final s = S.of(context);
return MainBackgroundBouble(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Stack(
children: [
Positioned(
left: 0,
top: 0,
bottom: 0,
child: Container(
width: 4,
decoration: BoxDecoration(
color: appTheme.blueA400, borderRadius: const BorderRadius.only(topRight: Radius.circular(20), bottomRight: Radius.circular(20))),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(right: 80),
child: Text(
'${s.congratsYouHaveFinishedPlan} «${chosenPlan.plan.name}»',
style: TextStyles.textMSemibold.copyWith(
color: appTheme.black,
),
),
),
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.only(right: 80),
child: Text(
'${s.userConfirmedPlanCompletion} $price₽',
style: TextStyles.textSMedium.copyWith(
color: appTheme.black,
),
),
),
const SizedBox(height: 12),
CustomOutlinedButton(
text: s.collectCharge,
height: 52,
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.green)),
onPressed: () async {
GoRouter.of(context).push(CardSettingsScreen.path, extra: chosenPlan.id);
},
)
],
),
)
],
),
);
}
}

View File

@@ -14,6 +14,7 @@ class PaymentBanner extends StatefulWidget {
const PaymentBanner({
super.key,
required this.successfulPayment,
});
final bool successfulPayment;