|
|
|
|
@ -3,6 +3,7 @@ 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/main.dart';
|
|
|
|
|
import 'package:mc_common_app/models/advertisment_models/vehicle_details_models.dart';
|
|
|
|
|
import 'package:mc_common_app/models/general_models/widgets_models.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
@ -38,128 +39,154 @@ class SelectAdTypeView extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// bool checkSelection(VehicleTypeModel vtype, AdVM adVM) {
|
|
|
|
|
// bool value = false;
|
|
|
|
|
// if (adVM.vehicleTypes.isNotEmpty) {
|
|
|
|
|
// for (var vehicle in adVM.vehicleTypes) {
|
|
|
|
|
// if (vtype.id == adVM.previousADDetails?.vehicle?.vehicleType) {
|
|
|
|
|
// value = true;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return value;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// clearAll(BuildContext context) {
|
|
|
|
|
// AdVM adVM = context.read<AdVM>();
|
|
|
|
|
// adVM.clearEditValues();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: CustomAppBar(
|
|
|
|
|
title: "Select Ad Type",
|
|
|
|
|
profileImageUrl: MyAssets.bnCar,
|
|
|
|
|
isRemoveBackButton: false,
|
|
|
|
|
isDrawerEnabled: false,
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Consumer(builder: (BuildContext context, AdVM adVM, Widget? child) {
|
|
|
|
|
return ListView.separated(
|
|
|
|
|
itemCount: adVM.vehicleTypes.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
VehicleTypeModel vehicleTypeModel = adVM.vehicleTypes[index];
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
adVM.updateSelectionVehicleTypeId(
|
|
|
|
|
SelectionModel(selectedId: vehicleTypeModel.id!, selectedOption: vehicleTypeModel.vehicleTypeName ?? "", errorValue: ""),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
showMyBottomSheet(context, child: const AdDurationSelectionSheetContent(isUpdateAdSelected: false, isFromExtendAd: false));
|
|
|
|
|
},
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
vehicleTypeModel.vehicleTypeName.toString().toText(fontSize: 18, isBold: true),
|
|
|
|
|
getVehicleAdTypeIcon(vehicleTypeModel.vehicleTypeEnum!),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (isProvider) ...[
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Duration: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"Valid Until Subscription Expiration".toText(fontSize: 13, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 5, bottom: 5),
|
|
|
|
|
] else ...[
|
|
|
|
|
return WillPopScope(
|
|
|
|
|
onWillPop: () async {
|
|
|
|
|
logger.d("Clead All Values");
|
|
|
|
|
// clearAll(context);
|
|
|
|
|
AdVM adVM = context.read<AdVM>();
|
|
|
|
|
adVM.clearEditValues();
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: CustomAppBar(
|
|
|
|
|
title: "Select Ad Type",
|
|
|
|
|
profileImageUrl: MyAssets.bnCar,
|
|
|
|
|
isRemoveBackButton: false,
|
|
|
|
|
isDrawerEnabled: false,
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Consumer(builder: (BuildContext context, AdVM adVM, Widget? child) {
|
|
|
|
|
return ListView.separated(
|
|
|
|
|
itemCount: adVM.vehicleTypes.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
VehicleTypeModel vehicleTypeModel = adVM.vehicleTypes[index];
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
adVM.updateSelectionVehicleTypeId(
|
|
|
|
|
SelectionModel(selectedId: vehicleTypeModel.id!, selectedOption: vehicleTypeModel.vehicleTypeName ?? "", errorValue: ""),
|
|
|
|
|
);
|
|
|
|
|
showMyBottomSheet(context, child: const AdDurationSelectionSheetContent(isUpdateAdSelected: false, isFromExtendAd: false));
|
|
|
|
|
},
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
"Duration: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
adVM.vehicleAdDurationId.selectedOption.toText(fontSize: 13, isBold: true),
|
|
|
|
|
const Icon(Icons.keyboard_arrow_down_sharp, color: MyColors.darkPrimaryColor, size: 20),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 5, bottom: 5),
|
|
|
|
|
],
|
|
|
|
|
if (!isProvider) ...[
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
adVM.vehicleAdDurationId.itemPrice.toText(fontSize: 22, isBold: true),
|
|
|
|
|
2.width,
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 4),
|
|
|
|
|
child: "SAR".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
),
|
|
|
|
|
vehicleTypeModel.vehicleTypeName.toString().toText(fontSize: 18, isBold: true),
|
|
|
|
|
getVehicleAdTypeIcon(vehicleTypeModel.vehicleTypeEnum!),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (isProvider) ...[
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Duration: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
"Valid Until Subscription Expiration".toText(fontSize: 13, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 5, bottom: 5),
|
|
|
|
|
] else ...[
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Duration: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
adVM.vehicleAdDurationId.selectedOption.toText(fontSize: 13, isBold: true),
|
|
|
|
|
const Icon(Icons.keyboard_arrow_down_sharp, color: MyColors.darkPrimaryColor, size: 20),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 5, bottom: 5),
|
|
|
|
|
],
|
|
|
|
|
if (!isProvider) ...[
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
adVM.vehicleAdDurationId.itemPrice.toText(fontSize: 22, isBold: true),
|
|
|
|
|
2.width,
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 4),
|
|
|
|
|
child: "SAR".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.symmetric(horizontal: 20, vertical: 10)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return 9.height;
|
|
|
|
|
},
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
if (isProvider) ...[
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"5 of 10 ".toText(fontSize: 29, isBold: true, letterSpacing: 0, height: 1),
|
|
|
|
|
"Ads Remaining ".toText(fontSize: 17, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const Text.rich(
|
|
|
|
|
TextSpan(
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).toWhiteContainer(width: double.infinity, isBorderRequired: vehicleTypeModel.isSelected! ? true : false, pading: const EdgeInsets.symmetric(horizontal: 20, vertical: 10)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return 9.height;
|
|
|
|
|
},
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
if (isProvider) ...[
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
TextSpan(
|
|
|
|
|
text: "You have left with 05 out of 50 ads given in the subscription. ",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
|
)),
|
|
|
|
|
TextSpan(
|
|
|
|
|
text: "Update Subscription",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: MyColors.darkPrimaryColor,
|
|
|
|
|
))
|
|
|
|
|
"5 of 10 ".toText(fontSize: 29, isBold: true, letterSpacing: 0, height: 1),
|
|
|
|
|
"Ads Remaining ".toText(fontSize: 17, color: MyColors.lightTextColor, isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
],
|
|
|
|
|
).toContainer(paddingAll: 20, backgroundColor: Colors.white),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
const Text.rich(
|
|
|
|
|
TextSpan(
|
|
|
|
|
children: [
|
|
|
|
|
TextSpan(
|
|
|
|
|
text: "You have left with 05 out of 50 ads given in the subscription. ",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
|
)),
|
|
|
|
|
TextSpan(
|
|
|
|
|
text: "Update Subscription",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: MyColors.darkPrimaryColor,
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
10.height,
|
|
|
|
|
],
|
|
|
|
|
).toContainer(paddingAll: 20, backgroundColor: Colors.white),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|