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,217 +36,188 @@ 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>(
children: <Widget>[ value: Platform.isIOS
Center(child: Image.asset('assets/images/logo.png', height: 32)), ? SystemUiOverlayStyle.light
SizedBox( : SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light),
height: 80, child: Stack(
),
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>[ children: <Widget>[
GestureDetector( // top blue background gradient
onTap: () { Container(
//Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route<dynamic> route) => false); height: MediaQuery.of(context).size.height / 3.5,
Navigator.pushReplacement(context, decoration: BoxDecoration(
MaterialPageRoute(builder: (context) => HomePage())); gradient: LinearGradient(
Fluttertoast.showToast( colors: [_gradientTop, _gradientBottom],
msg: 'Sign in with Google', begin: Alignment.topCenter,
toastLength: Toast.LENGTH_LONG); end: Alignment.bottomCenter)),
},
child: Image(
image: AssetImage("assets/images/google.png"),
width: 40,
),
), ),
GestureDetector( // set your logo here
onTap: () { Container(
//Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route<dynamic> route) => false); margin: EdgeInsets.fromLTRB(
Navigator.pushReplacement(context, 0, MediaQuery.of(context).size.height / 20, 0, 0),
MaterialPageRoute(builder: (context) => HomePage())); alignment: Alignment.topCenter,
Fluttertoast.showToast( child:
msg: 'Sign in with Facebook', Image.asset('assets/images/logo_dark.png', height: 120)),
toastLength: Toast.LENGTH_LONG); ListView(
}, children: <Widget>[
child: Image( // create form login
image: AssetImage("assets/images/facebook.png"), Card(
width: 40, shape: RoundedRectangleBorder(
), borderRadius: BorderRadius.circular(10),
), ),
GestureDetector( elevation: 5,
onTap: () { margin: EdgeInsets.fromLTRB(32,
//Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => HomePage()), (Route<dynamic> route) => false); MediaQuery.of(context).size.height / 3.5 - 72, 32, 0),
Navigator.pushReplacement(context, color: Colors.white,
MaterialPageRoute(builder: (context) => HomePage())); child: Container(
Fluttertoast.showToast( margin: EdgeInsets.fromLTRB(24, 0, 24, 20),
msg: 'Sign in with Twitter', child: Column(
toastLength: Toast.LENGTH_LONG); children: <Widget>[
}, SizedBox(
child: Image( height: 40,
image: AssetImage("assets/images/twitter.png"), ),
width: 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<Color>(
(Set<MaterialState> 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<dynamic> 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: <Widget>[
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: <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