diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies
index 697cd7d..f69803f 100644
--- a/.flutter-plugins-dependencies
+++ b/.flutter-plugins-dependencies
@@ -1 +1 @@
-{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.19\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.4.13\\\\","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.4.1\\\\","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.4.1\\\\","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.4.3\\\\","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2025-11-27 16:07:43.320239","version":"3.32.2","swift_package_manager_enabled":{"ios":false,"macos":false}}
\ No newline at end of file
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_ios-0.8.13\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_plugin_android_lifecycle-2.0.31\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_android","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_android-0.8.13+1\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"path_provider_android","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.19\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.4.13\\\\","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"file_selector_macos","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_macos-0.9.4+4\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_macos","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_macos-0.2.2\\\\","native_build":false,"dependencies":["file_selector_macos"],"dev_dependency":false},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"file_selector_linux","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_linux-0.9.4\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_linux","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_linux-0.2.2\\\\","native_build":false,"dependencies":["file_selector_linux"],"dev_dependency":false},{"name":"path_provider_linux","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.4.1\\\\","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"file_selector_windows","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_windows-0.9.3+5\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"image_picker_windows","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_windows-0.2.2\\\\","native_build":false,"dependencies":["file_selector_windows"],"dev_dependency":false},{"name":"path_provider_windows","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.4.1\\\\","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"image_picker_for_web","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_for_web-3.1.1\\\\","dependencies":[],"dev_dependency":false},{"name":"shared_preferences_web","path":"C:\\\\Users\\\\malia\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.4.3\\\\","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2025-12-03 11:42:36.705771","version":"3.32.2","swift_package_manager_enabled":{"ios":false,"macos":false}}
\ No newline at end of file
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index fd27643..dfaeced 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -8,7 +8,7 @@ plugins {
android {
namespace = "com.example.kent_logistics_app"
compileSdk = flutter.compileSdkVersion
- ndkVersion = flutter.ndkVersion
+ ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 3e9c080..70f970d 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,8 +1,15 @@
+
+
+
+
+
+
+
-
+
+ android:name="io.flutter.embedding.android.NormalTheme"
+ android:resource="@style/NormalTheme" />
+
+
-
+
-
-
+
+
+
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 3aec1cc..7ec31d6 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -2,6 +2,11 @@
+ NSPhotoLibraryUsageDescription
+ App requires photo library access to update profile picture.
+ NSCameraUsageDescription
+ App requires camera access to take profile picture.
+
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
diff --git a/lib/config/api_config.dart b/lib/config/api_config.dart
index 50800a0..4f285c1 100644
--- a/lib/config/api_config.dart
+++ b/lib/config/api_config.dart
@@ -1,4 +1,3 @@
class ApiConfig {
- // Android emulator (use 10.0.2.2), change for physical device or iOS simulator
- static const String baseUrl = "http://10.0.2.2:8000/api";
+ static const String baseUrl = "http://10.207.50.74:8000/api";
}
diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart
new file mode 100644
index 0000000..5c09b72
--- /dev/null
+++ b/lib/config/app_config.dart
@@ -0,0 +1,13 @@
+class AppConfig {
+ // For Website & Browser (PC)
+ static const String logoUrlWeb = "http://127.0.0.1:8000/images/kent_logo2.png";
+
+ // For Android Emulator
+ static const String logoUrlEmulator = "http://10.0.2.2:8000/images/kent_logo2.png";
+
+ // For Physical Device (Replace with your actual PC local IP)
+ static const String logoUrlDevice = "http://10.207.50.74:8000/images/kent_logo2.png";
+
+ // Which one to use?
+ static const String logoUrl = logoUrlDevice; // CHANGE THIS WHEN TESTING ON REAL DEVICE
+}
diff --git a/lib/main.dart b/lib/main.dart
index 92817bb..b1c0a83 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,28 +1,78 @@
import 'package:flutter/material.dart';
+import 'package:kent_logistics_app/providers/dashboard_provider.dart';
+import 'package:kent_logistics_app/providers/invoice_provider.dart';
+import 'package:kent_logistics_app/providers/mark_list_provider.dart';
+import 'package:kent_logistics_app/providers/order_provider.dart';
+import 'package:kent_logistics_app/services/dio_client.dart';
+import 'package:kent_logistics_app/services/order_service.dart';
import 'package:provider/provider.dart';
import 'providers/auth_provider.dart';
+import 'providers/user_profile_provider.dart'; // NEW IMPORT
import 'screens/splash_screen.dart';
import 'package:google_fonts/google_fonts.dart';
-void main() {
- runApp(const KentApp());
+void main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+
+ final auth = AuthProvider();
+ await auth.init(); // IMPORTANT: ensure prefs loaded before build
+
+ runApp(MultiProvider(
+ providers: [
+ ChangeNotifierProvider(create: (_) => auth),
+ ChangeNotifierProvider(create: (_) => UserProfileProvider()),
+ ChangeNotifierProvider(create: (_) => DashboardProvider()),
+ ChangeNotifierProvider(create: (_) => MarkListProvider()),
+ ChangeNotifierProvider(
+ create: (context) => OrderProvider(
+ OrderService(DioClient.getInstance(context)),
+ ),
+
+ ),
+ ChangeNotifierProvider(create: (_) => InvoiceProvider()),
+ ],
+ child: const KentApp(),
+ ));
}
+
class KentApp extends StatelessWidget {
const KentApp({super.key});
@override
Widget build(BuildContext context) {
- return ChangeNotifierProvider(
- create: (_) => AuthProvider(),
+
+ return MultiProvider(
+ providers: [
+ ChangeNotifierProvider(create: (_) => AuthProvider()),
+ ChangeNotifierProvider(create: (_) => UserProfileProvider()), // NEW
+ ChangeNotifierProvider(create: (_) => DashboardProvider()),
+ ChangeNotifierProvider(create: (_) => MarkListProvider()),
+ ChangeNotifierProvider(
+ create: (context) => OrderProvider(
+ OrderService(DioClient.getInstance(context)),
+ ),
+ ),
+ ChangeNotifierProvider(create: (_) => InvoiceProvider()),
+
+
+ ],
child: MaterialApp(
title: 'Kent Logistics',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
textTheme: GoogleFonts.interTextTheme(),
- colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
+ colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),
+ scaffoldBackgroundColor: const Color(0xfff8f6ff), // your light background
+ appBarTheme: const AppBarTheme(
+ backgroundColor: Colors.indigo, // FIX
+ foregroundColor: Colors.white, // white text + icons
+ elevation: 1,
+ centerTitle: true,
+ ),
),
+
home: const SplashScreen(),
),
);
diff --git a/lib/models/user_profile.dart b/lib/models/user_profile.dart
new file mode 100644
index 0000000..9dc2b2d
--- /dev/null
+++ b/lib/models/user_profile.dart
@@ -0,0 +1,46 @@
+class UserProfile {
+ final String customerId;
+ final String customerName;
+ final String companyName;
+ final String? designation;
+ final String email;
+ final String mobile;
+ final String? address;
+ final String? pincode;
+ final String? status;
+ final String? customerType;
+ final String? profileImage;
+ final String? date;
+
+ UserProfile({
+ required this.customerId,
+ required this.customerName,
+ required this.companyName,
+ this.designation,
+ required this.email,
+ required this.mobile,
+ this.address,
+ this.pincode,
+ this.status,
+ this.customerType,
+ this.profileImage,
+ required this.date,
+ });
+
+ factory UserProfile.fromJson(Map json) {
+ return UserProfile(
+ customerId: json['customer_id'],
+ customerName: json['customer_name'],
+ companyName: json['company_name'],
+ designation: json['designation'],
+ email: json['email'],
+ mobile: json['mobile'],
+ address: json['address'],
+ pincode: json['pincode'],
+ status: json['status'],
+ customerType: json['customer_type'],
+ profileImage: json['profile_image'],
+ date: json['date'], // nullable ok now
+ );
+ }
+}
diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart
index 4681d61..ca28d91 100644
--- a/lib/providers/auth_provider.dart
+++ b/lib/providers/auth_provider.dart
@@ -4,25 +4,43 @@ import 'package:shared_preferences/shared_preferences.dart';
import '../services/auth_service.dart';
class AuthProvider extends ChangeNotifier {
- final AuthService _service = AuthService();
+ AuthService? _service;
bool _loading = false;
bool get loading => _loading;
+ bool initialized = false;
+
String? _token;
Map? _user;
String? get token => _token;
Map? get user => _user;
+
bool get isLoggedIn => _token != null && _token!.isNotEmpty;
+ // Inject context after provider initializes
+ void initContext(BuildContext context) {
+ _service = AuthService(context);
+ }
+
AuthProvider() {
_loadFromPrefs();
}
+ // ---------------------- NEW FIX: SAFE INIT -----------------------
+ Future init() async {
+ if (!initialized) {
+ await _loadFromPrefs();
+ }
+ }
+
+ // ---------------------- LOAD FROM PREFS -----------------------
Future _loadFromPrefs() async {
final prefs = await SharedPreferences.getInstance();
+
_token = prefs.getString('token');
+
final userJson = prefs.getString('user');
if (userJson != null) {
try {
@@ -31,22 +49,33 @@ class AuthProvider extends ChangeNotifier {
_user = null;
}
}
+
+ initialized = true;
notifyListeners();
}
- Future