import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../../Controller/Orders/Tabs/Summarycontroller.dart';
import '../../../Helper/Constants/Colorconstants.dart';

class OrderSummary extends StatelessWidget {
   OrderSummary({super.key});
  OrderSummaryController orderSummaryController = Get.put(OrderSummaryController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor : Colors.grey[100],
        body: GetBuilder<OrderSummaryController>(
            initState: (_){
              orderSummaryController.shimmer.value = true;
              orderSummaryController.getOrdersSummary();
            },
            builder: (controller) {
              return controller.shimmer.value
                  ? Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor,))
                  :ListView(
                  scrollDirection: Axis.vertical,
                  children: [
                    Padding(
                      padding: const EdgeInsets.only(top: 10,left: 10,right: 10),
                      child: Column(
                        children: [
                          Container(
                            height: Get.height*0.10,
                            width: Get.width*0.94,
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(12),
                              color: Colors.white,
                              boxShadow: [
                                BoxShadow(
                                  color: Colors.grey.withOpacity(0.2),
                                  spreadRadius: 1,
                                  blurRadius: 3,
                                  offset: const Offset(0, 3),
                                ),
                              ],
                            ),
                            child: Container(
                              padding: const EdgeInsets.all(10),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Center(child: Icon(Icons.pending, size: 54, color:ColorConstants.primaryColor1)),
                                  const SizedBox(width: 5,),
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    crossAxisAlignment: CrossAxisAlignment.start,
                                    children: [
                                      const SizedBox(height: 2,),
                                      Text('Pending',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
                                      const SizedBox(height: 4,),
                                      Text('${controller.getOrderSummary.pending}',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
                                    ],
                                  ),
                                ],
                              ),
                            ),
                          ),
                          const SizedBox(height: 15,),
                          Container(
                            height: Get.height*0.10,
                            width: Get.width*0.94,
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(12),
                              color: Colors.white,
                              boxShadow: [
                                BoxShadow(
                                  color: Colors.grey.withOpacity(0.2),
                                  spreadRadius: 1,
                                  blurRadius: 3,
                                  offset: const Offset(0, 3),
                                ),
                              ],
                            ),
                            child: Container(
                              padding: const EdgeInsets.all(10),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Center(child: Icon(Icons.check_circle, size: 46, color:ColorConstants.primaryColor1)),
                                  const SizedBox(width: 10,),
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    crossAxisAlignment: CrossAxisAlignment.start,
                                    children: [
                                      const SizedBox(height: 4,),
                                      Text('Completed',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
                                      const SizedBox(height: 4,),
                                      Row(
                                        children: [
                                          Text('${controller.getOrderSummary.delivered}',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
                                        ],
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                            ),
                          ),
                          const SizedBox(height: 15,),
                          Container(
                            height: Get.height*0.10,
                            width: Get.width*0.94,
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(12),
                              color: Colors.white,
                              boxShadow: [
                                BoxShadow(
                                  color: Colors.grey.withOpacity(0.2),
                                  spreadRadius: 1,
                                  blurRadius: 3,
                                  offset: const Offset(0, 3),
                                ),
                              ],
                            ),
                            child: Container(
                              padding: const EdgeInsets.all(10),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Center(child: Icon(Icons.cancel, size: 48, color:ColorConstants.primaryColor1)),
                                  const SizedBox(width: 10,),
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    crossAxisAlignment: CrossAxisAlignment.start,
                                    children: [
                                      const SizedBox(height: 4,),
                                      Text('Cancelled',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
                                      const SizedBox(height: 4,),
                                      Row(
                                        children: [
                                          Text('${controller.getOrderSummary.cancelled}',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
                                        ],
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                            ),
                          ),

                          const SizedBox(height: 15,),
                          Container(
                            height: Get.height*0.10,
                            width: Get.width*0.94,
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(12),
                              color: Colors.white,
                              boxShadow: [
                                BoxShadow(
                                  color: Colors.grey.withOpacity(0.2),
                                  spreadRadius: 1,
                                  blurRadius: 3,
                                  offset: const Offset(0, 3),
                                ),
                              ],
                            ),
                            child: Container(
                              padding: const EdgeInsets.all(10),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Center(child: Icon(Icons.location_city, size: 46, color:ColorConstants.primaryColor1)),
                                  const SizedBox(width: 10,),
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    crossAxisAlignment: CrossAxisAlignment.start,
                                    children: [
                                      const SizedBox(height: 4,),
                                      Text('Amount',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
                                      const SizedBox(height: 4,),
                                      Row(
                                        children: [
                                          Icon(Icons.currency_rupee_sharp,color: Colors.grey[600],size: 20),
                                          Text('0.00',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
                                        ],
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                            ),
                          ),

                        ],
                      ),
                    ),
                  ]
              );
            }
        )

    );
  }
}
