|
|
|
|
@ -1,23 +1,24 @@
|
|
|
|
|
import 'package:car_customer_app/view_models/appointments_view_model.dart';
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:mc_common_app/models/service_schedule_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/services/item_model.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
const ReviewAppointment({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
Widget buildBranchInfoCard({
|
|
|
|
|
required String branchImageUrl,
|
|
|
|
|
required String branchName,
|
|
|
|
|
required String branchRatings,
|
|
|
|
|
required String branchLocation,
|
|
|
|
|
}) {
|
|
|
|
|
Widget buildBranchInfoCard({required BuildContext context}) {
|
|
|
|
|
AppointmentsVM appointmentsVM = context.read<AppointmentsVM>();
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
bottom: 10,
|
|
|
|
|
@ -27,7 +28,7 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
branchImageUrl,
|
|
|
|
|
MyAssets.bnCar,
|
|
|
|
|
width: 80,
|
|
|
|
|
height: 60,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
@ -46,12 +47,12 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
branchName.toText(fontSize: 16, isBold: true),
|
|
|
|
|
(appointmentsVM.selectedBranchModel!.branchName ?? "").toText(fontSize: 16, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.location.tr().toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
|
|
|
2.width,
|
|
|
|
|
":$branchLocation".toText(fontSize: 12),
|
|
|
|
|
": ${appointmentsVM.selectedBranchModel!.branchDescription ?? ""}".toText(fontSize: 12),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -60,7 +61,7 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
branchRatings.toText(
|
|
|
|
|
"4.9".toText(
|
|
|
|
|
isUnderLine: true,
|
|
|
|
|
isBold: true,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
@ -78,44 +79,100 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
).onPress(() {}).toWhiteContainer(width: double.infinity, allPading: 12));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildServicesSubSection({required String title, required List<String> itemList}) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
title.toText(fontSize: 16, isBold: true),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: List.generate(
|
|
|
|
|
itemList.length,
|
|
|
|
|
(index) => itemList[index].toText(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
|
isBold: true,
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(bottom: 14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildServicesInfoCard() {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: List.generate(
|
|
|
|
|
2,
|
|
|
|
|
(index) => buildServicesSubSection(
|
|
|
|
|
title: "Mechanic",
|
|
|
|
|
itemList: [
|
|
|
|
|
"Engine Check : 450 SAR",
|
|
|
|
|
"Gear Check : 700 SAR",
|
|
|
|
|
"Gear Check : 700 SAR",
|
|
|
|
|
"Gear Check : 700 SAR",
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12, margin: EdgeInsets.symmetric(horizontal: 21)),
|
|
|
|
|
Widget buildServicesInfoCard({required BuildContext context}) {
|
|
|
|
|
AppointmentsVM appointmentsVM = context.read<AppointmentsVM>();
|
|
|
|
|
return ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: appointmentsVM.serviceAppointmentScheduleList.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int scheduleIndex) {
|
|
|
|
|
ServiceAppointmentScheduleModel scheduleData = appointmentsVM.serviceAppointmentScheduleList[scheduleIndex];
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: "Schedule: ${scheduleIndex + 1}".toText(fontSize: 20, isBold: true),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: appointmentsVM.servicesInSchedule.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int serviceIndex) {
|
|
|
|
|
DropValue selectedService = appointmentsVM.servicesInSchedule[serviceIndex];
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: selectedService.value.toText(fontSize: 15, isBold: true),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (true) ...[
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Service Location: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
("Home").toText(fontSize: 12, isBold: true).expand(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
5.height,
|
|
|
|
|
Column(
|
|
|
|
|
children: List.generate(scheduleData.serviceItemList!.length, (itemIndex) {
|
|
|
|
|
ItemData itemData = scheduleData.serviceItemList![itemIndex];
|
|
|
|
|
return Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"${itemData.name}: ".toText(fontSize: 13, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) => Divider(thickness: 2),
|
|
|
|
|
).paddingOnly(bottom: 10),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).toWhiteContainer(width: double.infinity, allPading: 12, margin: const EdgeInsets.symmetric(horizontal: 21, vertical: 10));
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
// AppointmentsVM appointmentsVM = context.read<AppointmentsVM>();
|
|
|
|
|
// return SizedBox(
|
|
|
|
|
// width: double.infinity,
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: List.generate(
|
|
|
|
|
// appointmentsVM.servicesInSchedule.length,
|
|
|
|
|
// (serviceIndex) => Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// appointmentsVM.servicesInSchedule[serviceIndex].value.toText(fontSize: 16, isBold: true),
|
|
|
|
|
// Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: List.generate(
|
|
|
|
|
// appointmentsVM,
|
|
|
|
|
// (index) => itemList[index].toText(
|
|
|
|
|
// fontSize: 12,
|
|
|
|
|
// color: MyColors.lightTextColor,
|
|
|
|
|
// isBold: true,
|
|
|
|
|
// )),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ).paddingOnly(bottom: 14),
|
|
|
|
|
// ),
|
|
|
|
|
// ).toWhiteContainer(width: double.infinity, allPading: 12, margin: EdgeInsets.symmetric(horizontal: 21)),
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildTimeAndLocationInfoCard() {
|
|
|
|
|
@ -139,19 +196,29 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildChargesBreakDown() {
|
|
|
|
|
Widget buildChargesBreakDown({required BuildContext context}) {
|
|
|
|
|
AppointmentsVM appointmentsVM = context.read<AppointmentsVM>();
|
|
|
|
|
List<ItemData> allSelectedItems = [];
|
|
|
|
|
double totalServicePrice = 0.0;
|
|
|
|
|
appointmentsVM.serviceAppointmentScheduleList.forEach((schedule) {
|
|
|
|
|
schedule.serviceItemList!.forEach((item) {
|
|
|
|
|
allSelectedItems.add(item);
|
|
|
|
|
totalServicePrice = totalServicePrice + double.parse(item.price!);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Services".toText(fontSize: 16, isBold: true),
|
|
|
|
|
Column(
|
|
|
|
|
children: List.generate(
|
|
|
|
|
5,
|
|
|
|
|
allSelectedItems.length,
|
|
|
|
|
(index) => Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Gear Kit".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"200 SAR".toText(fontSize: 12, isBold: true),
|
|
|
|
|
"${allSelectedItems[index].name}".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"${allSelectedItems[index].price} SAR".toText(fontSize: 12, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -159,13 +226,11 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
"1149 SAR".toText(fontSize: 16, isBold: true),
|
|
|
|
|
"${totalServicePrice.toString()} SAR".toText(fontSize: 16, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
Divider(
|
|
|
|
|
thickness: 0.7,
|
|
|
|
|
),
|
|
|
|
|
Divider(thickness: 0.7),
|
|
|
|
|
"Home Location".toText(fontSize: 16, isBold: true),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
@ -245,15 +310,10 @@ class ReviewAppointment extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
buildBranchInfoCard(
|
|
|
|
|
branchImageUrl: MyAssets.bnCar,
|
|
|
|
|
branchLocation: " 3km",
|
|
|
|
|
branchName: "Al Ahmed Maintenance",
|
|
|
|
|
branchRatings: "4.9",
|
|
|
|
|
),
|
|
|
|
|
buildServicesInfoCard(),
|
|
|
|
|
buildBranchInfoCard(context: context),
|
|
|
|
|
buildServicesInfoCard(context: context),
|
|
|
|
|
buildTimeAndLocationInfoCard(),
|
|
|
|
|
buildChargesBreakDown(),
|
|
|
|
|
buildChargesBreakDown(context: context),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|