Created
December 9, 2021 17:15
-
-
Save red-star25/b7e261ae38e4c0e9d547668e4f38756a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_screenutil/flutter_screenutil.dart'; | |
void main() => runApp( | |
MyApp(), | |
); | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return ScreenUtilInit( | |
designSize: const Size(360, 640), | |
builder: () { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: const Login(), | |
); | |
}); | |
} | |
} | |
class Login extends StatelessWidget { | |
const Login({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: SingleChildScrollView( | |
reverse: true, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.center, | |
children: [ | |
Image.asset( | |
'assets/images/sign_in.png', | |
height: 250.h, | |
fit: BoxFit.cover, | |
), | |
SizedBox(height: 10.h), | |
Padding( | |
padding: EdgeInsets.all(18.0.w), | |
child: Column( | |
children: [ | |
Text( | |
"Welcome Back", | |
style: TextStyle( | |
fontSize: 20.sp, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
SizedBox(height: 20.h), | |
const TextField( | |
decoration: InputDecoration( | |
hintText: 'Email', | |
label: Text( | |
'Email', | |
style: TextStyle( | |
color: Colors.blue, | |
), | |
), | |
), | |
), | |
SizedBox(height: 10.h), | |
const TextField( | |
obscureText: true, | |
decoration: InputDecoration( | |
hintText: 'Password', | |
label: Text( | |
'Password', | |
style: TextStyle( | |
color: Colors.blue, | |
), | |
), | |
), | |
), | |
SizedBox(height: 50.h), | |
SizedBox( | |
width: MediaQuery.of(context).size.width * 0.8, | |
height: 40.h, | |
child: ElevatedButton( | |
onPressed: () {}, | |
child: Text( | |
'Sign In', | |
style: TextStyle( | |
fontSize: 18.sp, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
), | |
), | |
SizedBox(height: 10.h), | |
Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Text( | |
"Or", | |
style: TextStyle(fontSize: 14.sp, color: Colors.grey), | |
), | |
SizedBox(width: 10.w), | |
GestureDetector( | |
onTap: () { | |
Navigator.push( | |
context, | |
MaterialPageRoute( | |
builder: (context) => const SignUp(), | |
), | |
); | |
}, | |
child: Text( | |
"Sign Up", | |
style: TextStyle( | |
fontSize: 14.sp, | |
color: Colors.blue, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
), | |
], | |
), | |
], | |
), | |
) | |
], | |
), | |
), | |
); | |
} | |
} | |
class SignUp extends StatelessWidget { | |
const SignUp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: SingleChildScrollView( | |
reverse: true, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.center, | |
children: [ | |
Image.asset( | |
'assets/images/sign_up.png', | |
height: 250.h, | |
fit: BoxFit.contain, | |
), | |
SizedBox(height: 10.h), | |
Padding( | |
padding: EdgeInsets.all(18.0.w), | |
child: Column( | |
children: [ | |
Text( | |
"Let's Get Started", | |
style: TextStyle( | |
fontSize: 20.sp, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
SizedBox(height: 10.h), | |
const TextField( | |
decoration: InputDecoration( | |
hintText: 'Username', | |
label: Text( | |
'Username', | |
style: TextStyle( | |
color: Colors.blue, | |
), | |
), | |
), | |
), | |
SizedBox(height: 10.h), | |
const TextField( | |
decoration: InputDecoration( | |
hintText: 'Email', | |
label: Text( | |
'Email', | |
style: TextStyle( | |
color: Colors.blue, | |
), | |
), | |
), | |
), | |
SizedBox(height: 10.h), | |
const TextField( | |
obscureText: true, | |
decoration: InputDecoration( | |
hintText: 'Password', | |
label: Text( | |
'Password', | |
style: TextStyle( | |
color: Colors.blue, | |
), | |
), | |
), | |
), | |
SizedBox(height: 10.h), | |
const TextField( | |
obscureText: true, | |
decoration: InputDecoration( | |
hintText: 'Confirm Password', | |
label: Text( | |
'Confirm Password', | |
style: TextStyle( | |
color: Colors.blue, | |
), | |
), | |
), | |
), | |
SizedBox(height: 20.h), | |
SizedBox( | |
width: MediaQuery.of(context).size.width * 0.8, | |
height: 40.h, | |
child: ElevatedButton( | |
onPressed: () {}, | |
child: Text( | |
'Create account', | |
style: TextStyle( | |
fontSize: 18.sp, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
), | |
), | |
SizedBox(height: 10.h), | |
Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Text( | |
"Or", | |
style: TextStyle(fontSize: 14.sp, color: Colors.grey), | |
), | |
SizedBox(width: 10.h), | |
GestureDetector( | |
onTap: () { | |
Navigator.push( | |
context, | |
MaterialPageRoute( | |
builder: (context) => const Login(), | |
), | |
); | |
}, | |
child: Text( | |
"Login", | |
style: TextStyle( | |
fontSize: 14.sp, | |
color: Colors.blue, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
), | |
], | |
), | |
], | |
), | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment