import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/controller/home/profile/promos_controller.dart';
import 'package:ride/views/widgets/my_scafold.dart';

import '../../../constant/colors.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<PromosController>(
          builder: (orderHistoryController) => orderHistoryController.isloading
              ? const MyCircularProgressIndicator()
              : ListView.builder(
                  itemCount: orderHistoryController.promoList.length,
                  itemBuilder: (BuildContext context, int index) {
                    final rides = orderHistoryController.promoList[index];
                    return Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Container(
                        decoration: const BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(12)),
                            color: AppColor.secondaryColor,
                            boxShadow: [
                              BoxShadow(
                                  color: AppColor.accentColor,
                                  offset: Offset(-3, -3),
                                  blurRadius: 0,
                                  spreadRadius: 0,
                                  blurStyle: BlurStyle.outer),
                              BoxShadow(
                                  color: AppColor.accentColor,
                                  offset: Offset(3, 3),
                                  blurRadius: 0,
                                  spreadRadius: 0,
                                  blurStyle: BlurStyle.outer)
                            ]),
                        child: Padding(
                          padding: const EdgeInsets.all(8.0),
                          child: Column(
                            children: [
                              Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Column(
                                    crossAxisAlignment:
                                        CrossAxisAlignment.start,
                                    children: [
                                      AnimatedTextKit(
                                        animatedTexts: [
                                          ScaleAnimatedText(rides['promo_code'],
                                              textStyle: AppStyle.title),
                                          WavyAnimatedText(rides['promo_code'],
                                              textStyle: AppStyle.title),
                                          FlickerAnimatedText(
                                              rides['promo_code'],
                                              textStyle: AppStyle.title),
                                          WavyAnimatedText(rides['promo_code'],
                                              textStyle: AppStyle.title),
                                        ],
                                        isRepeatingAnimation: true,
                                        onTap: () {
                                          print("Tap Event");
                                        },
                                      ),
                                      Text(
                                        rides['description'],
                                        style: AppStyle.title,
                                      ),
                                    ],
                                  ),
                                  Column(
                                    children: [
                                      Text(
                                        rides['validity_start_date'],
                                        style: AppStyle.title,
                                      ),
                                      Text(
                                        rides['validity_end_date'],
                                        style: AppStyle.title,
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                              Text(
                                'Copy this Promo to use it in your Ride!'.tr,
                                textAlign: TextAlign.center,
                                style: AppStyle.headtitle2
                                    .copyWith(color: AppColor.accentColor),
                              )
                            ],
                          ),
                        ),
                      ),
                    );
                  },
                ),
        )
      ],
    );
  }
}
