auth UI and Api

This commit is contained in:
mohammad
2024-07-31 16:02:05 +03:00
parent 69abad24b7
commit 1d65617d18
13 changed files with 405 additions and 228 deletions

View File

@ -7,4 +7,5 @@ abstract class ApiEndpoints {
static const String login = '$baseUrl/authentication/user/login';
static const String forgetPassword = '$baseUrl/authentication/user/forget-password';
static const String sendOtp = '$baseUrl/authentication/user/send-otp';
static const String verifyOtp = '$baseUrl/authentication/user/verify-otp';
}

View File

@ -0,0 +1,43 @@
class StringsManager {
static const noRouteFound = 'No route found';
static const noInternetConnection = 'No internet connection';
static const String dashboard = 'Dashboard';
static const String devices = 'Devices';
static const String routine = 'Routines';
static const String tapToRunRoutine = 'Tap to run routine';
static const String wizard = 'Wizard';
static const String active = 'Active';
static const String current = 'Current';
static const String frequency = 'Frequency';
static const String energyUsage = 'Energy Usage';
static const String totalConsumption = 'Total Consumption';
static const String ACConsumption = 'AC Consumption';
static const String units = 'Units';
static const String emissions = 'Emissions';
static const String reductions = 'Reductions';
static const String winter = 'Winter';
static const String winterMode = 'Winter Mode';
static const String summer = 'Summer';
static const String summerMode = 'Summer Mode';
static const String on = 'ON';
static const String off = 'OFF';
static const String timer = 'Timer';
static const String dimmerAndColor = "Dimmer & color";
static const String recentlyUsed = "Recently used colors";
static const String lightingModes = "Lighting modes";
static const String doze = "Doze";
static const String relax = "Relax";
static const String reading = "Reading";
static const String energizing = "Energizing";
static const String createScene = 'Create Scene';
static const String tapToRun = 'Launch: Tap - To - Run';
static const String turnOffAllLights =
'Example: turn off all lights in the with one tap.';
static const String whenDeviceStatusChanges = 'When device status changes';
static const String whenUnusualActivityIsDetected =
'Example: when an unusual activity is detected.';
static const String functions = "Functions";
static const String firstLaunch = "firstLaunch";
static const String deleteScene = 'Delete Scene';
static const String deleteAutomation = 'Delete Automation';
}

View File

@ -0,0 +1,58 @@
import 'package:shared_preferences/shared_preferences.dart';
class SharedPreferencesHelper {
static saveStringToSP(String key, String value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setString(key, value);
}
static saveBoolToSP(String key, bool value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool(key, value);
}
static saveIntToSP(String key, int value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setInt(key, value);
}
static saveDoubleToSP(String key, double value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setDouble(key, value);
}
static saveStringListToSP(String key, List<String> value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setStringList(key, value);
}
static Future<String> readStringFromSP(String key) async {
final prefs = await SharedPreferences.getInstance();
String value = prefs.getString(key) ?? '';
return value;
}
static Future<bool?> readBoolFromSP(String key) async {
final prefs = await SharedPreferences.getInstance();
bool? value = prefs.getBool(key);
return value;
}
static Future<int> readIntFromSP(String key) async {
final prefs = await SharedPreferences.getInstance();
int value = prefs.getInt(key) ?? 0;
return value;
}
static Future<List<String>> readStringListFromSP(String key) async {
final prefs = await SharedPreferences.getInstance();
List<String>? value = prefs.getStringList(key) ?? [];
return value;
}
static Future<bool> removeValueFromSP(String key) async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove(key);
return true;
}
}