In this tutorial, we’ll learn how to create a beautiful Flutter login and registration screen UI design. The complete source code of the mentioned Flutter login and registration design will be provided in the end.
Outline
- Introduction: Flutter Login and Registration Screen UI Design
- Flutter Login and Registration Screen UI Design Template Source Code
- Conclusion
Introduction: Flutter Login And Registration Screen UI Design
We’ve used a toggle at the end of screen. Clicking on the login will show the login form while clicking on signup will display registration form. Widgets that are used in creating this beautiful Flutter login and registration UI design are listed below:
- Flutter Column Widget
- Flutter Row Widget
- Flutter Stack Widget
- Flutter Container Widget
- Flutter Gradient Container Widget
- Flutter Textfield Widget
- Flutter Gesture Detector Widget
- Flutter Inkwell Widget
- Flutter Text Widget
- Flutter Positioned Widget
- Flutter Single Child Scroll View Widget
- Flutter Padding Widget
- Flutter Snackbar Widget
I’ve written detailed articles on these widgets, you can check them out as well.
The complete source code of this beautiful Flutter login and registration screen design is available in the below section.
Try to understand how every Flutter widget is doing its role in this beautiful login and registration screen design and implement this design from scratch.
You can paste this code inside your main file. No additional packages required. Hope you’ll like it.
Flutter Login and Registration Screen UI Design Template Source Code
import 'package:flutter/material.dart'; main() { runApp(myApp()); } class myApp extends StatelessWidget { const myApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: LoginScreen(), ); } } // beautiful Flutter login and registration screen UI class LoginScreen extends StatefulWidget { const LoginScreen({Key? key}) : super(key: key); @override State<LoginScreen> createState() => _LoginScreenState(); } class _LoginScreenState extends State<LoginScreen> { bool loginSelected = true; bool showPassword = false; bool showConfirmPassword = false; @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Container( height: double.infinity, width: double.infinity, decoration: BoxDecoration( gradient: LinearGradient(colors: [Colors.purple, Colors.orange])), child: Stack( children: [ Positioned(top: 50, left: 100, child: customContainer(100, 100)), Positioned(top: 50, right: 70, child: customContainer(150, 150)), Positioned( top: 130, right: 150, child: customContainer(100, 100), ), Positioned( bottom: 150, right: 150, child: customContainer(50, 50), ), SingleChildScrollView( padding: EdgeInsets.only(top: 250), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ emailField(), passwordField(), !loginSelected ? SizedBox() : forgotPassword(), loginSelected ? SizedBox() : confirmPasswordField(), !loginSelected ? SizedBox( height: 40, ) : SizedBox(), button(), Align( alignment: Alignment.topCenter, child: Container( margin: EdgeInsets.only(top: 10), height: 40, width: 150, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), gradient: LinearGradient( colors: [Colors.purple, Colors.orange])), child: Row( children: [ !loginSelected ? Expanded( child: Center( child: GestureDetector( onTap: () { setState(() { print('tap'); loginSelected = true; }); }, child: Text( 'Login', style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500), ), ), )) : Expanded( child: Container( alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), gradient: LinearGradient(colors: [ Colors.purple, Colors.orange ])), child: Text( 'Login', style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500), ), )), loginSelected ? Expanded( child: Center( child: TextButton( onPressed: () { setState(() { print('tap'); loginSelected = false; }); }, child: Text( 'Register', style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500), ), ), )) : Expanded( child: Container( alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), gradient: LinearGradient(colors: [ Colors.purple, Colors.orange ])), child: Text( 'Sign Up', style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500), ), )) ], ), ), ), ], ), ) ], ), ), ), ); } // Beautiful flutter login and registration template screen ui design Widget customContainer(height, width) { return Container( height: double.parse(height.toString()), width: double.parse(width.toString()), decoration: BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient(colors: [Colors.orange, Colors.purple])), ); } Widget emailField() { return Padding( padding: const EdgeInsets.symmetric(horizontal: 60), child: TextField( style: TextStyle(color: Colors.white70, fontSize: 14), decoration: InputDecoration( prefixIconConstraints: BoxConstraints(minWidth: 24), prefixIcon: Padding( padding: EdgeInsets.only(right: 10), child: Icon( Icons.email, color: Colors.white70, size: 20, ), ), hintText: 'Enter email', hintStyle: TextStyle(color: Colors.white60, fontSize: 14), enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.white60, width: .4)), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.white70, width: .4))), )); } Widget passwordField() { return Padding( padding: const EdgeInsets.symmetric(horizontal: 60).copyWith(top: 12), child: TextField( obscureText: showPassword ? false : true, style: TextStyle(color: Colors.white70, fontSize: 14), decoration: InputDecoration( prefixIconConstraints: BoxConstraints(minWidth: 24), suffixIconConstraints: BoxConstraints(minWidth: 24), prefixIcon: Padding( padding: EdgeInsets.only(right: 10), child: Icon( Icons.lock, color: Colors.white70, size: 20, ), ), suffixIcon: Padding( padding: EdgeInsets.only(left: 10), child: GestureDetector( onTap: () { setState(() { showPassword = !showPassword; }); }, child: Icon( showPassword ? Icons.visibility : Icons.visibility_off, color: Colors.white70, size: 20, ), ), ), hintText: 'Enter password', hintStyle: TextStyle(color: Colors.white60, fontSize: 14), enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.white60, width: .4)), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.white70, width: .4))), )); } Widget confirmPasswordField() { return Padding( padding: const EdgeInsets.symmetric(horizontal: 60).copyWith(top: 12), child: TextField( obscureText: showConfirmPassword ? false : true, style: TextStyle(color: Colors.white70, fontSize: 14), decoration: InputDecoration( prefixIconConstraints: BoxConstraints(minWidth: 24), suffixIconConstraints: BoxConstraints(minWidth: 24), prefixIcon: Padding( padding: EdgeInsets.only(right: 10), child: Icon( Icons.lock, color: Colors.white70, size: 20, ), ), suffixIcon: Padding( padding: EdgeInsets.only(left: 10), child: GestureDetector( onTap: () { setState(() { showConfirmPassword = !showConfirmPassword; }); }, child: Icon( showConfirmPassword ? Icons.visibility : Icons.visibility_off, color: Colors.white70, size: 20, ), ), ), hintText: 'Confirm password', hintStyle: TextStyle(color: Colors.white60, fontSize: 14), enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.white60, width: .4)), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.white70, width: .4))), )); } Widget forgotPassword() { return Align( alignment: Alignment.centerRight, child: Padding( padding: const EdgeInsets.only(top: 10, right: 58, bottom: 30), child: InkWell( onTap: () { // navigate to other screen }, child: Text( 'Forgot password?', style: TextStyle( color: Colors.white70, fontSize: 12, fontWeight: FontWeight.w700), ), ), ), ); } Widget button() { return GestureDetector( onTap: () { ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text('Clicked'))); }, child: Container( alignment: Alignment.center, margin: EdgeInsets.symmetric(horizontal: 60).copyWith(bottom: 15), height: 50, width: double.infinity, decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(3, 3), blurRadius: 4, spreadRadius: 1, color: Colors.black12.withOpacity(.08)) ], borderRadius: BorderRadius.circular(50) .copyWith(topRight: Radius.circular(0)), gradient: LinearGradient(colors: [ Colors.orange, Colors.purple, ])), child: Text( loginSelected ? 'Sign In' : 'Register', style: TextStyle( color: Colors.white70, fontSize: 14, fontWeight: FontWeight.w700), ), ), ); } }
Conclusion
To conclude this tutorial, hope you now have a complete and in-depth practical knowledge of how to create this beautiful Flutter login and registration screen UI design. I’d be looking forward to have your feedback on this post.
I’d also love to see you visit my other tutorials on Flutter app development and Python programming as well. Thank you for reading this post.
You might also like:
How To Use Flutter FloatingActionButton OnPressed [Flutter Easy Guide]
Beautiful Flutter Animated Login Screen UI Design [Free Source Code]
[Solved] Flutter Elevated Button Remove Padding Implementation
How To Use Flutter TextButton OnPressed [Flutter Easy Guide]
How To Easily Customize Flutter FloatingActionButton Widget
[Solved] How To Use Flutter OutlinedButton OnPressed
How To Use Animated Container In Flutter? Explained With Example
How To Set Flutter Raised Button Rounded Corners [Easy Flutter Guide]