remove i18n package, change the location localized values,
change provider name and create new providermerge-requests/53/head
parent
cc929ba4a5
commit
3fbc2dabef
@ -0,0 +1,7 @@
|
||||
const Map<String, Map<String, String>> localizedValues = {
|
||||
'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'},
|
||||
'settings': {'en': 'Settings', 'ar': 'الاعدادات'},
|
||||
'language': {'en': 'App Language', 'ar': 'لغة التطبيق'},
|
||||
'lanEnglish': {'en': 'English', 'ar': 'English'},
|
||||
'lanArabic': {'en': 'العربية', 'ar': 'العربية'}
|
||||
};
|
||||
@ -1,4 +1,4 @@
|
||||
final TOKEN = 'token';
|
||||
final PROJECT_ID="projectID";
|
||||
final SLECTED_PATIENT_TYPE="slectedPatientType";
|
||||
final APP_Language = "Language";
|
||||
final APP_Language = "language";
|
||||
@ -1,25 +0,0 @@
|
||||
// GENERATED FILE, do not edit!
|
||||
import 'package:i18n/i18n.dart' as i18n;
|
||||
|
||||
String get _languageCode => 'en';
|
||||
String get _localeName => 'en';
|
||||
|
||||
String _plural(int count, {String zero, String one, String two, String few, String many, String other}) =>
|
||||
i18n.plural(count, _languageCode, zero:zero, one:one, two:two, few:few, many:many, other:other);
|
||||
String _ordinal(int count, {String zero, String one, String two, String few, String many, String other}) =>
|
||||
i18n.ordinal(count, _languageCode, zero:zero, one:one, two:two, few:few, many:many, other:other);
|
||||
String _cardinal(int count, {String zero, String one, String two, String few, String many, String other}) =>
|
||||
i18n.cardinal(count, _languageCode, zero:zero, one:one, two:two, few:few, many:many, other:other);
|
||||
|
||||
class Ar {
|
||||
const Ar();
|
||||
ButtonAr get button => ButtonAr(this);
|
||||
}
|
||||
|
||||
class ButtonAr {
|
||||
final Ar _parent;
|
||||
const ButtonAr(this._parent);
|
||||
String get save => "حفظ";
|
||||
String get load => "تحميل";
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
button:
|
||||
save: حفظ
|
||||
load: تحميل
|
||||
@ -1,25 +0,0 @@
|
||||
// GENERATED FILE, do not edit!
|
||||
import 'package:i18n/i18n.dart' as i18n;
|
||||
|
||||
String get _languageCode => 'en';
|
||||
String get _localeName => 'en';
|
||||
|
||||
String _plural(int count, {String zero, String one, String two, String few, String many, String other}) =>
|
||||
i18n.plural(count, _languageCode, zero:zero, one:one, two:two, few:few, many:many, other:other);
|
||||
String _ordinal(int count, {String zero, String one, String two, String few, String many, String other}) =>
|
||||
i18n.ordinal(count, _languageCode, zero:zero, one:one, two:two, few:few, many:many, other:other);
|
||||
String _cardinal(int count, {String zero, String one, String two, String few, String many, String other}) =>
|
||||
i18n.cardinal(count, _languageCode, zero:zero, one:one, two:two, few:few, many:many, other:other);
|
||||
|
||||
class En {
|
||||
const En();
|
||||
ButtonEn get button => ButtonEn(this);
|
||||
}
|
||||
|
||||
class ButtonEn {
|
||||
final En _parent;
|
||||
const ButtonEn(this._parent);
|
||||
String get save => "Save";
|
||||
String get load => "Load";
|
||||
}
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
button:
|
||||
save: Save
|
||||
load: Load
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class ProjectProvider with ChangeNotifier{
|
||||
|
||||
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
|
||||
Locale _appLocale;
|
||||
String currentLanguage = 'ar';
|
||||
bool _isArabic = false;
|
||||
|
||||
Locale get appLocal => _appLocale;
|
||||
|
||||
bool get isArabic => _isArabic;
|
||||
|
||||
ProjectProvider(){
|
||||
loadSharedPrefLanguage ();
|
||||
}
|
||||
void loadSharedPrefLanguage() async {
|
||||
currentLanguage = await sharedPref.getString(APP_Language);
|
||||
_appLocale = Locale(currentLanguage ?? 'ar');
|
||||
_isArabic = currentLanguage != null
|
||||
? currentLanguage == 'ar' ? true : false
|
||||
: false;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void changeLanguage(String lan) {
|
||||
if (lan != "en" && currentLanguage != lan) {
|
||||
_appLocale = Locale("ar");
|
||||
_isArabic = true;
|
||||
currentLanguage = 'ar';
|
||||
sharedPref.setString(APP_Language, 'ar');
|
||||
} else if (lan != "ar" && currentLanguage != lan) {
|
||||
_appLocale = Locale("en");
|
||||
_isArabic = false;
|
||||
currentLanguage = 'en';
|
||||
sharedPref.setString(APP_Language, 'en');
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||
|
||||
import '../interceptor/http_interceptor.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http_interceptor/http_client_with_interceptor.dart';
|
||||
|
||||
const GET_PROJECTS = BASE_URL + 'Lists.svc/REST/GetProjectForDoctorAPP';
|
||||
|
||||
class HospitalProvider with ChangeNotifier {
|
||||
|
||||
|
||||
|
||||
Client client =
|
||||
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
|
||||
|
||||
Future<Map> getProjectsList() async {
|
||||
const url = GET_PROJECTS;
|
||||
var info = {
|
||||
"LanguageID": 2,
|
||||
"stamp": "2020-02-26T13:51:44.111Z",
|
||||
"IPAdress": "11.11.11.11",
|
||||
"VersionID": 1.2,
|
||||
"Channel": 9,
|
||||
"TokenID": "",
|
||||
"SessionID": "i1UJwCTSqt",
|
||||
"IsLoginForDoctorApp": true
|
||||
};
|
||||
try {
|
||||
final response = await client.post(url, body: json.encode(info));
|
||||
return Future.value(json.decode(response.body));
|
||||
} catch (error) {
|
||||
throw error;
|
||||
// print('error');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/providers/schedule_provider.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../interceptor/http_interceptor.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http_interceptor/http_client_with_interceptor.dart';
|
||||
|
||||
const GET_PROJECTS = BASE_URL + 'Lists.svc/REST/GetProjectForDoctorAPP';
|
||||
|
||||
class ProjectsProvider with ChangeNotifier {
|
||||
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
|
||||
Locale _appLocale;
|
||||
String currentLanguage = 'ar';
|
||||
bool _isArabic = false;
|
||||
|
||||
Locale get appLocal => _appLocale;
|
||||
|
||||
bool get isArabic => _isArabic;
|
||||
|
||||
ProjectsProvider() {
|
||||
loadSharedPrefLan();
|
||||
}
|
||||
|
||||
void loadSharedPrefLan() async {
|
||||
currentLanguage = await sharedPref.getString(APP_Language);
|
||||
_appLocale = Locale(currentLanguage ?? 'ar');
|
||||
_isArabic = currentLanguage != null
|
||||
? currentLanguage == 'ar' ? true : false
|
||||
: false;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void changeDirection(String lan) {
|
||||
if (lan != "en" && currentLanguage != lan) {
|
||||
_appLocale = Locale("ar");
|
||||
_isArabic = true;
|
||||
currentLanguage = 'ar';
|
||||
sharedPref.setString(APP_Language, 'ar');
|
||||
} else if (lan != "ar" && currentLanguage != lan) {
|
||||
_appLocale = Locale("en");
|
||||
_isArabic = false;
|
||||
currentLanguage = 'en';
|
||||
sharedPref.setString(APP_Language, 'en');
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Client client =
|
||||
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
|
||||
|
||||
Future<Map> getProjectsList() async {
|
||||
const url = GET_PROJECTS;
|
||||
var info = {
|
||||
"LanguageID": 2,
|
||||
"stamp": "2020-02-26T13:51:44.111Z",
|
||||
"IPAdress": "11.11.11.11",
|
||||
"VersionID": 1.2,
|
||||
"Channel": 9,
|
||||
"TokenID": "",
|
||||
"SessionID": "i1UJwCTSqt",
|
||||
"IsLoginForDoctorApp": true
|
||||
};
|
||||
try {
|
||||
final response = await client.post(url, body: json.encode(info));
|
||||
return Future.value(json.decode(response.body));
|
||||
} catch (error) {
|
||||
throw error;
|
||||
// print('error');
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue