diff --git a/lib/app_router.dart b/lib/app_router.dart index 2ac5e24c..abfff5b2 100644 --- a/lib/app_router.dart +++ b/lib/app_router.dart @@ -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, diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index d1c48565..e49195e7 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -173,10 +173,7 @@ class _LoginPageState extends State { 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 { ); } - 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: [ - _entryField("Email id"), - _entryField("Password", isPassword: true), + EntryField("Email id"), + EntryField("Password", isPassword: true), ], ); } @@ -227,10 +218,6 @@ class _LoginPageState extends State { height: height, child: Stack( children: [ - /*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 { mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: height * .12), - _title(), + FormTitle(), const SizedBox(height: 50), _emailPasswordWidget(), const SizedBox(height: 20), @@ -259,9 +246,76 @@ class _LoginPageState extends State { ), ), ), - 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: [ + 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: [ + 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); + } +} diff --git a/lib/screens/signup_screen.dart b/lib/screens/signup_screen.dart new file mode 100644 index 00000000..b1606382 --- /dev/null +++ b/lib/screens/signup_screen.dart @@ -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 { + 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( + 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: [ + 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: [ + 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: [ + Container( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + 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())), + ], + ), + ), + ); + } +}