177 lines
7.4 KiB
Dart
177 lines
7.4 KiB
Dart
import 'package:cheminova/controller/home_controller.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/order_history_report_screen.dart';
|
|
import 'package:cheminova/screens/report/reporting_analytics_screen.dart';
|
|
import 'package:cheminova/screens/retail/retail_distributer_on_boarding_screen.dart';
|
|
import 'package:cheminova/screens/shipping/shipping_management_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<HomeScreen> createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
// 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: 'Product Catalogue',
|
|
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: 10), // 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: 'Shipping Management',
|
|
onTap: () => Get.to(
|
|
() => const ShippingManagementScreen(), // Navigates to ShippingManagementScreen.
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
// Row with two HomeCard widgets for Inventory Management and Reporting & Analytics.
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
HomeCard(
|
|
title: 'Inventory Management',
|
|
onTap: () => Get.to(
|
|
() => const InventoryManagementScreen(), // Navigates to InventoryManagementScreen.
|
|
),
|
|
),
|
|
HomeCard(
|
|
title: 'Reporting & Analytics',
|
|
onTap: () => Get.to(
|
|
() => const ReportingAnalyticsScreen(), // Navigates to ReportingAnalyticsScreen.
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
// Row with two HomeCard widgets for Order Data Export and Retail Distributors Onboarding.
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
HomeCard(
|
|
title: 'Order Data Export',
|
|
onTap: () => Get.to(
|
|
() => const OrderHistoryReportScreen(), // Navigates to OrderHistoryReportScreen.
|
|
),
|
|
),
|
|
HomeCard(
|
|
title: 'Retail Distributors Onboarding',
|
|
onTap: () => Get.to(
|
|
() => const RetailDistributerOnBoardingScreen(), // Navigates to RetailDistributerOnBoardingScreen.
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|