import 'package:flutter/material.
dart';
import 'package:form_field_validator/form_field_validator.dart';
import 'package:myapp/login/Sign_up.dart';
import 'package:myapp/login/login_file.dart';
import 'package:myapp/menubar/Drawer_app.dart';
class HomePage extends StatefulWidget {
const HomePage({[Link]});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
late String username = '';
late String password = '';
bool _showpassword = true;
final emailController = TextEditingController();
final passwordController = TextEditingController();
final formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
centerTitle: true,
),
drawer: AppDrawer(),
body: SingleChildScrollView(
child: Form(
key: formKey,
child: Container(
height: 770,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: [Link],
end: [Link],
colors: [
[Link],
[Link].shade700,
]),
),
child: Column(
mainAxisAlignment: [Link],
children: [
//Top Text
Padding(
padding:
const [Link](right: 150, top: 40, left: 15),
child: Text(
'WELCOME TO MYAPP ',
style: TextStyle(
fontSize: 40,
fontWeight: [Link],
color: Colors.white70),
),
),
SizedBox(
height: 125,
),
//image of login file
// login form inside home
Center(
child: Padding(
padding: const [Link](
left: 20,
right: 20,
),
child: SingleChildScrollView(
child: Container(
height: 70,
child: TextFormField(
controller: emailController,
validator: MultiValidator([
RequiredValidator(
errorText: 'Email must be valid'),
EmailValidator(errorText: 'Invalid email format'),
]),
onChanged: (val) {
username = val;
},
style: TextStyle(fontSize: 18),
keyboardType: [Link],
decoration: InputDecoration(
fillColor: [Link],
filled: true,
border: [Link],
prefixIcon: Icon([Link]),
hintText: 'youremail@[Link]',
labelText: 'Email',
),
),
),
),
),
),
SizedBox(
height: 10,
),
// Login Password
Center(
child: Padding(
padding: const [Link](
top: 5,
left: 20,
right: 20,
),
child: SingleChildScrollView(
child: Container(
height: 70,
child: TextFormField(
validator: MultiValidator([
RequiredValidator(
errorText: 'Password is required'),
MinLengthValidator(8,
errorText:
'Password must be at least 8 characters
long'),
PatternValidator(r'(?=.*?[#?!@$%^&*-])',
errorText:
'Password must contain at least 1 special
character'),
]),
controller: passwordController,
onChanged: (value) {
password = value;
},
style: TextStyle(fontSize: 18),
obscureText: _showpassword,
keyboardType: [Link],
decoration: InputDecoration(
border: [Link],
prefixIcon: Icon([Link]),
fillColor: [Link],
filled: true,
labelText: 'Password',
hintText: 'Enter your password',
suffix: IconButton(
onPressed: () {
setState(() {
_showpassword = !_showpassword;
});
},
icon: Icon(
_showpassword
? Icons.visibility_off
: [Link],
color: [Link],
)),
),
),
),
),
),
),
SizedBox(
height: 5,
),
//forgot password
Row(
mainAxisAlignment: [Link],
children: [
Padding(
padding: const [Link](right: 15),
child: TextButton(
onPressed: () {
final SnackBar sb = SnackBar(
content: Text('You Clicked Forgot buttom'),
duration: Duration(seconds: 5),
action: SnackBarAction(
label: 'Close', onPressed: () {}),
);
[Link](context).showSnackBar(sb);
},
child: Text(
'FORGOT PASSWORD ?',
style: TextStyle(
color: Colors.white70,
),
),
),
),
],
),
SizedBox(
height: 5,
),
//login buttom
Padding(
padding: const [Link](
left: 20,
right: 20,
),
child: Container(
height: 60,
width: 360,
child: ElevatedButton(
onPressed: () {
final email = [Link];
final password = [Link];
final form = [Link];
if (form != null && [Link]()) {
// Validation successful
print('Email: $email');
print('Password: $password');
// Perform login or other actions here
}
if (username == 'sumanghimire@[Link]' &&
password == 'password') {
[Link](
context,
MaterialPageRoute(
builder: (context) => loginfile(),
));
}
},
child: Text(
'LOGIN',
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w700),
textAlign: [Link],
),
style: ButtonStyle(
elevation: MaterialStatePropertyAll(20),
shape: MaterialStatePropertyAll(StadiumBorder())),
),
),
),
//creat new account?
SizedBox(
height: 40,
),
Row(
mainAxisAlignment: [Link],
children: [
Text(
'DON\'T HAVE AN ACCOUNT ?',
style: TextStyle(
fontSize: 15,
color: Colors.white60,
fontWeight: FontWeight.w500),
),
TextButton(
onPressed: () {
[Link](
context,
MaterialPageRoute(
builder: (context) => SignUp(),
));
},
child: Text(
'SIGN UP',
style: TextStyle(
fontSize: 15,
color: Colors.white70,
fontWeight: FontWeight.w600),
))
],
),
// Sign in with google ............>
Padding(
padding:
const [Link](top: 10, left: 35, right: 30),
child: Container(
height: 50,
width: 220,
decoration: BoxDecoration(
borderRadius: [Link](24),
color: [Link],
),
child: TextButton(
onPressed: () {},
child: Row(
mainAxisAlignment: [Link],
children: [
[Link](
'assets/photos/[Link]',
width: 25,
height: 25,
),
SizedBox(
width: 15,
),
Text('Sign in With Google',
style: TextStyle(
fontSize: 15,
color: [Link](193, 15, 8, 8),
fontWeight: FontWeight.w500))
],
),
),
),
)
],
),
),
),
),
),
);
}
}