|
|
|
@ -1,6 +1,8 @@
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:developer';
|
|
|
|
import 'dart:developer';
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:mc_common_app/classes/app_state.dart';
|
|
|
|
import 'package:mc_common_app/classes/app_state.dart';
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
@ -32,7 +34,6 @@ import 'package:mc_common_app/utils/utils.dart';
|
|
|
|
import 'package:mc_common_app/view_models/base_view_model.dart';
|
|
|
|
import 'package:mc_common_app/view_models/base_view_model.dart';
|
|
|
|
import 'package:mc_common_app/view_models/chat_view_model.dart';
|
|
|
|
import 'package:mc_common_app/view_models/chat_view_model.dart';
|
|
|
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class AdVM extends BaseVM {
|
|
|
|
class AdVM extends BaseVM {
|
|
|
|
@ -114,10 +115,7 @@ class AdVM extends BaseVM {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void removeSpecialServiceCard(int index) {
|
|
|
|
void removeSpecialServiceCard(int index) {
|
|
|
|
String option = specialServiceCards
|
|
|
|
String option = specialServiceCards.elementAt(index).serviceSelectedId!.selectedOption;
|
|
|
|
.elementAt(index)
|
|
|
|
|
|
|
|
.serviceSelectedId!
|
|
|
|
|
|
|
|
.selectedOption;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var value in vehicleAdsSpecialServices) {
|
|
|
|
for (var value in vehicleAdsSpecialServices) {
|
|
|
|
if (value.name == option) {
|
|
|
|
if (value.name == option) {
|
|
|
|
@ -221,6 +219,14 @@ class AdVM extends BaseVM {
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int currentPage = 1;
|
|
|
|
|
|
|
|
bool isLoadingMore = false;
|
|
|
|
|
|
|
|
bool hasMoreData = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetchMoreAds() async {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<List<AdDetailsModel>> getAdsByFilter({AdPostStatus? adPostStatus, required bool isMyAds, CreatedByRoleEnum? createdByRoleEnum}) async {
|
|
|
|
Future<List<AdDetailsModel>> getAdsByFilter({AdPostStatus? adPostStatus, required bool isMyAds, CreatedByRoleEnum? createdByRoleEnum}) async {
|
|
|
|
return await adsRepo.getAllAds(isMyAds: isMyAds, adPostStatus: adPostStatus, createdByRoleEnum: createdByRoleEnum);
|
|
|
|
return await adsRepo.getAllAds(isMyAds: isMyAds, adPostStatus: adPostStatus, createdByRoleEnum: createdByRoleEnum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1258,10 +1264,7 @@ class AdVM extends BaseVM {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void removeDamagePartCard(int index) {
|
|
|
|
void removeDamagePartCard(int index) {
|
|
|
|
String option = vehicleDamageCards
|
|
|
|
String option = vehicleDamageCards.elementAt(index).partSelectedId!.selectedOption;
|
|
|
|
.elementAt(index)
|
|
|
|
|
|
|
|
.partSelectedId!
|
|
|
|
|
|
|
|
.selectedOption;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var value in vehicleDamageParts) {
|
|
|
|
for (var value in vehicleDamageParts) {
|
|
|
|
if (value.partName == option) {
|
|
|
|
if (value.partName == option) {
|
|
|
|
@ -1539,9 +1542,7 @@ class AdVM extends BaseVM {
|
|
|
|
File file = File(imageModel.filePath!);
|
|
|
|
File file = File(imageModel.filePath!);
|
|
|
|
List<int> imageBytes = await file.readAsBytes();
|
|
|
|
List<int> imageBytes = await file.readAsBytes();
|
|
|
|
String image = base64Encode(imageBytes);
|
|
|
|
String image = base64Encode(imageBytes);
|
|
|
|
String fileName = file.path
|
|
|
|
String fileName = file.path.split('/').last;
|
|
|
|
.split('/')
|
|
|
|
|
|
|
|
.last;
|
|
|
|
|
|
|
|
vehiclePostingImages = VehiclePostingImages(
|
|
|
|
vehiclePostingImages = VehiclePostingImages(
|
|
|
|
imageName: fileName,
|
|
|
|
imageName: fileName,
|
|
|
|
imageStr: image,
|
|
|
|
imageStr: image,
|
|
|
|
@ -2041,13 +2042,13 @@ class AdVM extends BaseVM {
|
|
|
|
final chatVM = context.read<ChatVM>();
|
|
|
|
final chatVM = context.read<ChatVM>();
|
|
|
|
await chatVM
|
|
|
|
await chatVM
|
|
|
|
.getUsersChatMessagesForAd(
|
|
|
|
.getUsersChatMessagesForAd(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
isForBuyer: true,
|
|
|
|
isForBuyer: true,
|
|
|
|
adsChatBuyerId: 1,
|
|
|
|
adsChatBuyerId: 1,
|
|
|
|
adID: adDetailsModel.id,
|
|
|
|
adID: adDetailsModel.id,
|
|
|
|
userID: myUserID,
|
|
|
|
userID: myUserID,
|
|
|
|
senderName: adDetailsModel.adOwnerName,
|
|
|
|
senderName: adDetailsModel.adOwnerName,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.whenComplete(() => navigateWithName(context, AppRoutes.chatView, arguments: chatViewArguments));
|
|
|
|
.whenComplete(() => navigateWithName(context, AppRoutes.chatView, arguments: chatViewArguments));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|