From c721ff9954f4205fd09aad40842a59511f761fad Mon Sep 17 00:00:00 2001 From: samdid Date: Fri, 19 Mar 2021 01:04:27 +0530 Subject: [PATCH 1/2] Added login screen(With all resolved changes) --- assets/items/fb.png | Bin 0 -> 700 bytes assets/items/google.png | Bin 0 -> 837 bytes lib/dashboard.dart | 2 +- lib/main.dart | 8 +- lib/views/login.dart | 228 ++++++++++++++++++++++++++++++++++++++++ lib/widgets/splash.dart | 55 ++++++++++ pubspec.yaml | 3 +- 7 files changed, 292 insertions(+), 4 deletions(-) create mode 100644 assets/items/fb.png create mode 100644 assets/items/google.png create mode 100644 lib/views/login.dart create mode 100644 lib/widgets/splash.dart diff --git a/assets/items/fb.png b/assets/items/fb.png new file mode 100644 index 0000000000000000000000000000000000000000..be54a5d73582be3f486dd5886a21654e61027af0 GIT binary patch literal 700 zcmV;t0z>_YP)$1xU&3x+)B zy#B;jdbyx0gm2KpIHgXB)17~wc~z8NFHX-+*1x|x(#eHW;k1iX?qe9PKMBI!=WHI*569r*b%5BbWd7IiH zxI>o*F_JPoU(h8HBlk=nBSxa<`6J?9j2NcR?7d`U?;&=`%g`r{?awXaBDxfakqzU) z5JxFSwv30^Qm_#tFN}xSLitCGJTnetviV^dw<(w=)Za z@LOxGzvKzxffN(Px#Ca7X@eJ3nlFk6#X|oc9h}LPVySrYB*$)0KZwDRDCY3byonhG zGDM0yAi9A;4J{Rqz}-zWt6Yl6cm@VD(B?BDfE)83z-eUeaohWSN)y3m9?3-0j0j`4 z2^%}x%%meNMcw^{;1$|0sRb;tAZ4qBiS$FX|KD zdJ1z1`aa4a8Y9T;a1IfO;n0g1*vxaYZ6r8t8fZ;IbL(g}?QX8_NQ4v>R; zJ(n3n#UG*VW8n~+zz?oViQ^N(5i*Ol;mz^7X$&I|0XE|5`kNu$HU6$(Bkzvak|Djo z{oq<{EB=tI&B-8?3p6CU&K(h#$bYzFVMzZ6fAIaQj`RfXIIs~(|NhI6UcleX+K|40 zJI)>mvTBg@2uha&>mIFAphK6SN)VKzA4`W!*p|qtAU|a@a4iTt!M?B}Tz5&h*elJg zj_vD>rjV7!rX73|GUigZ3F+n_wFPpaK main() async { //firebase Initialization WidgetsFlutterBinding.ensureInitialized(); @@ -51,9 +55,9 @@ class MyApp extends StatelessWidget { textTheme: GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme)), routes: { - '/dashboard': (BuildContext context) => Dashboard(), + '/login': (BuildContext context) => LoginScreen(), }, - home: Dashboard(), + home: Splash(), ), ); } diff --git a/lib/views/login.dart b/lib/views/login.dart new file mode 100644 index 0000000..4a02f58 --- /dev/null +++ b/lib/views/login.dart @@ -0,0 +1,228 @@ +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 createState() { + return LoginScreenState(); + } +} + +TextEditingController _emailController = TextEditingController(); +TextEditingController _passwordController = TextEditingController(); + +class LoginScreenState extends State{ + @override + Widget build(BuildContext context) { + final height = MediaQuery.of(context).size.height; + final width = MediaQuery.of(context).size.width; + return Scaffold( + + body: Stack( + children: [ + Center( + child: Stack( + alignment: AlignmentDirectional.topStart, + 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( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20,vertical: 10), + child: Row( + children: [ + 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( + 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( + 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( + 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') + ), + ), + ] + ), + ) + + ], + ), + ) + ), + ], + ), + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/splash.dart b/lib/widgets/splash.dart new file mode 100644 index 0000000..befd20b --- /dev/null +++ b/lib/widgets/splash.dart @@ -0,0 +1,55 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; + +class Splash extends StatefulWidget { + @override + _SplashState createState() => _SplashState(); +} + +class _SplashState extends State { + @override + void initState() { + super.initState(); + startTime(); + } + + Future startTime() async { + const Duration _duration = Duration(seconds: 3); + return Timer(_duration, navigationPage); + } + + void navigationPage() { + Navigator.of(context).pushReplacementNamed('/login'); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: Container( + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, + decoration: const BoxDecoration( + image: DecorationImage( + fit: BoxFit.cover, + image: AssetImage( + 'assets/splash.png', + ))), + child: Stack( + children: [ + Positioned( + top: MediaQuery.of(context).size.height * 0.85, + left: MediaQuery.of(context).size.width * 0.47, + child: const SizedBox( + height: 35, + width: 35, + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.white), + ), + ), + ), + ], + ), + )); + } +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 01a44cf..b860cfc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,7 +56,8 @@ flutter: assets: - assets/ - assets/items/ - - images/ + - assets/items/google.png + - assets/items/fb.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. From 7e0821ccf879a4de71fa61c4092c3db646c40905 Mon Sep 17 00:00:00 2001 From: samdid Date: Fri, 19 Mar 2021 15:23:38 +0530 Subject: [PATCH 2/2] Resolved all the changes --- lib/main.dart | 5 ++-- lib/views/login.dart | 15 ++++++++--- lib/widgets/splash.dart | 55 ----------------------------------------- pubspec.yaml | 3 +-- 4 files changed, 14 insertions(+), 64 deletions(-) delete mode 100644 lib/widgets/splash.dart diff --git a/lib/main.dart b/lib/main.dart index 2db5f11..3c64f32 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,13 +4,12 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'package:retro_shopping/helpers/ad_state.dart'; import 'package:retro_shopping/helpers/constants.dart'; -import 'package:retro_shopping/widgets/splash.dart'; -import 'package:retro_shopping/views/profile.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'package:retro_shopping/views/login.dart'; import 'dashboard.dart'; + Future main() async { //firebase Initialization WidgetsFlutterBinding.ensureInitialized(); @@ -57,7 +56,7 @@ class MyApp extends StatelessWidget { routes: { '/login': (BuildContext context) => LoginScreen(), }, - home: Splash(), + home: LoginScreen(), ), ); } diff --git a/lib/views/login.dart b/lib/views/login.dart index 4a02f58..f15d148 100644 --- a/lib/views/login.dart +++ b/lib/views/login.dart @@ -17,15 +17,16 @@ TextEditingController _passwordController = TextEditingController(); class LoginScreenState extends State{ @override Widget build(BuildContext context) { - final height = MediaQuery.of(context).size.height; - final width = MediaQuery.of(context).size.width; + 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( - alignment: AlignmentDirectional.topStart, + // ignore: always_specify_types children: [ Transform.translate( offset: const Offset(5,5), @@ -42,12 +43,15 @@ class LoginScreenState extends State{ 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: [ - const Text('Login', + // ignore: prefer_const_literals_to_create_immutables, + const Text('Login', style: TextStyle( fontSize: 40, color: Colors.white, @@ -74,6 +78,7 @@ class LoginScreenState extends State{ height: height*0.020, ), Stack( + // ignore: always_specify_types children:[ Transform.translate( offset: const Offset(25,10), @@ -112,6 +117,7 @@ class LoginScreenState extends State{ height: height*0.030, ), Stack( + // ignore: always_specify_types children:[ Transform.translate( offset: const Offset(25,10), @@ -184,6 +190,7 @@ class LoginScreenState extends State{ Padding( padding: const EdgeInsets.symmetric(horizontal: 115), child: Row( + // ignore: always_specify_types children:[ InkWell( onTap: (){ diff --git a/lib/widgets/splash.dart b/lib/widgets/splash.dart deleted file mode 100644 index befd20b..0000000 --- a/lib/widgets/splash.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'dart:async'; -import 'package:flutter/material.dart'; - -class Splash extends StatefulWidget { - @override - _SplashState createState() => _SplashState(); -} - -class _SplashState extends State { - @override - void initState() { - super.initState(); - startTime(); - } - - Future startTime() async { - const Duration _duration = Duration(seconds: 3); - return Timer(_duration, navigationPage); - } - - void navigationPage() { - Navigator.of(context).pushReplacementNamed('/login'); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.white, - body: Container( - height: MediaQuery.of(context).size.height, - width: MediaQuery.of(context).size.width, - decoration: const BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: AssetImage( - 'assets/splash.png', - ))), - child: Stack( - children: [ - Positioned( - top: MediaQuery.of(context).size.height * 0.85, - left: MediaQuery.of(context).size.width * 0.47, - child: const SizedBox( - height: 35, - width: 35, - child: CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation(Colors.white), - ), - ), - ), - ], - ), - )); - } -} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index b860cfc..01a44cf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,8 +56,7 @@ flutter: assets: - assets/ - assets/items/ - - assets/items/google.png - - assets/items/fb.png + - images/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.