diff --git a/android/app/build.gradle b/android/app/build.gradle
index dd7a2958..1aa8b742 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 28
+ compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -39,8 +39,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.doctor_app_flutter"
- minSdkVersion 16
- targetSdkVersion 28
+ minSdkVersion 18
+ targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 1eb79e87..e6d9a9ad 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -5,6 +5,8 @@
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
+
+
UIViewControllerBasedStatusBarAppearance
+ NSCameraUsageDescription
+ Camera permission is required for barcode scanning.
diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart
index c85edace..6e1813fe 100644
--- a/lib/models/patient/patiant_info_model.dart
+++ b/lib/models/patient/patiant_info_model.dart
@@ -123,7 +123,7 @@ class PatiantInformtion {
age: json["Age"],
genderDescription: json["GenderDescription"],
nursingStationName: json["NursingStationName"],
- appointmentDate: json["AppointmentDate"],
+ appointmentDate: json["AppointmentDate"]?? '',
);
diff --git a/lib/models/patient/patient_model.dart b/lib/models/patient/patient_model.dart
index e49f64ea..564f2527 100644
--- a/lib/models/patient/patient_model.dart
+++ b/lib/models/patient/patient_model.dart
@@ -60,6 +60,31 @@ class PatientModel {
LastName: json["LasttName"],
);
+ Map toJson() {
+ final Map data = new Map();
+ data['ProjectID'] = this.ProjectID;
+ data['ClinicID'] = this.ClinicID;
+ data['DoctorID'] = this.DoctorID;
+ data['PatientID'] = this.PatientID;
+ data['FirstName'] = this.FirstName;
+ data['MiddleName'] = this.MiddleName;
+ data['LastName'] = this.LastName;
+ data['PatientMobileNumber'] = this.PatientMobileNumber;
+ data['PatientIdentificationID'] = this.PatientIdentificationID;
+ data['PatientID'] = this.PatientID;
+ data['From'] = this.From;
+ data['To'] = this.To;
+ data['LanguageID'] = this.LanguageID;
+ data['stamp'] = this.stamp;
+ data['IPAdress'] = this.IPAdress;
+ data['VersionID'] = this.VersionID;
+ data['Channel'] = this.Channel;
+ data['TokenID'] = this.TokenID;
+ data['SessionID'] = this.SessionID;
+ data['IsLoginForDoctorApp'] = this.IsLoginForDoctorApp;
+ data['PatientOutSA'] = this.PatientOutSA;
+ return data;
+ }
}
//***************************
\ No newline at end of file
diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart
index b67cba47..b187639e 100644
--- a/lib/providers/doctor_reply_provider.dart
+++ b/lib/providers/doctor_reply_provider.dart
@@ -45,6 +45,7 @@ class DoctorReplyProvider with ChangeNotifier {
isLoading = false;
} else {
isError = true;
+ isLoading = false;
error = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage'];
}
}
diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart
index 7a7baacf..646e8f2f 100644
--- a/lib/screens/QR_reader_screen.dart
+++ b/lib/screens/QR_reader_screen.dart
@@ -1,11 +1,184 @@
+import 'package:barcode_scan/platform_wrapper.dart';
+import 'package:doctor_app_flutter/config/size_config.dart';
+import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
+import 'package:doctor_app_flutter/models/patient/patient_model.dart';
+import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart';
+import 'package:doctor_app_flutter/providers/patients_provider.dart';
+import 'package:doctor_app_flutter/widgets/shared/app_button.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
+import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
+import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
+import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-class QrReaderScreen extends StatelessWidget {
+import 'package:provider/provider.dart';
+
+import '../routes.dart';
+
+class QrReaderScreen extends StatefulWidget {
+ @override
+ _QrReaderScreenState createState() => _QrReaderScreenState();
+}
+
+class _QrReaderScreenState extends State {
+ bool isLoading = false;
+ PatientModel patient = PatientModel(
+ ProjectID: 15,
+ ClinicID: 0,
+ DoctorID: 4709,
+ FirstName: "0",
+ MiddleName: "0",
+ LastName: "0",
+ PatientMobileNumber: "0",
+ PatientIdentificationID: "0",
+ PatientID: 0,
+ From: "0",
+ To: "0",
+ LanguageID: 2,
+ stamp: "2020-03-02T13:56:39.170Z",
+ IPAdress: "11.11.11.11",
+ VersionID: 1.2,
+ Channel: 9,
+ TokenID: "@dm!n",
+ SessionID: "5G0yXn0Jnq",
+ IsLoginForDoctorApp: true,
+ PatientOutSA: false);
+ List patientList = [];
+ String error = '';
+
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: "QR Reader",
- body: Container(),
+ body: Center(
+ child: Container(
+ margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7),
+ child: FractionallySizedBox(
+ widthFactor: 0.9,
+ child: ListView(
+ children: [
+ AppText(
+ 'Start Scanning',
+ fontSize: 18,
+ fontWeight: FontWeight.bold,
+ textAlign: TextAlign.center,
+ ),
+ SizedBox(
+ height: 7,
+ ),
+ AppText(
+ 'scan Qr code to retrieve patient profile',
+ fontSize: 14,
+ fontWeight: FontWeight.w400,
+ textAlign: TextAlign.center
+ ),
+ SizedBox(
+ height: 15,
+ ),
+ Container(
+ height: 150,
+ child: Image.asset('assets/images/qr_code.png'),
+ ),
+ SizedBox(
+ height: 35,
+ ),
+ Button(
+ onTap: () {
+ _scanQrAndGetPatient(context);
+ },
+ title: 'Scan Qr',
+ loading: isLoading,
+ icon: Image.asset('assets/images/qr_code_white.png'),
+ ),
+ error!=''?Container(
+ margin: EdgeInsets.only(top: 8),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(6.0),
+ color: Theme.of(context).errorColor.withOpacity(0.06),
+ ),
+ padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
+ child: Row(
+ children: [
+ Expanded(child: AppText(error ?? "Something went wrong.", color: Theme.of(context).errorColor)),
+ ],
+ ),
+ ):Container(),
+ Column(
+ children: patientList.map((item) {
+ return InkWell(
+ onTap: (){
+ Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
+ "patient": item,
+ });
+ },
+ child: CardWithBgWidget(
+ widget: Container(
+ child: AppText(
+ '${item.firstName} ${item.lastName}',
+ fontSize: 2.5 * SizeConfig.textMultiplier,
+ ),
+ ),
+ ),
+ );
+ }).toList()
+ )
+ ],
+ ),
+ ),
+ ),
+ ),
);
}
-}
\ No newline at end of file
+
+
+ _scanQrAndGetPatient(BuildContext context) async {
+ /// When give qr we will change this method to get data
+ /// var result = await BarcodeScanner.scan();
+ /// int patientID = get from qr result
+ String patientType = "1";
+ setState(() {
+ isLoading = true;
+ patientList = [];
+ });
+ patient.PatientID = 3120144;
+ Provider.of(context, listen: false)
+ .getPatientList(patient, "1")
+ .then((response) {
+ if (response['MessageStatus'] == 1) {
+ switch (patientType) {
+ case "0":
+ if (response['List_MyOutPatient'] != null) {
+ setState(() {
+ patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list;
+ isLoading = false;
+ });
+ } else {
+ setState(() {
+ error = 'No patient';
+ isLoading = false;
+ });
+ }
+ break;
+ case "1":
+ if (response['List_MyInPatient'] != null) {
+ setState(() {
+ patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
+ isLoading = false;
+ error="";
+ });
+ } else {
+ setState(() {
+ error = 'No patient';
+ isLoading = false;
+ });
+ break;
+ }
+ }
+ } else {
+ setState(() {
+ error = response['ErrorMessage'] ?? response['ErrorEndUserMessage'];
+ isLoading = false;
+ });
+ }
+ });
+ }
+}
diff --git a/lib/widgets/shared/app_button.dart b/lib/widgets/shared/app_button.dart
new file mode 100644
index 00000000..522255df
--- /dev/null
+++ b/lib/widgets/shared/app_button.dart
@@ -0,0 +1,146 @@
+import 'package:flutter/material.dart';
+import 'package:hexcolor/hexcolor.dart';
+
+class Button extends StatefulWidget {
+ Button({
+ Key key,
+ this.title: "",
+ this.icon,
+ this.onTap,
+ this.loading: false,
+ }) : super(key: key);
+
+ final String title;
+ final Widget icon;
+ final VoidCallback onTap;
+ final bool loading;
+
+ @override
+ _ButtonState createState() => _ButtonState();
+}
+
+class _ButtonState extends State