aamir_dev
Faiz Hashmi 2 months ago
parent fcc4f0ada0
commit 7f9d9dba71

@ -3,6 +3,7 @@ import 'dart:developer';
import 'package:car_customer_app/views/branches/components/branch_reviews_widget.dart'; import 'package:car_customer_app/views/branches/components/branch_reviews_widget.dart';
import 'package:car_customer_app/views/branches/components/items_list_sheet.dart'; import 'package:car_customer_app/views/branches/components/items_list_sheet.dart';
import 'package:mc_common_app/main.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart'; import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart'; import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart'; import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
@ -36,15 +37,13 @@ class _ProviderProfileViewState extends State<ProviderProfileView> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer( return Consumer(
builder: (BuildContext context, AppointmentsVM appointmentsVM, Widget? child) { builder: (BuildContext context, AppointmentsVM appointmentsVM, Widget? child) {
if (appointmentsVM.state == ViewState.busy) { if (appointmentsVM.state == ViewState.busy || appointmentsVM.providerProfileModel == null) {
return Scaffold( return Scaffold(
backgroundColor: MyColors.white, backgroundColor: MyColors.white,
appBar: CustomAppBar( appBar: CustomAppBar(
title: LocaleKeys.providerDetails.tr(), title: LocaleKeys.providerDetails.tr(),
), ),
body: Center( body: Center(child: CircularProgressIndicator()),
child: CircularProgressIndicator(),
),
); );
} }
return Scaffold( return Scaffold(
@ -87,16 +86,19 @@ class _ProviderProfileViewState extends State<ProviderProfileView> {
Image.asset(MyAssets.bnCar), Image.asset(MyAssets.bnCar),
12.height, 12.height,
(appointmentsVM.providerProfileModel!.name ?? appointmentsVM.providerProfileModel!.companyName).toString().toText( (appointmentsVM.providerProfileModel!.name ?? appointmentsVM.providerProfileModel!.companyName).toString().toText(
fontSize: 16, fontSize: 16,
isBold: true, isBold: true,
), ),
if (appointmentsVM.providerProfileModel!.memberSince!.isNotEmpty ) ...[ if (appointmentsVM.providerProfileModel!.memberSince!.isNotEmpty) ...[
Row( Row(
children: [ children: [
("Member Since:").toText(color: MyColors.lightTextColor, fontSize: 12), ("Member Since:").toText(color: MyColors.lightTextColor, fontSize: 12),
4.width, 4.width,
"${appointmentsVM.providerProfileModel!.memberSince ?? ""}".toText(fontSize: 12, isBold: true), "${DateHelper.formatAsMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(appointmentsVM.providerProfileModel!.memberSince ?? "")))}".toText(
fontSize: 12,
isBold: true,
),
], ],
), ),
], ],
@ -107,35 +109,35 @@ class _ProviderProfileViewState extends State<ProviderProfileView> {
12.height, 12.height,
appointmentsVM.providerProfileModel!.serviceProviderBranch == null appointmentsVM.providerProfileModel!.serviceProviderBranch == null
? Center( ? Center(
child: (LocaleKeys.noBranchFound.tr()).toText( child: (LocaleKeys.noBranchFound.tr()).toText(
fontSize: 16, fontSize: 16,
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
), ),
) )
: appointmentsVM.providerProfileModel!.serviceProviderBranch!.isEmpty : appointmentsVM.providerProfileModel!.serviceProviderBranch!.isEmpty
? Center(child: Text(LocaleKeys.no_branch.tr())) ? Center(child: Text(LocaleKeys.no_branch.tr()))
: ListView.separated( : ListView.separated(
itemBuilder: (context, index) { itemBuilder: (context, index) {
BranchDetailModel branchModel = appointmentsVM.providerProfileModel!.serviceProviderBranch![index]; BranchDetailModel branchModel = appointmentsVM.providerProfileModel!.serviceProviderBranch![index];
return BranchDetailCard( return BranchDetailCard(
onCardTapped: () { onCardTapped: () {
navigateWithName(context, AppRoutes.branchDetailView, arguments: branchModel); navigateWithName(context, AppRoutes.branchDetailView, arguments: branchModel);
}, },
providerImageUrl: MyAssets.bnCar, providerImageUrl: MyAssets.bnCar,
title: branchModel.branchName ?? "", title: branchModel.branchName ?? "",
providerLocation: branchModel.distanceKm.toString() + " KM", providerLocation: branchModel.distanceKm.toString() + " KM",
providerName: branchModel.serviceProviderName ?? "", providerName: branchModel.serviceProviderName ?? "",
providerRatings: (branchModel.branchRateAvg ?? 0.0), providerRatings: (branchModel.branchRateAvg ?? 0.0),
services: branchModel.branchServices, services: branchModel.branchServices,
); );
}, },
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return 12.height; return 12.height;
}, },
itemCount: appointmentsVM.providerProfileModel!.serviceProviderBranch!.length, itemCount: appointmentsVM.providerProfileModel!.serviceProviderBranch!.length,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
) )
], ],
), ),
), ),

@ -31,6 +31,7 @@ class MyRecentBranchesWidget extends StatelessWidget {
.buildNetworkImage( .buildNetworkImage(
height: 80, height: 80,
width: 80, width: 80,
fit: BoxFit.cover,
) )
.toCircle(borderRadius: 100), .toCircle(borderRadius: 100),
8.height, 8.height,

Loading…
Cancel
Save