Skip to content

Commit

Permalink
Merge pull request #9 from kavindu016/main
Browse files Browse the repository at this point in the history
Update the Login page
  • Loading branch information
kavindu016 authored Feb 1, 2025
2 parents 9b8c58f + 3cec760 commit 60d127d
Show file tree
Hide file tree
Showing 11 changed files with 261 additions and 82 deletions.
Binary file added code/Frontend/assert/images/Google_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/Frontend/assert/images/Logo_Icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion code/Frontend/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import 'package:flutter/material.dart';
import 'screens/login_screen.dart'; // Import the login screen

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand Down
25 changes: 21 additions & 4 deletions code/Frontend/lib/screens/dashboard_screen.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
import 'package:flutter/material.dart';

import 'login_screen.dart'; // Import the login screen
import '../widgets/custom_button.dart';

class DashboardScreen extends StatelessWidget {
const DashboardScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Dashboard'),
title: const Text('Dashboard'),
),
body: Center(
child: Text(
'Welcome to the Dashboard!',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
child: Column(
children: [
const Text(
'Welcome to the Dashboard!',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
ElevatedButton(
onPressed: () {
// Navigate to the dashboard after login
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const LoginScreen()),
);
}, child: const Text('Logout'),),
],
),
),
);
Expand Down
168 changes: 121 additions & 47 deletions code/Frontend/lib/screens/login_screen.dart
Original file line number Diff line number Diff line change
@@ -1,59 +1,133 @@
import 'package:flutter/material.dart';

import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../widgets/custom_button.dart';
import 'dashboard_screen.dart'; // Import the dashboard screen
import 'registration_screen.dart'; // Import the registration screen
import '../widgets/Dividerwithtext.dart';

class LoginScreen extends StatelessWidget {
const LoginScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Login'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextField(
decoration: InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(),
),
),
SizedBox(height: 20),
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
border: OutlineInputBorder(),
),
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Navigate to the dashboard after login
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => DashboardScreen()),
);
},
child: Text('Login'),
),
SizedBox(height: 10),
CustomButton(
text: "Don't have an account? Register",
onPressed: () {
// Handle registration
// Navigate to the registration screen
Navigator.push(
context,
MaterialPageRoute(builder: (context) => RegistrationScreen()),
);
},
),
],
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF0468BF), Color(0xFFA1D6F3)], // Gradient colors
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Padding(
padding: const EdgeInsets.all(22.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('assert/images/Logo_Icon.jpg',
width: 100, height: 100),
const SizedBox(height: 20),
const Text(
'Login',
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Color(0xFFD0F0FF),
),
),
const SizedBox(height: 20),
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(100)),
prefixIcon: const Icon(Icons.email),
fillColor: Colors.white, // Set background color
filled: true,
floatingLabelBehavior: FloatingLabelBehavior.never,
),
),
const SizedBox(height: 20),
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(100)),
prefixIcon: const Icon(Icons.lock),
suffixIcon: const Icon(Icons.visibility),
fillColor: Colors.white, // Set background color
filled: true,
floatingLabelBehavior: FloatingLabelBehavior.never,
),
),
const SizedBox(height: 20),
const Align(
alignment: Alignment.centerRight,
child: Text(
'Forgot Password?',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
),
),
),
const SizedBox(height: 10),
CustomButton(
text: "Login",
fontSize: 30,
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
onPressed: () {
// Handle registration
// Navigate to the registration screen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const RegistrationScreen()),
);
},
),
const SizedBox(height: 20),
const DividerWithText(
text: "Or Login with",
lineColor: Color(0xFFD0F0FF),
thickness: 3.0,
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.facebook,
color: Color(0xFF1e52e6),
size: 55.0,
),
const SizedBox(width: 25,),
const Icon(
Icons.apple,
size: 55.0,
),
const SizedBox(width: 25,),
Image.asset('assert/images/Google_logo.png',
width: 55, height: 55),
],
),
const SizedBox(height: 20),
CustomButton(
text: "Don't have an account? Register",
onPressed: () {
// Handle registration
// Navigate to the registration screen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const RegistrationScreen()),
);
},
),
],
),
),
),
);
Expand Down
18 changes: 10 additions & 8 deletions code/Frontend/lib/screens/registration_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,43 @@ import 'package:flutter/material.dart';
import 'login_screen.dart'; // Import the login screen

class RegistrationScreen extends StatelessWidget {
const RegistrationScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Registration'),
title: const Text('Registration'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextField(
const TextField(
decoration: InputDecoration(
labelText: 'Name',
border: OutlineInputBorder(),
),
),
SizedBox(height: 20),
TextField(
const SizedBox(height: 20),
const TextField(
decoration: InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(),
),
),
SizedBox(height: 20),
TextField(
const SizedBox(height: 20),
const TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
border: OutlineInputBorder(),
),
),
SizedBox(height: 20),
const SizedBox(height: 20),
ElevatedButton(
child: Text("Already have an account? Login"),
child: const Text("Already have an account? Login"),
onPressed: () {
// Handle registration
// Navigate to the registration screen
Expand Down
41 changes: 41 additions & 0 deletions code/Frontend/lib/widgets/Dividerwithtext.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';

class DividerWithText extends StatelessWidget {
final String text;
final Color lineColor;
final double thickness;

const DividerWithText({
super.key,
required this.text,
this.lineColor = Colors.grey,
this.thickness = 1.0,
});

@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
child: Divider(
color: lineColor,
thickness: thickness,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
text,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w600),
),
),
Expanded(
child: Divider(
color: lineColor,
thickness: thickness,
),
),
],
);
}
}
40 changes: 37 additions & 3 deletions code/Frontend/lib/widgets/custom_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,48 @@ import 'package:flutter/material.dart';
class CustomButton extends StatelessWidget {
final String text;
final VoidCallback onPressed;
final Color backgroundColor;
final Color textColor;
final FontWeight fontWeight;
final String fontFamily;
final double fontSize;
final EdgeInsets padding;
final double elevation; // Controls the shadow intensity

CustomButton({required this.text, required this.onPressed});
const CustomButton({
super.key,
required this.text,
required this.onPressed,
this.backgroundColor = Colors.blue,
this.textColor = Colors.white,
this.fontWeight = FontWeight.normal,
this.fontFamily = 'Roboto',
this.fontSize = 16.0,
this.padding = const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
this.elevation = 4.0, // Default shadow elevation
});

@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
child: Text(text),
style: ElevatedButton.styleFrom(
backgroundColor: backgroundColor,
elevation: elevation, // Shadow effect
padding: padding, // Custom padding
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), // Rounded corners
),
),
child: Text(
text,
style: TextStyle(
color: textColor,
fontWeight: fontWeight,
fontFamily: fontFamily,
fontSize: fontSize,
),
),
);
}
}
}
Loading

0 comments on commit 60d127d

Please sign in to comment.