sc-android-app/lib/screens/summary_screen.dart
2024-09-29 22:09:36 +05:30

131 lines
5.9 KiB
Dart

import 'package:cheminova/screens/data_submit_successfull.dart';
import 'package:cheminova/widgets/common_drawer.dart';
import 'package:flutter/material.dart';
import 'package:cheminova/widgets/common_background.dart';
import 'package:intl/intl.dart';
import '../widgets/common_app_bar.dart';
import '../widgets/common_elevated_button.dart';
import '../widgets/common_text_form_field.dart';
class SummaryScreen extends StatefulWidget {
const SummaryScreen({super.key});
@override
State<SummaryScreen> createState() => SummaryScreenState();
}
class SummaryScreenState extends State<SummaryScreen> {
// Controllers for managing text input fields
final dateController = TextEditingController(
text: DateFormat('dd/MM/yyyy').format(DateTime.now())); // Default date set to today
final timeController =
TextEditingController(text: DateFormat('hh:mm a').format(DateTime.now())); // Default time set to now
final ProductController = TextEditingController(); // Controller for product input
final liquidationController = TextEditingController(); // Controller for liquidation input
final dealercontroller = TextEditingController(); // Controller for dealer input
final inventoryController = TextEditingController(); // Controller for inventory input
final qualityController = TextEditingController(); // Controller for quality input
final salesController = TextEditingController(); // Controller for sales input
final skuController = TextEditingController(); // Controller for SKU input
@override
Widget build(BuildContext context) {
return CommonBackground(
child: Scaffold(
backgroundColor: Colors.transparent, // Transparent background
appBar: CommonAppBar(
actions: [
// Back button in the app bar
IconButton(
onPressed: () {
Navigator.pop(context); // Navigate back to the previous screen
},
icon: Image.asset('assets/Back_attendance.png'),
padding: const EdgeInsets.only(right: 20),
),
],
title: const Text(
'Summary',
style: TextStyle(
fontSize: 20,
color: Colors.black,
fontWeight: FontWeight.w400,
fontFamily: 'Anek'),
),
backgroundColor: Colors.transparent, // Transparent app bar background
elevation: 0, // No shadow
),
drawer: const CommonDrawer(), // Drawer for navigation
body: Padding(
padding: const EdgeInsets.all(16.0), // Padding around the body content
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(), // Enable bouncing scroll physics
child: Column(
mainAxisAlignment: MainAxisAlignment.center, // Center the content vertically
crossAxisAlignment: CrossAxisAlignment.center, // Center the content horizontally
children: <Widget>[
const SizedBox(height: 16), // Spacing
Container(
padding: const EdgeInsets.all(20.0).copyWith(top: 30, bottom: 30),
// Container styling
decoration: BoxDecoration(
border: Border.all(color: Colors.white), // White border
color: const Color(0xffB4D1E5).withOpacity(0.9), // Light blue background
borderRadius: BorderRadius.circular(26.0)), // Rounded corners
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // Align children to the start
children: <Widget>[
// Input fields for summary data
CommonTextFormField(
title: 'Sales :',
fillColor: Colors.white,
controller: salesController), // Sales input field
const SizedBox(height: 15),
CommonTextFormField(
title: 'Inventory :',
fillColor: Colors.white,
controller: inventoryController), // Inventory input field
const SizedBox(height: 15),
CommonTextFormField(
title: 'Liquidation :',
fillColor: Colors.white,
controller: liquidationController), // Liquidation input field
const SizedBox(height: 15),
CommonTextFormField(
title: 'SKU :',
fillColor: Colors.white,
controller: skuController), // SKU input field
const SizedBox(height: 15),
CommonTextFormField(
title: 'Product :',
fillColor: Colors.white,
controller: ProductController), // Product input field
const SizedBox(height: 15),
Align(
alignment: Alignment.center,
child: CommonElevatedButton(
borderRadius: 30, // Rounded corners for the button
width: double.infinity, // Full width button
height: kToolbarHeight - 10, // Button height
text: 'VIEW DATA', // Button text
backgroundColor: const Color(0xff004791), // Button background color
onPressed: () {
// Navigate to DataSubmitSuccessFullScreen on button press
Navigator.push(context, MaterialPageRoute(builder: (context) => const DataSubmitSuccessFullScreen()));
},
),
),
],
),
),
],
),
),
),
),
);
}
}