import 'package:cheminova/controller/home_controller.dart'; import 'package:cheminova/screens/announment/announment_screen.dart'; import 'package:cheminova/screens/inventory/inventory_management_screen.dart'; import 'package:cheminova/screens/order/order_tracking_screen.dart'; import 'package:cheminova/screens/order_management/order_management_screen.dart'; import 'package:cheminova/screens/product/product_catalog_screen.dart'; import 'package:cheminova/screens/report/notification_screen.dart'; import 'package:cheminova/widgets/home_card.dart'; import 'package:cheminova/widgets/my_drawer.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; // HomeScreen displays various feature options (Product Catalogue, Order Tracking, etc.) as a grid of cards. // It uses the GetX package for navigation and state management. class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @override State createState() => _HomeScreenState(); } class _HomeScreenState extends State { // HomeController is being initialized using GetX for state management. final HomeController homeController = Get.put(HomeController()); @override Widget build(BuildContext context) { return Scaffold( extendBodyBehindAppBar: true, // The app bar extends behind the body content. // AppBar configuration with transparent background and a custom menu icon appBar: AppBar( centerTitle: true, backgroundColor: Colors.transparent, // AppBar background is transparent to blend with the background image. elevation: 0, // No shadow under the AppBar. // Leading widget is a custom menu icon that opens the drawer when tapped. leading: Builder( builder: (context) { return GestureDetector( onTap: () => Scaffold.of(context).openDrawer(), // Opens the drawer. child: Padding( padding: const EdgeInsets.all(16.0), child: SvgPicture.asset( 'assets/svg/menu.svg', // SVG asset for the menu icon. ), ), ); }, ), // Title in the AppBar. title: const Text( "Welcome", ), ), // Drawer widget displayed on the side when the menu icon is tapped. drawer: const MyDrawer(), // Stack widget to layer the background image and content on top. body: Stack( fit: StackFit.expand, // Background image will fill the screen. children: [ // Background image covering the entire screen. Image.asset( 'assets/images/image_1.png', fit: BoxFit.cover, // The image is resized to cover the entire area. ), // SafeArea widget to ensure the content is placed within safe boundaries. SafeArea( child: Padding( padding: const EdgeInsets.all(8.0), // SingleChildScrollView allows scrolling if the content is larger than the screen. child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, // Evenly spaces the rows of cards. children: [ // Row with two HomeCard widgets for Product Catalogue and Order Tracking. Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, // Cards are spaced evenly across the row. children: [ // HomeCard widget with the title and navigation to the Product Catalog screen. HomeCard( title: 'Products', onTap: () => Get.to(() => const ProductCatalogScreen()), // Navigates to ProductCatalogScreen using GetX. ), // HomeCard widget with the title and navigation to the Order Tracking screen. HomeCard( title: 'Order Tracking', onTap: () => Get.to( () => const OrderTrackingScreen(), // Navigates to OrderTrackingScreen using GetX. ), ), ], ), const SizedBox(height: 30), // Adds vertical spacing between rows. // Row with two HomeCard widgets for Order Management and Shipping Management. Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ HomeCard( title: 'Order Management', onTap: () => Get.to( () => OrderManagementScreen(), // Navigates to OrderManagementScreen. ), ), HomeCard( title: 'Inventory Management', onTap: () => Get.to( () => const InventoryManagementScreen(), // Navigates to InventoryManagementScreen. ), ), // HomeCard( // title: 'Shipping Management', // onTap: () => Get.to( // () => // const ShippingManagementScreen(), // Navigates to ShippingManagementScreen. // ), // ), ], ), const SizedBox(height: 30), // Row with two HomeCard widgets for Order Data Export and Retail Distributors Onboarding. Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ HomeCard( title: 'Notifications', onTap: () => Get.to(() => NotificationScreen())), HomeCard( title: 'Announcement', onTap: () => Get.to( () => AnnouncementScreen(), // Navigates to RetailDistributerOnBoardingScreen. ), ), ], ), ], ), ), ), ) ], ), ); } }