You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
car_common_app/lib/classes/app_state.dart

93 lines
2.2 KiB
Dart

import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:mc_common_app/models/general_models/post_params_model.dart';
import 'package:mc_common_app/models/subscriptions_models/provider_subscription_model.dart';
import 'package:mc_common_app/models/subscriptions_models/subscription_model.dart';
import 'package:mc_common_app/models/user_models/user.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
class AppState {
static final AppState _instance = AppState._internal();
AppState._internal();
factory AppState() => _instance;
bool isLogged = false;
set setLogged(v) => isLogged = v;
bool? get getIsLogged => isLogged;
String? _deviceToken;
String? get getDeviceToken => _deviceToken;
set setDeviceToken(String value) {
_deviceToken = value;
}
String? _deviceType;
String? get getDeviceType => _deviceType;
set setDeviceType(String value) {
_deviceType = value;
}
AppType currentAppType = AppType.provider;
UserType userType = UserType.customer;
void setAppType(AppType appType) {
currentAppType = appType;
}
User? _user;
set setUser(v) => _user = v;
User get getUser => _user ?? User();
PostParamsModel? _postParams;
PostParamsModel? get postParamsObject => _postParams;
Map<String, dynamic> get postParamsJson => _postParams?.toJson() ?? {};
void setPostParamsModel(PostParamsModel _postParams) {
this._postParams = _postParams;
}
LatLng currentLocation = const LatLng(0, 0);
set setCurrentLocation(v) => currentLocation = v;
LatLng get getCurrentLocation => currentLocation;
List<Subscription>? _providerSubscription;
List<Subscription> get getproviderSubscription => _providerSubscription ?? [Subscription(name: "")];
set setproviderSubscription(List<Subscription>? value) {
_providerSubscription = value;
}
DropValue? _userRegisterCountrySelection;
DropValue get getUserRegisterCountrySelection => _userRegisterCountrySelection!;
set setUserRegisterCountrySelection(DropValue value) {
_userRegisterCountrySelection = value;
}
bool _isViewOnly = false;
bool get getIsViewOnly => _isViewOnly;
set setIsViewOnly(bool value) {
_isViewOnly = value;
}
}