content: import 'package:flutter/material.dart';
  import 'package:get/get.dart';
  import 'package:t_store/common/widgets/custom_shapes/containers/primary_header_container.dart';
  import 'package:t_store/common/widgets/custom_shapes/containers/search_container.dart';
  import 'package:t_store/common/widgets/layouts/grid_layout.dart';
  import 'package:t_store/common/widgets/loaders/vertical_product_shimmer.dart';
  import 'package:t_store/common/widgets/products/product_cards/product_card_vertical.dart';
  import 'package:t_store/common/widgets/texts/section_heading.dart';
  import 'package:t_store/features/shop/controllers/product_controller.dart';
  import 'package:t_store/features/shop/screens/all_products/all_products.dart';
  import 'package:t_store/features/shop/screens/home/widgets/home_appbar.dart';
  import 'package:t_store/features/shop/screens/home/widgets/home_categories.dart';
  import 'package:t_store/features/shop/screens/home/widgets/promo_slider.dart';
  import 'package:t_store/utils/constraints/sizes.dart';
  
  class HomeScreen extends StatelessWidget {
    const HomeScreen({Key? key}) : super(key: key);
  
    @override
    Widget build(BuildContext context) {
      final controller = Get.put(ProductController());
      return Scaffold(
        body: SingleChildScrollView(
          child: Column(
            children: [
              ///header
              const TPrimaryHeaderContainer(
                child: Column(
                  children: [
                    ///appbar
                    THomeAppBar(),
                    SizedBox(height: TSizes.spaceBtwSections),
  
                    ///searchbar
                    TSearchContainer(text: 'Search in store'),
                    SizedBox(height: TSizes.spaceBtwSections),
  
                    ///categories
                    Padding(
                      padding: EdgeInsets.only(left: TSizes.defaultSpace),
                      child: Column(
                        children: [
                          ///heading of categories
                          TSectionHeading(
                              title: 'Popular Categories',
                              showActionButton: false,
                              textColor: Colors.white),
                          SizedBox(height: TSizes.spaceBtwItems),
  
                          ///categories
                          THomeCategories(),
                        ],
                      ),
                    ),
                    SizedBox(height: TSizes.spaceBtwSections),
                  ],
                ),
              ),
  
              ///Body
              Padding(
                padding: const EdgeInsets.all(TSizes.defaultSpace),
                child: Column(
                  children: [
                    const TPromoSlider(),
                    const SizedBox(height: TSizes.spaceBtwSections),
                    ///-heading
                    TSectionHeading(title: 'Popular products', onPressed: () => Get.to(() => const AllProducts())),
                    const SizedBox(height: TSizes.spaceBtwItems),
  
                    ///popular products
                    Obx(() {
                      if(controller.isLoading.value) return const TVerticalProductShimmer();
                      if(controller.featuredProducts.isEmpty){
                        return Center(child: Text('No data found!', style: Theme.of(context).textTheme.bodyMedium));
                      }
                      return TGridLayout(
                          itemCount: controller.featuredProducts.length,
                          itemBuilder: (_, index) =>  TProductCardVertical(product: controller.featuredProducts[index]));
                    } ),
                  ],
                ),
              )
            ],
          ),
        ),
      );
    }
  }
  
  
  