|
|
|
@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../routes.dart';
|
|
|
|
import '../routes.dart';
|
|
|
|
|
|
|
|
|
|
|
|
@ -55,7 +56,7 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return AppScaffold(
|
|
|
|
return AppScaffold(
|
|
|
|
appBarTitle: "QR Reader",
|
|
|
|
appBarTitle: TranslationBase.of(context).qrReader,
|
|
|
|
body: Center(
|
|
|
|
body: Center(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7),
|
|
|
|
margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7),
|
|
|
|
@ -64,7 +65,7 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
child: ListView(
|
|
|
|
child: ListView(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
'Start Scanning',
|
|
|
|
TranslationBase.of(context).startScanning,
|
|
|
|
fontSize: 18,
|
|
|
|
fontSize: 18,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
@ -72,12 +73,10 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 7,
|
|
|
|
height: 7,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(TranslationBase.of(context).scanQrCode,
|
|
|
|
'scan Qr code to retrieve patient profile',
|
|
|
|
|
|
|
|
fontSize: 14,
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
textAlign: TextAlign.center
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 15,
|
|
|
|
height: 15,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -92,24 +91,31 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
_scanQrAndGetPatient(context);
|
|
|
|
_scanQrAndGetPatient(context);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
title: 'Scan Qr',
|
|
|
|
title: TranslationBase.of(context).scanQr,
|
|
|
|
loading: isLoading,
|
|
|
|
loading: isLoading,
|
|
|
|
icon: Image.asset('assets/images/qr_code_white.png'),
|
|
|
|
icon: Image.asset('assets/images/qr_code_white.png'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
isError ? Container(
|
|
|
|
isError
|
|
|
|
|
|
|
|
? Container(
|
|
|
|
margin: EdgeInsets.only(top: 8),
|
|
|
|
margin: EdgeInsets.only(top: 8),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(6.0),
|
|
|
|
borderRadius: BorderRadius.circular(6.0),
|
|
|
|
color: Theme.of(context).errorColor.withOpacity(0.06),
|
|
|
|
color: Theme.of(context).errorColor.withOpacity(0.06),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
|
|
|
vertical: 8.0, horizontal: 12.0),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(child: AppText(error ?? "Something went wrong.", color: Theme.of(context).errorColor)),
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: AppText(
|
|
|
|
|
|
|
|
error ??
|
|
|
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.errorMessage,
|
|
|
|
|
|
|
|
color: Theme.of(context).errorColor)),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
):Container(),
|
|
|
|
)
|
|
|
|
|
|
|
|
: Container(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -118,7 +124,6 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_scanQrAndGetPatient(BuildContext context) async {
|
|
|
|
_scanQrAndGetPatient(BuildContext context) async {
|
|
|
|
/// When give qr we will change this method to get data
|
|
|
|
/// When give qr we will change this method to get data
|
|
|
|
/// var result = await BarcodeScanner.scan();
|
|
|
|
/// var result = await BarcodeScanner.scan();
|
|
|
|
@ -151,7 +156,8 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
case "0":
|
|
|
|
case "0":
|
|
|
|
if (response['List_MyOutPatient'] != null) {
|
|
|
|
if (response['List_MyOutPatient'] != null) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list;
|
|
|
|
patientList =
|
|
|
|
|
|
|
|
ModelResponse.fromJson(response['List_MyOutPatient']).list;
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
|
|
|
|
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
|
|
|
|
@ -168,7 +174,8 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
case "1":
|
|
|
|
case "1":
|
|
|
|
if (response['List_MyInPatient'] != null) {
|
|
|
|
if (response['List_MyInPatient'] != null) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
patientList = ModelResponse.fromJson(response['List_MyInPatient']).list;
|
|
|
|
patientList =
|
|
|
|
|
|
|
|
ModelResponse.fromJson(response['List_MyInPatient']).list;
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
error = "";
|
|
|
|
error = "";
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -189,8 +196,8 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
isError = true;
|
|
|
|
isError = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
DrAppToastMsg.showErrorToast(response['ErrorEndUserMessage'] ?? response['ErrorMessage']);
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
|
|
|
response['ErrorEndUserMessage'] ?? response['ErrorMessage']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catchError((error) {
|
|
|
|
}).catchError((error) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
|