Fix: promos discount query and compact car details layout
This commit is contained in:
@@ -53,7 +53,12 @@ class MapEngineController extends GetxController {
|
||||
double mainBottomMenuMapHeight = Get.height * .2;
|
||||
double wayPointSheetHeight = 0;
|
||||
bool heightMenuBool = false;
|
||||
bool isPickerShown = false;
|
||||
bool _isPickerShown = false;
|
||||
bool get isPickerShown => _isPickerShown;
|
||||
set isPickerShown(bool value) {
|
||||
_isPickerShown = value;
|
||||
update();
|
||||
}
|
||||
bool isPointsPageForRider = false;
|
||||
bool isBottomSheetShown = false;
|
||||
bool reloadStartApp = false;
|
||||
@@ -678,8 +683,8 @@ class MapEngineController extends GetxController {
|
||||
}
|
||||
|
||||
void changePickerShown() {
|
||||
isPickerShown = !isPickerShown;
|
||||
heightPickerContainer = isPickerShown == true ? 150 : 90;
|
||||
_isPickerShown = !_isPickerShown;
|
||||
heightPickerContainer = _isPickerShown == true ? 150 : 90;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ class PickerIconOnMap extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<RideLifecycleController>(
|
||||
return GetBuilder<MapEngineController>(
|
||||
builder: (controller) => controller.isPickerShown
|
||||
? Positioned(
|
||||
bottom: Get.height * .2,
|
||||
|
||||
@@ -121,7 +121,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 4,
|
||||
margin: const EdgeInsets.only(top: 12, bottom: 8),
|
||||
margin: const EdgeInsets.only(top: 8, bottom: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
@@ -137,11 +137,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
|
||||
// ── Car Selection List ───────────────────────────────
|
||||
SizedBox(
|
||||
height: 170,
|
||||
height: 120,
|
||||
child: ListView.builder(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 12),
|
||||
padding: const EdgeInsets.fromLTRB(20, 4, 20, 6),
|
||||
itemCount: carTypes.length,
|
||||
itemBuilder: (context, index) {
|
||||
final carType = carTypes[index];
|
||||
@@ -159,7 +159,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
// ── Promo Code & Actions ─────────────────────────────
|
||||
_buildPromoButton(context, controller),
|
||||
|
||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 10),
|
||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 4),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -174,7 +174,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
Widget _buildHeader(RideLifecycleController controller) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(22, 4, 22, 8),
|
||||
padding: const EdgeInsets.fromLTRB(22, 2, 22, 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -211,7 +211,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 6),
|
||||
// Trip Stats Row
|
||||
Row(
|
||||
children: [
|
||||
@@ -265,7 +265,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
Widget _buildStatChip(
|
||||
{required IconData icon, required String value, required Color color}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withAlpha(20),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
@@ -303,7 +303,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeOutCubic,
|
||||
width: 108,
|
||||
width: 104,
|
||||
decoration: BoxDecoration(
|
||||
gradient: isSelected
|
||||
? LinearGradient(
|
||||
@@ -338,8 +338,8 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
// Selected indicator
|
||||
if (isSelected)
|
||||
Positioned(
|
||||
top: 6,
|
||||
right: 6,
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: Container(
|
||||
width: 18,
|
||||
height: 18,
|
||||
@@ -364,7 +364,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
|
||||
// Card content
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 10, 8, 8),
|
||||
padding: const EdgeInsets.fromLTRB(6, 6, 6, 6),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@@ -374,11 +374,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: Image.asset(
|
||||
carType.image,
|
||||
height: 48,
|
||||
height: 44,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
// Car name
|
||||
FittedBox(
|
||||
@@ -388,7 +388,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontWeight:
|
||||
isSelected ? FontWeight.w800 : FontWeight.w600,
|
||||
fontSize: 13,
|
||||
fontSize: 12,
|
||||
color: isSelected
|
||||
? AppColor.primaryColor
|
||||
: AppColor.writeColor,
|
||||
@@ -397,12 +397,12 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 3),
|
||||
|
||||
// Price tag
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? AppColor.primaryColor
|
||||
@@ -443,14 +443,14 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
if (controller.promoTaken) return const SizedBox.shrink();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 6, 20, 4),
|
||||
padding: const EdgeInsets.fromLTRB(20, 4, 20, 2),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => _showPromoCodeDialog(context, controller),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 14),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
@@ -951,7 +951,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildRayehGaiOption(BuildContext context, RideLifecycleController mapPassengerController, String carTypeName, String price) {
|
||||
Widget _buildRayehGaiOption(
|
||||
BuildContext context,
|
||||
RideLifecycleController mapPassengerController,
|
||||
String carTypeName,
|
||||
String price) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
@@ -92,7 +92,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
promo['description'],
|
||||
promo['description']?.toString() ?? '',
|
||||
style: AppStyle.headTitle.copyWith(fontSize: 18),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -104,7 +104,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
size: 14, color: Colors.grey),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'${'Valid Until:'.tr} ${promo['validity_end_date']}',
|
||||
'${'Valid Until:'.tr} ${promo['validity_end_date']?.toString() ?? ''}',
|
||||
style: AppStyle.subtitle
|
||||
.copyWith(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
@@ -131,9 +131,10 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// --- نفس منطقك القديم للنسخ ---
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: promo['promo_code']));
|
||||
mySnackbarSuccess('${'Code'.tr} ${promo['promo_code']} ${'copied to clipboard'.tr}');
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: promo['promo_code']?.toString() ?? ''));
|
||||
mySnackbarSuccess(
|
||||
'${'Code'.tr} ${promo['promo_code']?.toString() ?? ''} ${'copied to clipboard'.tr}');
|
||||
},
|
||||
child: Container(
|
||||
color: AppColor.primaryColor.withOpacity(0.1),
|
||||
@@ -147,7 +148,7 @@ class PromosPassengerPage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
promo['promo_code'],
|
||||
promo['promo_code']?.toString() ?? '',
|
||||
style: AppStyle.headTitle.copyWith(
|
||||
fontSize: 24, color: AppColor.primaryColor),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user