import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:Tripz/controller/home/profile/promos_controller.dart'; import 'package:Tripz/views/widgets/my_scafold.dart'; import '../../../constant/style.dart'; import '../../widgets/mycircular.dart'; class PromosPassengerPage extends StatelessWidget { const PromosPassengerPage({super.key}); @override Widget build(BuildContext context) { Get.put(PromosController()); return MyScafolld( title: "Promos For Today".tr, isleading: true, body: [ GetBuilder( builder: (orderHistoryController) => orderHistoryController.isLoading ? const MyCircularProgressIndicator() : ListView.builder( itemCount: orderHistoryController .promoList.length, // Adding 1 for the ad itemBuilder: (BuildContext context, int index) { // if (index == 0) { // // Ad at the beginning // return Padding( // padding: const EdgeInsets.all(8.0), // child: Container( // height: 120, // Adjust the height of the ad container // decoration: BoxDecoration( // color: // Colors.grey[200], // Background color for the ad // borderRadius: BorderRadius.circular(10), // ), // child: Center( // child: Container( // decoration: AppStyle.boxDecoration, // height: Get.height * .19, // child: ListView( // scrollDirection: Axis.horizontal, // children: [ // PointsCaptain( // kolor: AppColor.greyColor, // pricePoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? 5 // : 100, // countPoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? '300' // : '100', // ), // PointsCaptain( // kolor: AppColor.bronze, // pricePoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? 10 // : 200, // countPoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? '1040' // : '210', // ), // PointsCaptain( // kolor: AppColor.goldenBronze, // pricePoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? 22 // : 400, // countPoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? '2300' // : '450', // ), // PointsCaptain( // kolor: AppColor.gold, // pricePoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? 50 // : 1000, // countPoint: // box.read(BoxName.countryCode) == // 'Jordan' // ? '55000' // : '1200', // ), // ], // )), // ), // ), // ); // } else { // Promo items final rides = orderHistoryController.promoList[index]; return Padding( padding: const EdgeInsets.all(12.0), child: Container( decoration: BoxDecoration( color: CupertinoColors.systemGrey6, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: CupertinoColors.systemGrey.withOpacity(0.5), blurRadius: 8, offset: Offset(0, 4), ), ], ), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ GestureDetector( onTap: () {}, child: AnimatedTextKit( animatedTexts: [ ScaleAnimatedText( rides['promo_code'], textStyle: AppStyle.title.copyWith( fontSize: 32, // Increased font size for emphasis color: CupertinoColors.activeBlue, fontWeight: FontWeight.bold, ), ), WavyAnimatedText( rides['promo_code'], textStyle: AppStyle.title.copyWith( fontSize: 32, // Increased font size for emphasis color: CupertinoColors.activeBlue, fontWeight: FontWeight.bold, ), ), ], isRepeatingAnimation: true, ), ), const SizedBox(height: 8), // Description Text Text( rides['description'], style: AppStyle.title.copyWith( fontSize: 22, color: CupertinoColors.systemGrey, ), ), ], ), Column( children: [ // Only displaying end date Text( '${'Valid Until:'.tr} ${rides['validity_end_date']}', style: AppStyle.subtitle.copyWith( fontWeight: FontWeight.bold, fontSize: 20, color: CupertinoColors.systemGrey, ), ), ], ), ], ), // const SizedBox(height: 16), // Copy Promo Text Center( child: GestureDetector( onTap: () { Clipboard.setData(ClipboardData( text: rides['promo_code'])); Get.snackbar( 'Promo Copied!'.tr, 'You have copied the promo code.'.tr, snackPosition: SnackPosition.BOTTOM, backgroundColor: CupertinoColors.systemGrey, colorText: CupertinoColors.white, ); }, child: Text( 'Copy Code'.tr, textAlign: TextAlign.center, style: AppStyle.headTitle2.copyWith( color: CupertinoColors.systemBlue, fontWeight: FontWeight.bold, ), ), ), ), ], ), ), ), ); // } }, ), ) ], ); } }