Add a signup screen

This commit is contained in:
Vishesh Handa
2020-11-19 12:20:47 +01:00
parent c89b72e667
commit 60ae75c3cc
3 changed files with 187 additions and 18 deletions

View File

@ -15,6 +15,7 @@ import 'package:gitjournal/screens/onboarding_screens.dart';
import 'package:gitjournal/screens/purchase_screen.dart';
import 'package:gitjournal/screens/purchase_thankyou_screen.dart';
import 'package:gitjournal/screens/settings_screen.dart';
import 'package:gitjournal/screens/signup_screen.dart';
import 'package:gitjournal/screens/tag_listing.dart';
import 'package:gitjournal/settings.dart';
import 'package:gitjournal/setup/screens.dart';
@ -99,6 +100,8 @@ class AppRouter {
return SettingsScreen();
case '/login':
return LoginPage();
case '/register':
return SignUpScreen();
case '/setupRemoteGit':
return GitHostSetupScreen(
repoFolderName: settings.folderName,

View File

@ -173,10 +173,7 @@ class _LoginPageState extends State<LoginPage> {
Widget _createAccountLabel() {
return InkWell(
onTap: () {
//Navigator.push(
// context, MaterialPageRoute(builder: (context) => SignUpPage()));
},
onTap: () => Navigator.pushNamed(context, "/register"),
child: Container(
margin: const EdgeInsets.symmetric(vertical: 20),
padding: const EdgeInsets.all(15),
@ -204,17 +201,11 @@ class _LoginPageState extends State<LoginPage> {
);
}
Widget _title() {
var textTheme = Theme.of(context).textTheme;
var style = textTheme.headline2.copyWith(fontFamily: "Lato");
return Text('GitJournal', style: style);
}
Widget _emailPasswordWidget() {
return Column(
children: <Widget>[
_entryField("Email id"),
_entryField("Password", isPassword: true),
EntryField("Email id"),
EntryField("Password", isPassword: true),
],
);
}
@ -227,10 +218,6 @@ class _LoginPageState extends State<LoginPage> {
height: height,
child: Stack(
children: <Widget>[
/*Positioned(
top: -height * .15,
right: -MediaQuery.of(context).size.width * .4,
child: BezierContainer()),*/
Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: ScrollViewWithoutAnimation(
@ -239,7 +226,7 @@ class _LoginPageState extends State<LoginPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: height * .12),
_title(),
FormTitle(),
const SizedBox(height: 50),
_emailPasswordWidget(),
const SizedBox(height: 20),
@ -259,9 +246,76 @@ class _LoginPageState extends State<LoginPage> {
),
),
),
Positioned(top: 15, left: 0, child: SafeArea(child: _backButton())),
Positioned(
top: 15, left: 0, child: SafeArea(child: FormBackButton())),
],
),
));
}
}
class FormBackButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
children: <Widget>[
Container(
child: const Icon(Icons.keyboard_arrow_left, color: Colors.black),
),
const Text(
'Back',
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
)
],
),
),
);
}
}
class EntryField extends StatelessWidget {
final String title;
final bool isPassword;
EntryField(this.title, {this.isPassword = false});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
const SizedBox(height: 10),
TextField(
obscureText: isPassword,
decoration: const InputDecoration(
border: InputBorder.none,
fillColor: Color(0xfff3f3f4),
filled: true,
),
)
],
),
);
}
}
class FormTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
var textTheme = Theme.of(context).textTheme;
var style = textTheme.headline2.copyWith(fontFamily: "Lato");
return Text('GitJournal', style: style);
}
}

View File

@ -0,0 +1,112 @@
import 'package:flutter/material.dart';
import 'package:gitjournal/screens/login_screen.dart';
class SignUpScreen extends StatefulWidget {
SignUpScreen({Key key}) : super(key: key);
@override
_SignUpScreenState createState() => _SignUpScreenState();
}
class _SignUpScreenState extends State<SignUpScreen> {
Widget _submitButton() {
return Container(
width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.symmetric(vertical: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(5)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.shade200,
offset: const Offset(2, 4),
blurRadius: 5,
spreadRadius: 2)
],
gradient: const LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Color(0xfffbb448), Color(0xfff7892b)])),
child: const Text(
'Register Now',
style: TextStyle(fontSize: 20, color: Colors.white),
),
);
}
Widget _loginAccountLabel() {
return InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
margin: const EdgeInsets.symmetric(vertical: 20),
padding: const EdgeInsets.all(15),
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Already have an account ?',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600),
),
const SizedBox(width: 10),
const Text(
'Login',
style: TextStyle(
color: Color(0xfff79c4f),
fontSize: 13,
fontWeight: FontWeight.w600,
),
),
],
),
),
);
}
Widget _emailPasswordWidget() {
return Column(
children: <Widget>[
EntryField("Email"),
EntryField("Password", isPassword: true),
],
);
}
@override
Widget build(BuildContext context) {
final height = MediaQuery.of(context).size.height;
return Scaffold(
body: Container(
height: height,
child: Stack(
children: <Widget>[
Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: height * .12),
FormTitle(),
const SizedBox(height: 50),
_emailPasswordWidget(),
const SizedBox(height: 20),
_submitButton(),
SizedBox(height: height * .14),
_loginAccountLabel(),
],
),
),
),
Positioned(
top: 15, left: 0, child: SafeArea(child: FormBackButton())),
],
),
),
);
}
}