Ad Code

Register page ui created by flutter

 Register page UI created by flutter 

#Flutter  #Register_page



Source code:

 main.dart:

import 'package:flutter/material.dart';
import 'package:login_ui/pages/login_page.dart';

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

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: LoginPage(),
);
}
}

login_page.dart :

import 'package:flutter/material.dart';
import 'package:login_ui/components/button.dart';
import 'package:login_ui/components/text_field.dart';
import 'package:login_ui/pages/register_page.dart';

class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);

@override
State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
final emailController = TextEditingController();
final passwordController = TextEditingController();

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[350],
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 25),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [

Image.asset(
"assets/images/key.png",
height: 150,
),

const SizedBox(
height: 30,
),
const Text(
'Welcome back, you\'ve been missed',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(
height: 25,
),
MyTextField(
controller: emailController,
hintText: 'Email',
obscureText: false),
const SizedBox(
height: 10,
),
MyTextField(
controller: passwordController,
hintText: 'Password',
obscureText: true),
const SizedBox(
height: 10,
),
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(''),
Text(
'Forgotten password',
style: TextStyle(
color: Colors.blue, fontWeight: FontWeight.bold),
),
],
),
const SizedBox(
height: 15,
),
MyButton(onTap: () {}, text: 'Sign In'),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Not a member?'),
const SizedBox(
width: 5,
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MyRegisterPage()),
);
},
child: const Text(
'Register here',
style: TextStyle(color: Colors.blue),
),
)
],
),
],
),
),
),
),
);
}
}

register_page.dart:

import 'package:flutter/material.dart';

import '../components/button.dart';
import '../components/text_field.dart';

class MyRegisterPage extends StatefulWidget {
const MyRegisterPage({Key? key}) : super(key: key);

@override
State<MyRegisterPage> createState() => _MyRegisterPageState();
}

class _MyRegisterPageState extends State<MyRegisterPage> {

final emailController = TextEditingController();
final passwordController = TextEditingController();
final confirmPasswordController = TextEditingController();

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[350],
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 25),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// const Icon(
// Icons.lock,
// size: 80,
// ),

Image.asset(
"assets/images/signup.png",
height: 150,
),

const SizedBox(
height: 30,
),
const Text(
'Welcome for creating an account',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(
height: 25,
),
MyTextField(
controller: emailController,
hintText: 'Email',
obscureText: false),
const SizedBox(
height: 10,
),
MyTextField(
controller: passwordController,
hintText: 'Password',
obscureText: true),
const SizedBox(
height: 10,
),

MyTextField(
controller: confirmPasswordController,
hintText: 'Confirm password',
obscureText: true),
const SizedBox(
height: 10,
),

const SizedBox(
height: 15,
),
MyButton(onTap: () {}, text: 'Sign Up'),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Already a member?'),
const SizedBox(
width: 5,
),
GestureDetector(
onTap: () {},
child: const Text(
'Login here',
style: TextStyle(color: Colors.blue),
),
)
],
),
],
),
),
),
),
);
}
}

text_field.dart :

import 'package:flutter/material.dart';

class MyTextField extends StatelessWidget {
final TextEditingController controller;
final String hintText;
final bool obscureText;

const MyTextField(
{Key? key,
required this.controller,
required this.hintText,
required this.obscureText})
: super(key: key);

@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
obscureText: obscureText,
decoration: InputDecoration(
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.white)
),
fillColor: Colors.grey[200],
filled: true,
hintText: hintText,
hintStyle: TextStyle(
color: Colors.grey[700],
fontWeight: FontWeight.bold,
)
),
);
}
}

button.dart:

import 'package:flutter/material.dart';

class MyButton extends StatelessWidget {
final Function()? onTap;
final String text;

const MyButton({Key? key, required this.onTap, required this.text})
: super(key: key);

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(8),
),
child: Center(
child: Text(
text,
style: const TextStyle(color: Colors.white,fontWeight: FontWeight.bold ,fontSize: 18),
),
),
);
}
}


Post a Comment

0 Comments