Skip to content

Commit

Permalink
Merge pull request #144 from Samdid/loginscreen
Browse files Browse the repository at this point in the history
Added login screen(with all the resolved changes)
  • Loading branch information
himanshusharma89 authored Mar 19, 2021
2 parents 152c0d2 + 7e0821c commit d2ea9a4
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 3 deletions.
Binary file added assets/items/fb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/items/google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:provider/provider.dart';

import 'package:retro_shopping/views/login.dart';
import 'package:retro_shopping/views/cart.dart';
import 'package:retro_shopping/views/home.dart';
import 'package:retro_shopping/views/search.dart';
Expand Down
7 changes: 5 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import 'package:provider/provider.dart';
import 'package:retro_shopping/helpers/ad_state.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:retro_shopping/views/login.dart';
import 'dashboard.dart';



Future<void> main() async {
//firebase Initialization
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -51,9 +54,9 @@ class MyApp extends StatelessWidget {
textTheme:
GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme)),
routes: <String, WidgetBuilder>{
'/dashboard': (BuildContext context) => Dashboard(),
'/login': (BuildContext context) => LoginScreen(),
},
home: Dashboard(),
home: LoginScreen(),
),
);
}
Expand Down
235 changes: 235 additions & 0 deletions lib/views/login.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/dashboard.dart';

class LoginScreen extends StatefulWidget{
@override
State<StatefulWidget> createState() {
return LoginScreenState();
}
}

TextEditingController _emailController = TextEditingController();
TextEditingController _passwordController = TextEditingController();

class LoginScreenState extends State<LoginScreen>{
@override
Widget build(BuildContext context) {
final double height = MediaQuery.of(context).size.height;
final double width = MediaQuery.of(context).size.width;
return Scaffold(

body: Stack(
// ignore: always_specify_types
children: [
Center(
child: Stack(
// ignore: always_specify_types
children: [
Transform.translate(
offset: const Offset(5,5),
child: Container(
width: width * 0.88,
height: height * 0.605,
decoration: const BoxDecoration(color: Colors.black),
),
),
Container(
height: height * 0.60,
//height: 458,
width: width * 0.87,
decoration: const BoxDecoration(color: RelicColors.primaryColor),
child: Center(
child: ListView(
// ignore: always_specify_types
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20,vertical: 10),
child: Row(
// ignore: always_specify_types, prefer_const_literals_to_create_immutables
children: [
// ignore: prefer_const_literals_to_create_immutables,
const Text('Login',
style: TextStyle(
fontSize: 40,
color: Colors.white,
fontFamily: 'pix M 8pt',
fontWeight: FontWeight.bold
),),
],
),
),
SizedBox(
height: height*0.011,
),
const Padding(
padding: EdgeInsets.only(left:20.0, right: 20.0),
child: Text('Welcome back,\n please login to your account',
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontFamily: 'pix M 8pt',
//fontWeight: FontWeight.bold
),),
),
SizedBox(
height: height*0.020,
),
Stack(
// ignore: always_specify_types
children:[
Transform.translate(
offset: const Offset(25,10),
child: Container(
color: Colors.black,
width: width * 0.77,
height: height * 0.065,
),
),
Padding(
padding: const EdgeInsets.only(left:20.0, right: 20.0),
// ignore: sized_box_for_whitespace
child: Container(
height: height*0.07,
child: TextField(
controller: _emailController,
decoration: const InputDecoration(
labelText: 'Email Address',
labelStyle: TextStyle(
fontSize: 20.0,
color: Colors.black
),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.zero
)
)
),
),
),
]
),

SizedBox(
height: height*0.030,
),
Stack(
// ignore: always_specify_types
children:[
Transform.translate(
offset: const Offset(25,10),
child: Container(
color: Colors.black,
width: width * 0.77,
height: height * 0.065,
),
),
Padding(
padding: const EdgeInsets.only(left:20.0, right: 20.0),
// ignore: sized_box_for_whitespace
child: Container(
height: height*0.07,
child: TextField(
controller: _passwordController,
decoration: const InputDecoration(
labelText: 'Password',
labelStyle: TextStyle(
fontSize: 20.0,
color: Colors.black
),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.zero
)
)
),
),
),
]
),
SizedBox(
height: height*0.030,
),
Padding(
padding: const EdgeInsets.only(left:20.0, right: 20.0),
child: InkWell(
onTap: (){
debugPrint('Login!');
// ignore: always_specify_types
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context){
return Dashboard();
}));
},
child: RetroButton(
upperColor: Colors.black,
lowerColor: Colors.white,
height: height * 0.065,
width: width * 0.40,
borderColor: Colors.white,
child: const Center(
child: Text(
'Login',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
),
),
SizedBox(
height: height*0.040,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 115),
child: Row(
// ignore: always_specify_types
children:[
InkWell(
onTap: (){
debugPrint('Navigate to google!');
},
// ignore: sized_box_for_whitespace
child: Container(
width: 45,
height: 45,
child: Image.asset('assets/items/google.png',)
),
),
SizedBox(
width: width*0.05,
),
InkWell(
onTap: (){
debugPrint('Navigate to facebook!');
},
// ignore: sized_box_for_whitespace
child: Container(
width: 45,
height: 45,
child: Image.asset('assets/items/fb.png')
),
),
]
),
)

],
),
)
),
],
),
),
],
),
);
}
}

0 comments on commit d2ea9a4

Please sign in to comment.