Skip to content

Commit

Permalink
Merge pull request #19 from SriramPatibanda/login
Browse files Browse the repository at this point in the history
Welcome Screen
  • Loading branch information
adithyaanilkumar authored Oct 4, 2020
2 parents 3d07f31 + 8b249f4 commit edbb015
Show file tree
Hide file tree
Showing 20 changed files with 438 additions and 133 deletions.
1 change: 1 addition & 0 deletions app/safenet/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
Binary file added app/safenet/fonts/Montserrat-Bold.ttf
Binary file not shown.
Binary file added app/safenet/fonts/Montserrat-ExtraBold.ttf
Binary file not shown.
Binary file added app/safenet/fonts/Montserrat-ExtraLight.ttf
Binary file not shown.
Binary file added app/safenet/fonts/Montserrat-Light.ttf
Binary file not shown.
Binary file added app/safenet/fonts/Montserrat-Medium.ttf
Binary file not shown.
Binary file added app/safenet/fonts/Montserrat-Regular.ttf
Binary file not shown.
6 changes: 6 additions & 0 deletions app/safenet/lib/core/viewmodals/login_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:flutter/material.dart';

class LoginModel extends ChangeNotifier {
String _title = "Safenet";
String get title => _title;
}
6 changes: 6 additions & 0 deletions app/safenet/lib/core/viewmodals/register_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:flutter/material.dart';

class RegisterModel extends ChangeNotifier {
String _title = "Safenet";
String get title => _title;
}
121 changes: 19 additions & 102 deletions app/safenet/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:safenet/core/viewmodals/login_model.dart';
import 'package:safenet/ui/views/login_view.dart';
import 'package:safenet/ui/views/register_view.dart';
import 'package:safenet/ui/views/welcome_screen.dart';

void main() {
runApp(MyApp());
Expand All @@ -8,110 +13,22 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'SafeNet',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;

void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}

@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
return ChangeNotifierProvider<LoginModel>(
create: (context) => LoginModel(),
child: MaterialApp(
initialRoute: 'welcome',
routes: {
WelcomeScreen.id: (context) => WelcomeScreen(),
RegisterView.id: (context) => RegisterView(),
LoginView.id: (context) => LoginView(),
},
theme: ThemeData(
fontFamily: 'Montserrat',
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: WelcomeScreen(),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
20 changes: 20 additions & 0 deletions app/safenet/lib/ui/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:flutter/material.dart';

const kTextFieldDecoration = InputDecoration(
hintText: 'Enter a value',
contentPadding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.lightBlueAccent, width: 1.0),
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.lightBlueAccent, width: 2.0),
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
);

const kSocialMediaDecoration =
BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(10.0)));
34 changes: 34 additions & 0 deletions app/safenet/lib/ui/customWidgets/customSignInButton.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';

class CustomSignInButton extends StatelessWidget {
final Function onPressed;
final String buttonText;
final Color buttonColor;

CustomSignInButton(
{this.buttonColor, this.buttonText, @required this.onPressed});

@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(vertical: 10.0),
child: Material(
color: buttonColor,
borderRadius: BorderRadius.circular(10.0),
elevation: 5.0,
child: MaterialButton(
onPressed: onPressed,
minWidth: 400.0,
height: 42.0,
child: Text(
buttonText,
style: TextStyle(
color: Colors.white,
),
),
),
),
);
}
}
// Color(0xff0278ae)
18 changes: 18 additions & 0 deletions app/safenet/lib/ui/customWidgets/facebookSignInButton.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart';

class FacebookSignInButton extends StatelessWidget {
final String text;

FacebookSignInButton({this.text});
@override
Widget build(BuildContext context) {
return Container(
width: 400,
height: 50.0,
child: SignInButton(Buttons.Facebook, text: text, onPressed: () {
print("Clicked facebook");
}),
);
}
}
19 changes: 19 additions & 0 deletions app/safenet/lib/ui/customWidgets/googleSignInButton.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart';

class GoogleSignInButton extends StatelessWidget {
final String text;

GoogleSignInButton({this.text});

@override
Widget build(BuildContext context) {
return Container(
width: 400,
height: 50.0,
child: SignInButton(Buttons.Google, text: text, onPressed: () {
print("Clicked google");
}),
);
}
}
19 changes: 19 additions & 0 deletions app/safenet/lib/ui/customWidgets/mainTitle.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:safenet/core/viewmodals/login_model.dart';

class MainTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Text(
Provider.of<LoginModel>(context).title,
style: TextStyle(
fontFamily: 'MontserratExtraBold',
fontWeight: FontWeight.bold,
fontSize: 60.0,
),
),
);
}
}
87 changes: 87 additions & 0 deletions app/safenet/lib/ui/views/login_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import 'package:safenet/ui/constants.dart';
import 'package:safenet/ui/customWidgets/customSignInButton.dart';
import 'package:safenet/ui/customWidgets/facebookSignInButton.dart';
import 'package:safenet/ui/customWidgets/googleSignInButton.dart';
import 'package:safenet/ui/customWidgets/mainTitle.dart';
import 'package:safenet/ui/views/register_view.dart';

class LoginView extends StatelessWidget {
static const String id = 'loginView';
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 120.0),
Center(child: MainTitle()),
SizedBox(
height: 80.0,
),
TextField(
keyboardType: TextInputType.phone,
onChanged: null,
decoration: kTextFieldDecoration.copyWith(
hintText: 'Enter your Phone Number',
prefixIcon: Icon(Icons.person)),
),
SizedBox(
height: 15.0,
),
TextField(
obscureText: true,
onChanged: null,
decoration: kTextFieldDecoration.copyWith(
hintText: 'Enter your Password',
prefixIcon: Icon(Icons.lock_outline)),
),
SizedBox(
height: 15.0,
),
CustomSignInButton(
onPressed: null,
buttonColor: Color(0xff51adcf),
buttonText: "Sign In",
),
SizedBox(
height: 8.0,
),
FlatButton(onPressed: null, child: Text("Forgot Password?")),
SizedBox(
height: 8.0,
),
GoogleSignInButton(),
SizedBox(
height: 15.0,
),
FacebookSignInButton(),
SizedBox(
height: 40.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Don't have an account?"),
FlatButton(
onPressed: () {
Navigator.pushNamed(context, RegisterView.id);
},
padding: EdgeInsets.only(left: 0.0),
child: Text(
"Create one",
style: TextStyle(color: Color(0xff51adcf)),
),
)
],
)
],
),
),
),
);
}
}
Loading

0 comments on commit edbb015

Please sign in to comment.