done QR reader

merge-requests/65/head
her_username 6 years ago
parent b07ff8154c
commit 7d3856f2b2

@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 28 compileSdkVersion 29
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
@ -39,8 +39,8 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.doctor_app_flutter" applicationId "com.example.doctor_app_flutter"
minSdkVersion 16 minSdkVersion 18
targetSdkVersion 28 targetSdkVersion 29
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

@ -5,6 +5,8 @@
In most cases you can leave this as-is, but you if you want to provide 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 additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA" />
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:label="doctor_app_flutter" android:label="doctor_app_flutter"

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -43,5 +43,7 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSCameraUsageDescription</key>
<string>Camera permission is required for barcode scanning.</string>
</dict> </dict>
</plist> </plist>

@ -123,7 +123,7 @@ class PatiantInformtion {
age: json["Age"], age: json["Age"],
genderDescription: json["GenderDescription"], genderDescription: json["GenderDescription"],
nursingStationName: json["NursingStationName"], nursingStationName: json["NursingStationName"],
appointmentDate: json["AppointmentDate"], appointmentDate: json["AppointmentDate"]?? '',
); );

@ -60,6 +60,31 @@ class PatientModel {
LastName: json["LasttName"], LastName: json["LasttName"],
); );
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
} }
//*************************** //***************************

@ -45,6 +45,7 @@ class DoctorReplyProvider with ChangeNotifier {
isLoading = false; isLoading = false;
} else { } else {
isError = true; isError = true;
isLoading = false;
error = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage']; error = parsed['ErrorMessage'] ?? parsed['ErrorEndUserMessage'];
} }
} }

@ -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_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'; 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<QrReaderScreen> {
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<PatiantInformtion> patientList = [];
String error = '';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: "QR Reader", 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: <Widget>[
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()
)
],
),
),
),
),
); );
} }
}
_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<PatientsProvider>(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;
});
}
});
}
}

@ -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<Button> with TickerProviderStateMixin {
double _buttonSize = 1.0;
AnimationController _animationController;
Animation _animation;
@override
void initState() {
_animationController = AnimationController(
vsync: this,
lowerBound: 0.7,
upperBound: 1.0,
duration: Duration(milliseconds: 120));
_animation = CurvedAnimation(
parent: _animationController,
curve: Curves.easeOutQuad,
reverseCurve: Curves.easeOutQuad);
_animation.addListener(() {
setState(() {
_buttonSize = _animation.value;
});
});
super.initState();
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
Widget _buildIcon() {
if (widget.icon != null && (widget.title != null && widget.title != "")) {
return Container(
margin: EdgeInsets.only(right: 12.0),
height: 24.0,
child: widget.icon);
} else if (widget.icon != null) {
return Container(
height: 18.0,
width: 18.0,
child: widget.icon,
);
} else {
return Container();
}
}
@override
Widget build(BuildContext context) {
return IgnorePointer(
ignoring: widget.loading,
child: GestureDetector(
onTapDown: (TapDownDetails tap) {
_animationController.reverse(from: 1.0);
},
onTapUp: (TapUpDetails tap) {
_animationController.forward();
},
onTapCancel: () {
_animationController.forward();
},
onTap: Feedback.wrapForTap(widget.onTap, context),
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,
child: AnimatedContainer(
duration: Duration(milliseconds: 150),
margin:
EdgeInsets.only(bottom: widget.title.isNotEmpty ? 14.0 : 0.0),
padding: EdgeInsets.symmetric(
vertical: widget.title != null && widget.title.isNotEmpty
? 12.0
: 15.0,
horizontal: widget.title != null && widget.title.isNotEmpty
? 22.0
: 19),
decoration: BoxDecoration(
color: Hexcolor('#58434F'),
borderRadius: BorderRadius.all(Radius.circular(100.0)),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(70, 70, 70, 0.28),
spreadRadius:
_buttonSize < 1.0 ? -(1 - _buttonSize) * 50 : 0.0,
offset: Offset(0, 7.0),
blurRadius: 24.0)
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
_buildIcon(),
widget.loading
? Padding(
padding: const EdgeInsets.all(2.7),
child: SizedBox(
height: 19.0,
width: 19.0,
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Hexcolor('#FFDDD9'),
),
),
),
)
: Padding(
padding: EdgeInsets.only(bottom: 3.0),
child: Text(widget.title,
style: TextStyle(
color: Colors.white,
fontSize: 17.0,
fontWeight: FontWeight.w700,
fontFamily: "WorkSans")),
)
],
),
),
),
),
);
}
}

@ -21,14 +21,14 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.11" version: "2.0.13"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.2" version: "1.6.0"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -36,6 +36,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.1" version: "2.4.1"
barcode_scan:
dependency: "direct main"
description:
name: barcode_scan
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
bazel_worker: bazel_worker:
dependency: transitive dependency: transitive
description: description:
@ -134,13 +141,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
code_builder: code_builder:
dependency: transitive dependency: transitive
description: description:
@ -189,7 +189,7 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.4"
csslib: csslib:
dependency: transitive dependency: transitive
description: description:
@ -211,13 +211,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.4" version: "1.3.4"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
@ -322,6 +315,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.4" version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
imei_plugin: imei_plugin:
dependency: "direct main" dependency: "direct main"
description: description:
@ -433,7 +433,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.6.4"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@ -448,6 +448,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1+1" version: "2.1.1+1"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0+hotfix.5"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -510,7 +531,7 @@ packages:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.1.3"
scratch_space: scratch_space:
dependency: transitive dependency: transitive
description: description:
@ -684,6 +705,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
yaml: yaml:
dependency: transitive dependency: transitive
description: description:

@ -36,6 +36,12 @@ dependencies:
maps_launcher: ^1.2.0 maps_launcher: ^1.2.0
url_launcher: ^5.4.5 url_launcher: ^5.4.5
# Qr code Scanner
barcode_scan: ^3.0.1
# permissions
permission_handler: ^5.0.0+hotfix.3
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
@ -85,6 +91,8 @@ flutter:
- assets/images/lab.png - assets/images/lab.png
- assets/images/note.png - assets/images/note.png
- assets/images/radiology-1.png - assets/images/radiology-1.png
- assets/images/qr_code.png
- assets/images/qr_code_white.png
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg

Loading…
Cancel
Save