Ajout log + sign_in

release/mobdr-v0.0.1
Frédérik Benoist 2023-02-26 15:15:02 +01:00
parent 7cea57d5ec
commit af9a6507f5
6 changed files with 440 additions and 207 deletions

BIN
assets/images/logo_dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,10 +1,8 @@
import 'package:mobdr/config/global_style.dart'; import 'package:universal_io/io.dart';
import 'package:mobdr/ui/authentication/forgot_password.dart';
import 'package:mobdr/ui/home.dart'; import 'package:mobdr/ui/home.dart';
import 'package:mobdr/ui/authentication/signup.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:mobdr/config/constant.dart';
class SigninPage extends StatefulWidget { class SigninPage extends StatefulWidget {
@override @override
@ -12,10 +10,14 @@ class SigninPage extends StatefulWidget {
} }
class _SigninPageState extends State<SigninPage> { class _SigninPageState extends State<SigninPage> {
TextEditingController _etEmail = TextEditingController();
bool _obscureText = true; bool _obscureText = true;
IconData _iconVisible = Icons.visibility_off; IconData _iconVisible = Icons.visibility_off;
Color _gradientTop = Color(0xFF039be6);
Color _gradientBottom = Color(0xFF0299e2);
Color _mainColor = Color(0xFF0181cc);
Color _underlineColor = Color(0xFFCCCCCC);
void _toggleObscureText() { void _toggleObscureText() {
setState(() { setState(() {
_obscureText = !_obscureText; _obscureText = !_obscureText;
@ -34,54 +36,97 @@ class _SigninPageState extends State<SigninPage> {
@override @override
void dispose() { void dispose() {
_etEmail.dispose();
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: ListView( backgroundColor: Colors.white,
padding: EdgeInsets.fromLTRB(30, 120, 30, 30), body: AnnotatedRegion<SystemUiOverlayStyle>(
value: Platform.isIOS
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light),
child: Stack(
children: <Widget>[
// 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)),
),
// 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: <Widget>[
// 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: <Widget>[ children: <Widget>[
Center(child: Image.asset('assets/images/logo.png', height: 32)),
SizedBox( SizedBox(
height: 80, height: 40,
), ),
Text('Sign In', style: GlobalStyle.authTitle), Center(
TextFormField( child: Text(
keyboardType: TextInputType.emailAddress, 'SIGN IN',
controller: _etEmail, style: TextStyle(
style: TextStyle(color: CHARCOAL), color: _mainColor,
onChanged: (textValue) { fontSize: 18,
setState(() {}); fontWeight: FontWeight.w900),
},
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( SizedBox(
height: 20, height: 20,
), ),
TextField( TextField(
obscureText: _obscureText, keyboardType: TextInputType.emailAddress,
style: TextStyle(color: CHARCOAL),
decoration: InputDecoration( decoration: InputDecoration(
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: PRIMARY_COLOR, width: 2.0)), borderSide:
BorderSide(color: Colors.grey[600]!)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC)), 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', labelText: 'Password',
labelStyle: TextStyle(color: BLACK_GREY), labelStyle: TextStyle(color: Colors.grey[700]),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon(_iconVisible, color: Colors.grey[400], size: 20), icon: Icon(_iconVisible,
color: Colors.grey[700], size: 20),
onPressed: () { onPressed: () {
_toggleObscureText(); _toggleObscureText();
}), }),
@ -92,159 +137,87 @@ class _SigninPageState extends State<SigninPage> {
), ),
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Container(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
Navigator.push( Fluttertoast.showToast(
context, msg: 'Click forgot password',
MaterialPageRoute( toastLength: Toast.LENGTH_SHORT);
builder: (context) => ForgotPasswordPage()));
FocusScope.of(context).unfocus();
}, },
child: Text( child: Text(
'Forgot Password?', 'Forgot Password?',
style: TextStyle(color: PRIMARY_COLOR, fontSize: 13), style: TextStyle(fontSize: 13),
),
), ),
), ),
)),
SizedBox( SizedBox(
height: 40, height: 40,
), ),
Container( SizedBox(
width: double.maxFinite,
child: TextButton( child: TextButton(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>( backgroundColor: MaterialStateProperty
(Set<MaterialState> states) => PRIMARY_COLOR, .resolveWith<Color>(
(Set<MaterialState> states) => _mainColor,
), ),
overlayColor: MaterialStateProperty.all(Colors.transparent), overlayColor: MaterialStateProperty.all(
shape: MaterialStateProperty.all(RoundedRectangleBorder( Colors.transparent),
borderRadius: BorderRadius.circular(3.0), shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
)), )),
), ),
onPressed: () { onPressed: () {
//Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route<dynamic> route) => false); //Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route<dynamic> route) => false);
Navigator.pushReplacement(context, Navigator.pushReplacement(
MaterialPageRoute(builder: (context) => HomePage())); context,
MaterialPageRoute(
builder: (context) => HomePage()));
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 5.0), padding:
const EdgeInsets.symmetric(vertical: 5),
child: Text( child: Text(
'Login', 'LOGIN',
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16, color: Colors.white),
fontWeight: FontWeight.bold,
color: Colors.white),
textAlign: TextAlign.center, 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: <Widget>[
GestureDetector(
onTap: () {
//Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route<dynamic> 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<dynamic> 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<dynamic> 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( SizedBox(
height: 20, height: 50,
), ),
// create sign up link
Center( Center(
child: GestureDetector(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => SignupPage()));
FocusScope.of(context).unfocus();
},
child: Wrap( child: Wrap(
children: [ children: <Widget>[
Text( Text('New User? '),
'No account yet? ', GestureDetector(
style: GlobalStyle.authBottom1, onTap: () {
Fluttertoast.showToast(
msg: 'Click signup',
toastLength: Toast.LENGTH_SHORT);
},
child: Text(
'Sign Up',
style: TextStyle(
color: _mainColor, fontWeight: FontWeight.w700),
), ),
Text(
'Create one',
style: GlobalStyle.authBottom2,
) )
], ],
), ),
), ),
),
SizedBox( SizedBox(
height: 30, height: 20,
), ),
Center( ],
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GlobalStyle.iconBack,
Text(
' Back',
style: GlobalStyle.back,
) )
], ],
), ),
),
),
],
)); ));
} }
} }

View File

@ -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<SigninPage> {
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: <Widget>[
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<Color>(
(Set<MaterialState> 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<dynamic> 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: <Widget>[
GestureDetector(
onTap: () {
//Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route<dynamic> 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<dynamic> 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<dynamic> 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: <Widget>[
GlobalStyle.iconBack,
Text(
' Back',
style: GlobalStyle.back,
)
],
),
),
),
],
));
}
}

View File

@ -329,7 +329,7 @@ class _TabHomePageState extends State<TabHomePage>
), ),
SizedBox(width: 8), SizedBox(width: 8),
Text( Text(
'Search Product', 'Search Product a',
style: TextStyle( style: TextStyle(
color: Colors.grey[500], color: Colors.grey[500],
fontWeight: FontWeight.normal), fontWeight: FontWeight.normal),

View File

@ -445,6 +445,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" 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: uuid:
dependency: transitive dependency: transitive
description: description:

View File

@ -41,6 +41,7 @@ dependencies:
intl: 0.17.0 intl: 0.17.0
carousel_slider: 4.2.1 carousel_slider: 4.2.1
cached_network_image: 3.2.3 cached_network_image: 3.2.3
universal_io: 2.2.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -105,4 +106,5 @@ flutter:
- assets/images/visa.png - assets/images/visa.png
- assets/images/mastercard.png - assets/images/mastercard.png
- assets/images/logo.png - assets/images/logo.png
- assets/images/logo_dark.png
- assets/images/onboarding/search_product.gif - assets/images/onboarding/search_product.gif