diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3926dfc..eef1798 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ + createState() => _DashboardScreenState(); +} + +class _DashboardScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar:AppSettings.appBar('Dashboard'), + + ); + } +} diff --git a/lib/common/settings.dart b/lib/common/settings.dart index 9e7cbd3..dd645a6 100644 --- a/lib/common/settings.dart +++ b/lib/common/settings.dart @@ -305,4 +305,43 @@ class AppSettings{ textColor: Colors.white, fontSize: 16.0); } + + static appBar(String title) { + title = title ?? ''; + return AppBar( + backgroundColor: Colors.white, + elevation: 0, + scrolledUnderElevation: 0, + title: Text(title,style: fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w500),), + iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), + actions: [ + Row( + children: [ + Padding(padding: EdgeInsets.fromLTRB(10,10,0,10), + child: IconButton( + icon: Image( + image: AssetImage('images/customercare_appbar.png') + + ), + onPressed: (){ + + }, + ), + ), + + Padding(padding: EdgeInsets.fromLTRB(0,10,10,10), + child: IconButton( + icon: Image.asset( + 'images/notification_appbar.png', // Example URL image + ), + onPressed: (){ + + }, + ), + ) + ], + ) + ], + ); + } } \ No newline at end of file diff --git a/lib/common/splash_screen.dart b/lib/common/splash_screen.dart index 148d400..cc75f45 100644 --- a/lib/common/splash_screen.dart +++ b/lib/common/splash_screen.dart @@ -1,11 +1,15 @@ -import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:firebase_core/firebase_core.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:supplier_new/common/dashboard.dart'; +import 'package:supplier_new/common/settings.dart'; import 'package:supplier_new/login/login.dart'; import 'package:supplier_new/login/starting_screen.dart'; void main() async{ SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); + await Firebase.initializeApp(); //FirebaseMessaging.onBackgroundMessage(_messageHandler); runApp(new Splash()); } @@ -17,7 +21,7 @@ class Splash extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, - title: 'Water Management', + title: 'Aquick Supplier', theme: new ThemeData( primarySwatch: Colors.blue, ), @@ -35,36 +39,31 @@ class SplashScreen extends StatefulWidget { class _SplashScreenState extends State { - - Widget _defaultHome = new StartingScreen(); - - - /*void loginCheck()async{ - - bool _result = await AppSettings.isSigIn(); - - - *//*store device information in firebase*//* - try{ - if(Platform.isIOS){ - await FireBaseCore.init(); - } - //await FireBaseCore.init(); - await FireBaseCore.checkFcmTokenInFireStoreDbWithdeviceId(); - // AppSettings.fcmId=await AppSettings.getData('FCM_TOKEN', 'STRING'); - } - catch(e){ - print(e); - } - - if (_result) { + final storage = FlutterSecureStorage( + aOptions: AndroidOptions( + resetOnError: true, + encryptedSharedPreferences: true, + ), + ); + + Future _checkLoginStatus() async { + await Future.delayed(Duration(seconds: 2)); // Simulate splash delay + String? authToken = await storage.read(key: 'authToken'); + if (authToken != null) { await AppSettings.loadDataFromMemory(); - AppSettings.fcmId=await AppSettings.getData('FCM_TOKEN', 'STRING'); - // await AppSettings.getProfile(); - _defaultHome = new DashboardScreen(); + //AppSettings.fcmId=await AppSettings.getData('FCM_TOKEN', 'STRING'); + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => DashboardScreen()), + ); + } else { + // Navigate to Login Screen otherwise + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => StartingScreen()), + ); } - }*/ - + } @@ -73,12 +72,13 @@ class _SplashScreenState extends State { //loginCheck(); super.initState(); - Future.delayed( + _checkLoginStatus(); + /* Future.delayed( const Duration(seconds: 3), () => Navigator.push( context, MaterialPageRoute(builder: (context) => _defaultHome), - )); + ));*/ } @override Widget build(BuildContext context) { diff --git a/lib/login/login.dart b/lib/login/login.dart index 8181edb..2ae5d90 100644 --- a/lib/login/login.dart +++ b/lib/login/login.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:supplier_new/common/dashboard.dart'; import 'package:supplier_new/common/settings.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -219,11 +220,11 @@ class _LoginState extends State { await storage.write(key: 'authToken', value: token); print('Token saved: $token'); - /*await Navigator.push( + await Navigator.push( context, MaterialPageRoute( builder: (context) => const DashboardScreen()), - );*/ + ); AppSettings.longSuccessToast("Logged in Successfully"); mobileNumberController.text=''; passwordController.text=''; diff --git a/lib/login/login_signup_screen.dart b/lib/login/login_signup_screen.dart index a28b7b6..6e1b377 100644 --- a/lib/login/login_signup_screen.dart +++ b/lib/login/login_signup_screen.dart @@ -1,6 +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'; class LoginSignUpScreen extends StatefulWidget { const LoginSignUpScreen({super.key}); @@ -79,7 +80,11 @@ class _LoginSignUpScreenState extends State { ), ), onPressed: () async { - // Your onPressed logic + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SignUp()), + ); }, child: Text( 'Sign up', diff --git a/lib/login/signup.dart b/lib/login/signup.dart new file mode 100644 index 0000000..8d60fee --- /dev/null +++ b/lib/login/signup.dart @@ -0,0 +1,150 @@ +import 'package:flutter/material.dart'; + +import '../common/settings.dart'; + +class SignUp extends StatefulWidget { + const SignUp({super.key}); + + @override + State createState() => _SignUpState(); +} + +class _SignUpState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.white, + elevation: 0, + scrolledUnderElevation: 0, + + ), + backgroundColor: Colors.white, + body: SingleChildScrollView( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Top image + Container( + width: 24, + height: 24, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('images/business.png'), + fit: BoxFit.contain, // Optional: can also use BoxFit.cover + ), + ), + ), + + const SizedBox(height: 12), + + Text( + 'Tell us about your water tanker business', + style: fontTextStyle(12, Color(0xFF2D2E30),FontWeight.w400), + ), + + const SizedBox(height: 24), + + Text( + "BUSINESS REGISTRATION", + style: fontTextStyle(10, Color(0xFF2D2E30),FontWeight.w600), + ), + const SizedBox(height: 10), + + _buildTextField('Business Name *', 'Enter your Business Name'), + _buildTextField('Registration Number *', 'Business Registration Number'), + _buildTextField('Years in Business *', 'Years of operation'), + + const SizedBox(height: 24), + Text( + "CONTACT INFORMATION", + style: fontTextStyle(10, Color(0xFF2D2E30),FontWeight.w600), + ), + const SizedBox(height: 10), + + _buildTextField('Primary Contact Name *', 'Full Name'), + _buildTextField('Position/Title *', 'Job title'), + _buildTextField('Mobile Number *', 'Mobile Number'), + _buildTextField('Additional Mobile Number', 'Alternate Number'), + _buildTextField('Email Address', 'Email Address'), + + const SizedBox(height: 24), + Text( + "BUSINESS ADDRESS", + style: fontTextStyle(10, Color(0xFF2D2E30),FontWeight.w600), + ), + const SizedBox(height: 10), + + _buildTextField('Address Line 1 *', '123 Main St'), + _buildTextField('Address Line 2(Optional)', 'Area'), + _buildTextField('City *', 'City'), + _buildTextField('State/Province *', 'State'), + _buildTextField('ZIP/Postal Code ', '12345'), + + const SizedBox(height: 10), + Padding( + padding: const EdgeInsets.only(left: 45.0), // Add space on the left + child: Row( + children: [ + Image.asset( + 'images/Maps.png', + width: 20, + height: 20, + ), + const SizedBox(width: 8), + Text( + "Add Location from Maps", + style: fontTextStyle(14, Color(0xFF2D2E30),FontWeight.w500), + ), + ], + ), + ), + const SizedBox(height: 20), + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: () { + // Submit logic goes here + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blueAccent, + padding: const EdgeInsets.symmetric(vertical: 16), + ), + child: Text( + 'Submit', + style: fontTextStyle(16, Colors.white, FontWeight.w600), + ), + ), + ), + ], + ), + ), + ); + } + + Widget _buildTextField(String label, String hint) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label, + style: fontTextStyle(12, Color(0xFF2D2E30),FontWeight.w500), + ), + const SizedBox(height: 6), + TextField( + decoration: InputDecoration( + hintText: hint, + hintStyle: fontTextStyle(13, Colors.grey.shade600, FontWeight.normal), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), + ), + ), + const SizedBox(height: 16), + ], + ); + } +} +