Merge branch 'faiz_development' into aamir_dev

aamir_dev
Aamir 11 months ago
commit 957407a7ab

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:car_customer_app/config/customer_dependencies.dart'; import 'package:car_customer_app/config/customer_dependencies.dart';
import 'package:car_customer_app/config/customer_routes.dart'; import 'package:car_customer_app/config/customer_routes.dart';
import 'package:flutter/services.dart';
import 'package:mc_common_app/repositories/branch_repo.dart'; import 'package:mc_common_app/repositories/branch_repo.dart';
import 'package:mc_common_app/repositories/chat_repo.dart'; import 'package:mc_common_app/repositories/chat_repo.dart';
import 'package:mc_common_app/repositories/appointment_repo.dart'; import 'package:mc_common_app/repositories/appointment_repo.dart';
@ -62,67 +63,69 @@ Future<void> main() async {
injector.get<Location>().handleLocationPermission(); injector.get<Location>().handleLocationPermission();
}); });
CustomerAppRoutes.routes.addAll(AppRoutes.routes); CustomerAppRoutes.routes.addAll(AppRoutes.routes);
initializeDateFormatting().then((_) => runApp( initializeDateFormatting().then(
MultiProvider( (_) => runApp(
providers: <SingleChildWidget>[ MultiProvider(
ChangeNotifierProvider<BaseVM>( providers: <SingleChildWidget>[
create: (_) => BaseVM(), ChangeNotifierProvider<BaseVM>(
), create: (_) => BaseVM(),
ChangeNotifierProvider<DashboardVmCustomer>( ),
create: (_) => DashboardVmCustomer( ChangeNotifierProvider<DashboardVmCustomer>(
commonServices: injector.get<CommonAppServices>(), create: (_) => DashboardVmCustomer(
userRepo: injector.get<UserRepo>(), commonServices: injector.get<CommonAppServices>(),
), userRepo: injector.get<UserRepo>(),
), ),
ChangeNotifierProvider<UserVM>( ),
create: (_) => UserVM( ChangeNotifierProvider<UserVM>(
userRepo: injector.get<UserRepo>(), create: (_) => UserVM(
commanServices: injector.get<CommonAppServices>(), userRepo: injector.get<UserRepo>(),
), commanServices: injector.get<CommonAppServices>(),
), ),
ChangeNotifierProvider<AdVM>( ),
create: (_) => AdVM( ChangeNotifierProvider<AdVM>(
commonServices: injector.get<CommonAppServices>(), create: (_) => AdVM(
commonRepo: injector.get<CommonRepo>(), commonServices: injector.get<CommonAppServices>(),
adsRepo: injector.get<AdsRepo>(), commonRepo: injector.get<CommonRepo>(),
), adsRepo: injector.get<AdsRepo>(),
), ),
ChangeNotifierProvider<AppointmentsVM>( ),
create: (_) => AppointmentsVM( ChangeNotifierProvider<AppointmentsVM>(
appointmentRepo: injector.get<AppointmentRepo>(), create: (_) => AppointmentsVM(
commonServices: injector.get<CommonAppServices>(), appointmentRepo: injector.get<AppointmentRepo>(),
commonRepo: injector.get<CommonRepo>(), commonServices: injector.get<CommonAppServices>(),
branchRepo: injector.get<BranchRepo>(), commonRepo: injector.get<CommonRepo>(),
), branchRepo: injector.get<BranchRepo>(),
), ),
ChangeNotifierProvider<PaymentVM>( ),
create: (_) => PaymentVM( ChangeNotifierProvider<PaymentVM>(
paymentService: injector.get<PaymentService>(), create: (_) => PaymentVM(
paymentRepo: injector.get<PaymentsRepo>(), paymentService: injector.get<PaymentService>(),
), paymentRepo: injector.get<PaymentsRepo>(),
), ),
ChangeNotifierProvider<ChatVM>( ),
create: (_) => ChatVM( ChangeNotifierProvider<ChatVM>(
chatRepo: injector.get<ChatRepo>(), create: (_) => ChatVM(
requestRepo: injector.get<RequestRepo>(), chatRepo: injector.get<ChatRepo>(),
commonServices: injector.get<CommonAppServices>(), requestRepo: injector.get<RequestRepo>(),
)), commonServices: injector.get<CommonAppServices>(),
ChangeNotifierProvider<RequestsVM>( )),
create: (_) => RequestsVM( ChangeNotifierProvider<RequestsVM>(
requestRepo: injector.get<RequestRepo>(), create: (_) => RequestsVM(
commonServices: injector.get<CommonAppServices>(), requestRepo: injector.get<RequestRepo>(),
commonRepo: injector.get<CommonRepo>(), commonServices: injector.get<CommonAppServices>(),
), commonRepo: injector.get<CommonRepo>(),
), ),
ChangeNotifierProvider<SettingOptionsVM>( ),
create: (_) => SettingOptionsVM( ChangeNotifierProvider<SettingOptionsVM>(
settingOptionsRepo: injector.get<SettingOptionsRepo>(), create: (_) => SettingOptionsVM(
), settingOptionsRepo: injector.get<SettingOptionsRepo>(),
), ),
], ),
child: MyApp(), ],
).setupLocale(), child: MyApp(),
)); ).setupLocale(),
),
);
} }
// todo terminal command to generate translation files // todo terminal command to generate translation files
@ -136,6 +139,10 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
return Sizer( return Sizer(
builder: (context, orientation, deviceType) { builder: (context, orientation, deviceType) {
injector.get<AppState>().setAppType(AppType.customer); injector.get<AppState>().setAppType(AppType.customer);
@ -160,3 +167,12 @@ class MyApp extends StatelessWidget {
); );
} }
} }
//Latitude: 24.708741, Longitude: 46.6657643,
//Longitude=24.708741&Latitude=46.6657643
//update I/flutter ( 5035): "latitude": "37.421998",
// I/flutter ( 5035): "longitude": "-122.0839",

@ -46,6 +46,15 @@ class _ProviderProfileViewState extends State<ProviderProfileView> {
body: Center(child: CircularProgressIndicator()), body: Center(child: CircularProgressIndicator()),
); );
} }
String providerBannerImageUrl = "";
if (appointmentsVM.providerProfileModel!.serviceProviderBranch!.isNotEmpty) {
if (appointmentsVM.providerProfileModel!.serviceProviderBranch!.first.branchImages!.isNotEmpty) {
providerBannerImageUrl = appointmentsVM.providerProfileModel!.serviceProviderBranch!.first.branchImages!.first.imageUrl ?? "";
}
}
return Scaffold( return Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
title: LocaleKeys.providerDetails.tr(), title: LocaleKeys.providerDetails.tr(),
@ -59,6 +68,7 @@ class _ProviderProfileViewState extends State<ProviderProfileView> {
bool status = await appointmentsVM.removeProviderFromFavorite(serviceProviderID: appointmentsVM.providerProfileModel!.id!, context: context); bool status = await appointmentsVM.removeProviderFromFavorite(serviceProviderID: appointmentsVM.providerProfileModel!.id!, context: context);
if (status) { if (status) {
appointmentsVM.providerProfileModel!.isFavorite = false; appointmentsVM.providerProfileModel!.isFavorite = false;
appointmentsVM.getMyFavoriteProviders();
setState(() {}); setState(() {});
} }
} else { } else {
@ -76,29 +86,39 @@ class _ProviderProfileViewState extends State<ProviderProfileView> {
body: Container( body: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
padding: EdgeInsets.all(21), padding: EdgeInsets.symmetric(horizontal: 21),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
//TODO: company logo/banner not added form provider app yet Center(child: providerBannerImageUrl.buildNetworkImage(height: 250, width: double.infinity, fit: BoxFit.cover)),
Image.asset(MyAssets.bnCar),
12.height, 12.height,
(appointmentsVM.providerProfileModel!.name ?? appointmentsVM.providerProfileModel!.companyName).toString().toText( if (appointmentsVM.providerProfileModel!.memberSince!.isNotEmpty) ...[
fontSize: 16, Row(
isBold: true, children: [
), ("${LocaleKeys.companyName.tr()}:").toText(color: MyColors.lightTextColor, fontSize: 12),
4.width,
(appointmentsVM.providerProfileModel!.companyName ?? appointmentsVM.providerProfileModel!.name).toString().toText(
fontSize: 16,
isBold: true,
),
],
),
],
if (appointmentsVM.providerProfileModel!.memberSince!.isNotEmpty) ...[ if (appointmentsVM.providerProfileModel!.memberSince!.isNotEmpty) ...[
Row( Row(
children: [ children: [
("${LocaleKeys.memberSince.tr()}:").toText(color: MyColors.lightTextColor, fontSize: 12), ("${LocaleKeys.memberSince.tr()}:").toText(color: MyColors.lightTextColor, fontSize: 12),
4.width, 4.width,
"${DateHelper.formatAsMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT( "${DateHelper.formatAsMonthYear(
appointmentsVM.providerProfileModel!.memberSince ?? "", DateHelper.parseStringToDate(
)))}" DateHelper.formatDateT(
appointmentsVM.providerProfileModel!.memberSince ?? "",
),
),
)}"
.toText(fontSize: 12, isBold: true), .toText(fontSize: 12, isBold: true),
], ],
), ),
@ -124,7 +144,7 @@ class _ProviderProfileViewState extends State<ProviderProfileView> {
onCardTapped: () { onCardTapped: () {
navigateWithName(context, AppRoutes.branchDetailView, arguments: branchModel); navigateWithName(context, AppRoutes.branchDetailView, arguments: branchModel);
}, },
providerImageUrl: MyAssets.bnCar, providerImageUrl: (branchModel.branchImages != null && branchModel.branchImages!.isNotEmpty) ? (branchModel.branchImages!.first.imageUrl ?? "") : "",
title: branchModel.branchName ?? "", title: branchModel.branchName ?? "",
providerLocation: branchModel.distanceKm.toString() + " KM", providerLocation: branchModel.distanceKm.toString() + " KM",
providerName: branchModel.serviceProviderName ?? "", providerName: branchModel.serviceProviderName ?? "",

Loading…
Cancel
Save