Added Damage Pictures in ad_detail_view and extend edit ad
parent
91ea03c834
commit
6f527b7e8f
@ -0,0 +1,95 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mc_common_app/classes/consts.dart';
|
||||||
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||||
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||||
|
import 'package:mc_common_app/theme/colors.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/widgets/extensions/extensions_widget.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class BranchReviewsWidget extends StatelessWidget {
|
||||||
|
final double branchRateAvg;
|
||||||
|
|
||||||
|
const BranchReviewsWidget({super.key, required this.branchRateAvg});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Consumer(builder: (BuildContext context, AppointmentsVM appointmentsVM, Widget? child) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
LocaleKeys.review.tr().toText(fontSize: 18, isBold: true, letterSpacing: 0.1),
|
||||||
|
if (branchRateAvg != 0.0) ...[
|
||||||
|
"$branchRateAvg".toString().toText(fontSize: 18, isBold: true, letterSpacing: 0.1),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
10.height,
|
||||||
|
if (appointmentsVM.state == ViewState.busy) ...[
|
||||||
|
Center(child: CircularProgressIndicator())
|
||||||
|
] else if (appointmentsVM.currentBranchReviews.isEmpty) ...[
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
"This branch has no reviews.".toText(fontSize: 14, color: MyColors.lightTextColor),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
] else ...[
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: List.generate(
|
||||||
|
5,
|
||||||
|
(index) => MyAssets.icStar.buildSvg(
|
||||||
|
color: (index <= branchRateAvg - 1) ? MyColors.lightPrimaryColor : MyColors.lightGreyDDColor,
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
10.height,
|
||||||
|
ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(height: 1),
|
||||||
|
itemCount: !appointmentsVM.isReadMoreEnabled ? 3 : appointmentsVM.currentBranchReviews.length,
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
10.height,
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
("Mohammad Al Shafa - 5.0").toText(fontSize: 14, isBold: true),
|
||||||
|
MyAssets.icStar.buildSvg(color: MyColors.darkPrimaryColor, height: 13).paddingOnly(left: 5, bottom: 2),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
3.height,
|
||||||
|
"Some Reviews about the Provider from Customer".toText(fontSize: 12, color: MyColors.lightTextColor),
|
||||||
|
10.height,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (appointmentsVM.isReadMoreEnabled) ...[
|
||||||
|
("Read Less").toText(fontSize: 13, color: MyColors.darkPrimaryColor, isUnderLine: true).onPress(() {
|
||||||
|
appointmentsVM.updateIsReadMoreEnabled(false);
|
||||||
|
}),
|
||||||
|
] else ...[
|
||||||
|
("Read More Reviews").toText(fontSize: 13, color: MyColors.darkPrimaryColor, isUnderLine: true).onPress(() {
|
||||||
|
appointmentsVM.updateIsReadMoreEnabled(true);
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
).toWhiteContainer(
|
||||||
|
width: double.infinity,
|
||||||
|
allPading: 12,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,113 +0,0 @@
|
|||||||
import 'package:mc_common_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/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/theme/colors.dart';
|
|
||||||
import 'package:mc_common_app/utils/navigator.dart';
|
|
||||||
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
|
||||||
import 'package:mc_common_app/widgets/common_widgets/provider_details_card.dart';
|
|
||||||
import 'package:mc_common_app/widgets/empty_widget.dart';
|
|
||||||
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class ProviderProfilePage extends StatefulWidget {
|
|
||||||
final int providerId;
|
|
||||||
|
|
||||||
ProviderProfilePage({required this.providerId});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ProviderProfilePage> createState() => _ProviderProfilePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ProviderProfilePageState extends State<ProviderProfilePage> {
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
context.read<AppointmentsVM>().getBranchAndServices(widget.providerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: CustomAppBar(
|
|
||||||
title: LocaleKeys.providerDetails.tr(),
|
|
||||||
),
|
|
||||||
body: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: double.infinity,
|
|
||||||
padding: EdgeInsets.all(21),
|
|
||||||
child: Consumer<AppointmentsVM>(
|
|
||||||
builder: (context, model, _) {
|
|
||||||
return model.providerProfileModel == null
|
|
||||||
? const Center(child: CircularProgressIndicator())
|
|
||||||
: model.providerProfileModel == null
|
|
||||||
? const EmptyWidget()
|
|
||||||
: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
//TODO: company logo/banner not added form provider app yet
|
|
||||||
Image.asset(MyAssets.bnCar),
|
|
||||||
12.height,
|
|
||||||
model.providerProfileModel!.companyName.toString().toText(
|
|
||||||
fontSize: 16,
|
|
||||||
isBold: true,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
("Mowater Member Since:").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
||||||
4.width,
|
|
||||||
//TODO: date is missing from API side
|
|
||||||
"2023".toText(fontSize: 12, isBold: true),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
4.height,
|
|
||||||
//TODO: company description not added form provider app yet
|
|
||||||
// model.providerModel!.data!.companyDescription!.toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
||||||
LocaleKeys.someDescriptionExperienceandtheirReputation.tr().toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
||||||
],
|
|
||||||
).toWhiteContainer(
|
|
||||||
width: double.infinity,
|
|
||||||
allPading: 12,
|
|
||||||
),
|
|
||||||
12.height,
|
|
||||||
model.providerProfileModel!.serviceProviderBranch == null
|
|
||||||
? Center(child: Text(LocaleKeys.noBranchFound))
|
|
||||||
: model.providerProfileModel!.serviceProviderBranch!.isEmpty
|
|
||||||
? Center(child: Text(LocaleKeys.no_branch.tr()))
|
|
||||||
: ListView.separated(
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return ProviderDetailsCard(
|
|
||||||
onCardTapped: () {
|
|
||||||
navigateWithName(context, AppRoutes.branchDetailPage, arguments: model.providerProfileModel!.serviceProviderBranch![index]);
|
|
||||||
},
|
|
||||||
providerImageUrl: MyAssets.bnCar,
|
|
||||||
title: model.providerProfileModel!.serviceProviderBranch![index].branchName ?? "",
|
|
||||||
providerLocation: model.providerProfileModel!.serviceProviderBranch![index].distanceKm.toString() + " KM",
|
|
||||||
providerName: model.providerProfileModel!.serviceProviderBranch![index].serviceProviderName ?? "",
|
|
||||||
providerRatings: "4.9",
|
|
||||||
services: model.providerProfileModel!.serviceProviderBranch![index].branchServices,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) {
|
|
||||||
return 12.height;
|
|
||||||
},
|
|
||||||
itemCount: model.providerProfileModel!.serviceProviderBranch!.length,
|
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
import 'package:mc_common_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/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/theme/colors.dart';
|
||||||
|
import 'package:mc_common_app/utils/navigator.dart';
|
||||||
|
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
||||||
|
import 'package:mc_common_app/widgets/common_widgets/provider_details_card.dart';
|
||||||
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class ProviderProfileView extends StatefulWidget {
|
||||||
|
final int providerId;
|
||||||
|
|
||||||
|
ProviderProfileView({required this.providerId});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ProviderProfileView> createState() => _ProviderProfileViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ProviderProfileViewState extends State<ProviderProfileView> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
context.read<AppointmentsVM>().getBranchAndServices(widget.providerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Consumer(
|
||||||
|
builder: (BuildContext context, AppointmentsVM appointmentsVM, Widget? child) {
|
||||||
|
if (appointmentsVM.providerProfileModel == null) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: MyColors.white,
|
||||||
|
body: Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Scaffold(
|
||||||
|
appBar: CustomAppBar(
|
||||||
|
title: LocaleKeys.providerDetails.tr(),
|
||||||
|
actions: [
|
||||||
|
Icon(
|
||||||
|
appointmentsVM.providerProfileModel!.isFavorite! ? Icons.favorite : Icons.favorite_border,
|
||||||
|
color: appointmentsVM.providerProfileModel!.isFavorite! ? MyColors.darkPrimaryColor : MyColors.black,
|
||||||
|
).horPaddingMain().onPress(() {}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: double.infinity,
|
||||||
|
padding: EdgeInsets.all(21),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
//TODO: company logo/banner not added form provider app yet
|
||||||
|
Image.asset(MyAssets.bnCar),
|
||||||
|
12.height,
|
||||||
|
appointmentsVM.providerProfileModel!.companyName.toString().toText(
|
||||||
|
fontSize: 16,
|
||||||
|
isBold: true,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
("Mowater Member Since:").toText(color: MyColors.lightTextColor, fontSize: 12),
|
||||||
|
4.width,
|
||||||
|
//TODO: date is missing from API side
|
||||||
|
"2023".toText(fontSize: 12, isBold: true),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
4.height,
|
||||||
|
appointmentsVM.providerProfileModel!.companyDescription!.toText(color: MyColors.lightTextColor, fontSize: 12),
|
||||||
|
],
|
||||||
|
).toWhiteContainer(width: double.infinity, allPading: 12),
|
||||||
|
12.height,
|
||||||
|
appointmentsVM.providerProfileModel!.serviceProviderBranch == null
|
||||||
|
? Center(child: Text(LocaleKeys.noBranchFound))
|
||||||
|
: appointmentsVM.providerProfileModel!.serviceProviderBranch!.isEmpty
|
||||||
|
? Center(child: Text(LocaleKeys.no_branch.tr()))
|
||||||
|
: ListView.separated(
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ProviderDetailsCard(
|
||||||
|
onCardTapped: () {
|
||||||
|
navigateWithName(context, AppRoutes.branchDetailView, arguments: appointmentsVM.providerProfileModel!.serviceProviderBranch![index]);
|
||||||
|
},
|
||||||
|
providerImageUrl: MyAssets.bnCar,
|
||||||
|
title: appointmentsVM.providerProfileModel!.serviceProviderBranch![index].branchName ?? "",
|
||||||
|
providerLocation: appointmentsVM.providerProfileModel!.serviceProviderBranch![index].distanceKm.toString() + " KM",
|
||||||
|
providerName: appointmentsVM.providerProfileModel!.serviceProviderBranch![index].serviceProviderName ?? "",
|
||||||
|
providerRatings: "4.9",
|
||||||
|
services: appointmentsVM.providerProfileModel!.serviceProviderBranch![index].branchServices,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return 12.height;
|
||||||
|
},
|
||||||
|
itemCount: appointmentsVM.providerProfileModel!.serviceProviderBranch!.length,
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue