Commit 1a8fc67b authored by Budi Prasetyo's avatar Budi Prasetyo

nambah back

parent ed9c4abe
...@@ -17,7 +17,10 @@ class _ForgotPasswordState extends State<ForgotPassword> { ...@@ -17,7 +17,10 @@ class _ForgotPasswordState extends State<ForgotPassword> {
return Stack( return Stack(
children: [ children: [
Container( Container(
decoration: BoxDecoration(image: DecorationImage(image: AssetImage('assets/images/medapp_image1.png'),fit: BoxFit.fill)), decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/medapp_image2.jpg'),
fit: BoxFit.fill)),
), ),
Padding( Padding(
padding: const EdgeInsets.all(21.0), padding: const EdgeInsets.all(21.0),
......
...@@ -29,288 +29,300 @@ class _loginState extends State<login> { ...@@ -29,288 +29,300 @@ class _loginState extends State<login> {
setPageTitle('Login MedApps', context); setPageTitle('Login MedApps', context);
var screenSize = MediaQuery.of(context).size; var screenSize = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
body: Container( body: Stack(
decoration: const BoxDecoration( children: [
image: DecorationImage(
image: AssetImage("assets/images/bg-medapp.png"), Container(
fit: BoxFit.fill, decoration: const BoxDecoration(
)), image: DecorationImage(
height: screenSize.height, image: AssetImage("assets/images/bg-medapp.png"),
width: screenSize.width, fit: BoxFit.fill,
padding: EdgeInsets.only( )),
left: screenSize.width * 0.15, height: screenSize.height,
top: screenSize.height * 0.13, width: screenSize.width,
bottom: screenSize.height * 0.13), padding: EdgeInsets.only(
child: Stack( left: screenSize.width * 0.15,
children: [ top: screenSize.height * 0.13,
Container( bottom: screenSize.height * 0.13),
decoration: BoxDecoration( child: Stack(
color: const Color.fromARGB(255, 10, 116, 255), children: [
borderRadius: BorderRadius.circular(20),
), Container(
width: screenSize.width * 0.36, decoration: BoxDecoration(
height: screenSize.height * 0.9, color: const Color.fromARGB(255, 10, 116, 255),
child: Image.asset(
"assets/logo/eksad.jpg",
),
),
Padding(
padding: EdgeInsets.only(
left: screenSize.width * 0.33, top: screenSize.height * 0.07),
child: Container(
width: screenSize.width * 0.3,
height: screenSize.height * 0.6,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
border: Border.all( ),
width: 5, width: screenSize.width * 0.36,
color: const Color.fromARGB(255, 10, 116, 255), height: screenSize.height * 0.9,
), child: Image.asset(
boxShadow: [ "assets/logo/eksad.jpg",
BoxShadow( ),
color: const Color.fromARGB(255, 10, 116, 255) ),
.withAlpha(60), Padding(
blurRadius: 15.0, padding: EdgeInsets.only(
spreadRadius: 20.0, left: screenSize.width * 0.33, top: screenSize.height * 0.07),
offset: const Offset(
0.0,
3.0,
),
),
]),
child: Form(
key: formKey,
child: Container( child: Container(
padding: EdgeInsets.only( width: screenSize.width * 0.3,
left: screenSize.width * 0.045, height: screenSize.height * 0.6,
top: screenSize.height * 0.05), decoration: BoxDecoration(
width: screenSize.width * 0.36, color: Colors.white,
height: screenSize.height * 0.9, borderRadius: BorderRadius.circular(20),
child: Column( border: Border.all(
crossAxisAlignment: CrossAxisAlignment.start, width: 5,
children: [ color: const Color.fromARGB(255, 10, 116, 255),
Container(
padding:
EdgeInsets.only(left: screenSize.width * 0.055),
height: screenSize.width * 0.02,
child: Image.asset("assets/logo/medapp-logo.png"),
), ),
const Spacer( boxShadow: [
flex: 1, BoxShadow(
), color: const Color.fromARGB(255, 10, 116, 255)
Row( .withAlpha(60),
children: [ blurRadius: 15.0,
Icon( spreadRadius: 20.0,
Icons.email_outlined, offset: const Offset(
color: Colors.grey[500], 0.0,
size: screenSize.width * 0.01, 3.0,
), ),
const SizedBox(
width: 10,
),
const Text("Email"),
],
),
const Spacer(
flex: 1,
),
Container(
height: 40,
width: screenSize.width * 0.2,
child: TextFormField(
controller: _editingController,
textAlign: TextAlign.start,
decoration: InputDecoration(
labelText: "Enter Your Email",
hintStyle: const TextStyle(),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
),
),
validator: (value) {
if (value == null || value.trim().isEmpty) {
_editingController.clear();
return "please enter your email address";
} else if (!RegExp(r'\S+@\S+\.\S+')
.hasMatch(value)) {
return 'Please enter a valid email address';
} else {
return null;
}
},
onChanged: (value) => _usmail = value,
), ),
), ]),
const Spacer( child: Form(
flex: 2, key: formKey,
), child: Container(
Row( padding: EdgeInsets.only(
left: screenSize.width * 0.045,
top: screenSize.height * 0.05),
width: screenSize.width * 0.36,
height: screenSize.height * 0.9,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon( Container(
Icons.vpn_key_outlined, padding:
color: Colors.grey[500], EdgeInsets.only(left: screenSize.width * 0.055),
size: screenSize.width * 0.01, height: screenSize.width * 0.02,
child: Image.asset("assets/logo/medapp-logo.png"),
), ),
const SizedBox( const Spacer(
width: 10, flex: 1,
), ),
const Text("Password"), Row(
], children: [
), Icon(
const Spacer( Icons.email_outlined,
flex: 1, color: Colors.grey[500],
), size: screenSize.width * 0.01,
Container( ),
height: 40, const SizedBox(
width: screenSize.width * 0.2, width: 10,
child: TextFormField( ),
controller: _editingController2, const Text("Email"),
textAlign: TextAlign.start, ],
obscureText: _isObscure, ),
decoration: InputDecoration( const Spacer(
labelText: "Password", flex: 1,
suffixIcon: IconButton(
icon: Icon(_isObscure
? Icons.visibility
: Icons.visibility_off),
onPressed: () {
setState(
() {
_isObscure = !_isObscure;
},
);
},
),
hintStyle: const TextStyle(),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0)),
), ),
validator: (value) {
if (value == null || value.trim().isEmpty) {
_editingController2.clear();
return 'This field is required';
} else if (value.trim().length < 8) {
return 'Password must be at least 8 characters in length';
}
return null;
},
onChanged: (value) => _uspswd = value,
),
),
const Spacer(
flex: 2,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(onPressed: (){
Navigator.pushNamed(context, '/reset_password');
}, child: Text('Forgot Password?')),
SizedBox(width: 52,)
],
),
const Spacer(
flex: 2,
),
Row(
children: [
Container( Container(
height: 30, height: 40,
width: screenSize.width * 0.08, width: screenSize.width * 0.2,
child: ElevatedButton( child: TextFormField(
onPressed: () { controller: _editingController,
if (_usmail == 'admin@admin.com' && textAlign: TextAlign.start,
_uspswd != 'administrator') { decoration: InputDecoration(
showDialog<String>( labelText: "Enter Your Email",
context: context, hintStyle: const TextStyle(),
builder: (BuildContext context) => border: OutlineInputBorder(
AlertDialog( borderRadius: BorderRadius.circular(5.0),
title: const Text('Gagal login'), ),
content: const Text( ),
'Password anda salah!!!'), validator: (value) {
actions: <Widget>[ if (value == null || value.trim().isEmpty) {
TextButton( _editingController.clear();
onPressed: () => return "please enter your email address";
Navigator.pop(context, 'OK'), } else if (!RegExp(r'\S+@\S+\.\S+')
child: const Text('OK'), .hasMatch(value)) {
), return 'Please enter a valid email address';
],
),
);
} else if (_usmail == 'client@client.com' &&
_uspswd != 'clientpage') {
showDialog<String>(
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Gagal login'),
content: const Text(
'Password anda salah!!!'),
actions: <Widget>[
TextButton(
onPressed: () =>
Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
} else if (_usmail == 'admin@admin.com' &&
_uspswd == 'administrator') {
Navigator.pushNamed(context, '/admin');
} else if (_usmail == 'client@client.com' &&
_uspswd == 'clientpage') {
Navigator.pushNamed(context, '/client');
} else { } else {
showDialog<String>( return null;
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Gagal login'),
content: const Text(
'Akun Belum terdaftar, Silahkan Registrasi'),
actions: <Widget>[
TextButton(
onPressed: () =>
Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
} }
}, },
child: const Text("LOGIN"), onChanged: (value) => _usmail = value,
), ),
), ),
SizedBox( const Spacer(
width: screenSize.width * 0.04, flex: 2,
),
Row(
children: [
Icon(
Icons.vpn_key_outlined,
color: Colors.grey[500],
size: screenSize.width * 0.01,
),
const SizedBox(
width: 10,
),
const Text("Password"),
],
),
const Spacer(
flex: 1,
), ),
Container( Container(
height: 30, height: 40,
width: screenSize.width * 0.08, width: screenSize.width * 0.2,
child: ElevatedButton( child: TextFormField(
onPressed: () { controller: _editingController2,
Navigator.pushNamed(context, '/register'); textAlign: TextAlign.start,
obscureText: _isObscure,
decoration: InputDecoration(
labelText: "Password",
suffixIcon: IconButton(
icon: Icon(_isObscure
? Icons.visibility
: Icons.visibility_off),
onPressed: () {
setState(
() {
_isObscure = !_isObscure;
},
);
},
),
hintStyle: const TextStyle(),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0)),
),
validator: (value) {
if (value == null || value.trim().isEmpty) {
_editingController2.clear();
return 'This field is required';
} else if (value.trim().length < 8) {
return 'Password must be at least 8 characters in length';
}
return null;
}, },
child: const Text("REGISTER"), onChanged: (value) => _uspswd = value,
), ),
), ),
const Spacer(
flex: 2,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(onPressed: (){
Navigator.pushNamed(context, '/reset_password');
}, child: Text('Forgot Password?')),
SizedBox(width: 52,)
],
),
const Spacer(
flex: 2,
),
Row(
children: [
Container(
height: 30,
width: screenSize.width * 0.08,
child: ElevatedButton(
onPressed: () {
if (_usmail == 'admin@admin.com' &&
_uspswd != 'administrator') {
showDialog<String>(
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Gagal login'),
content: const Text(
'Password anda salah!!!'),
actions: <Widget>[
TextButton(
onPressed: () =>
Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
} else if (_usmail == 'client@client.com' &&
_uspswd != 'clientpage') {
showDialog<String>(
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Gagal login'),
content: const Text(
'Password anda salah!!!'),
actions: <Widget>[
TextButton(
onPressed: () =>
Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
} else if (_usmail == 'admin@admin.com' &&
_uspswd == 'administrator') {
Navigator.pushNamed(context, '/admin');
} else if (_usmail == 'client@client.com' &&
_uspswd == 'clientpage') {
Navigator.pushNamed(context, '/client');
} else {
showDialog<String>(
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Gagal login'),
content: const Text(
'Akun Belum terdaftar, Silahkan Registrasi'),
actions: <Widget>[
TextButton(
onPressed: () =>
Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
}
},
child: const Text("LOGIN"),
),
),
SizedBox(
width: screenSize.width * 0.04,
),
Container(
height: 30,
width: screenSize.width * 0.08,
child: ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/register');
},
child: const Text("REGISTER"),
),
),
],
),
const Spacer(
flex: 7,
),
], ],
), ),
const Spacer( ),
flex: 7,
),
],
), ),
), ),
), ),
), ],
), ),
], ),
), Padding(
padding: const EdgeInsets.all(21.0),
child: ElevatedButton(onPressed: (){
Navigator.pushNamed(context, '/');
}, child: Icon(Icons.arrow_back)),
),
],
), ),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment