|
|
|
|
@ -13,14 +13,23 @@ import 'package:mc_common_app/views/advertisement/custom_add_button.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
//TODO: Need to make onTapped dynamic
|
|
|
|
|
class CustomerAppointmentSliderWidget extends StatelessWidget {
|
|
|
|
|
final List<AppointmentListModel> myUpComingAppointments;
|
|
|
|
|
bool isNeedToShowEmptyMessage;
|
|
|
|
|
Function()? onAppointmentClick;
|
|
|
|
|
|
|
|
|
|
const CustomerAppointmentSliderWidget({Key? key, required this.myUpComingAppointments}) : super(key: key);
|
|
|
|
|
CustomerAppointmentSliderWidget({Key? key,
|
|
|
|
|
required this.myUpComingAppointments,
|
|
|
|
|
this.isNeedToShowEmptyMessage = false,
|
|
|
|
|
this.onAppointmentClick})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
if (myUpComingAppointments.isEmpty) {
|
|
|
|
|
if (isNeedToShowEmptyMessage)
|
|
|
|
|
return "No Upcoming Appointment Available".toText().paddingAll(21);
|
|
|
|
|
return CustomAddButton(
|
|
|
|
|
needsBorder: true,
|
|
|
|
|
bgColor: MyColors.white,
|
|
|
|
|
@ -29,7 +38,8 @@ class CustomerAppointmentSliderWidget extends StatelessWidget {
|
|
|
|
|
icon: Container(
|
|
|
|
|
height: 24,
|
|
|
|
|
width: 24,
|
|
|
|
|
decoration: const BoxDecoration(shape: BoxShape.circle, color: MyColors.darkTextColor),
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle, color: MyColors.darkTextColor),
|
|
|
|
|
child: const Icon(Icons.add, color: MyColors.white),
|
|
|
|
|
),
|
|
|
|
|
).padding(EdgeInsets.symmetric(vertical: 10, horizontal: 21));
|
|
|
|
|
@ -41,7 +51,8 @@ class CustomerAppointmentSliderWidget extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
height: 24,
|
|
|
|
|
width: 24,
|
|
|
|
|
decoration: BoxDecoration(shape: BoxShape.circle, color: MyColors.darkTextColor),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle, color: MyColors.darkTextColor),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.add,
|
|
|
|
|
color: MyColors.white,
|
|
|
|
|
@ -55,7 +66,9 @@ class CustomerAppointmentSliderWidget extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).onPress(() {}).toWhiteContainer(width: double.infinity, margin: EdgeInsets.symmetric(horizontal: 21, vertical: 10));
|
|
|
|
|
).onPress(() {}).toWhiteContainer(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 21, vertical: 10));
|
|
|
|
|
}
|
|
|
|
|
return CarouselSlider.builder(
|
|
|
|
|
options: CarouselOptions(
|
|
|
|
|
@ -65,10 +78,15 @@ class CustomerAppointmentSliderWidget extends StatelessWidget {
|
|
|
|
|
enableInfiniteScroll: false,
|
|
|
|
|
),
|
|
|
|
|
itemCount: myUpComingAppointments.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) => BuildAppointmentContainerForCustomer(
|
|
|
|
|
itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) =>
|
|
|
|
|
BuildAppointmentContainerForCustomer(
|
|
|
|
|
isForHome: true,
|
|
|
|
|
appointmentListModel: myUpComingAppointments[itemIndex],
|
|
|
|
|
onTapped: () => navigateWithName(context, AppRoutes.appointmentDetailView, arguments: myUpComingAppointments[itemIndex]),
|
|
|
|
|
onTapped: isNeedToShowEmptyMessage
|
|
|
|
|
? onAppointmentClick!
|
|
|
|
|
: () =>
|
|
|
|
|
navigateWithName(context, AppRoutes.appointmentDetailView,
|
|
|
|
|
arguments: myUpComingAppointments[itemIndex]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -79,7 +97,11 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
|
|
|
|
|
final AppointmentListModel? appointmentListModel;
|
|
|
|
|
final Function() onTapped;
|
|
|
|
|
|
|
|
|
|
const BuildAppointmentContainerForCustomer({Key? key, this.isForHome = false, required this.onTapped, required this.appointmentListModel}) : super(key: key);
|
|
|
|
|
const BuildAppointmentContainerForCustomer({Key? key,
|
|
|
|
|
this.isForHome = false,
|
|
|
|
|
required this.onTapped,
|
|
|
|
|
required this.appointmentListModel})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
Widget showServices(String title, String icon, {bool isMoreText = false}) {
|
|
|
|
|
return Row(
|
|
|
|
|
@ -99,15 +121,18 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Widget> buildServicesFromAppointment({required AppointmentListModel appointmentListModel}) {
|
|
|
|
|
if (appointmentListModel.appointmentServicesList == null || appointmentListModel.appointmentServicesList!.isEmpty) {
|
|
|
|
|
List<Widget> buildServicesFromAppointment(
|
|
|
|
|
{required AppointmentListModel appointmentListModel}) {
|
|
|
|
|
if (appointmentListModel.appointmentServicesList == null ||
|
|
|
|
|
appointmentListModel.appointmentServicesList!.isEmpty) {
|
|
|
|
|
return [SizedBox()];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (appointmentListModel.appointmentServicesList!.length == 1) {
|
|
|
|
|
return [
|
|
|
|
|
showServices(
|
|
|
|
|
appointmentListModel.appointmentServicesList![0].providerServiceDescription,
|
|
|
|
|
appointmentListModel
|
|
|
|
|
.appointmentServicesList![0].providerServiceDescription,
|
|
|
|
|
MyAssets.modificationsIcon,
|
|
|
|
|
)
|
|
|
|
|
];
|
|
|
|
|
@ -115,7 +140,11 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
List<Widget> servicesList = List.generate(
|
|
|
|
|
2,
|
|
|
|
|
(index) => showServices(appointmentListModel.appointmentServicesList![index].providerServiceDescription, MyAssets.modificationsIcon),
|
|
|
|
|
(index) =>
|
|
|
|
|
showServices(
|
|
|
|
|
appointmentListModel
|
|
|
|
|
.appointmentServicesList![index].providerServiceDescription,
|
|
|
|
|
MyAssets.modificationsIcon),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (appointmentListModel.appointmentServicesList!.length > 1) {
|
|
|
|
|
@ -158,12 +187,16 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
(appointmentListModel!.providerName ?? "").toText(color: MyColors.black, isBold: true, fontSize: 16),
|
|
|
|
|
(appointmentListModel!.providerName ?? "").toText(
|
|
|
|
|
color: MyColors.black, isBold: true, fontSize: 16),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
MyAssets.miniClock.buildSvg(height: 12),
|
|
|
|
|
2.width,
|
|
|
|
|
"${appointmentListModel!.duration ?? ""} ${appointmentListModel!.appointmentDate!.toFormattedDateWithoutTime()}".toText(
|
|
|
|
|
"${appointmentListModel!.duration ??
|
|
|
|
|
""} ${appointmentListModel!.appointmentDate!
|
|
|
|
|
.toFormattedDateWithoutTime()}"
|
|
|
|
|
.toText(
|
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
@ -189,7 +222,9 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: buildServicesFromAppointment(appointmentListModel: appointmentListModel!),
|
|
|
|
|
children: buildServicesFromAppointment(
|
|
|
|
|
appointmentListModel:
|
|
|
|
|
appointmentListModel!),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Icon(
|
|
|
|
|
@ -203,7 +238,9 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).onPress(onTapped).toWhiteContainer(width: double.infinity, allPading: 12),
|
|
|
|
|
)
|
|
|
|
|
.onPress(onTapped)
|
|
|
|
|
.toWhiteContainer(width: double.infinity, allPading: 12),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|