chap8&9 sam
chap8&9 sam
A
MAJOR PROJECT-I REPORT
Submitted in partial fulfillment of the requirements
for the degree of
BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE & ENGINEERING
By
GROUP NO.03
Priyal Gupta 0187CS221152
Shubhek Kumar 0187CS221190
Yadav Aman 0187CS222016
Anuj Raghuwanshi 0187CS221050
Shivanshu Kumar 0187CS221187
Pranjal Amulani 0187CS221154
December -2024
SISTec/BTech/CS/2024/5/MajorProject_I/03
CHAPTER-8
CODING
Main.dart
import 'package:flutter/material.dart';
import 'package:krishak_sathi/Home_Page.dart';
import 'package:krishak_sathi/Labs/Confirm_adress.dart';
import 'package:krishak_sathi/lab.dart';
import 'package:krishak_sathi/login_page.dart';
import 'package:krishak_sathi/otp_page.dart';
import 'package:krishak_sathi/profile.dart';
import 'package:krishak_sathi/report/multiple_soil_reports.dart';
import 'package:krishak_sathi/router.dart';
import 'package:krishak_sathi/tracker/test_tracker.dart';
import 'crops/Crops.dart';
import 'report/report_analize.dart';
void main() {
runApp(const MyApp());
}
@override
State<MyApp> createState() => MyAppState();
}
34
SISTec/BTech/CS/2024/5/MajorProject_I/03
debugShowCheckedModeBanner: false,
home: Login(),
onGenerateRoute: generateRoute,
);
}
}
Home_page.dart
import 'package:flutter/material.dart';
import 'package:krishak_sathi/Home_info.dart';
import 'package:krishak_sathi/lab.dart';
import 'package:krishak_sathi/profile.dart';
import 'package:krishak_sathi/weather_pages/weather_pages.dart';
class GobalColors {
static const PrimaryColor = Color(0xFF2DB83D); // Define primary color
}
@override
State<HomePage> createState() => _HomePageState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: IndexedStack(
index: currentIndex, // Control which page is displayed
children: pages, // Pages to navigate between
),
bottomNavigationBar: Container(
height: 80,
margin: const EdgeInsets.all(15),
decoration: BoxDecoration(
35
SISTec/BTech/CS/2024/5/MajorProject_I/03
36
SISTec/BTech/CS/2024/5/MajorProject_I/03
Signup_page.dart
import 'package:flutter/material.dart';
@override
Widget build(BuildContext context) {
// Controller to capture the mobile number input
final TextEditingController mobileNumberController =
TextEditingController();
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
// Top section with a modern gradient background
Container(
height: 450,
width: double.infinity,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(40),
bottomRight: Radius.circular(40),
),
gradient: LinearGradient(
colors: [Color(0xFF2DB83D), Color(0xFF28A745)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.person,
size: 80,
color: Colors.white,
),
SizedBox(height: 10),
Text(
"Welcome",
style: TextStyle(
37
SISTec/BTech/CS/2024/5/MajorProject_I/03
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
],
),
),
// Login header
Container(
margin: const EdgeInsets.symmetric(vertical: 20),
child: const Text(
"SignIn",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 24,
color: Color(0xFF333333),
),
),
),
// Input fields and button
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Enter Mobile Number",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 5),
const Text(
"Please confirm your mobile number to proceed",
style: TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
const SizedBox(height: 20),
// Mobile number input field
Card(
elevation: 6,
shadowColor: Colors.grey.withOpacity(0.3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
38
SISTec/BTech/CS/2024/5/MajorProject_I/03
child: TextField(
controller: mobileNumberController,
keyboardType: TextInputType.phone,
decoration: InputDecoration(
hintText: "+91 | Mobile number",
filled: true,
fillColor: Colors.white,
contentPadding: const EdgeInsets.symmetric(
vertical: 16, horizontal: 20),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none,
),
suffixIcon: const Icon(
Icons.phone,
color: Color(0xFF2DB83D),
),
),
),
),
const SizedBox(height: 20),
// Continue button
ElevatedButton(
onPressed: () {
// Validate the mobile number
if (mobileNumberController.text == '8423304966') {
Navigator.pushReplacementNamed(
context, '/farmer_details');
} else {
// Show an error message if the number doesn't match
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
"Invalid mobile number. Please try again.",
style: TextStyle(color: Colors.white),
),
backgroundColor: Colors.red,
),
);
}
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2DB83D),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
minimumSize: const Size(double.infinity, 50),
elevation: 6,
),
39
SISTec/BTech/CS/2024/5/MajorProject_I/03
Login_page.dart
import 'package:flutter/material.dart';
@override
Widget build(BuildContext context) {
40
SISTec/BTech/CS/2024/5/MajorProject_I/03
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
// Top section with a modern gradient background
Container(
height: 450,
width: double.infinity,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(40),
bottomRight: Radius.circular(40),
),
gradient: LinearGradient(
colors: [Color(0xFF2DB83D), Color(0xFF28A745)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.person,
size: 80,
color: Colors.white,
),
SizedBox(height: 10),
Text(
"Welcome Back",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
],
),
),
// Login header
Container(
margin: const EdgeInsets.symmetric(vertical: 20),
child: const Text(
"Login",
style: TextStyle(
41
SISTec/BTech/CS/2024/5/MajorProject_I/03
fontWeight: FontWeight.bold,
fontSize: 24,
color: Color(0xFF333333),
),
),
),
// Input fields and button
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Enter Mobile Number",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 5),
const Text(
"Please confirm your mobile number to proceed",
style: TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
const SizedBox(height: 20),
// Mobile number input field
Card(
elevation: 6,
shadowColor: Colors.grey.withOpacity(0.3),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: TextField(
controller: mobileNumberController,
keyboardType: TextInputType.phone,
decoration: InputDecoration(
hintText: "+91 | Mobile number",
filled: true,
fillColor: Colors.white,
contentPadding: const EdgeInsets.symmetric(
vertical: 16, horizontal: 20),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none,
),
suffixIcon: const Icon(
42
SISTec/BTech/CS/2024/5/MajorProject_I/03
Icons.phone,
color: Color(0xFF2DB83D),
),
),
),
),
const SizedBox(height: 20),
// Continue button
ElevatedButton(
onPressed: () {
// Validate the mobile number
if (mobileNumberController.text == '8423304966') {
Navigator.pushReplacementNamed(context, '/homePage');
} else {
// Show an error message if the number doesn't match
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
"Invalid mobile number. Please try again.",
style: TextStyle(color: Colors.white),
),
backgroundColor: Colors.red,
),
);
}
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2DB83D),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
minimumSize: const Size(double.infinity, 50),
elevation: 6,
),
child: const Text(
"Continue",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
),
const SizedBox(height: 20),
// Alternative login link
Center(
child: TextButton(
onPressed: () {
Navigator.pushReplacementNamed(context, '/signup');
},
43
SISTec/BTech/CS/2024/5/MajorProject_I/03
Home_info.dart
import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:krishak_sathi/constant.dart';
@override
State<HomePageInfo> createState() => _HomePageInfoState();
}
44
SISTec/BTech/CS/2024/5/MajorProject_I/03
{
'title': 'New Agricultural Technology',
'image': 'assets/images/news2.jpg',
'description':
'Learn about new agricultural technology making farming more efficient.',
},
{
'title': 'Farming Tips for Winter',
'image': 'assets/images/news3.jpg',
'description':
'Stay prepared with these essential farming tips for the winter season.',
},
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(
'Krishak Sathi',
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 22, color: Colors.white),
),
backgroundColor: GobalColors.PrimaryColor,
elevation: 5,
centerTitle: true,
),
body: ListView(
padding: const EdgeInsets.all(10),
children: [
// Carousel with farmer images
CarouselSlider(
options: CarouselOptions(
height: 250,
autoPlay: true,
enlargeCenterPage: true,
autoPlayInterval: const Duration(seconds: 4),
aspectRatio: 16 / 9,
enableInfiniteScroll: true,
viewportFraction: 0.85,
),
items: imageList
.map((item) => ClipRRect(
borderRadius: BorderRadius.circular(15),
child: Stack(
fit: StackFit.expand,
children: [
Image.asset(item, fit: BoxFit.cover),
Container(
45
SISTec/BTech/CS/2024/5/MajorProject_I/03
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.black.withOpacity(0.6),
Colors.transparent,
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
),
),
), // Gradient overlay
Positioned(
bottom: 10,
left: 10,
child: Text(
'Inspiring Farmer Stories',
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.bold,
shadows: [
Shadow(
color: Colors.black.withOpacity(0.8),
blurRadius: 5,
)
],
),
),
),
],
),
))
.toList(),
),
// Section heading
const SizedBox(height: 20),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(
'News Related to Agriculture and Farmers',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: GobalColors.PrimaryColor,
),
),
),
const SizedBox(height: 15),
46
SISTec/BTech/CS/2024/5/MajorProject_I/03
47
SISTec/BTech/CS/2024/5/MajorProject_I/03
child: TextButton(
onPressed: () {
// Placeholder for "Read More" functionality
},
child: const Text(
'Read More',
style: TextStyle(color: Colors.green),
),
),
),
],
),
);
}).toList(),
],
),
);
}
}
Farmers_details.dart
import 'package:flutter/material.dart';
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xFF2DB83D),
title: const Text(
"Farmer Details",
style: TextStyle(color: Colors.white),
),
centerTitle: true,
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
48
SISTec/BTech/CS/2024/5/MajorProject_I/03
49
SISTec/BTech/CS/2024/5/MajorProject_I/03
filled: true,
fillColor: Colors.white,
),
),
const SizedBox(height: 20),
50
SISTec/BTech/CS/2024/5/MajorProject_I/03
// Submit Button
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () {
Navigator.pushReplacementNamed(context, '/homePage');
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2DB83D),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
minimumSize: const Size(double.infinity, 50),
elevation: 6,
),
child: const Text(
"Submit",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
),
),
],
),
),
),
),
);
}
}
51
SISTec/BTech/CS/2024/5/MajorProject_I/03
Lab.dart
import 'package:flutter/material.dart';
import 'package:krishak_sathi/constant.dart';
void main() {
runApp(const MyApp());
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch:
Colors.green, // Set the theme color (Green for agriculture)
appBarTheme: AppBarTheme(
backgroundColor: Colors.green[700], // Custom AppBar color
),
textTheme: const TextTheme(),
),
home: LabsPage(),
);
}
}
52
SISTec/BTech/CS/2024/5/MajorProject_I/03
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Labs in Bhopal'),
foregroundColor: Colors.white,
backgroundColor: GobalColors.PrimaryColor,
),
body: ListView.builder(
itemCount: labs.length,
itemBuilder: (context, index) {
final lab = labs[index];
return Card(
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(20), // Rounded corners for the card
),
elevation: 10, // Add some shadow for a floating effect
color: Colors.green[50], // Light green background for the card
child: InkWell(
onTap: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(lab['name']!),
content: Text(
'Address: ${lab['address']}\nContact: ${lab['contact']}'),
actions: [
TextButton(
onPressed: () => {},
child: const Text('Close'),
53
SISTec/BTech/CS/2024/5/MajorProject_I/03
),
],
);
},
);
},
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Left side with lab details
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
lab['name']!,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.green, // Dark green for title
),
),
const SizedBox(height: 8),
Text(
lab['address']!,
style: const TextStyle(
fontSize: 16,
color: Colors.grey, // Darker grey for address
),
),
const SizedBox(height: 8),
Text(
'Contact: ${lab['contact']}',
style: const TextStyle(
fontSize: 14,
color: Colors.grey, // Lighter grey for contact
),
),
],
),
),
// Enhanced Arrow button
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
54
SISTec/BTech/CS/2024/5/MajorProject_I/03
title: Text(lab['name']!),
content: Text(
'Address: ${lab['address']}\nContact: ${lab['contact']}'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Close'),
),
],
);
},
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.green[700], // Dark green background
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 8,
offset: Offset(0, 4),
),
], // Shadow effect for depth
),
padding: const EdgeInsets.all(
12.0), // Space inside the button
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/confirm_address');
},
child: const Icon(
Icons.arrow_forward_ios,
color: Colors.white, // White icon for contrast
size: 20, // Icon size
),
),
),
),
],
),
),
),
);
},
),
);
}
}
55
SISTec/BTech/CS/2024/5/MajorProject_I/03
SISTec/BTech/CS/2024/5/MajorProject_I/03
CHAPTER-9
RESULT AND OUTPUT SCREENS
9.1 RESULTS
Krishak Sathi: Empowering Farmers with Data-Driven
Insights
Accurate Soil Analysis : Our app provides precise soil testing reports,
identifying deficiencies in essential minerals like nitrogen, phosphorus, and
potassium.
Real-time Weather Updates : Farmers can access accurate weather forecasts to plan
their farming activities effectively.
Market Insights : Stay informed about market trends and prices to make
informed decisions.
38
SISTec/BTech/CS/2024/5/MajorProject_I/03
38
SISTec/BTech/CS/2024/5/MajorProject_I/03
Figure 9.2.4: Lab Booking Details and and Soil Test Tracker
40