diff --git a/assets/images/logo_dark.png b/assets/images/logo_dark.png new file mode 100644 index 0000000..23c18ee Binary files /dev/null and b/assets/images/logo_dark.png differ diff --git a/lib/ui/authentication/signin.dart b/lib/ui/authentication/signin.dart index 7019d2f..301d2af 100644 --- a/lib/ui/authentication/signin.dart +++ b/lib/ui/authentication/signin.dart @@ -1,10 +1,8 @@ -import 'package:mobdr/config/global_style.dart'; -import 'package:mobdr/ui/authentication/forgot_password.dart'; +import 'package:universal_io/io.dart'; import 'package:mobdr/ui/home.dart'; -import 'package:mobdr/ui/authentication/signup.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:fluttertoast/fluttertoast.dart'; -import 'package:mobdr/config/constant.dart'; class SigninPage extends StatefulWidget { @override @@ -12,10 +10,14 @@ class SigninPage extends StatefulWidget { } class _SigninPageState extends State { - TextEditingController _etEmail = TextEditingController(); bool _obscureText = true; IconData _iconVisible = Icons.visibility_off; + Color _gradientTop = Color(0xFF039be6); + Color _gradientBottom = Color(0xFF0299e2); + Color _mainColor = Color(0xFF0181cc); + Color _underlineColor = Color(0xFFCCCCCC); + void _toggleObscureText() { setState(() { _obscureText = !_obscureText; @@ -34,217 +36,188 @@ class _SigninPageState extends State { @override void dispose() { - _etEmail.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( - body: ListView( - padding: EdgeInsets.fromLTRB(30, 120, 30, 30), - children: [ - Center(child: Image.asset('assets/images/logo.png', height: 32)), - SizedBox( - height: 80, - ), - Text('Sign In', style: GlobalStyle.authTitle), - TextFormField( - keyboardType: TextInputType.emailAddress, - controller: _etEmail, - style: TextStyle(color: CHARCOAL), - onChanged: (textValue) { - setState(() {}); - }, - decoration: InputDecoration( - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: PRIMARY_COLOR, width: 2.0)), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC)), - ), - labelText: 'Email', - labelStyle: TextStyle(color: BLACK_GREY), - ), - ), - SizedBox( - height: 20, - ), - TextField( - obscureText: _obscureText, - style: TextStyle(color: CHARCOAL), - decoration: InputDecoration( - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: PRIMARY_COLOR, width: 2.0)), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC)), - ), - labelText: 'Password', - labelStyle: TextStyle(color: BLACK_GREY), - suffixIcon: IconButton( - icon: Icon(_iconVisible, color: Colors.grey[400], size: 20), - onPressed: () { - _toggleObscureText(); - }), - ), - ), - SizedBox( - height: 20, - ), - Align( - alignment: Alignment.centerRight, - child: Container( - child: GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ForgotPasswordPage())); - FocusScope.of(context).unfocus(); - }, - child: Text( - 'Forgot Password?', - style: TextStyle(color: PRIMARY_COLOR, fontSize: 13), - ), - ), - )), - SizedBox( - height: 40, - ), - Container( - child: TextButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.resolveWith( - (Set states) => PRIMARY_COLOR, - ), - overlayColor: MaterialStateProperty.all(Colors.transparent), - shape: MaterialStateProperty.all(RoundedRectangleBorder( - borderRadius: BorderRadius.circular(3.0), - )), - ), - onPressed: () { - //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); - Navigator.pushReplacement(context, - MaterialPageRoute(builder: (context) => HomePage())); - }, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 5.0), - child: Text( - 'Login', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - color: Colors.white), - textAlign: TextAlign.center, - ), - )), - ), - SizedBox( - height: 40, - ), - Center( - child: Text( - 'Or sign in with', - style: GlobalStyle.authSignWith, - ), - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.fromLTRB(20, 0, 20, 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + backgroundColor: Colors.white, + body: AnnotatedRegion( + value: Platform.isIOS + ? SystemUiOverlayStyle.light + : SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light), + child: Stack( children: [ - GestureDetector( - onTap: () { - //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); - Navigator.pushReplacement(context, - MaterialPageRoute(builder: (context) => HomePage())); - Fluttertoast.showToast( - msg: 'Sign in with Google', - toastLength: Toast.LENGTH_LONG); - }, - child: Image( - image: AssetImage("assets/images/google.png"), - width: 40, - ), + // top blue background gradient + Container( + height: MediaQuery.of(context).size.height / 3.5, + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [_gradientTop, _gradientBottom], + begin: Alignment.topCenter, + end: Alignment.bottomCenter)), ), - GestureDetector( - onTap: () { - //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); - Navigator.pushReplacement(context, - MaterialPageRoute(builder: (context) => HomePage())); - Fluttertoast.showToast( - msg: 'Sign in with Facebook', - toastLength: Toast.LENGTH_LONG); - }, - child: Image( - image: AssetImage("assets/images/facebook.png"), - width: 40, - ), - ), - GestureDetector( - onTap: () { - //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); - Navigator.pushReplacement(context, - MaterialPageRoute(builder: (context) => HomePage())); - Fluttertoast.showToast( - msg: 'Sign in with Twitter', - toastLength: Toast.LENGTH_LONG); - }, - child: Image( - image: AssetImage("assets/images/twitter.png"), - width: 40, - ), + // set your logo here + Container( + margin: EdgeInsets.fromLTRB( + 0, MediaQuery.of(context).size.height / 20, 0, 0), + alignment: Alignment.topCenter, + child: + Image.asset('assets/images/logo_dark.png', height: 120)), + ListView( + children: [ + // create form login + Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + elevation: 5, + margin: EdgeInsets.fromLTRB(32, + MediaQuery.of(context).size.height / 3.5 - 72, 32, 0), + color: Colors.white, + child: Container( + margin: EdgeInsets.fromLTRB(24, 0, 24, 20), + child: Column( + children: [ + SizedBox( + height: 40, + ), + Center( + child: Text( + 'SIGN IN', + style: TextStyle( + color: _mainColor, + fontSize: 18, + fontWeight: FontWeight.w900), + ), + ), + SizedBox( + height: 20, + ), + TextField( + keyboardType: TextInputType.emailAddress, + decoration: InputDecoration( + focusedBorder: UnderlineInputBorder( + borderSide: + BorderSide(color: Colors.grey[600]!)), + enabledBorder: UnderlineInputBorder( + borderSide: + BorderSide(color: _underlineColor), + ), + labelText: 'Email', + labelStyle: + TextStyle(color: Colors.grey[700])), + ), + SizedBox( + height: 20, + ), + TextField( + obscureText: _obscureText, + decoration: InputDecoration( + focusedBorder: UnderlineInputBorder( + borderSide: + BorderSide(color: Colors.grey[600]!)), + enabledBorder: UnderlineInputBorder( + borderSide: + BorderSide(color: _underlineColor), + ), + labelText: 'Password', + labelStyle: TextStyle(color: Colors.grey[700]), + suffixIcon: IconButton( + icon: Icon(_iconVisible, + color: Colors.grey[700], size: 20), + onPressed: () { + _toggleObscureText(); + }), + ), + ), + SizedBox( + height: 20, + ), + Align( + alignment: Alignment.centerRight, + child: GestureDetector( + onTap: () { + Fluttertoast.showToast( + msg: 'Click forgot password', + toastLength: Toast.LENGTH_SHORT); + }, + child: Text( + 'Forgot Password?', + style: TextStyle(fontSize: 13), + ), + ), + ), + SizedBox( + height: 40, + ), + SizedBox( + width: double.maxFinite, + child: TextButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty + .resolveWith( + (Set states) => _mainColor, + ), + overlayColor: MaterialStateProperty.all( + Colors.transparent), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + )), + ), + onPressed: () { + //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => HomePage())); + }, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 5), + child: Text( + 'LOGIN', + style: TextStyle( + fontSize: 16, color: Colors.white), + textAlign: TextAlign.center, + ), + )), + ), + ], + )), + ), + SizedBox( + height: 50, + ), + // create sign up link + Center( + child: Wrap( + children: [ + Text('New User? '), + GestureDetector( + onTap: () { + Fluttertoast.showToast( + msg: 'Click signup', + toastLength: Toast.LENGTH_SHORT); + }, + child: Text( + 'Sign Up', + style: TextStyle( + color: _mainColor, fontWeight: FontWeight.w700), + ), + ) + ], + ), + ), + SizedBox( + height: 20, + ), + ], ) ], ), - ), - SizedBox( - height: 20, - ), - Center( - child: GestureDetector( - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => SignupPage())); - FocusScope.of(context).unfocus(); - }, - child: Wrap( - children: [ - Text( - 'No account yet? ', - style: GlobalStyle.authBottom1, - ), - Text( - 'Create one', - style: GlobalStyle.authBottom2, - ) - ], - ), - ), - ), - SizedBox( - height: 30, - ), - Center( - child: GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GlobalStyle.iconBack, - Text( - ' Back', - style: GlobalStyle.back, - ) - ], - ), - ), - ), - ], - )); + )); } } diff --git a/lib/ui/authentication/signin_old.dart b/lib/ui/authentication/signin_old.dart new file mode 100644 index 0000000..7019d2f --- /dev/null +++ b/lib/ui/authentication/signin_old.dart @@ -0,0 +1,250 @@ +import 'package:mobdr/config/global_style.dart'; +import 'package:mobdr/ui/authentication/forgot_password.dart'; +import 'package:mobdr/ui/home.dart'; +import 'package:mobdr/ui/authentication/signup.dart'; +import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:mobdr/config/constant.dart'; + +class SigninPage extends StatefulWidget { + @override + _SigninPageState createState() => _SigninPageState(); +} + +class _SigninPageState extends State { + TextEditingController _etEmail = TextEditingController(); + bool _obscureText = true; + IconData _iconVisible = Icons.visibility_off; + + void _toggleObscureText() { + setState(() { + _obscureText = !_obscureText; + if (_obscureText == true) { + _iconVisible = Icons.visibility_off; + } else { + _iconVisible = Icons.visibility; + } + }); + } + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + _etEmail.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: ListView( + padding: EdgeInsets.fromLTRB(30, 120, 30, 30), + children: [ + Center(child: Image.asset('assets/images/logo.png', height: 32)), + SizedBox( + height: 80, + ), + Text('Sign In', style: GlobalStyle.authTitle), + TextFormField( + keyboardType: TextInputType.emailAddress, + controller: _etEmail, + style: TextStyle(color: CHARCOAL), + onChanged: (textValue) { + setState(() {}); + }, + decoration: InputDecoration( + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: PRIMARY_COLOR, width: 2.0)), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC)), + ), + labelText: 'Email', + labelStyle: TextStyle(color: BLACK_GREY), + ), + ), + SizedBox( + height: 20, + ), + TextField( + obscureText: _obscureText, + style: TextStyle(color: CHARCOAL), + decoration: InputDecoration( + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: PRIMARY_COLOR, width: 2.0)), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC)), + ), + labelText: 'Password', + labelStyle: TextStyle(color: BLACK_GREY), + suffixIcon: IconButton( + icon: Icon(_iconVisible, color: Colors.grey[400], size: 20), + onPressed: () { + _toggleObscureText(); + }), + ), + ), + SizedBox( + height: 20, + ), + Align( + alignment: Alignment.centerRight, + child: Container( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ForgotPasswordPage())); + FocusScope.of(context).unfocus(); + }, + child: Text( + 'Forgot Password?', + style: TextStyle(color: PRIMARY_COLOR, fontSize: 13), + ), + ), + )), + SizedBox( + height: 40, + ), + Container( + child: TextButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.resolveWith( + (Set states) => PRIMARY_COLOR, + ), + overlayColor: MaterialStateProperty.all(Colors.transparent), + shape: MaterialStateProperty.all(RoundedRectangleBorder( + borderRadius: BorderRadius.circular(3.0), + )), + ), + onPressed: () { + //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); + Navigator.pushReplacement(context, + MaterialPageRoute(builder: (context) => HomePage())); + }, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 5.0), + child: Text( + 'Login', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.white), + textAlign: TextAlign.center, + ), + )), + ), + SizedBox( + height: 40, + ), + Center( + child: Text( + 'Or sign in with', + style: GlobalStyle.authSignWith, + ), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.fromLTRB(20, 0, 20, 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); + Navigator.pushReplacement(context, + MaterialPageRoute(builder: (context) => HomePage())); + Fluttertoast.showToast( + msg: 'Sign in with Google', + toastLength: Toast.LENGTH_LONG); + }, + child: Image( + image: AssetImage("assets/images/google.png"), + width: 40, + ), + ), + GestureDetector( + onTap: () { + //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); + Navigator.pushReplacement(context, + MaterialPageRoute(builder: (context) => HomePage())); + Fluttertoast.showToast( + msg: 'Sign in with Facebook', + toastLength: Toast.LENGTH_LONG); + }, + child: Image( + image: AssetImage("assets/images/facebook.png"), + width: 40, + ), + ), + GestureDetector( + onTap: () { + //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route route) => false); + Navigator.pushReplacement(context, + MaterialPageRoute(builder: (context) => HomePage())); + Fluttertoast.showToast( + msg: 'Sign in with Twitter', + toastLength: Toast.LENGTH_LONG); + }, + child: Image( + image: AssetImage("assets/images/twitter.png"), + width: 40, + ), + ) + ], + ), + ), + SizedBox( + height: 20, + ), + Center( + child: GestureDetector( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => SignupPage())); + FocusScope.of(context).unfocus(); + }, + child: Wrap( + children: [ + Text( + 'No account yet? ', + style: GlobalStyle.authBottom1, + ), + Text( + 'Create one', + style: GlobalStyle.authBottom2, + ) + ], + ), + ), + ), + SizedBox( + height: 30, + ), + Center( + child: GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GlobalStyle.iconBack, + Text( + ' Back', + style: GlobalStyle.back, + ) + ], + ), + ), + ), + ], + )); + } +} diff --git a/lib/ui/home/tab_home.dart b/lib/ui/home/tab_home.dart index c4c9ac6..875cb6e 100644 --- a/lib/ui/home/tab_home.dart +++ b/lib/ui/home/tab_home.dart @@ -329,7 +329,7 @@ class _TabHomePageState extends State ), SizedBox(width: 8), Text( - 'Search Product', + 'Search Product a', style: TextStyle( color: Colors.grey[500], fontWeight: FontWeight.normal), diff --git a/pubspec.lock b/pubspec.lock index 5fce04a..88a76c2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -445,6 +445,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + universal_io: + dependency: "direct main" + description: + name: universal_io + sha256: "06866290206d196064fd61df4c7aea1ffe9a4e7c4ccaa8fcded42dd41948005d" + url: "https://pub.dev" + source: hosted + version: "2.2.0" uuid: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index d5cdc33..37af339 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,6 +41,7 @@ dependencies: intl: 0.17.0 carousel_slider: 4.2.1 cached_network_image: 3.2.3 + universal_io: 2.2.0 dev_dependencies: flutter_test: @@ -105,4 +106,5 @@ flutter: - assets/images/visa.png - assets/images/mastercard.png - assets/images/logo.png + - assets/images/logo_dark.png - assets/images/onboarding/search_product.gif \ No newline at end of file