Reformatted Code

faiz_dev_new
FaizHashmiCS22 3 years ago
parent 017f01621e
commit 941ca2ff0e

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:queuing_system/core/base/base_app_client.dart'; import 'package:queuing_system/core/base/base_app_client.dart';
import 'package:queuing_system/core/config/config.dart'; import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/core/response_model/call_config.dart';
import 'package:queuing_system/core/response_model/patient_call.dart'; import 'package:queuing_system/core/response_model/patient_call.dart';
import 'package:queuing_system/home/home_screen.dart'; import 'package:queuing_system/home/home_screen.dart';
@ -18,13 +19,14 @@ class MyHttpOverrides extends HttpOverrides {
} }
class API { class API {
static getCallRequestInfoByClinicInfo(String deviceIp, {@required Function(List<Tickets>, List<Tickets>) onSuccess, @required Function(dynamic) onFailure}) async { static getCallRequestInfoByClinicInfo(String deviceIp, {@required Function(List<Tickets>, List<Tickets>, CallConfig callConfig) onSuccess, @required Function(dynamic) onFailure}) async {
final body = {"ipAdress": deviceIp, "apiKey": apiKey}; final body = {"ipAdress": deviceIp, "apiKey": apiKey};
if (isDevMode) { if (isDevMode) {
var callPatients = Tickets.testCallPatients; var callPatients = Tickets.testCallPatients;
var isQueuePatients = callPatients.where((element) => (element.callType == 1 && element.isQueue == false) || (element.callType == 2 && element.isQueue == false)).toList(); var isQueuePatients = callPatients.where((element) => (element.callType == 1 && element.isQueue == false) || (element.callType == 2 && element.isQueue == false)).toList();
onSuccess(callPatients.reversed.toList(), isQueuePatients.reversed.toList()); CallConfig callConfig = CallConfig();
onSuccess(callPatients.reversed.toList(), isQueuePatients.reversed.toList(), callConfig);
return; return;
} }
BaseAppClient.post(_getCallRequestInfoByClinicInfo, BaseAppClient.post(_getCallRequestInfoByClinicInfo,
@ -32,6 +34,8 @@ class API {
onSuccess: (apiResp, status) { onSuccess: (apiResp, status) {
if (status == 200) { if (status == 200) {
final response = apiResp["data"]; final response = apiResp["data"];
CallConfig callConfig = CallConfig.fromJson(response["callConfig"]);
var callPatients = (response["callPatients"] as List).map((j) => Tickets.fromJson(j)).toList(); var callPatients = (response["callPatients"] as List).map((j) => Tickets.fromJson(j)).toList();
// final patients = (response["drCallPatients"] as List).map((j) => Tickets.fromJson(j)).toList(); // final patients = (response["drCallPatients"] as List).map((j) => Tickets.fromJson(j)).toList();
// callPatients.addAll(patients); // callPatients.addAll(patients);
@ -44,7 +48,7 @@ class API {
// callPatients.addAll(isQueuePatients.toList()); // callPatients.addAll(isQueuePatients.toList());
onSuccess(callPatients.reversed.toList(), isQueuePatients.reversed.toList()); onSuccess(callPatients.reversed.toList(), isQueuePatients.reversed.toList(), callConfig);
} else { } else {
onFailure(apiResp); onFailure(apiResp);
} }
@ -60,7 +64,7 @@ class API {
List<Tickets> _ticketsUpdated = []; List<Tickets> _ticketsUpdated = [];
// for (var ticket in tickets) { // for (var ticket in tickets) {
final body = {"id": ticket.id, "apiKey": apiKey, "ipAddress": deviceIp}; final body = {"id": ticket.id, "apiKey": apiKey, "ipAddress": deviceIp, "callType": ticket.callType};
await BaseAppClient.post(_callUpdateNotIsQueueRecordByIDAsync, await BaseAppClient.post(_callUpdateNotIsQueueRecordByIDAsync,
body: body, body: body,
onSuccess: (response, status) { onSuccess: (response, status) {

@ -21,8 +21,8 @@ class AppScaffold extends StatelessWidget {
final bool isHomeIcon; final bool isHomeIcon;
final bool extendBody; final bool extendBody;
AppScaffold( const AppScaffold(
{this.appBarTitle = '', {Key key, this.appBarTitle = '',
this.body, this.body,
this.isLoading = false, this.isLoading = false,
this.isShowAppBar = true, this.isShowAppBar = true,
@ -34,14 +34,15 @@ class AppScaffold extends StatelessWidget {
this.subtitle, this.subtitle,
this.drawer, this.drawer,
this.extendBody = false, this.extendBody = false,
this.bottomNavigationBar}); this.bottomNavigationBar}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context);
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
FocusScope.of(context).requestFocus(new FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor
@ -54,12 +55,6 @@ class AppScaffold extends StatelessWidget {
AppBar( AppBar(
elevation: 0, elevation: 0,
backgroundColor: Colors.white, backgroundColor: Colors.white,
//HexColor('#515B5D'),
textTheme: TextTheme(
headline6: TextStyle(
color: Colors.black87,
fontSize: 16.8,
)),
title: Column( title: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -67,20 +62,28 @@ class AppScaffold extends StatelessWidget {
if (subtitle != null) if (subtitle != null)
Text( Text(
subtitle, subtitle,
style: TextStyle(fontSize: 12, color: Colors.red), style: const TextStyle(fontSize: 12, color: Colors.red),
), ),
], ],
), ),
leading: Builder(builder: (BuildContext context) { leading: Builder(builder: (BuildContext context) {
return IconButton( return IconButton(
icon: Icon(Icons.arrow_back_ios), icon: const Icon(Icons.arrow_back_ios),
color: Colors.black, //Colors.black, color: Colors.black, //Colors.black,
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
); );
}), }),
centerTitle: true, centerTitle: true,
actions: <Widget>[ actions: const <Widget>[
], ], toolbarTextStyle: const TextTheme(
titleLarge: TextStyle(
color: Colors.black87,
fontSize: 16.8,
)).bodyMedium, titleTextStyle: const TextTheme(
titleLarge: TextStyle(
color: Colors.black87,
fontSize: 16.8,
)).titleLarge,
) )
: null, : null,
bottomSheet: bottomSheet, bottomSheet: bottomSheet,
@ -101,7 +104,7 @@ class AppScaffold extends StatelessWidget {
"assets/images/undraw_connected_world_wuay.png", "assets/images/undraw_connected_world_wuay.png",
height: 250, height: 250,
), ),
AppText('No Internet Connection') const AppText('No Internet Connection')
], ],
), ),
), ),

@ -1,56 +1,41 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer'; import 'dart:developer';
import 'dart:io' show Platform;
import 'package:http/http.dart' as http;
import 'package:queuing_system/core/config/config.dart'; import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/utils/Utils.dart'; import 'package:queuing_system/utils/Utils.dart';
import 'package:http/http.dart' as http;
class BaseAppClient { class BaseAppClient {
static post(String endPoint, static post(String endPoint, {Map<String, dynamic> body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure}) async {
{Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure}) async {
String url; String url;
url = BASE_URL + endPoint; url = BASE_URL + endPoint;
try { try {
log("URL : $url");
print("URL : $url"); log("Body : ${json.encode(body)}");
print("Body : ${json.encode(body)}");
var asd = json.encode(body);
var asd2;
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {
final response = await http.post(Uri.parse(url), 'Content-Type': 'application/json',
body: json.encode(body), 'Accept': 'application/json',
headers: { });
'Content-Type': 'application/json',
'Accept': 'application/json',
});
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) { if (statusCode < 200 || statusCode >= 400) {
onFailure(Utils.generateContactAdminMsg(), statusCode); onFailure(Utils.generateContactAdminMsg(), statusCode);
} else { } else {
log("Response: ${response.body.toString()}"); log("Response: ${response.body.toString()}");
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} }
} else { } else {
onFailure('Please Check The Internet Connection', -1); onFailure('Please Check The Internet Connection', -1);
} }
} catch (e) { } catch (e) {
print(e);
onFailure(e.toString(), -1); onFailure(e.toString(), -1);
} }
} }
static get(String endPoint, {Map<String, dynamic> body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure}) async {
static get(String endPoint,
{Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure}) async {
String url; String url;
url = BASE_URL + endPoint; url = BASE_URL + endPoint;
@ -58,16 +43,10 @@ class BaseAppClient {
try { try {
// String token = await sharedPref.getString(TOKEN); // String token = await sharedPref.getString(TOKEN);
print("URL GET: $url"); log("URL GET: $url");
print("Body GET: ${json.encode(body)}"); log("Body GET: ${json.encode(body)}");
var asd = json.encode(body);
var asd2;
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'});
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
});
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) { if (statusCode < 200 || statusCode >= 400) {
onFailure(Utils.generateContactAdminMsg(), statusCode); onFailure(Utils.generateContactAdminMsg(), statusCode);
@ -79,26 +58,19 @@ class BaseAppClient {
onFailure('Please Check The Internet Connection', -1); onFailure('Please Check The Internet Connection', -1);
} }
} catch (e) { } catch (e) {
print(e);
onFailure(e.toString(), -1); onFailure(e.toString(), -1);
} }
} }
String getError(parsed) { String getError(parsed) {
//TODO change this fun //TODO change this fun
String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'];
if (parsed["ValidationErrors"] != null) { if (parsed["ValidationErrors"] != null) {
error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n";
if (parsed["ValidationErrors"]["ValidationErrors"] != null && if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) {
parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) {
for (var i = 0; error = error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n";
i < parsed["ValidationErrors"]["ValidationErrors"].length;
i++) {
error = error +
parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] +
"\n";
} }
} }
} }

@ -1,9 +1,9 @@
//
class BaseService { // class BaseService {
String error; // String error;
bool hasError = false; // bool hasError = false;
//
//
BaseService() { // BaseService() {
} // }
} // }

@ -1,50 +1,50 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
//
import 'base_view_model.dart'; // import 'base_view_model.dart';
import 'locater.dart'; // import 'locater.dart';
//
class BaseView<T extends BaseViewModel> extends StatefulWidget { // class BaseView<T extends BaseViewModel> extends StatefulWidget {
final Widget Function(BuildContext context, T model, Widget child) builder; // final Widget Function(BuildContext context, T model, Widget child) builder;
final Function(T) onModelReady; // final Function(T) onModelReady;
//
BaseView({ // BaseView({
this.builder, // this.builder,
this.onModelReady, // this.onModelReady,
}); // });
//
@override // @override
_BaseViewState<T> createState() => _BaseViewState<T>(); // _BaseViewState<T> createState() => _BaseViewState<T>();
} // }
//
class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> { // class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> {
T model = locator<T>(); // T model = locator<T>();
//
bool isLogin = false; // bool isLogin = false;
//
@override // @override
void initState() { // void initState() {
if (widget.onModelReady != null) { // if (widget.onModelReady != null) {
widget.onModelReady(model); // widget.onModelReady(model);
} // }
//
super.initState(); // super.initState();
} // }
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return ChangeNotifierProvider<T>.value( // return ChangeNotifierProvider<T>.value(
value: model, // value: model,
child: Consumer<T>(builder: widget.builder), // child: Consumer<T>(builder: widget.builder),
); // );
} // }
//
@override // @override
void dispose() { // void dispose() {
if (model != null) { // if (model != null) {
model = null; // model = null;
} // }
//
super.dispose(); // super.dispose();
} // }
} // }

@ -27,30 +27,30 @@ class CallConfig {
CallConfig( CallConfig(
{this.id, {this.id,
this.globalClinicPrefixReq, this.globalClinicPrefixReq,
this.clinicPrefixReq, this.clinicPrefixReq,
this.concurrentCallDelaySec, this.concurrentCallDelaySec,
this.voiceType, this.voiceType,
this.screenLanguage, this.screenLanguage,
this.voiceLanguage, this.voiceLanguage,
this.screenMaxDisplayPatients, this.screenMaxDisplayPatients,
this.prioritySMS, this.prioritySMS,
this.priorityWhatsApp, this.priorityWhatsApp,
this.priorityEmail, this.priorityEmail,
this.vitalSignText, this.vitalSignText,
this.vitalSignTextN, this.vitalSignTextN,
this.doctorText, this.doctorText,
this.doctorTextN, this.doctorTextN,
this.procedureText, this.procedureText,
this.procedureTextN, this.procedureTextN,
this.vaccinationText, this.vaccinationText,
this.vaccinationTextN, this.vaccinationTextN,
this.nebulizationText, this.nebulizationText,
this.nebulizationTextN, this.nebulizationTextN,
this.createdBy, this.createdBy,
this.createdOn, this.createdOn,
this.editedBy, this.editedBy,
this.editedOn}); this.editedOn});
CallConfig.fromJson(Map<String, dynamic> json) { CallConfig.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -58,7 +58,7 @@ class CallConfig {
clinicPrefixReq = json['clinicPrefixReq']; clinicPrefixReq = json['clinicPrefixReq'];
concurrentCallDelaySec = json['concurrentCallDelaySec']; concurrentCallDelaySec = json['concurrentCallDelaySec'];
voiceType = json['voiceType']; voiceType = json['voiceType'];
screenLanguage = json['screenLanguage']; screenLanguage = json['screenLanguage'] ?? 1;
voiceLanguage = json['voiceLanguage']; voiceLanguage = json['voiceLanguage'];
screenMaxDisplayPatients = json['screenMaxDisplayPatients']; screenMaxDisplayPatients = json['screenMaxDisplayPatients'];
prioritySMS = json['prioritySMS']; prioritySMS = json['prioritySMS'];

@ -92,19 +92,7 @@ class Tickets {
} }
CallType getCallType() { CallType getCallType() {
// { if (callType == 1) return CallType.vitalSign;
// [EnumMember]
// VitalSign = 1,
// [EnumMember]
// Doctor = 2,
// [EnumMember]
// Procedure = 3,
// [EnumMember]
// Vaccination = 4,
// [EnumMember]
// Nebulization = 5
if (callType == 1) return CallType.nebulization;
if (callType == 2) return CallType.doctor; if (callType == 2) return CallType.doctor;
if (callType == 3) return CallType.procedure; if (callType == 3) return CallType.procedure;
if (callType == 4) return CallType.vaccination; if (callType == 4) return CallType.vaccination;

@ -1,32 +0,0 @@
import 'package:flutter/material.dart';
import 'package:queuing_system/core/config/size_config.dart';
import 'package:queuing_system/home/que_item/que_item.dart';
class FirstColumn extends StatelessWidget {
final bool have3Patient;
final bool have2Patient;
const FirstColumn({Key key, this.have3Patient = false, this.have2Patient = false}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
const TicketItem(queNo: "OBG-T45", isFirstLine: true, isNurseVisit: true, haveListOfPatient: true,),
SizedBox(
height: SizeConfig.getHeightMultiplier() * 5,),
if(have3Patient ||have2Patient )
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
if(have2Patient || have3Patient)
const TicketItem(queNo: "OBG-T45", isSecondLine: true, isNurseVisit: false, haveListOfPatient: true,),
if(have3Patient)
const TicketItem(queNo: "OBG-T45", isSecondLine: true, isNurseVisit: true, haveListOfPatient: true,),
],
),
],
);
}
}

@ -1,205 +0,0 @@
// import 'dart:async';
// import 'package:flutter/material.dart';
// import 'package:queuing_system/core/api.dart';
// import 'package:queuing_system/core/base/app_scaffold_widget.dart';
// import 'package:queuing_system/core/base/base_app_client.dart';
// import 'package:queuing_system/core/config/config.dart';
// import 'package:queuing_system/core/config/size_config.dart';
// import 'package:queuing_system/header/app_header.dart';
// import 'package:queuing_system/home/que_item_list.dart';
// import 'package:queuing_system/utils/signalR_utils.dart';
// import 'package:queuing_system/utils/utils.dart';
// import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
// import 'first_column.dart';
//
//
// var DEVICE_IP = "10.70.249.21";
//
// class MyHomePage extends StatefulWidget {
// String title = "MyHomePage";
// bool have0Patient = true;
// bool have1Patient = false;
// bool have2Patient = false;
// bool have3Patient = false;
// bool haveListOfPatient = false;
//
// @override
// State<MyHomePage> createState() => _MyHomePageState();
// }
//
// class _MyHomePageState extends State<MyHomePage> {
// Timer _timer;
// int remainingTime = 30;
//
// @override
// void dispose() {
// _timer.cancel();
// super.dispose();
// }
//
// startTimer() {
// Timer.periodic(const Duration(seconds: 1), (timer) {
// if (remainingTime == 0) {
// setState(() {
// remainingTime = 30;
// });
// } else {
// setState(() {
// remainingTime--;
// if (remainingTime > 25) {
//
// /// for 0 patinet
// widget.have0Patient = true;
// widget.have1Patient = false;
// widget.have2Patient = false;
// widget.have3Patient = false;
// widget.haveListOfPatient = false;
// } else if (remainingTime > 20) {
// /// for 1 patinet
//
// widget.have0Patient = false;
// widget.have1Patient = true;
// widget.have2Patient = false;
// widget.have3Patient = false;
// widget.haveListOfPatient = false;
// } else if (remainingTime > 15) {
//
// /// for 2 patinet
//
// widget.have0Patient = false;
// widget.have1Patient = false;
// widget.have2Patient = true;
// widget.have3Patient = false;
// widget.haveListOfPatient = false;
// } else if (remainingTime > 10) {
// /// for 3 only patinet
// widget.have0Patient = false;
// widget.have1Patient = false;
// widget.have2Patient = false;
// widget.have3Patient = true;
// widget.haveListOfPatient = false;
// } else {
// /// for 3+ only patinet
//
// widget.have0Patient = false;
// widget.have1Patient = false;
// widget.have2Patient = false;
// widget.have3Patient = true;
// widget.haveListOfPatient = true;
// }
// });
// }
// });
// }
//
// @override
// void initState() {
// startTimer();
// // Get Ticket Info
// // http://10.200.204.11:2222/Services/Nurses.svc/REST/GetCallRequestInfoByClinincInfo
//
// SignalRHelper signalRHelper = SignalRHelper();
// if (!signalRHelper.getConnectionState()) {
// signalRHelper.startSignalRConnection(DEVICE_IP, onUpdateAvailable: onUpdateAvailable);
// }
// super.initState();
// }
//
// @override
// Widget build(BuildContext context) {
//
//
// return AppScaffold(
// appBar: AppHeader(),
// body: Column(
// children: [
// SizedBox(
// height: SizeConfig.getHeightMultiplier() *
// (widget.haveListOfPatient
// ? 2
// : widget.have1Patient || widget.have0Patient
// ? 20
// : 10)),
// widget.have0Patient
// ? Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Center(
// child: AppText("Awaiting Patients Arrival",
// fontFamily: 'Poppins-SemiBold.ttf',
// fontSize: SizeConfig.getWidthMultiplier() * 9),
// ),
// ],
// )
// : widget.haveListOfPatient
// ? Row(
// children: [
// FirstColumn(
// have3Patient: widget.have3Patient,
// have2Patient: widget.have2Patient,
// ),
// const SizedBox(
// width: 40,
// ),
// if (widget.haveListOfPatient)
// Container(
// width: 10,
// height: SizeConfig.getHeightMultiplier() * 40,
// color: AppGlobal.appLightGreyColor,
// ),
// if (widget.haveListOfPatient)
// const SizedBox(
// width: 40,
// ),
// if (widget.haveListOfPatient) const QueItemList()
// ],
// )
// : FirstColumn(
// have3Patient: widget.have3Patient,
// have2Patient: widget.have2Patient,
// ),
// ],
// ),
// bottomSheet: Container(
// color: Colors.transparent,
// height: Utils.getHeight(),
// width: double.infinity,
// child: Row(
// children: [
// Padding(
// padding: const EdgeInsets.only(top: 30, left: 30),
// child: AppText(
// "Powered By",
// fontSize: SizeConfig.getWidthMultiplier() * 2.6,
// fontFamily: 'Poppins-Medium.ttf',
// ),
// ),
// Padding(
// padding: const EdgeInsets.only(top: 40, left: 18),
// child: Image.asset(
// "assets/images/cloud_logo.png",
// height: SizeConfig.getHeightMultiplier() * 6,
// ),
// ),
// ],
// ),
// ), // This trailing comma makes auto-formatting nicer for build methods.
// );
// }
//
//
// onUpdateAvailable(data) async{
// API.GetCallRequestInfoByClinincInfo(
// DEVICE_IP,
// onSuccess: (waitingCalls, currentInClinic){
// print("\n\n");
// print("--------------------");
// print("Current: $currentInClinic");
// print("Waiting: $waitingCalls");
// print("--------------------");
// print("\n\n");
// }, onFailure: (error){
//
// });
// }
// }

@ -1,6 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:queuing_system/core/config/size_config.dart'; import 'package:queuing_system/core/config/size_config.dart';
import 'package:queuing_system/core/response_model/call_config.dart';
import 'package:queuing_system/core/response_model/patient_call.dart'; import 'package:queuing_system/core/response_model/patient_call.dart';
import 'package:queuing_system/home/priority_calls.dart'; import 'package:queuing_system/home/priority_calls.dart';
import 'package:queuing_system/utils/call_type.dart'; import 'package:queuing_system/utils/call_type.dart';
@ -17,16 +17,16 @@ Widget noPatientInQueue() {
); );
} }
Widget priorityTickets(List<Tickets> tickets) { Widget priorityTickets(List<Tickets> tickets, CallConfig callConfig) {
return PriorityTickets(tickets); return PriorityTickets(tickets, callConfig);
} }
Widget priorityTicketsWithSideList(List<Tickets> tickets) { Widget priorityTicketsWithSideList(List<Tickets> tickets, CallConfig callConfig) {
final priorityTickets = tickets.sublist(0, 3); final priorityTickets = tickets.sublist(0, 3);
final otherTickets = tickets.sublist(3, tickets.length); final otherTickets = tickets.sublist(3, tickets.length);
return Row( return Row(
children: [ children: [
Expanded(flex: 7, child: PriorityTickets(priorityTickets)), Expanded(flex: 7, child: PriorityTickets(priorityTickets, callConfig)),
Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 50)), Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 50)),
Expanded( Expanded(
flex: 5, flex: 5,
@ -63,7 +63,7 @@ Widget priorityTicketsWithSideList(List<Tickets> tickets) {
SizedBox( SizedBox(
width: SizeConfig.getWidthMultiplier() * 28, width: SizeConfig.getWidthMultiplier() * 28,
child: AppText( child: AppText(
itm.getCallType().message('en'), itm.getCallType().message(callConfig),
color: itm.getCallType().color(), color: itm.getCallType().color(),
letterSpacing: -1.5, letterSpacing: -1.5,
fontSize: SizeConfig.getWidthMultiplier() * 3, fontSize: SizeConfig.getWidthMultiplier() * 3,

@ -1,14 +1,16 @@
import 'package:blinking_text/blinking_text.dart'; import 'package:blinking_text/blinking_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:queuing_system/core/config/size_config.dart'; import 'package:queuing_system/core/config/size_config.dart';
import 'package:queuing_system/core/response_model/call_config.dart';
import 'package:queuing_system/core/response_model/patient_call.dart'; import 'package:queuing_system/core/response_model/patient_call.dart';
import 'package:queuing_system/utils/call_type.dart'; import 'package:queuing_system/utils/call_type.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart'; import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
class PriorityTickets extends StatelessWidget { class PriorityTickets extends StatelessWidget {
final List<Tickets> tickets; final List<Tickets> tickets;
final CallConfig callConfig;
const PriorityTickets(this.tickets, {Key key}) : super(key: key); const PriorityTickets(this.tickets, this.callConfig, {Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -27,6 +29,7 @@ class PriorityTickets extends StatelessWidget {
blink: true, blink: true,
roomNo: firstTicket.roomNo, roomNo: firstTicket.roomNo,
isClinicAdded: firstTicket.callNoStr != firstTicket.queueNo, isClinicAdded: firstTicket.callNoStr != firstTicket.queueNo,
callConfig: callConfig,
), ),
const SizedBox(height: 40), const SizedBox(height: 40),
if (tickets.length > 1) ...[ if (tickets.length > 1) ...[
@ -42,6 +45,7 @@ class PriorityTickets extends StatelessWidget {
scale: 0.7, scale: 0.7,
roomNo: ticket.roomNo, roomNo: ticket.roomNo,
isClinicAdded: ticket.callNoStr != ticket.queueNo, isClinicAdded: ticket.callNoStr != ticket.queueNo,
callConfig: callConfig,
), ),
)) ))
.toList(), .toList(),
@ -59,11 +63,20 @@ class TicketItem extends StatelessWidget {
final bool blink; final bool blink;
final double scale; final double scale;
final bool isClinicAdded; final bool isClinicAdded;
final CallConfig callConfig;
const TicketItem({Key key, @required this.isClinicAdded, @required this.ticketNo, @required this.roomNo, @required this.callType, this.scale, this.blink = false}) : super(key: key); const TicketItem({
Key key,
@required this.isClinicAdded,
@required this.ticketNo,
@required this.roomNo,
@required this.callType,
@required this.callConfig,
this.scale,
this.blink = false,
}) : super(key: key);
String getFormattedTicket(String ticketNo, bool isClinicAdded) { String getFormattedTicket(String ticketNo, bool isClinicAdded) {
print("ticket: $ticketNo");
if (isClinicAdded) { if (isClinicAdded) {
var formattedString = ticketNo.split(" "); var formattedString = ticketNo.split(" ");
return formattedString[0] + " " + formattedString[1]; return formattedString[0] + " " + formattedString[1];
@ -90,13 +103,6 @@ class TicketItem extends StatelessWidget {
// endColor: blink ? AppGlobal.appRedColor : Colors.black, // endColor: blink ? AppGlobal.appRedColor : Colors.black,
times: 0, times: 0,
duration: const Duration(seconds: 1)), duration: const Duration(seconds: 1)),
// AppText(
// ticketNo,
// letterSpacing: -9.32,
// fontSize: SizeConfig.getWidthMultiplier() * 16,
// fontWeight: FontWeight.bold,
// fontHeight: 0.7,
// ),
const SizedBox(height: 10), const SizedBox(height: 10),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
@ -105,7 +111,7 @@ class TicketItem extends StatelessWidget {
callType.icon(SizeConfig.getHeightMultiplier() * 3), callType.icon(SizeConfig.getHeightMultiplier() * 3),
const SizedBox(width: 10), const SizedBox(width: 10),
AppText( AppText(
callType.message('en'), callType.message(callConfig),
color: callType.color(), color: callType.color(),
letterSpacing: -1.5, letterSpacing: -1.5,
fontSize: SizeConfig.getWidthMultiplier() * 3.8, fontSize: SizeConfig.getWidthMultiplier() * 3.8,

@ -1,88 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/core/config/size_config.dart';
import 'package:queuing_system/home/que_item/que_item_widget.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
class TicketItem extends StatelessWidget {
const TicketItem({
Key key,
this.isFirstLine = false,
this.isSecondLine = false,
this.isInListLine = false,
this.queNo,
this.isNurseVisit = false,
this.idDoctorVisit = false, this.haveListOfPatient
}) : super(key: key);
final bool isFirstLine;
final bool isSecondLine;
final bool isInListLine;
final bool isNurseVisit;
final bool idDoctorVisit;
final String queNo;
final bool haveListOfPatient;
@override
Widget build(BuildContext context) {
return haveListOfPatient?
Padding(
padding: const EdgeInsets.all(45.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
QueItemWidget(
isFirstLine: isFirstLine,
isNurseVisit: isNurseVisit,
isSecondLine: isSecondLine,
queNo: queNo,
),
],
),
)
:Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(right: 20.0, left: 20.0),
child: AppText(
queNo,
fontSize: SizeConfig.getWidthMultiplier() *
(isFirstLine
? 13
: isSecondLine
? 8.5
: 4.7),
letterSpacing: -3.26,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
),
),
const SizedBox(width: 30,),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset(
isNurseVisit
? "assets/images/nurseicon.svg"
: "assets/images/doctoricon.svg", height:SizeConfig.getHeightMultiplier()*2.5 ,),
const SizedBox(width: 4,),
AppText(
isNurseVisit ? " Please Visit Nurse" : " Please Visit Doctor",
color: AppGlobal.appGreyColor,
fontSize: SizeConfig.getWidthMultiplier() * (isFirstLine
? 3.3
: isSecondLine
? 3.3
: 3.3),
letterSpacing: -1.6,
fontFamily: 'Poppins-Medium.ttf',
),
],
)
],
);
}
}

@ -1,67 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/core/config/size_config.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
///TODO Roaa we have dublicated code between this and the que item widget we need to make it customize
class QueItemWidget extends StatelessWidget {
const QueItemWidget({
Key key,
this.isFirstLine = false,
this.isSecondLine = false,
this.queNo,
this.isNurseVisit = false,
}) : super(key: key);
final bool isFirstLine;
final bool isSecondLine;
final bool isNurseVisit;
final String queNo;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppText(
queNo,
fontSize: SizeConfig.getWidthMultiplier() *
(isFirstLine
? 14
: isSecondLine
? 8.5
: 5.5),
letterSpacing: -13.72,
fontWeight: FontWeight.bold,
// fontFamily: 'Poppins-Bold.ttf',
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
isNurseVisit
? "assets/images/nurseicon.svg"
: "assets/images/doctoricon.svg", height:SizeConfig.getHeightMultiplier()*2.5 ,),
const SizedBox(width: 25,),
AppText(
isNurseVisit ? "Please Visit Nurse" : "Please Visit Doctor",
color: isNurseVisit
? AppGlobal.appGreenColor
: AppGlobal.appRedColor,
fontSize: SizeConfig.getWidthMultiplier() * (isFirstLine
? 3.3
: isSecondLine
? 3.3
: 3.3),
letterSpacing: -3.25,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins-Medium.ttf',
),
],
),
],
);
}
}

@ -1,27 +1,27 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:queuing_system/core/config/size_config.dart'; // import 'package:queuing_system/core/config/size_config.dart';
import 'package:queuing_system/home/que_item/que_item.dart'; // import 'package:queuing_system/home/que_item/que_item.dart';
//
class QueItemList extends StatelessWidget { // class QueItemList extends StatelessWidget {
const QueItemList({Key key}) : super(key: key); // const QueItemList({Key key}) : super(key: key);
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return SizedBox( // return SizedBox(
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
SizedBox(height: SizeConfig.getHeightMultiplier() *2.3,), // SizedBox(height: SizeConfig.getHeightMultiplier() *2.3,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: true, haveListOfPatient: false,),
const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,), // const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,),
//
],), // ],),
); // );
} // }
} // }

@ -44,13 +44,11 @@ class MyApp extends StatelessWidget {
showSemanticsDebugger: false, showSemanticsDebugger: false,
title: 'Doctors App', title: 'Doctors App',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.grey,
primaryColor: Colors.grey, primaryColor: Colors.grey,
fontFamily: 'Poppins', fontFamily: 'Poppins',
dividerColor: Colors.grey[350], dividerColor: Colors.grey[350], colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.grey).copyWith(background: const Color.fromRGBO(255, 255, 255, 1)),
backgroundColor: const Color.fromRGBO(255, 255, 255, 1),
), ),
home:MyHomePage() , home:const MyHomePage() ,
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
)), )),
); );

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:queuing_system/core/config/config.dart'; import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/core/response_model/call_config.dart';
enum CallType { vitalSign, doctor, procedure, vaccination, nebulization, none } enum CallType { vitalSign, doctor, procedure, vaccination, nebulization, none }
@ -21,20 +22,25 @@ extension XCallType on CallType {
} }
} }
String message(String lang) { String message(CallConfig callConfig) {
if (this == CallType.vitalSign) { int language = callConfig.screenLanguage;
return "Please visit VitalSign"; switch (this) {
} else if (this == CallType.doctor) { case CallType.vitalSign:
return "Please visit Doctor"; return language == 1 ? callConfig.vitalSignText : callConfig.vitalSignTextN;
} else if (this == CallType.procedure) { case CallType.doctor:
return "Please visit Procedure"; return language == 1 ? callConfig.doctorText : callConfig.doctorTextN;
} else if (this == CallType.vaccination) { case CallType.procedure:
return "Please visit Vaccination"; return language == 1 ? callConfig.procedureText : callConfig.procedureTextN;
} case CallType.vaccination:
if (this == CallType.nebulization) { return language == 1 ? callConfig.vaccinationText : callConfig.vaccinationTextN;
return "Please visit Nebulization"; case CallType.nebulization:
return language == 1 ? callConfig.nebulizationText : callConfig.nebulizationTextN;
case CallType.none:
return language == 1 ? callConfig.vitalSignText : callConfig.vitalSignTextN;
default:
return language == 1 ? callConfig.vitalSignText : callConfig.vitalSignTextN;
} }
return "Please wait . . .";
} }
SvgPicture icon( SvgPicture icon(

@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:queuing_system/widget/loader/gif_loader_container.dart';
import 'loader/gif_loader_container.dart';
class AppLoaderWidget extends StatefulWidget { class AppLoaderWidget extends StatefulWidget {
AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key); AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key);
@ -9,13 +8,13 @@ class AppLoaderWidget extends StatefulWidget {
final Color containerColor; final Color containerColor;
@override @override
_AppLoaderWidgetState createState() => new _AppLoaderWidgetState(); _AppLoaderWidgetState createState() => _AppLoaderWidgetState();
} }
class _AppLoaderWidgetState extends State<AppLoaderWidget> { class _AppLoaderWidgetState extends State<AppLoaderWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return SizedBox(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
child: Stack( child: Stack(
children: [ children: [

@ -30,14 +30,14 @@ class _GifLoaderContainerState extends State<GifLoaderContainer>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Center(
//progress-loading.gif //progress-loading.gif
child: Container( child: Container(
// margin: EdgeInsets.only(bottom: 40), // margin: EdgeInsets.only(bottom: 40),
child: GifImage( child: GifImage(
controller: controller1, controller: controller1,
image: AssetImage( image: AssetImage(
"assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"),
), ),
)); ));
} }
} }

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'gif_loader_container.dart'; import 'gif_loader_container.dart';
class GifLoaderDialogUtils { class GifLoaderDialogUtils {
static showMyDialog(BuildContext context) { static showMyDialog(BuildContext context) {
showDialog(context: context, builder: (ctx) => GifLoaderContainer()); showDialog(context: context, builder: (ctx) => GifLoaderContainer());

Loading…
Cancel
Save