Added AskPrescriptionFor Paharmacy
parent
b4d881d24e
commit
e685cc9575
@ -0,0 +1,46 @@
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
class KioskLanguageConfigModel {
|
||||
int? id;
|
||||
int? languageID;
|
||||
ui.TextDirection languageTextDirection;
|
||||
String? languageName;
|
||||
String? languageNameN;
|
||||
String? shortForm;
|
||||
String? yourTicketNoText;
|
||||
String? waitForYourTurnText;
|
||||
String? thankYouText;
|
||||
String? goBackToMainPage;
|
||||
bool? isActive;
|
||||
|
||||
KioskLanguageConfigModel({
|
||||
required this.id,
|
||||
required this.languageID,
|
||||
this.languageTextDirection = ui.TextDirection.ltr,
|
||||
required this.languageName,
|
||||
required this.languageNameN,
|
||||
required this.shortForm,
|
||||
required this.yourTicketNoText,
|
||||
required this.waitForYourTurnText,
|
||||
required this.thankYouText,
|
||||
required this.goBackToMainPage,
|
||||
required this.isActive,
|
||||
});
|
||||
|
||||
factory KioskLanguageConfigModel.fromJson(Map<String, dynamic> json) {
|
||||
return KioskLanguageConfigModel(
|
||||
id: json['id'],
|
||||
languageID: json['languageID'],
|
||||
languageTextDirection: ((json['languageTextDirection'] == null || json['languageTextDirection'] == 0 ) ? ui.TextDirection.ltr : ui.TextDirection.rtl),
|
||||
// 0 for English and 1 for Others
|
||||
languageName: json['languageName'],
|
||||
languageNameN: json['languageNameN'],
|
||||
shortForm: json['shortForm'],
|
||||
yourTicketNoText: json['yourTicketNoText'],
|
||||
waitForYourTurnText: json['waitForYourTurnText'],
|
||||
thankYouText: json['thankYouText'],
|
||||
goBackToMainPage: json['goBackToMainPage'],
|
||||
isActive: json['isActive'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,142 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_qline/constants/app_constants.dart';
|
||||
import 'package:hmg_qline/utilities/extensions.dart';
|
||||
import 'package:hmg_qline/view_models/screen_config_view_model.dart';
|
||||
import 'package:hmg_qline/views/view_helpers/size_config.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qr_code_scanner_plus/qr_code_scanner_plus.dart';
|
||||
|
||||
class KioskQrScannerScreen extends StatelessWidget {
|
||||
KioskQrScannerScreen({super.key});
|
||||
|
||||
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenConfigViewModel = context.read<ScreenConfigViewModel>();
|
||||
final size = MediaQuery.of(context).size;
|
||||
final scanArea = (size.width < size.height ? size.width : size.height) * 0.6;
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: QRView(
|
||||
key: qrKey,
|
||||
overlay: QrScannerOverlayShape(
|
||||
borderColor: AppColors.redColor,
|
||||
borderRadius: 10,
|
||||
borderLength: 30,
|
||||
borderWidth: 10,
|
||||
cutOutSize: scanArea,
|
||||
),
|
||||
onQRViewCreated: (controller) {
|
||||
screenConfigViewModel.onQRViewCreated(
|
||||
controller: controller,
|
||||
onSuccess: () => context.popScreen(),
|
||||
onFailure: () {},
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
color: Colors.black.withOpacity(0.4),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => context.popScreen(),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: AppColors.whiteColor,
|
||||
size: SizeConfig.getHeightMultiplier() * 0.3,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Back',
|
||||
style: TextStyle(
|
||||
color: AppColors.whiteColor,
|
||||
fontSize: SizeConfig.getHeightMultiplier() * 0.3,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => screenConfigViewModel.flipCamera(),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.flip_camera_ios_outlined,
|
||||
color: AppColors.whiteColor,
|
||||
size: SizeConfig.getHeightMultiplier() * 0.4,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: SizeConfig.getHeightMultiplier() * 0.5,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Consumer<ScreenConfigViewModel>(
|
||||
builder: (BuildContext context, ScreenConfigViewModel screenConfigViewModel, _) {
|
||||
String text = "";
|
||||
|
||||
if (screenConfigViewModel.qrCodeResult != null) {
|
||||
final code = screenConfigViewModel.qrCodeResult?.code;
|
||||
|
||||
int? patientId = int.tryParse(code ?? '');
|
||||
|
||||
if (patientId != null && patientId > 0) {
|
||||
text = "Patient ID: $patientId\nGenerating Ticket...";
|
||||
} else {
|
||||
text = "Invalid QR Code. Please scan a valid patient ID.";
|
||||
}
|
||||
} else {
|
||||
text = "Please scan your Patient QR from Sulaiman Al Habib Mobile App";
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: AppColors.whiteColor,
|
||||
fontSize: SizeConfig.getHeightMultiplier() * 0.3,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue