new pages added
parent
192b21a7e7
commit
f8d8e1c685
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "815750722565",
|
||||||
|
"firebase_url": "https://api-project-815750722565.firebaseio.com",
|
||||||
|
"project_id": "api-project-815750722565",
|
||||||
|
"storage_bucket": "api-project-815750722565.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:815750722565:android:62281cd3e5df4063",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.cloud.diplomaticquarterapp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"analytics_service": {
|
||||||
|
"status": 1
|
||||||
|
},
|
||||||
|
"appinvite_service": {
|
||||||
|
"status": 1,
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
},
|
||||||
|
"ads_service": {
|
||||||
|
"status": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@ -1,3 +1,3 @@
|
|||||||
const TOKEN = 'token';
|
const TOKEN = 'token';
|
||||||
const APP_LANGUAGE = 'language';
|
const APP_LANGUAGE = 'language';
|
||||||
|
const USER_PROFILE = 'user-profile';
|
||||||
|
|||||||
@ -0,0 +1,68 @@
|
|||||||
|
class SelectDeviceIMEIRES {
|
||||||
|
bool biometricEnabled;
|
||||||
|
String createdOn;
|
||||||
|
String editedOn;
|
||||||
|
int iD;
|
||||||
|
String iMEI;
|
||||||
|
String identificationNo;
|
||||||
|
int logInType;
|
||||||
|
String mobile;
|
||||||
|
String name;
|
||||||
|
String nameN;
|
||||||
|
bool outSA;
|
||||||
|
int patientID;
|
||||||
|
int patientType;
|
||||||
|
int preferredLanguage;
|
||||||
|
|
||||||
|
SelectDeviceIMEIRES(
|
||||||
|
{this.biometricEnabled,
|
||||||
|
this.createdOn,
|
||||||
|
this.editedOn,
|
||||||
|
this.iD,
|
||||||
|
this.iMEI,
|
||||||
|
this.identificationNo,
|
||||||
|
this.logInType,
|
||||||
|
this.mobile,
|
||||||
|
this.name,
|
||||||
|
this.nameN,
|
||||||
|
this.outSA,
|
||||||
|
this.patientID,
|
||||||
|
this.patientType,
|
||||||
|
this.preferredLanguage});
|
||||||
|
|
||||||
|
SelectDeviceIMEIRES.fromJson(Map<String, dynamic> json) {
|
||||||
|
biometricEnabled = json['BiometricEnabled'];
|
||||||
|
createdOn = json['CreatedOn'];
|
||||||
|
editedOn = json['EditedOn'];
|
||||||
|
iD = json['ID'];
|
||||||
|
iMEI = json['IMEI'];
|
||||||
|
identificationNo = json['IdentificationNo'];
|
||||||
|
logInType = json['LogInType'];
|
||||||
|
mobile = json['Mobile'];
|
||||||
|
name = json['Name'];
|
||||||
|
nameN = json['NameN'];
|
||||||
|
outSA = json['OutSA'];
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
patientType = json['PatientType'];
|
||||||
|
preferredLanguage = json['PreferredLanguage'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['BiometricEnabled'] = this.biometricEnabled;
|
||||||
|
data['CreatedOn'] = this.createdOn;
|
||||||
|
data['EditedOn'] = this.editedOn;
|
||||||
|
data['ID'] = this.iD;
|
||||||
|
data['IMEI'] = this.iMEI;
|
||||||
|
data['IdentificationNo'] = this.identificationNo;
|
||||||
|
data['LogInType'] = this.logInType;
|
||||||
|
data['Mobile'] = this.mobile;
|
||||||
|
data['Name'] = this.name;
|
||||||
|
data['NameN'] = this.nameN;
|
||||||
|
data['OutSA'] = this.outSA;
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['PatientType'] = this.patientType;
|
||||||
|
data['PreferredLanguage'] = this.preferredLanguage;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class Register extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_Register createState() => _Register();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _Register extends State<Register> {
|
||||||
|
final TextEditingController nationalIDorFile = null;
|
||||||
|
final int loginType = LoginType.loginType;
|
||||||
|
final TextEditingController mobileNo = null;
|
||||||
|
var isHijri;
|
||||||
|
|
||||||
|
DateTime selectedDate;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).login,
|
||||||
|
isShowAppBar: true,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(top: 10, left: 20, right: 20),
|
||||||
|
height: SizeConfig.realScreenHeight * .8,
|
||||||
|
width: SizeConfig.realScreenWidth,
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: AppText(
|
||||||
|
TranslationBase.of(context).enterNationalId,
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3.5,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
MobileNo(controller: mobileNo),
|
||||||
|
Container(
|
||||||
|
child: TextFields(
|
||||||
|
controller: nationalIDorFile,
|
||||||
|
prefixIcon:
|
||||||
|
Icon(Icons.chrome_reader_mode, color: Colors.red),
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20, bottom: 20, left: 10, right: 10),
|
||||||
|
hintText: TranslationBase.of(context).nationalID,
|
||||||
|
)),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Radio(
|
||||||
|
value: 1,
|
||||||
|
groupValue: isHijri,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
isHijri = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(TranslationBase.of(context).hijriDate),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Radio(
|
||||||
|
value: 0,
|
||||||
|
groupValue: isHijri,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
isHijri = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(TranslationBase.of(context).gregorianDate),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: RaisedButton.icon(
|
||||||
|
onPressed: () => {_selectDate(context)},
|
||||||
|
icon: Icon(Icons.date_range),
|
||||||
|
label: Text(selectedDate != null
|
||||||
|
? "${selectedDate.toLocal()}".split(' ')[0]
|
||||||
|
: TranslationBase.of(context).dob)))
|
||||||
|
])
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: RaisedButton(
|
||||||
|
color: Colors.grey,
|
||||||
|
textColor: Colors.white,
|
||||||
|
child: Text(TranslationBase.of(context).login),
|
||||||
|
onPressed: () => {},
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
]),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Null> _selectDate(BuildContext context) async {
|
||||||
|
final DateTime picked = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(2015, 8),
|
||||||
|
lastDate: DateTime(2101));
|
||||||
|
if (picked != null && picked != selectedDate)
|
||||||
|
setState(() {
|
||||||
|
selectedDate = picked;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
// SharedPreferences sharedPref = new SharedPreferences();
|
||||||
|
enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
|
||||||
|
AppSharedPreferences sharedPref = new AppSharedPreferences();
|
||||||
|
|
||||||
|
const String INSERT_DEVICE_IMEI =
|
||||||
|
'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
|
||||||
|
const String SELECT_DEVICE_IMEI =
|
||||||
|
'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
|
||||||
|
|
||||||
|
class AuthProvider with ChangeNotifier {
|
||||||
|
bool isLogin = false;
|
||||||
|
bool isLoading = true;
|
||||||
|
AuthProvider() {
|
||||||
|
getUserAuthentication();
|
||||||
|
}
|
||||||
|
|
||||||
|
void getUserAuthentication() async {
|
||||||
|
Map profile = await sharedPref.getObject(USER_PROFILE);
|
||||||
|
if (profile != null) {
|
||||||
|
isLoading = false;
|
||||||
|
isLogin = true;
|
||||||
|
} else {
|
||||||
|
isLoading = false;
|
||||||
|
isLogin = false;
|
||||||
|
}
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
APP_STATUS get stutas {
|
||||||
|
if (isLoading) {
|
||||||
|
return APP_STATUS.LOADING;
|
||||||
|
} else {
|
||||||
|
if (this.isLogin) {
|
||||||
|
return APP_STATUS.AUTHENTICATED;
|
||||||
|
} else {
|
||||||
|
return APP_STATUS.UNAUTHENTICATED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Future<dynamic> login(UserModel userInfo) async {
|
||||||
|
// try {
|
||||||
|
// dynamic localRes;
|
||||||
|
|
||||||
|
// await BaseAppClient.post(LOGIN_URL,
|
||||||
|
// onSuccess: (dynamic response, int statusCode) {
|
||||||
|
// localRes = response;
|
||||||
|
// }, onFailure: (String error, int statusCode) {
|
||||||
|
// throw error;
|
||||||
|
// }, body: userInfo.toJson());
|
||||||
|
|
||||||
|
// return Future.value(localRes);
|
||||||
|
// } catch (error) {
|
||||||
|
// print(error);
|
||||||
|
// throw error;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<dynamic> insertDeviceImei(imei) async {
|
||||||
|
try {
|
||||||
|
dynamic localRes;
|
||||||
|
|
||||||
|
await new BaseAppClient().post(INSERT_DEVICE_IMEI,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
localRes = response;
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
throw error;
|
||||||
|
}, body: imei);
|
||||||
|
return Future.value(localRes);
|
||||||
|
} catch (error) {
|
||||||
|
print(error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<dynamic> selectDeviceImei(imei) async {
|
||||||
|
try {
|
||||||
|
dynamic localRes;
|
||||||
|
await new BaseAppClient().post(SELECT_DEVICE_IMEI,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
localRes = response;
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
throw error;
|
||||||
|
}, body: imei);
|
||||||
|
return Future.value(localRes);
|
||||||
|
} catch (error) {
|
||||||
|
print(error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue