|
|
|
|
@ -1,18 +1,21 @@
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mc_common_app/config/routes.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/general_models/widgets_models.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/navigator.dart';
|
|
|
|
|
import 'package:mc_common_app/view_models/appointments_view_model.dart';
|
|
|
|
|
import 'package:mc_common_app/views/location_views/pick_location_page.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/txt_field.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
const AppointmentServicePickBottomSheet({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@ -33,7 +36,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Select Category".toText(fontSize: 24, isBold: true),
|
|
|
|
|
LocaleKeys.selectCategory.tr().toText(fontSize: 24, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
30.height,
|
|
|
|
|
@ -45,10 +48,8 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
return DropdownField(
|
|
|
|
|
(DropValue value) => appointmentsVM.updateProviderCategoryId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)),
|
|
|
|
|
list: appointmentsVM.branchCategories,
|
|
|
|
|
hint: "Select Category",
|
|
|
|
|
dropdownValue: appointmentsVM.branchSelectedCategoryId.selectedId != -1
|
|
|
|
|
? DropValue(appointmentsVM.branchSelectedCategoryId.selectedId, appointmentsVM.branchSelectedCategoryId.selectedOption, "")
|
|
|
|
|
: null,
|
|
|
|
|
hint: LocaleKeys.selectCategory.tr(),
|
|
|
|
|
dropdownValue: appointmentsVM.branchSelectedCategoryId.selectedId != -1 ? DropValue(appointmentsVM.branchSelectedCategoryId.selectedId, appointmentsVM.branchSelectedCategoryId.selectedOption, "") : null,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -75,10 +76,8 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
return DropdownField(
|
|
|
|
|
(DropValue value) => appointmentsVM.updateBranchServiceId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)),
|
|
|
|
|
list: serviceCategories,
|
|
|
|
|
hint: "Select Service",
|
|
|
|
|
dropdownValue: appointmentsVM.branchSelectedServiceId.selectedId != -1
|
|
|
|
|
? DropValue(appointmentsVM.branchSelectedServiceId.selectedId, appointmentsVM.branchSelectedServiceId.selectedOption, "")
|
|
|
|
|
: null,
|
|
|
|
|
hint: LocaleKeys.selectService.tr(),
|
|
|
|
|
dropdownValue: appointmentsVM.branchSelectedServiceId.selectedId != -1 ? DropValue(appointmentsVM.branchSelectedServiceId.selectedId, appointmentsVM.branchSelectedServiceId.selectedOption, "") : null,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -101,7 +100,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
isFilled: appointmentsVM.isHomeTapped,
|
|
|
|
|
maxHeight: 48,
|
|
|
|
|
title: "Home",
|
|
|
|
|
title: LocaleKeys.home.tr(),
|
|
|
|
|
txtColor: appointmentsVM.isHomeTapped ? MyColors.white : MyColors.darkTextColor,
|
|
|
|
|
onPressed: () => appointmentsVM.updateIsHomeTapped(true),
|
|
|
|
|
),
|
|
|
|
|
@ -112,7 +111,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
isFilled: !appointmentsVM.isHomeTapped,
|
|
|
|
|
txtColor: !appointmentsVM.isHomeTapped ? MyColors.white : MyColors.darkTextColor,
|
|
|
|
|
maxHeight: 48,
|
|
|
|
|
title: "Workshop",
|
|
|
|
|
title: LocaleKeys.workshop.tr(),
|
|
|
|
|
onPressed: () => appointmentsVM.updateIsHomeTapped(false),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -121,32 +120,31 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
if (appointmentsVM.isHomeTapped) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: 'Pick Home Location',
|
|
|
|
|
hint: LocaleKeys.pickLocation.tr(),
|
|
|
|
|
errorValue: appointmentsVM.pickHomeLocationError,
|
|
|
|
|
value: appointmentsVM.pickedHomeLocation,
|
|
|
|
|
isNeedClickAll: true,
|
|
|
|
|
postfixData: Icons.location_on,
|
|
|
|
|
postFixDataColor: MyColors.darkTextColor,
|
|
|
|
|
onTap: () {
|
|
|
|
|
//TODO: open the place picked to pick the location and save it in provider.
|
|
|
|
|
appointmentsVM.updatePickedHomeLocation("PM58+F97, Al Olaya, Riyadh 12333");
|
|
|
|
|
navigateTo(
|
|
|
|
|
context,
|
|
|
|
|
PickLocationPage(
|
|
|
|
|
onPickAddress: (double latitude, double longitude, String address) {
|
|
|
|
|
appointmentsVM.updatePickedHomeLocation(address);
|
|
|
|
|
appointmentsVM.setState(ViewState.idle);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
14.height,
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(
|
|
|
|
|
Icons.warning,
|
|
|
|
|
color: MyColors.adPendingStatusColor,
|
|
|
|
|
size: 19,
|
|
|
|
|
).paddingOnly(bottom: 2),
|
|
|
|
|
const Icon(Icons.warning, color: MyColors.adPendingStatusColor, size: 19).paddingOnly(bottom: 2),
|
|
|
|
|
3.width,
|
|
|
|
|
"Some services are not available on home location.".toText(
|
|
|
|
|
color: MyColors.adPendingStatusColor,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
isItalic: true,
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.servicesNotAvailableHomeLocation.tr().toText(color: MyColors.adPendingStatusColor, fontSize: 12, isItalic: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
@ -165,10 +163,10 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
// TODO: This Price will be decided according to the service selected, We will calculate the KMs and multiple it with price per KMs
|
|
|
|
|
150.toString().toText(fontSize: 30, isBold: true),
|
|
|
|
|
"SAR".toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5),
|
|
|
|
|
LocaleKeys.sar.tr().toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
"These charges are additional to the actual service charges. For heavy items the charges may vary.".toText(fontSize: 12, color: MyColors.lightTextColor),
|
|
|
|
|
LocaleKeys.additionalChargesNotice.tr().toText(fontSize: 12, color: MyColors.lightTextColor),
|
|
|
|
|
22.height,
|
|
|
|
|
],
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -176,7 +174,7 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
maxHeight: 55,
|
|
|
|
|
backgroundColor: !appointmentsVM.isServiceSelectionValidated() ? MyColors.lightTextColor.withOpacity(0.6) : MyColors.darkPrimaryColor,
|
|
|
|
|
title: "Next",
|
|
|
|
|
title: LocaleKeys.next.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
bool isValidated = appointmentsVM.isServiceSelectionValidated();
|
|
|
|
|
if (isValidated) {
|
|
|
|
|
|