Adviksha (1) - Copy
Adviksha (1) - Copy
dart
import 'package:flutter/material.dart';
import 'rickshaw_registration.dart';
import 'business_registration.dart';
void main() {
runApp(RickshawAdminApp());
}
void _login() {
if (_emailController.text.trim() == "[email protected]" &&
_passwordController.text.trim() == "admin123") {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Welcome Admin!')),
);
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => AdminDashboardPage()),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Invalid email or password!')),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.green[50],
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Card(
elevation: 8,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/adviksha logo.png', height: 150),
SizedBox(height: 10),
Text(
'Admin Login',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold,
color: Colors.teal),
),
SizedBox(height: 10),
_buildTextField(_emailController, 'Email', Icons.email),
SizedBox(height: 10),
_buildTextField(_passwordController, 'Password', Icons.lock,
obscure: true),
SizedBox(height: 10),
// Login Button
ElevatedButton(
onPressed: _login,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white70,
shape: RoundedRectangleBorder(borderRadius:
BorderRadius.circular(8)),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 40),
),
child: Text('Login', style: TextStyle(fontSize: 14)),
),
//Forgot Password Button
TextButton(
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Forgot Password clicked! Implement
reset logic here.')),
);
// You can navigate to a password reset page here instead
},
child: Text(
'Forgot Password?',
style: TextStyle(color: Colors.red, fontSize: 14, fontWeight:
FontWeight.bold),
),
),
],
),
),
),
),
),
);
}
***********************************************************************************
****************************************************
rickshaw registration.dart
import 'package:flutter/material.dart';
import 'main.dart'; // Import the Dashboard page
void _registerRickshaw() {
if (_driverNameController.text.isNotEmpty &&
_licenseNumberController.text.isNotEmpty &&
_phoneNumberController.text.isNotEmpty &&
_vehicleNumberController.text.isNotEmpty &&
_selectedArea != null) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Rickshaw Registered Successfully!')),
);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF006A4E),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.white), // Back arrow
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => AdminDashboardPage()),
);
},
),
title: Text('Rickshaw Registration', style: TextStyle(color:
Colors.white)),
),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF006A4E), Color(0xFFDAA520)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Center(
child: SingleChildScrollView(
padding: EdgeInsets.all(16),
child: Card(
elevation: 10,
shape: RoundedRectangleBorder(borderRadius:
BorderRadius.circular(12)),
margin: EdgeInsets.symmetric(horizontal: 30),
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset('assets/images/adviksha logo.png', height: 150),
SizedBox(height: 10),
Text(
'Register Your Rickshaw',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold,
color: Color(0xFF006A4E)),
),
SizedBox(height: 20),
_buildTextField(_driverNameController, 'Driver Name',
Icons.person),
SizedBox(height: 16),
_buildTextField(_licenseNumberController, 'License Number',
Icons.card_membership),
SizedBox(height: 16),
_buildTextField(_phoneNumberController, 'Phone Number',
Icons.phone),
SizedBox(height: 16),
_buildTextField(_vehicleNumberController, 'Vehicle Number',
Icons.directions_car),
SizedBox(height: 16),
_buildDropdownField(),
SizedBox(height: 20),
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: _registerRickshaw,
child: Text('Register', style: TextStyle(fontSize: 18,
color: Colors.white)), // White text
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF006A4E),
shape: RoundedRectangleBorder(borderRadius:
BorderRadius.circular(12)),
),
),
),
],
),
),
),
),
),
),
);
}
Widget _buildDropdownField() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(10),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: _selectedArea,
hint: Text('Select Choice Area'),
isExpanded: true,
icon: Icon(Icons.arrow_drop_down, color: Color(0xFF006A4E)),
items: ['Nashik Road', 'Satpur', 'Pathardi Phata', 'Gangapur road',
'CBS', 'Adgaon']
.map((area) => DropdownMenuItem<String>(
value: area,
child: Text(area),
))
.toList(),
onChanged: (value) {
setState(() {
_selectedArea = value;
});
},
),
),
);
}
}
***********************************************************************************
*************************************************
business registration.dart
import 'package:flutter/material.dart';
import 'main.dart'; // Import the file where AdminDashboardPage is defined
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green.shade700,
title: Text('Business Registration', style: TextStyle(color:
Colors.white)),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.white),
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => AdminDashboardPage()),
);
},
),
),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green.shade700, Color(0xFFC89D3C)], // Green to Gold
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Center(
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 30),
child: Card(
elevation: 10,
shape: RoundedRectangleBorder(borderRadius:
BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// ---------- LOGO ----------
Image.asset(
'assets/images/adviksha logo.png', // Change path to your
logo image
height: 100,
),
SizedBox(height: 10),
Text(
'Register Your Business',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold,
color: Colors.green.shade700),
),
SizedBox(height: 20),
_buildTextField(_businessNameController, 'Business Name',
Icons.business),
SizedBox(height: 10),
_buildTextField(_businessTypeController, 'Business Type',
Icons.category),
SizedBox(height: 20),
ElevatedButton(
onPressed: () => _registerBusiness(context),
child: Text('Register', style: TextStyle(fontSize: 18, color:
Colors.white)),
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFC89D3C), // Gold Button
shape: RoundedRectangleBorder(borderRadius:
BorderRadius.circular(12)),
padding: EdgeInsets.symmetric(vertical: 14, horizontal:
40),
),
),
],
),
),
),
),
),
),
);
}