forked from eatvio/eatvio_app
feat(order info): added order info screen
This commit is contained in:
45
lib/features/order_info/presentation/widgets/plan_info.dart
Normal file
45
lib/features/order_info/presentation/widgets/plan_info.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
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/main_background_bouble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PlanInfo extends StatelessWidget {
|
||||
const PlanInfo({super.key, required this.title, required this.description, required this.imagePath});
|
||||
final String title;
|
||||
final String description;
|
||||
final String imagePath;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MainBackgroundBouble(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
title,
|
||||
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
description,
|
||||
style: TextStyles.textSMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: '$baseUrl/storage/$imagePath',
|
||||
height: 220,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
76
lib/features/order_info/presentation/widgets/plan_props.dart
Normal file
76
lib/features/order_info/presentation/widgets/plan_props.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
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/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:eatvio_app/core/widgets/main_background_bouble.dart';
|
||||
import 'package:eatvio_app/features/order_info/presentation/widgets/plan_status_box.dart';
|
||||
|
||||
class PlanProps extends StatelessWidget {
|
||||
const PlanProps({
|
||||
super.key,
|
||||
required this.planDuration,
|
||||
required this.planPrice,
|
||||
required this.planStatus,
|
||||
});
|
||||
final int planDuration;
|
||||
final double planPrice;
|
||||
final PlanStatusValues planStatus;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return MainBackgroundBouble(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
s.order_status,
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
const Spacer(),
|
||||
PlanStatusBox(status: planStatus)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const CustomDivider(),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
s.order_price,
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'${planPrice.toStringAsFixed(0)}₽',
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const CustomDivider(),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
s.time_to_complete_plan,
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'$planDuration ${getDayForm(planDuration, s)}',
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
83
lib/features/order_info/presentation/widgets/plan_state.dart
Normal file
83
lib/features/order_info/presentation/widgets/plan_state.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
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/main_background_bouble.dart';
|
||||
import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PlanState extends StatelessWidget {
|
||||
PlanState({super.key, required this.state});
|
||||
final ChosenPlanStateEnum state;
|
||||
final List<List<ChosenPlanStateEnum>> states = [
|
||||
[
|
||||
ChosenPlanStateEnum.stateInited,
|
||||
ChosenPlanStateEnum.stateInCoordination,
|
||||
],
|
||||
[
|
||||
ChosenPlanStateEnum.stateStartDateHasBeenSet,
|
||||
ChosenPlanStateEnum.statePendingPayment,
|
||||
],
|
||||
[
|
||||
ChosenPlanStateEnum.statePaid,
|
||||
],
|
||||
[
|
||||
ChosenPlanStateEnum.stateStarted,
|
||||
ChosenPlanStateEnum.stateInProgress,
|
||||
ChosenPlanStateEnum.stateLastDayStarted,
|
||||
ChosenPlanStateEnum.stateLastDayFinished,
|
||||
],
|
||||
[
|
||||
ChosenPlanStateEnum.stateComplained,
|
||||
ChosenPlanStateEnum.stateDone,
|
||||
ChosenPlanStateEnum.stateChargeWasCollected,
|
||||
]
|
||||
];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
final titles = [s.order_created, s.startDateHasBeenSet, s.order_paid, s.in_progress, s.done];
|
||||
return MainBackgroundBouble(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: List.generate(states.length, (index) {
|
||||
final color = index <= states.indexWhere((element) => element.contains(state)) ? appTheme.greenA700 : appTheme.lightGray00;
|
||||
final text = titles[index];
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: color),
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: appTheme.whiteA700,
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: Container(
|
||||
height: 12,
|
||||
width: 1,
|
||||
color: color,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum PlanStatusValues {
|
||||
paid,
|
||||
pendingPayment,
|
||||
paymentFailed,
|
||||
}
|
||||
|
||||
class PlanStatusBox extends StatelessWidget {
|
||||
const PlanStatusBox({super.key, required this.status});
|
||||
final PlanStatusValues status;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
final title = switch (status) {
|
||||
PlanStatusValues.paid => s.order_paid,
|
||||
PlanStatusValues.pendingPayment => s.payment_failed,
|
||||
PlanStatusValues.paymentFailed => s.payment_failed,
|
||||
};
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: switch (status) {
|
||||
PlanStatusValues.paid => appTheme.greenA700,
|
||||
PlanStatusValues.pendingPayment => appTheme.gray,
|
||||
PlanStatusValues.paymentFailed => appTheme.strongRed,
|
||||
}),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyles.textMMedium.copyWith(color: appTheme.whiteA700),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user