updateProfile

This commit is contained in:
2025-02-03 01:29:42 +05:30
parent 42aaa7cdad
commit 1f7254ecaa
48 changed files with 6088 additions and 2473 deletions

View File

@@ -1,5 +1,6 @@
// ignore_for_file: constant_identifier_names
import 'package:grocery_app/src/data/user_profile.dart';
import 'package:shared_preferences/shared_preferences.dart';
// Shared preference for the app to store data locally
@@ -35,7 +36,43 @@ class SharedPrefUtils {
static const String STORE_ID = "STORE_ID";
static const String REFRESH_TOKEN = "REFRESH_TOKEN";
/// Set bearer authorization token
static const String KEY_NAME = "user_name";
static const String KEY_LAST_NAME = "user_name";
static const String KEY_EMAIL = "user_email";
static const String KEY_PROFILE = "user_profile";
static Future<void> saveUser({
required UserProfile user,
}) async {
print("jdhsfhjdjfhg ${user.img}");
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString(KEY_NAME, user.firstName ?? "");
await prefs.setString(KEY_LAST_NAME, user.lastName ?? "");
await prefs.setString(KEY_EMAIL, user.email ?? " ");
await prefs.setString(KEY_PROFILE, user.img ?? " ");
}
static Future<String?> getUserName() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getString(KEY_NAME);
}
static Future<String?> getLastName() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getString(KEY_LAST_NAME);
}
/// Get user email
static Future<String?> getUserEmail() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getString(KEY_EMAIL);
}
/// Get user profile URL
static Future<String?> getUserProfile() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getString(KEY_PROFILE);
}
static Future<bool> setToken({required String authToken}) {
_token = authToken;
return SharedPreferences.getInstance()
@@ -232,10 +269,7 @@ class SharedPrefUtils {
return firstName!;
}
static Future<String> getLastName() async {
final sp = await SharedPreferences.getInstance();
return sp.getString(LAST_NAME) ?? "";
}
static Future<String> getEmail() async {
final sp = await SharedPreferences.getInstance();
@@ -247,11 +281,6 @@ class SharedPrefUtils {
return sp.getString(PASSWORD) ?? "";
}
static Future<String> getUsername() async {
final sp = await SharedPreferences.getInstance();
return sp.getString(USER_NAME) ?? "";
}
static Future<bool> getRandomInstruction() async {
final sp = await SharedPreferences.getInstance();
return sp.getBool(INS_RANDOM) ?? true;

View File

@@ -2,10 +2,12 @@ class APPSTRING {
//title
static const String enterYourMobileNumber = "Enter Your Mobile Number";
static const String whatYourPhoneNumber = "What's your phone number?";
static const String codeSentText = "A code will be send to verify your phone number";
static const String codeSentText =
"A code will be send to verify your phone number";
static const String enterVerificationCode = "Enter Verification Code";
static const String enterCode = "Enter the 6-digit code sent to you at ********8902";
static const String enterCode =
"Enter the 6-digit code sent to you at ********8902";
static const String pleaseEnterYourFullName = "Please Enter Your Full Name";
//hint
@@ -13,11 +15,16 @@ class APPSTRING {
static const String firstNameHint = "First Name";
static const String lastNameHint = "last Name";
static const String emailHint = "Email-ID";
static const String emailHint = "Email-ID";
static const String addressHint = "Address";
//button
static const String verifyButton = "Verify";
static const String continueBtn = "Continue";
static const String appName = "Customer App";
static const String appName = "Customer App";
static String userName = "user_name";
static String userLastName = "user_name";
static String emailName = "user_email";
static String userProfile = "user_profile";
}