|
|
|
|
@ -1,14 +1,12 @@
|
|
|
|
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
@ -103,7 +101,9 @@ class _LiveCareTypeSelectState extends State<LiveCareTypeSelect> {
|
|
|
|
|
children: [
|
|
|
|
|
_loginOptionButton(TranslationBase.of(context).livecareOption1, 'assets/images/new/Live_Care.svg', 1),
|
|
|
|
|
_loginOptionButton(TranslationBase.of(context).livecareOption4, 'assets/images/new/book appointment.svg', 2),
|
|
|
|
|
_loginOptionButton("Pharma LiveCare", 'assets/images/new/Live_Care.svg', 3),
|
|
|
|
|
_loginOptionButton(TranslationBase.of(context).pharmaLiveCare, 'assets/images/new/pharma.svg', 3,
|
|
|
|
|
// isEnable: projectViewModel.havePrivilege(99)
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -116,7 +116,7 @@ class _LiveCareTypeSelectState extends State<LiveCareTypeSelect> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _loginOptionButton(String _title, String _icon, int _loginIndex) {
|
|
|
|
|
Widget _loginOptionButton(String _title, String _icon, int _loginIndex, {bool isEnable = true}) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (_loginIndex == 1) {
|
|
|
|
|
@ -127,53 +127,78 @@ class _LiveCareTypeSelectState extends State<LiveCareTypeSelect> {
|
|
|
|
|
projectViewModel.analytics.liveCare.livecare_schedule_video_call();
|
|
|
|
|
} else {
|
|
|
|
|
//Pharmacy LiveCare
|
|
|
|
|
readQRCode();
|
|
|
|
|
if (isEnable) readQRCode();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, bottom: 3, top: 28),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SvgPicture.asset(
|
|
|
|
|
_icon,
|
|
|
|
|
height: _loginIndex == 1 ? 60 : 50,
|
|
|
|
|
width: _loginIndex == 1 ? 60 : 50,
|
|
|
|
|
child: Stack(children: [
|
|
|
|
|
AspectRatio(
|
|
|
|
|
aspectRatio: 1.0,
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, bottom: 3, top: 28),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
_title,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SvgPicture.asset(
|
|
|
|
|
_icon,
|
|
|
|
|
height: _loginIndex == 3 ? 80 : 60,
|
|
|
|
|
width: _loginIndex == 3 ? 80 : 60,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
_title,
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
isEnable
|
|
|
|
|
? Container()
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
color: Colors.grey.withOpacity(0.6),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.lock_outline,
|
|
|
|
|
size: 40,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readQRCode() async {
|
|
|
|
|
pharmacyLiveCareQRCode = (await BarcodeScanner.scan())?.rawContent;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
LiveCareService service = new LiveCareService();
|
|
|
|
|
service.getPatientInfoByQR(pharmacyLiveCareQRCode, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
startPharmacyLiveCareProcess();
|
|
|
|
|
});
|
|
|
|
|
if (pharmacyLiveCareQRCode != "") {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
LiveCareService service = new LiveCareService();
|
|
|
|
|
service.getPatientInfoByQR(pharmacyLiveCareQRCode, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
startPharmacyLiveCareProcess();
|
|
|
|
|
});
|
|
|
|
|
} else {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startPharmacyLiveCareProcess() {
|
|
|
|
|
sharedPref.setString(LIVECARE_CLINIC_DATA, "Pharmacy LiveCare" + "-" + "501" + "-" + "7");
|
|
|
|
|
sharedPref.setString(LIVECARE_CLINIC_DATA, "Pharmacy LiveCare" + "-" + "501" + "-" + "1");
|
|
|
|
|
Navigator.pop(context, "pharmacy/$pharmacyLiveCareQRCode");
|
|
|
|
|
// Navigator.push(context, FadePage(page: LiveCareHome(isPharmacyLiveCare: true, pharmacyLiveCareQRCode: pharmacyLiveCareQRCode,)));
|
|
|
|
|
}
|
|
|
|
|
|