signup screen

master
Sneha 3 days ago
parent 753893cd56
commit 9da1810143

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -8,7 +8,7 @@ import 'package:fluttertoast/fluttertoast.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:supplier_new/common/preloader.dart'; import 'package:supplier_new/common/preloader.dart';
const Color primaryColor = Color(0XFF1D7AFC); const Color primaryColor = Color(0XFF8270DB);
const Color secondaryColor = Color(0XFFBFE0ED); const Color secondaryColor = Color(0XFFBFE0ED);
const Color greyColor = Color(0XFF7E7F80); const Color greyColor = Color(0XFF7E7F80);
@ -37,7 +37,7 @@ InputDecoration textFormFieldDecoration(IconData icon,var text){
width: 1, )), width: 1, )),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0), borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), borderSide: BorderSide(color: Color(0XFF8270DB),width: 2,),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(

@ -34,234 +34,193 @@ class _LoginState extends State<Login> {
super.initState(); super.initState();
} }
Future<bool> onWillPop() async {
final shouldPop = await showDialog<bool>(context: context, builder: (context) {
return AlertDialog(
title: const Text('Do you want to exit app?',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
actionsAlignment: MainAxisAlignment.spaceBetween,
actions: [
TextButton(
onPressed: () {
SystemNavigator.pop();
},
child: const Text('Yes',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: const Text('No',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
],
);
},
);
return shouldPop!;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String lastInputValue="";
return WillPopScope( return Scaffold(
onWillPop: () async => onWillPop(), backgroundColor: Colors.white,
child: Scaffold( body: Stack(
backgroundColor: Colors.white, children: <Widget>[
body: Stack( /*Container(
children: <Widget>[
/*Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage("images/backgroundimage.png"), fit: BoxFit.cover,), image: DecorationImage(image: AssetImage("images/backgroundimage.png"), fit: BoxFit.cover,),
), ),
),*/ ),*/
GestureDetector( GestureDetector(
onTap: () { onTap: () {
FocusManager.instance.primaryFocus?.unfocus(); FocusManager.instance.primaryFocus?.unfocus();
}, },
child: SafeArea( child: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(24, 0, 24, 0), padding: const EdgeInsets.fromLTRB(24, 0, 24, 0),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Image( Image(
image: const AssetImage('images/login_logo.png'), image: const AssetImage('images/login_logo.png'),
height: MediaQuery.of(context).size.height * .30, height: MediaQuery.of(context).size.height * .30,
width:MediaQuery.of(context).size.width * .30, width:MediaQuery.of(context).size.width * .30,
),
SizedBox(height:MediaQuery.of(context).size.height * .04,),
SizedBox(height:MediaQuery.of(context).size.height * .024,),
Container(
child: TextFormField(
controller: mobileNumberController,
keyboardType: TextInputType.number,
textCapitalization: TextCapitalization.sentences,
maxLength: 10,
decoration: textFormFieldDecoration(Icons.phone,'Mobile Number'),
style:fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w400),
cursorColor: Color(0XFF8270DB),
//TextStyle(color: Colors.black,fontWeight: FontWeight.bold),
), ),
),
SizedBox(height:MediaQuery.of(context).size.height * .04,), SizedBox(height:MediaQuery.of(context).size.height * .016,),
SizedBox(height:MediaQuery.of(context).size.height * .024,),
Container( Container(
child: TextFormField( child: TextFormField(
controller: mobileNumberController, cursorColor:Color(0XFF8270DB),
keyboardType: TextInputType.number, obscureText: isObscureText,
textCapitalization: TextCapitalization.sentences, obscuringCharacter: '*',
maxLength: 10, controller: passwordController,
decoration: textFormFieldDecoration(Icons.phone,'Mobile Number'), decoration: InputDecoration(
style:fontTextStyle(14,Color(0XFF101214),FontWeight.w400), filled: false,
cursorColor: Color(0XFF1D7AFC), fillColor: Colors.white,
labelText: 'Password',
//TextStyle(color: Colors.black,fontWeight: FontWeight.bold), //prefixIcon: const Icon(Icons.lock, color: Colors.white,),
), labelStyle: fontTextStyle(14,Color(0XFF7E7F80),FontWeight.w400),
), border: OutlineInputBorder(
SizedBox(height:MediaQuery.of(context).size.height * .016,),
Container(
child: TextFormField(
cursorColor:Color(0XFF1D7AFC),
obscureText: isObscureText,
obscuringCharacter: '*',
controller: passwordController,
decoration: InputDecoration(
filled: false,
fillColor: Colors.white,
labelText: 'Password',
//prefixIcon: const Icon(Icons.lock, color: Colors.white,),
labelStyle: fontTextStyle(14,Color(0XFF7E7F80),FontWeight.w400),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: greyColor,
width: 1, )),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0), borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), borderSide: BorderSide(color: greyColor,
), width: 1, )),
enabledBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0), borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: greyColor), borderSide: BorderSide(color: Color(0XFF8270DB),width: 2,),
), ),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(4.0),
borderSide: BorderSide(color: greyColor),
),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: isObscureText==true?Image.asset('images/eye_icon.png',color: Color(0XFF7E7F80),width: 30,height: 30,):Image.asset('images/open_eye.png',color:Color(0XFF7E7F80),width: 30,height: 30,), icon: isObscureText==true?Image.asset('images/eye_icon.png',color: Color(0XFF7E7F80),width: 30,height: 30,):Image.asset('images/open_eye.png',color:Color(0XFF7E7F80),width: 30,height: 30,),
/* Icon( /* Icon(
icon:Image.asset('assets/your_image.png'), icon:Image.asset('assets/your_image.png'),
color: isObscureText==true?greyColor:primaryColor, color: isObscureText==true?greyColor:primaryColor,
),*/ ),*/
onPressed: () { onPressed: () {
print("show password");
setState(() {
isObscureText = !isObscureText;
});
},
),
print("show password");
setState(() {
isObscureText = !isObscureText;
});
},
), ),
style: fontTextStyle(14,Color(0XFF101214),FontWeight.w400),
), ),
), style: fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w400),
SizedBox(height:MediaQuery.of(context).size.height * .016,), ),
Align( ),
alignment: Alignment.bottomLeft,
child:GestureDetector( SizedBox(height:MediaQuery.of(context).size.height * .016,),
onTap: (){ Align(
/* Navigator.push( alignment: Alignment.bottomLeft,
child:GestureDetector(
onTap: (){
/* Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => ForgotpasswordNew()), MaterialPageRoute(builder: (context) => ForgotpasswordNew()),
);*/ );*/
}, },
child: Text( child: Text(
'Forgot Password?', 'Forgot Password?',
style: fontTextStyle(12,Color(0XFF1D7AFC),FontWeight.w600), style: fontTextStyle(12,Color(0XFF1D7AFC),FontWeight.w600),
),
)
),
SizedBox(height:MediaQuery.of(context).size.height * .024,),
Container(
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0), // Customize the radius
), ),
) ),
), onPressed: () async{
SizedBox(height:MediaQuery.of(context).size.height * .024,),
Container(
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0), // Customize the radius
),
),
onPressed: () async{
if (mobileNumberController.text != ''&&
passwordController.text != '') {
AppSettings.preLoaderDialog(context);
bool isOnline = await AppSettings.internetConnectivity();
if(isOnline){ if (mobileNumberController.text != ''&&
SharedPreferences prefs = await SharedPreferences.getInstance(); passwordController.text != '') {
String? fcmToken = prefs.getString('fcmToken'); AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["phone"] = mobileNumberController.text.toString();
payload["password"] = passwordController.text.toString();
payload["fcmIds"] = [fcmToken];
bool signinStatus = await AppSettings.login(payload); bool isOnline = await AppSettings.internetConnectivity();
try{ if(isOnline){
if (signinStatus) { SharedPreferences prefs = await SharedPreferences.getInstance();
Navigator.of(context,rootNavigator: true).pop(); String? fcmToken = prefs.getString('fcmToken');
String token = AppSettings.accessToken; var payload = new Map<String, dynamic>();
await storage.write(key: 'authToken', value: token); payload["phone"] = mobileNumberController.text.toString();
payload["password"] = passwordController.text.toString();
payload["fcmIds"] = [fcmToken];
print('Token saved: $token'); bool signinStatus = await AppSettings.login(payload);
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DashboardScreen()),
);
AppSettings.longSuccessToast("Logged in Successfully");
mobileNumberController.text='';
passwordController.text='';
} else { try{
Navigator.of(context,rootNavigator: true).pop(); if (signinStatus) {
AppSettings.longFailedToast("Invalid details");
}
}
catch(exception){
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
print(exception); String token = AppSettings.accessToken;
await storage.write(key: 'authToken', value: token);
print('Token saved: $token');
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DashboardScreen()),
);
AppSettings.longSuccessToast("Logged in Successfully");
mobileNumberController.text='';
passwordController.text='';
} else {
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast("Invalid details");
} }
} }
else{ catch(exception){
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast("Please Check internet"); print(exception);
} }
} }
else{ else{
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast("Please enter valid details"); AppSettings.longFailedToast("Please Check internet");
} }
},
child: Text('Login',style: fontTextStyle(12,Colors.white,FontWeight.w600),), }
)), else{
],
), AppSettings.longFailedToast("Please enter valid details");
) }
)),
), },
], child: Text('Login',style: fontTextStyle(12,Colors.white,FontWeight.w600),),
) )),
), ],
),
)
)),
),
],
)
); );
} }
} }

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:supplier_new/common/settings.dart'; import 'package:supplier_new/common/settings.dart';
import 'package:supplier_new/login/login.dart'; import 'package:supplier_new/login/login.dart';
import 'package:supplier_new/login/signup.dart'; import 'package:supplier_new/signup/signup.dart';
class LoginSignUpScreen extends StatefulWidget { class LoginSignUpScreen extends StatefulWidget {
const LoginSignUpScreen({super.key}); const LoginSignUpScreen({super.key});
@ -13,90 +13,88 @@ class LoginSignUpScreen extends StatefulWidget {
class _LoginSignUpScreenState extends State<LoginSignUpScreen> { class _LoginSignUpScreenState extends State<LoginSignUpScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea( return Scaffold(
child: Scaffold( body: Padding(
body: Padding( padding: EdgeInsets.all(24),
padding: EdgeInsets.all(24), child: Column(
child: Column( children: [
children: [ SizedBox(height: MediaQuery.of(context).size.height * .2),
SizedBox(height: MediaQuery.of(context).size.height * .2), Center(
Center( child: Text("AQUICK SUPPLIER",
child: Text("AQUICK SUPPLIER", style: fontTextStyle(20, Color(0XFF515253), FontWeight.w800)),
style: fontTextStyle(20, Color(0XFF515253), FontWeight.w800)), ),
SizedBox(height: MediaQuery.of(context).size.height * .05),
CircleAvatar(radius: 80, backgroundColor: Color(0XFFC9DFFE)),
SizedBox(height: MediaQuery.of(context).size.height * .05),
Center(
child: Text(
"Welcome to Aquick Supplier",
style: fontTextStyle(20, Color(0XFF343637), FontWeight.w700),
), ),
SizedBox(height: MediaQuery.of(context).size.height * .05), ),
CircleAvatar(radius: 80, backgroundColor: Color(0XFFC9DFFE)), SizedBox(height: MediaQuery.of(context).size.height * .012),
SizedBox(height: MediaQuery.of(context).size.height * .05), Center(
Center( child: Text(
child: Text( "Sign up or login to be listed as a supplier, start deliveries and track orders",
"Welcome to Aquick Supplier", style: fontTextStyle(12, Color(0XFF7E7F80), FontWeight.w400),
style: fontTextStyle(20, Color(0XFF343637), FontWeight.w700), textAlign: TextAlign.center, // Keeps text centered in multiple lines
),
), ),
SizedBox(height: MediaQuery.of(context).size.height * .012), )
Center( ,
child: Text( SizedBox(height: MediaQuery.of(context).size.height * .04),
"Sign up or login to be listed as a supplier, start deliveries and track orders", Container(
style: fontTextStyle(12, Color(0XFF7E7F80), FontWeight.w400), width:double.infinity,
textAlign: TextAlign.center, // Keeps text centered in multiple lines
),
)
,
SizedBox(height: MediaQuery.of(context).size.height * .04),
Container(
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.0), // Customize the radius
),
),
onPressed: () async{
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Login()),
);
},
child: Text('Login',style: fontTextStyle(14,Colors.white,FontWeight.w500),),
)),
SizedBox(height: MediaQuery.of(context).size.height * .012),
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .06, height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Color(0XFF757575), foregroundColor: Colors.white,
backgroundColor: Colors.white, backgroundColor: primaryColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.0), // Customize the radius borderRadius: BorderRadius.circular(24.0), // Customize the radius
side: BorderSide(
color: Color(0XFF757575), // Border color
width: 1, // Border width
),
), ),
), ),
onPressed: () async { onPressed: () async{
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => SignUp()), builder: (context) => Login()),
); );
}, },
child: Text( child: Text('Login',style: fontTextStyle(14,Colors.white,FontWeight.w500),),
'Sign up', )),
style: fontTextStyle(12, Color(0XFF757575), FontWeight.w500), SizedBox(height: MediaQuery.of(context).size.height * .012),
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Color(0XFF757575),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.0), // Customize the radius
side: BorderSide(
color: Color(0XFF757575), // Border color
width: 1, // Border width
),
), ),
), ),
) onPressed: () async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SignUp()),
);
},
child: Text(
'Sign up',
style: fontTextStyle(12, Color(0XFF757575), FontWeight.w500),
),
),
)
], ],
), ),
) )
),
); );
} }
} }

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:supplier_new/common/settings.dart'; import 'package:supplier_new/common/settings.dart';
import 'package:supplier_new/login/login_signup_screen.dart'; import 'package:supplier_new/login/login_signup_screen.dart';
@ -12,78 +13,77 @@ class StartingScreen extends StatefulWidget {
class _StartingScreenState extends State<StartingScreen> { class _StartingScreenState extends State<StartingScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea(
child: Scaffold( return Scaffold(
body: Padding( body: Padding(
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
child: Column( child: Column(
children: [ children: [
SizedBox(height: MediaQuery.of(context).size.height * .2), SizedBox(height: MediaQuery.of(context).size.height * .2),
Center( Center(
child: Text("AQUICK SUPPLIER", child: Text("AQUICK SUPPLIER",
style: fontTextStyle(20, Color(0XFF515253), FontWeight.w800)), style: fontTextStyle(20, Color(0XFF515253), FontWeight.w800)),
), ),
SizedBox(height: MediaQuery.of(context).size.height * .05), SizedBox(height: MediaQuery.of(context).size.height * .05),
CircleAvatar(radius: 80, backgroundColor: Color(0XFFC9DFFE)), CircleAvatar(radius: 80, backgroundColor: Color(0XFFC9DFFE)),
SizedBox(height: MediaQuery.of(context).size.height * .05), SizedBox(height: MediaQuery.of(context).size.height * .05),
Center( Center(
child: Text("Want to be a supplier on Aquick Tankers?", child: Text("Want to be a supplier on Aquick Tankers?",
style: fontTextStyle(16, Color(0XFF343637), FontWeight.w600)), style: fontTextStyle(16, Color(0XFF343637), FontWeight.w600)),
), ),
SizedBox(height: MediaQuery.of(context).size.height * .04), SizedBox(height: MediaQuery.of(context).size.height * .04),
Container( Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: primaryColor,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(24.0), // Customize the radius
),
),
onPressed: () async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LoginSignUpScreen()),
);
},
child: Text(
'Yes',
style: fontTextStyle(14, Colors.white, FontWeight.w500),
),
)),
SizedBox(height: MediaQuery.of(context).size.height * .012),
Container(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * .06, height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, foregroundColor: Color(0XFF757575),
backgroundColor: primaryColor, backgroundColor: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(24.0), // Customize the radius BorderRadius.circular(24.0), // Customize the radius
side: BorderSide(
color: Color(0XFF757575), // Border color
width: 1, // Border width
),
), ),
), ),
onPressed: () async { onPressed: () async {
Navigator.push( // Your onPressed logic
context,
MaterialPageRoute(
builder: (context) => LoginSignUpScreen()),
);
}, },
child: Text( child: Text(
'Yes', 'No, I want to buy water',
style: fontTextStyle(14, Colors.white, FontWeight.w500), style: fontTextStyle(12, Color(0XFF757575), FontWeight.w500),
),
)),
SizedBox(height: MediaQuery.of(context).size.height * .012),
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Color(0XFF757575),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(24.0), // Customize the radius
side: BorderSide(
color: Color(0XFF757575), // Border color
width: 1, // Border width
),
), ),
), ),
onPressed: () async { )
// Your onPressed logic ],
}, ),
child: Text( ));
'No, I want to buy water',
style: fontTextStyle(12, Color(0XFF757575), FontWeight.w500),
),
),
)
],
),
)),
);
} }
} }

@ -88,9 +88,10 @@ class _SignUpState extends State<SignUp> {
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(
'images/Maps.png', 'images/maps.png',
width: 20, width: 20,
height: 20, height: 20,
color: primaryColor,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
Loading…
Cancel
Save