diff --git a/images/business.png b/images/business.png new file mode 100644 index 0000000..7657ca4 Binary files /dev/null and b/images/business.png differ diff --git a/images/maps.png b/images/maps.png new file mode 100644 index 0000000..95a196f Binary files /dev/null and b/images/maps.png differ diff --git a/lib/common/settings.dart b/lib/common/settings.dart index dd645a6..5729e6f 100644 --- a/lib/common/settings.dart +++ b/lib/common/settings.dart @@ -8,7 +8,7 @@ import 'package:fluttertoast/fluttertoast.dart'; import 'package:shared_preferences/shared_preferences.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 greyColor = Color(0XFF7E7F80); @@ -37,7 +37,7 @@ InputDecoration textFormFieldDecoration(IconData icon,var text){ width: 1, )), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(4.0), - borderSide: BorderSide(color: Color(0XFF1D7AFC),width: 2,), + borderSide: BorderSide(color: Color(0XFF8270DB),width: 2,), ), enabledBorder: OutlineInputBorder( diff --git a/lib/login/login.dart b/lib/login/login.dart index 2ae5d90..a5a3270 100644 --- a/lib/login/login.dart +++ b/lib/login/login.dart @@ -34,234 +34,193 @@ class _LoginState extends State { super.initState(); } - Future onWillPop() async { - final shouldPop = await showDialog(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 Widget build(BuildContext context) { - String lastInputValue=""; - return WillPopScope( - onWillPop: () async => onWillPop(), - child: Scaffold( - backgroundColor: Colors.white, - body: Stack( - children: [ - /*Container( + return Scaffold( + backgroundColor: Colors.white, + body: Stack( + children: [ + /*Container( decoration: const BoxDecoration( image: DecorationImage(image: AssetImage("images/backgroundimage.png"), fit: BoxFit.cover,), ), ),*/ - GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: SafeArea( - child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.fromLTRB(24, 0, 24, 0), - child: Column( - - children: [ - Image( - image: const AssetImage('images/login_logo.png'), - height: MediaQuery.of(context).size.height * .30, - width:MediaQuery.of(context).size.width * .30, + GestureDetector( + onTap: () { + FocusManager.instance.primaryFocus?.unfocus(); + }, + child: SafeArea( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.fromLTRB(24, 0, 24, 0), + child: Column( + + children: [ + Image( + image: const AssetImage('images/login_logo.png'), + height: MediaQuery.of(context).size.height * .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 * .024,), - Container( - child: TextFormField( - controller: mobileNumberController, - keyboardType: TextInputType.number, - textCapitalization: TextCapitalization.sentences, - maxLength: 10, - decoration: textFormFieldDecoration(Icons.phone,'Mobile Number'), - style:fontTextStyle(14,Color(0XFF101214),FontWeight.w400), - cursorColor: Color(0XFF1D7AFC), - - //TextStyle(color: Colors.black,fontWeight: FontWeight.bold), - ), - ), - 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( + ), + SizedBox(height:MediaQuery.of(context).size.height * .016,), + + Container( + child: TextFormField( + cursorColor:Color(0XFF8270DB), + 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: Color(0XFF1D7AFC),width: 2,), - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(4.0), - borderSide: BorderSide(color: greyColor), - ), + borderSide: BorderSide(color: greyColor, + width: 1, )), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(4.0), + borderSide: BorderSide(color: Color(0XFF8270DB),width: 2,), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(4.0), + borderSide: BorderSide(color: greyColor), + ), - 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( + 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( icon:Image.asset('assets/your_image.png'), color: isObscureText==true?greyColor:primaryColor, ),*/ - onPressed: () { - - print("show password"); - setState(() { - isObscureText = !isObscureText; - }); - }, - ), + onPressed: () { + 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( - onTap: (){ - /* Navigator.push( + ), + ), + + SizedBox(height:MediaQuery.of(context).size.height * .016,), + Align( + alignment: Alignment.bottomLeft, + child:GestureDetector( + onTap: (){ + /* Navigator.push( context, MaterialPageRoute(builder: (context) => ForgotpasswordNew()), );*/ - }, - child: Text( - 'Forgot Password?', - style: fontTextStyle(12,Color(0XFF1D7AFC),FontWeight.w600), + }, + child: Text( + 'Forgot Password?', + 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 ), - ) - ), - 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(); + ), + onPressed: () async{ - if(isOnline){ - SharedPreferences prefs = await SharedPreferences.getInstance(); - String? fcmToken = prefs.getString('fcmToken'); - var payload = new Map(); - payload["phone"] = mobileNumberController.text.toString(); - payload["password"] = passwordController.text.toString(); - payload["fcmIds"] = [fcmToken]; + if (mobileNumberController.text != ''&& + passwordController.text != '') { + AppSettings.preLoaderDialog(context); - bool signinStatus = await AppSettings.login(payload); + bool isOnline = await AppSettings.internetConnectivity(); - try{ - if (signinStatus) { - Navigator.of(context,rootNavigator: true).pop(); - String token = AppSettings.accessToken; - await storage.write(key: 'authToken', value: token); + if(isOnline){ + SharedPreferences prefs = await SharedPreferences.getInstance(); + String? fcmToken = prefs.getString('fcmToken'); + var payload = new Map(); + payload["phone"] = mobileNumberController.text.toString(); + payload["password"] = passwordController.text.toString(); + payload["fcmIds"] = [fcmToken]; - print('Token saved: $token'); - await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const DashboardScreen()), - ); - AppSettings.longSuccessToast("Logged in Successfully"); - mobileNumberController.text=''; - passwordController.text=''; + bool signinStatus = await AppSettings.login(payload); - } else { - Navigator.of(context,rootNavigator: true).pop(); - AppSettings.longFailedToast("Invalid details"); - } - } - catch(exception){ + try{ + if (signinStatus) { 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(); - AppSettings.longFailedToast("Please Check internet"); + print(exception); } - - } else{ - - AppSettings.longFailedToast("Please enter valid details"); + Navigator.of(context,rootNavigator: true).pop(); + 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),), + )), + ], + ), + ) + )), + ), + ], + ) ); } } diff --git a/lib/login/login_signup_screen.dart b/lib/login/login_signup_screen.dart index 6e1b377..11046cc 100644 --- a/lib/login/login_signup_screen.dart +++ b/lib/login/login_signup_screen.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:supplier_new/common/settings.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 { const LoginSignUpScreen({super.key}); @@ -13,90 +13,88 @@ class LoginSignUpScreen extends StatefulWidget { class _LoginSignUpScreenState extends State { @override Widget build(BuildContext context) { - return SafeArea( - child: Scaffold( - body: Padding( - padding: EdgeInsets.all(24), - child: Column( - children: [ - SizedBox(height: MediaQuery.of(context).size.height * .2), - Center( - child: Text("AQUICK SUPPLIER", - style: fontTextStyle(20, Color(0XFF515253), FontWeight.w800)), + return Scaffold( + body: Padding( + padding: EdgeInsets.all(24), + child: Column( + children: [ + SizedBox(height: MediaQuery.of(context).size.height * .2), + Center( + child: Text("AQUICK SUPPLIER", + 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 * .05), - Center( - child: Text( - "Welcome to Aquick Supplier", - style: fontTextStyle(20, Color(0XFF343637), FontWeight.w700), - ), + ), + SizedBox(height: MediaQuery.of(context).size.height * .012), + Center( + child: Text( + "Sign up or login to be listed as a supplier, start deliveries and track orders", + style: fontTextStyle(12, Color(0XFF7E7F80), FontWeight.w400), + textAlign: TextAlign.center, // Keeps text centered in multiple lines ), - SizedBox(height: MediaQuery.of(context).size.height * .012), - Center( - child: Text( - "Sign up or login to be listed as a supplier, start deliveries and track orders", - style: fontTextStyle(12, Color(0XFF7E7F80), FontWeight.w400), - 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, + ) + , + 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: Color(0XFF757575), - backgroundColor: Colors.white, + foregroundColor: Colors.white, + backgroundColor: primaryColor, shape: RoundedRectangleBorder( 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( context, MaterialPageRoute( - builder: (context) => SignUp()), + builder: (context) => Login()), ); }, - child: Text( - 'Sign up', - style: fontTextStyle(12, Color(0XFF757575), FontWeight.w500), + 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, + 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), + ), + ), + ) - ], - ), - ) - ), + ], + ), + ) ); } } diff --git a/lib/login/starting_screen.dart b/lib/login/starting_screen.dart index 740ed57..8c78c0f 100644 --- a/lib/login/starting_screen.dart +++ b/lib/login/starting_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:supplier_new/common/settings.dart'; import 'package:supplier_new/login/login_signup_screen.dart'; @@ -12,78 +13,77 @@ class StartingScreen extends StatefulWidget { class _StartingScreenState extends State { @override Widget build(BuildContext context) { - return SafeArea( - child: Scaffold( - body: Padding( - padding: EdgeInsets.all(24), - child: Column( - children: [ - SizedBox(height: MediaQuery.of(context).size.height * .2), - Center( - child: Text("AQUICK SUPPLIER", - 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("Want to be a supplier on Aquick Tankers?", - style: fontTextStyle(16, Color(0XFF343637), FontWeight.w600)), - ), - SizedBox(height: MediaQuery.of(context).size.height * .04), - Container( + + return Scaffold( + body: Padding( + padding: EdgeInsets.all(24), + child: Column( + children: [ + SizedBox(height: MediaQuery.of(context).size.height * .2), + Center( + child: Text("AQUICK SUPPLIER", + 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("Want to be a supplier on Aquick Tankers?", + style: fontTextStyle(16, Color(0XFF343637), FontWeight.w600)), + ), + 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) => LoginSignUpScreen()), + ); + }, + child: Text( + 'Yes', + 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, child: ElevatedButton( style: ElevatedButton.styleFrom( - foregroundColor: Colors.white, - backgroundColor: primaryColor, + foregroundColor: Color(0XFF757575), + backgroundColor: Colors.white, shape: RoundedRectangleBorder( 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 { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => LoginSignUpScreen()), - ); + // Your onPressed logic }, child: Text( - 'Yes', - 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, - 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 - ), + 'No, I want to buy water', + style: fontTextStyle(12, Color(0XFF757575), FontWeight.w500), ), ), - onPressed: () async { - // Your onPressed logic - }, - child: Text( - 'No, I want to buy water', - style: fontTextStyle(12, Color(0XFF757575), FontWeight.w500), - ), - ), - ) - ], - ), - )), - ); + ) + ], + ), + )); } } diff --git a/lib/login/signup.dart b/lib/signup/signup.dart similarity index 98% rename from lib/login/signup.dart rename to lib/signup/signup.dart index 8d60fee..ddbdf4f 100644 --- a/lib/login/signup.dart +++ b/lib/signup/signup.dart @@ -88,9 +88,10 @@ class _SignUpState extends State { child: Row( children: [ Image.asset( - 'images/Maps.png', + 'images/maps.png', width: 20, height: 20, + color: primaryColor, ), const SizedBox(width: 8), Text(