Structure Update

faiz_dev_structure_update
FaizHashmiCS22 2 years ago
parent 1a3ed42951
commit f524cee132

@ -1,25 +1,25 @@
import 'dart:developer';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:queuing_system/core/base/base_app_client.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/home/home_screen.dart';
import 'package:queuing_system/core/response_models/call_config.dart';
import 'package:queuing_system/core/response_models/patient_call.dart';
const _getCallRequestInfoByClinicInfo = "/GetCallRequestInfo_ByIP";
const _callUpdateNotIsQueueRecordByIDAsync = "/CallRequest_QueueUpdate";
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext context) {
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true;
}
}
bool isDevMode = true;
class API {
static getCallRequestInfoByClinicInfo(String deviceIp, {@required Function(List<Tickets>, List<Tickets>, CallConfig callConfig) 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};
if (isDevMode) {
@ -44,7 +44,7 @@ class API {
var isQueuePatients = callPatients.where((element) => (element.callType == 1 && element.isQueue == false) || (element.callType == 2 && element.isQueue == false)).toList();
// callPatients.removeWhere((element) => (element.callType == 1 && element.isQueueNurse == false) || (element.callType == 2 && element.isQueueDr == false));
callPatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp));
callPatients.sort((a, b) => a.editedOnTimeStamp!.compareTo(b.editedOnTimeStamp!));
// callPatients.addAll(isQueuePatients.toList());
@ -56,11 +56,12 @@ class API {
onFailure: (error, status) => onFailure(error));
}
static callUpdateNotIsQueueRecordByIDAsync(String deviceIp, {@required Tickets ticket, @required Function(List<Tickets>) onSuccess, @required Function(dynamic) onFailure}) async {
if (ticket.id == null) {
return;
}
static callUpdateNotIsQueueRecordByIDAsync(
String deviceIp, {
required Tickets ticket,
required Function(List<Tickets>) onSuccess,
required Function(dynamic) onFailure,
}) async {
List<Tickets> _ticketsUpdated = [];
// for (var ticket in tickets) {

@ -1,100 +1,54 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:queuing_system/core/base/project_view_model.dart';
import 'package:queuing_system/widget/app_loader_widget.dart';
import 'package:queuing_system/home/app_provider.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
import 'base_view_model.dart';
import 'network_base_view.dart';
class AppScaffold extends StatelessWidget {
final String appBarTitle;
final Widget body;
final bool isLoading;
final bool isShowAppBar;
final BaseViewModel baseViewModel;
final Widget bottomSheet;
final Color backgroundColor;
final Widget appBar;
final Widget? bottomSheet;
final Color? backgroundColor;
final PreferredSizeWidget appBar;
final Widget drawer;
final Widget bottomNavigationBar;
final String subtitle;
final bool isHomeIcon;
final bool extendBody;
final AppProvider appProvider;
const AppScaffold(
{Key key, this.appBarTitle = '',
this.body,
{Key? key,
this.appBarTitle = '',
required this.body,
this.isLoading = false,
this.isShowAppBar = true,
this.baseViewModel,
this.bottomSheet,
this.backgroundColor,
this.isHomeIcon = true,
this.appBar,
this.subtitle,
this.drawer,
required this.appBar,
this.subtitle = "",
this.drawer = const SizedBox.shrink(),
this.extendBody = false,
this.bottomNavigationBar}) : super(key: key);
required this.appProvider,
required this.bottomNavigationBar})
: super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: Scaffold(
backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor
,
backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
drawer: drawer,
extendBody: extendBody,
bottomNavigationBar: bottomNavigationBar,
appBar: isShowAppBar
? appBar ??
AppBar(
elevation: 0,
backgroundColor: Colors.white,
title: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(appBarTitle.toUpperCase()),
if (subtitle != null)
Text(
subtitle,
style: const TextStyle(fontSize: 12, color: Colors.red),
),
],
),
leading: Builder(builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.arrow_back_ios),
color: Colors.black, //Colors.black,
onPressed: () => Navigator.pop(context),
);
}),
centerTitle: true,
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,
appBar: isShowAppBar ? appBar : null,
bottomSheet: bottomSheet,
body: projectProvider.isInternetConnection
? baseViewModel != null
? NetworkBaseView(
baseViewModel: baseViewModel,
child: body,
)
: Stack(
children: <Widget>[body, buildAppLoaderWidget(isLoading)])
body: appProvider.isInternetConnectionAvailable
? body
: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -111,8 +65,4 @@ class AppScaffold extends StatelessWidget {
),
);
}
Widget buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container();
}
}

@ -6,7 +6,7 @@ import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/utils/Utils.dart';
class BaseAppClient {
static post(String endPoint, {Map<String, dynamic> body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure}) async {
static post(String endPoint, {Map<String, dynamic>? body, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure}) async {
String url;
url = BASE_URL + endPoint;
@ -21,21 +21,29 @@ class BaseAppClient {
});
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) {
onFailure(Utils.generateContactAdminMsg(), statusCode);
if (onFailure != null) {
onFailure(Utils.generateContactAdminMsg(), statusCode);
}
} else {
log("Response: ${response.body.toString()}");
var parsed = json.decode(response.body.toString());
onSuccess(parsed, statusCode);
if (onSuccess != null) {
onSuccess(parsed, statusCode);
}
}
} else {
onFailure('Please Check The Internet Connection', -1);
if (onFailure != null) {
onFailure('Please Check The Internet Connection', -1);
}
}
} catch (e) {
onFailure(e.toString(), -1);
if (onFailure != null) {
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;
url = BASE_URL + endPoint;
@ -49,16 +57,24 @@ class BaseAppClient {
final response = await http.get(Uri.parse(url), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'});
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) {
onFailure(Utils.generateContactAdminMsg(), statusCode);
if (onFailure != null) {
onFailure(Utils.generateContactAdminMsg(), statusCode);
}
} else {
var parsed = json.decode(response.body.toString());
onSuccess(parsed, statusCode);
if (onSuccess != null) {
onSuccess(parsed, statusCode);
}
}
} else {
onFailure('Please Check The Internet Connection', -1);
if (onFailure != null) {
onFailure('Please Check The Internet Connection', -1);
}
}
} catch (e) {
onFailure(e.toString(), -1);
if (onFailure != null) {
onFailure(e.toString(), -1);
}
}
}

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

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

@ -1,40 +0,0 @@
import 'dart:async';
import 'package:connectivity/connectivity.dart';
import 'package:flutter/material.dart';
import 'package:queuing_system/core/base/view_state.dart';
class BaseViewModel extends ChangeNotifier {
ViewState _state = ViewState.Idle;
bool isInternetConnection = true;
StreamSubscription subscription;
ViewState get state => _state;
String error = "";
void setState(ViewState viewState) {
_state = viewState;
notifyListeners();
}
BaseViewModel(){
subscription = Connectivity()
.onConnectivityChanged
.listen((ConnectivityResult result) {
switch (result) {
case ConnectivityResult.wifi:
isInternetConnection = true;
break;
case ConnectivityResult.mobile:
isInternetConnection = true;
break;
case ConnectivityResult.none:
isInternetConnection = false;
break;
}
notifyListeners();
});
}
}

@ -1,11 +0,0 @@
import 'package:get_it/get_it.dart';
GetIt locator = GetIt.instance;
///di
void setupLocator() {
/// Services
/// View Model
}

@ -1,40 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:queuing_system/core/base/view_state.dart';
import 'package:queuing_system/widget/app_loader_widget.dart';
import 'package:queuing_system/widget/errors/error_message.dart';
import 'base_view_model.dart';
class NetworkBaseView extends StatelessWidget {
final BaseViewModel baseViewModel;
final Widget child;
NetworkBaseView({Key key, this.baseViewModel, this.child});
@override
Widget build(BuildContext context) {
return Container(
color: Colors.grey[100],
child: buildBaseViewWidget(),
);
}
buildBaseViewWidget() {
switch (baseViewModel.state) {
case ViewState.ErrorLocal:
case ViewState.Idle:
case ViewState.BusyLocal:
return child;
break;
case ViewState.Busy:
return AppLoaderWidget();
break;
case ViewState.Error:
return ErrorMessage(
error: baseViewModel.error,
);
break;
}
}
}

@ -1,51 +0,0 @@
import 'dart:async';
import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart';
import 'package:queuing_system/core/base/base_app_client.dart';
class ProjectViewModel with ChangeNotifier {
Locale _appLocale;
String currentLanguage = 'ar';
bool _isArabic = false;
bool isInternetConnection = true;
bool isLoading = false;
bool isError = false;
String error = '';
BaseAppClient baseAppClient = BaseAppClient();
Locale get appLocal => _appLocale;
bool get isArabic => _isArabic;
StreamSubscription subscription;
ProjectViewModel() {
subscription = Connectivity()
.onConnectivityChanged
.listen((ConnectivityResult result) {
switch (result) {
case ConnectivityResult.wifi:
isInternetConnection = true;
break;
case ConnectivityResult.mobile:
isInternetConnection = true;
break;
case ConnectivityResult.none:
isInternetConnection = false;
break;
}
notifyListeners();
});
}
@override
void dispose() {
if (subscription != null) subscription.cancel();
super.dispose();
}
}

@ -1 +0,0 @@
enum ViewState { Idle, Busy, Error, BusyLocal, ErrorLocal }

File diff suppressed because it is too large Load Diff

@ -1,16 +0,0 @@
const TOKEN = 'token';
const PROJECT_ID = 'projectID';
const VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID';
const VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID';
const LOGIN_TOKEN_ID = 'LogInToken';
const DOCTOR_ID = 'doctorID';
const SLECTED_PATIENT_TYPE = 'slectedPatientType';
const APP_Language = 'language';
const DOCTOR_PROFILE = 'doctorProfile';
const LIVE_CARE_PATIENT = 'livecare-patient-profile';
const LOGGED_IN_USER = 'loggedUser';
const EMPLOYEE_ID = 'EmployeeID';
const DASHBOARD_DATA = 'dashboard-data';
const OTP_TYPE = 'otp-type';
const LAST_LOGIN_USER = 'last-login-user';
const CLINIC_NAME = 'clinic-name';

@ -5,15 +5,15 @@ class SizeConfig {
static double _blockWidth = 0;
static double _blockHeight = 0;
static double realScreenWidth;
static double realScreenHeight;
static double screenWidth;
static double screenHeight;
static double textMultiplier;
static double imageSizeMultiplier;
static double heightMultiplier;
static double realScreenWidth = 0.0;
static double realScreenHeight = 0.0;
static double screenWidth = 0.0;
static double screenHeight = 0.0;
static double? textMultiplier;
static double? imageSizeMultiplier;
static double? heightMultiplier;
static bool isPortrait = true;
static double widthMultiplier;
static double? widthMultiplier;
static bool isMobilePortrait = false;
static bool isMobile = false;
static bool isHeightShort = false;
@ -77,7 +77,7 @@ class SizeConfig {
// print('isMobilePortrait $isMobilePortrait');
}
static getTextMultiplierBasedOnWidth({double width}) {
static getTextMultiplierBasedOnWidth({required double width}) {
// TODO handel LandScape case
if (width != null) {
return width / 100;
@ -85,7 +85,7 @@ class SizeConfig {
return widthMultiplier;
}
static getWidthMultiplier({double width}) {
static getWidthMultiplier({double? width}) {
// TODO handel LandScape case
if (width != null) {
return width / 100;
@ -93,7 +93,7 @@ class SizeConfig {
return widthMultiplier;
}
static getHeightMultiplier({double height}) {
static getHeightMultiplier({double? height}) {
// TODO handel LandScape case
if (height != null) {
return height / 100;

@ -1,56 +1,56 @@
class CallConfig {
int id;
bool globalClinicPrefixReq;
bool clinicPrefixReq;
int concurrentCallDelaySec;
int voiceType;
int screenLanguage;
int voiceLanguage;
int screenMaxDisplayPatients;
int prioritySMS;
int priorityWhatsApp;
int priorityEmail;
String vitalSignText;
String vitalSignTextN;
String doctorText;
String doctorTextN;
String procedureText;
String procedureTextN;
String vaccinationText;
String vaccinationTextN;
String nebulizationText;
String nebulizationTextN;
int createdBy;
String createdOn;
int editedBy;
String editedOn;
late int id;
late bool globalClinicPrefixReq;
late bool clinicPrefixReq;
late int concurrentCallDelaySec;
late int voiceType;
late int screenLanguage;
late int voiceLanguage;
late int screenMaxDisplayPatients;
late int prioritySMS;
late int priorityWhatsApp;
late int priorityEmail;
late String vitalSignText;
late String vitalSignTextN;
late String doctorText;
late String doctorTextN;
late String procedureText;
late String procedureTextN;
late String vaccinationText;
late String vaccinationTextN;
late String nebulizationText;
late String nebulizationTextN;
late int createdBy;
late String createdOn;
late int editedBy;
late String editedOn;
CallConfig(
{this.id,
this.globalClinicPrefixReq,
this.clinicPrefixReq,
this.concurrentCallDelaySec,
this.voiceType,
this.screenLanguage,
this.voiceLanguage,
this.screenMaxDisplayPatients,
this.prioritySMS,
this.priorityWhatsApp,
this.priorityEmail,
this.vitalSignText,
this.vitalSignTextN,
this.doctorText,
this.doctorTextN,
this.procedureText,
this.procedureTextN,
this.vaccinationText,
this.vaccinationTextN,
this.nebulizationText,
this.nebulizationTextN,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn});
{this.id = 0,
this.globalClinicPrefixReq = false,
this.clinicPrefixReq = false,
this.concurrentCallDelaySec = 8,
this.voiceType = 0,
this.screenLanguage = 1,
this.voiceLanguage = 1,
this.screenMaxDisplayPatients = 5,
this.prioritySMS = 1,
this.priorityWhatsApp = 1,
this.priorityEmail = 1,
this.vitalSignText = "",
this.vitalSignTextN = "",
this.doctorText = "",
this.doctorTextN = "",
this.procedureText = "",
this.procedureTextN = "",
this.vaccinationText = "",
this.vaccinationTextN = "",
this.nebulizationText = "",
this.nebulizationTextN = "",
this.createdBy = 0,
this.createdOn = "",
this.editedBy = 0,
this.editedOn = ""});
CallConfig.fromJson(Map<String, dynamic> json) {
id = json['id'];

@ -3,43 +3,43 @@ import 'dart:math';
import 'package:queuing_system/utils/call_type.dart';
class Tickets {
int id;
int patientID;
String mobileNo;
String doctorName;
String doctorNameN;
int patientGender;
int callType;
int editedOnTimeStamp;
int concurrentCallDelaySec;
String roomNo;
String createdOn;
String editedOn;
String queueNo;
String callNoStr;
bool isQueue;
bool isToneReq;
bool isVoiceReq;
bool callUpdated = false;
late int id;
late int patientID;
late String mobileNo;
late String doctorName;
late String doctorNameN;
late int patientGender;
late int callType;
late int editedOnTimeStamp;
late int concurrentCallDelaySec;
late String roomNo;
late String createdOn;
late String editedOn;
late String queueNo;
late String callNoStr;
late bool isQueue;
late bool isToneReq;
late bool isVoiceReq;
late bool callUpdated = false;
Tickets(
{this.id,
this.patientID,
this.mobileNo,
this.doctorName,
this.doctorNameN,
this.patientGender,
this.callType,
this.editedOnTimeStamp,
this.roomNo,
this.createdOn,
this.editedOn,
this.queueNo,
this.callNoStr,
this.isQueue,
this.isToneReq,
this.isVoiceReq,
this.concurrentCallDelaySec});
{this.id = 0,
this.patientID = 0,
this.mobileNo = "",
this.doctorName = "",
this.doctorNameN = "",
this.patientGender = 1,
this.callType = 1,
this.editedOnTimeStamp = 0,
this.roomNo = "",
this.createdOn = "",
this.editedOn = "",
this.queueNo = "",
this.callNoStr = "",
this.isQueue = false,
this.isToneReq = false,
this.isVoiceReq = false,
this.concurrentCallDelaySec = 1});
int getRandomNum() {
return Random().nextInt(9);

@ -5,6 +5,8 @@ import 'package:queuing_system/utils/utils.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
class AppHeader extends StatelessWidget with PreferredSizeWidget {
const AppHeader({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(

@ -0,0 +1,227 @@
import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart';
import 'package:just_audio/just_audio.dart';
import 'package:queuing_system/core/api.dart';
import 'package:queuing_system/core/response_models/call_config.dart';
import 'package:queuing_system/core/response_models/patient_call.dart';
import 'package:queuing_system/utils/call_by_voice.dart';
import 'package:queuing_system/utils/call_type.dart';
import 'package:queuing_system/utils/signalR_utils.dart';
class AppProvider extends ChangeNotifier {
AppProvider() {
startSignalHubConnection();
listenNetworkConnectivity();
}
SignalRHelper signalRHelper = SignalRHelper();
final AudioPlayer audioPlayer = AudioPlayer();
CallConfig patientCallConfigurations = CallConfig();
List<Tickets> patientTickets = [];
List<Tickets> isQueuePatients = [];
String currentDeviceIp = "";
bool isCallingInProgress = false;
bool isInternetConnectionAvailable = true;
updateInternetConnection(bool value) {
isInternetConnectionAvailable = value;
notifyListeners();
}
Future<void> getCurrentIP() async {
final ips = await NetworkInterface.list(type: InternetAddressType.IPv4);
for (var interface in ips) {
if (interface.name == "eth0") {
for (var address in interface.addresses) {
currentDeviceIp = address.address;
notifyListeners();
}
}
if (interface.name == "wlan0") {
for (var address in interface.addresses) {
currentDeviceIp = address.address;
notifyListeners();
}
}
}
}
Future<void> startSignalHubConnection() async {
if (!signalRHelper.getConnectionState()) {
signalRHelper.startSignalRConnection(currentDeviceIp, onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
}
}
Future<void> callPatientsAPI() async {
patientTickets.clear();
API.getCallRequestInfoByClinicInfo(currentDeviceIp, onSuccess: (waitingCalls, isQueuePatientsCalls, callConfigs) {
patientCallConfigurations = callConfigs;
if (waitingCalls.length > patientCallConfigurations.screenMaxDisplayPatients) {
patientTickets = waitingCalls.sublist(0, patientCallConfigurations.screenMaxDisplayPatients);
} else {
patientTickets = waitingCalls;
}
isQueuePatients = isQueuePatientsCalls;
notifyListeners();
}, onFailure: (error) {
log("Api call failed with this error: ${error.toString()}");
});
}
onPingReceived(data) async {
if (patientTickets.isNotEmpty) {
if ((patientTickets.first.isToneReq && isCallingInProgress) || (patientTickets.first.isVoiceReq && voiceCaller != null)) {
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI();
});
} else {
await callPatientsAPI();
}
} else {
await callPatientsAPI();
}
}
String getCallTypeText(Tickets ticket, CallConfig callConfig) {
final callType = ticket.getCallType();
switch (callType) {
case CallType.vitalSign:
return callConfig.vitalSignText;
case CallType.doctor:
return callConfig.doctorText;
case CallType.procedure:
return callConfig.procedureText;
case CallType.vaccination:
return callConfig.vaccinationText;
case CallType.nebulization:
return callConfig.nebulizationText;
default:
return callConfig.vitalSignText;
}
}
CallByVoice? voiceCaller;
callPatientTicket(AudioPlayer audioPlayer) async {
isCallingInProgress = true;
if (patientTickets.isNotEmpty) {
if (patientTickets.first.isToneReq && !patientTickets.first.isQueue) {
audioPlayer.setAsset("assets/tones/call_tone.mp3");
await audioPlayer.play();
await Future.delayed(const Duration(seconds: 2));
isCallingInProgress = false;
}
if (patientTickets.first.isVoiceReq && voiceCaller == null && !patientTickets.first.isQueue) {
final postVoice = getCallTypeText(patientTickets.first, patientCallConfigurations);
voiceCaller = CallByVoice(preVoice: "Ticket Number", ticketNo: patientTickets.first.queueNo.trim().toString(), postVoice: postVoice, lang: 'en');
await voiceCaller!.startCalling(patientTickets.first.queueNo.trim().toString() != patientTickets.first.callNoStr.trim().toString());
voiceCaller = null;
isCallingInProgress = false;
}
}
if (isQueuePatients.isNotEmpty) {
await Future.delayed(Duration(seconds: isQueuePatients.first.concurrentCallDelaySec)).whenComplete(() async {
if (isQueuePatients.isNotEmpty) {
isQueuePatients.removeAt(0);
}
if (patientTickets.isNotEmpty) {
// Tickets ticket = patientTickets.elementAt(0);
// patientTickets.removeAt(0);
// patientTickets.add(ticket);
}
if (isQueuePatients.isNotEmpty) {
// setState(() {});
}
});
} else {
// if (isQueuePatients.isEmpty && callFlag == 1) {
// callFlag == 0;
// await Future.delayed(const Duration(seconds: 3));
// patientTickets.clear();
// API.getCallRequestInfoByClinicInfo(DEVICE_IP, onSuccess: (waitingCalls, isQueuePatientsCalls) {
// setState(() {
// patientTickets = waitingCalls;
// isQueuePatients = isQueuePatientsCalls;
// // currents = currentInClinic;
// });
//
// log("--------------------");
// log("waiting: $patientTickets");
// log("isQueuePatients: $isQueuePatients");
// log("--------------------");
//
// updateTickets();
// }, onFailure: (error) {});
// }
}
}
Future<void> listenAudioPlayerEvents() async {
audioPlayer.playerStateStream.listen((playerState) {
if (playerState.processingState == ProcessingState.completed) {
isCallingInProgress = false;
}
});
}
updatePatientTickets() {
if (patientTickets.isNotEmpty) {
List<Tickets> _ticketsToUpdate = patientTickets.where((t) => t.callUpdated == false).toList();
API.callUpdateNotIsQueueRecordByIDAsync(currentDeviceIp, ticket: _ticketsToUpdate.first, onSuccess: (ticketsUpdated) {
log("[${ticketsUpdated.length}] Tickets Updated: $ticketsUpdated");
}, onFailure: (e) {
log(" Tickets Update Failed with : ${e.toString()}");
});
}
}
updatePatientTicketByIndex(int index) {
if (patientTickets.isNotEmpty) {
API.callUpdateNotIsQueueRecordByIDAsync(currentDeviceIp, ticket: patientTickets.elementAt(index), onSuccess: (ticketsUpdated) {
log("[${patientTickets.elementAt(index).callNoStr}] Ticket Updated: $ticketsUpdated");
}, onFailure: (e) {
log(" Tickets Update ${patientTickets.elementAt(index).callNoStr} Failed with Error : ${e.toString()}");
});
}
}
onConnect() {
log("SignalR: onConnect");
}
onDisconnect(exception) {
log("SignalR: onDisconnect");
signalRHelper.startSignalRConnection(currentDeviceIp, onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
}
onConnecting() {
log("SignalR: onConnecting");
}
listenNetworkConnectivity() async {
Connectivity().onConnectivityChanged.listen((event) async {
switch (event) {
case ConnectivityResult.wifi:
updateInternetConnection(true);
await getCurrentIP();
if (signalRHelper.connection == null || signalRHelper.connection!.state != ConnectionState.active) {
signalRHelper.connection!.start();
}
break;
case ConnectivityResult.none:
updateInternetConnection(false);
signalRHelper.closeConnection();
break;
case ConnectivityResult.mobile:
break;
}
});
}
}

@ -1,105 +1,23 @@
import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:connectivity/connectivity.dart';
import 'package:flutter/material.dart';
import 'package:just_audio/just_audio.dart';
import 'package:queuing_system/core/api.dart';
import 'package:provider/provider.dart';
import 'package:queuing_system/core/base/app_scaffold_widget.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/header/app_header.dart';
import 'package:queuing_system/home/home_screen_components.dart';
import 'package:queuing_system/utils/call_by_voice.dart';
import 'package:queuing_system/utils/call_type.dart';
import 'package:queuing_system/utils/signalR_utils.dart';
import 'package:queuing_system/home/app_provider.dart';
import 'package:queuing_system/home/priority_calls_components.dart';
import 'package:queuing_system/utils/utils.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
var deviceIPGlobal = "10.10.15.11";
bool isDevMode = false; // Testing IP
// var DEVICE_IP = "10.10.14.11"; // Testing IP
// var DEVICE_IP = "10.10.15.11";
// var DEVICE_IP = "10.70.249.21"; // (Make sure by Haroon before use it) Production IP
class MyHomePage extends StatefulWidget {
final String title = "MyHomePage";
const MyHomePage({Key key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
SignalRHelper signalRHelper = SignalRHelper();
CallConfig callConfigsGlobal = CallConfig();
List<Tickets> waitings = [];
List<Tickets> isQueuePatients = [];
bool isLoading = false;
@override
void dispose() {
super.dispose();
}
Future<String> getCurrentIP() async {
final ips = await NetworkInterface.list(type: InternetAddressType.IPv4);
for (var interface in ips) {
//TODO: WE WILL UPDATE THIS WHEN TESTING ON SCREEN
// if (interface.name == "wlan0") {
if (interface.name == "eth0") {
for (var address in interface.addresses) {
deviceIPGlobal = address.address;
print("IP with eth0: ${address.address}");
return deviceIPGlobal;
}
}
if (interface.name == "wlan0") {
for (var address in interface.addresses) {
deviceIPGlobal = address.address;
print("IP with wlan0: ${address.address}");
return deviceIPGlobal;
}
}
return "";
}
return "";
}
final AudioPlayer audioPlayer = AudioPlayer();
@override
void initState() {
listenNetworkConnectivity();
scheduleMicrotask(() async {
if (!signalRHelper.getConnectionState()) {
signalRHelper.startSignalRConnection(await getCurrentIP(), onUpdateAvailable: onUpdateAvailable, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
}
});
audioPlayer.playerStateStream.listen((playerState) {
if (playerState.processingState == ProcessingState.completed) {
isCallingInProgress = false;
print("isCallingInProgress in Stream: $isCallingInProgress");
}
});
super.initState();
}
TextEditingController controller = TextEditingController();
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final appProvider = context.watch<AppProvider>();
return AppScaffold(
appProvider: appProvider,
appBar: AppHeader(),
body: dataContent(audioPlayer),
body: dataContent(appProvider: appProvider),
bottomNavigationBar: Container(
color: Colors.grey.withOpacity(0.1),
height: Utils.getHeight(),
@ -115,16 +33,14 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () {
// onUpdateAvailable("");
},
onTap: () {},
child: AppText(
"Powered By",
fontSize: SizeConfig.getWidthMultiplier() * 2.6,
fontFamily: 'Poppins-Medium.ttf',
),
),
Text(deviceIPGlobal, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
Text(appProvider.currentDeviceIp, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
],
),
const SizedBox(width: 10),
@ -140,235 +56,16 @@ class _MyHomePageState extends State<MyHomePage> {
);
}
onUpdateIPPressed() async {
// if (controller.text.isNotEmpty) {
// isLoading = true;
// setState(() {});
// DEVICE_IP = controller.text;
//
// await signalRHelper.connection.stop();
// if (!signalRHelper.getConnectionState()) {
// await signalRHelper.startSignalRConnection(DEVICE_IP, onUpdateAvailable: onUpdateAvailable, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
// }
//
// controller.clear();
// waitings.clear();
// isLoading = false;
// setState(() {});
// }
}
Widget dataContent(AudioPlayer audioPlayer) {
voiceCall(audioPlayer);
// print("wlength: ${waitings.length}");
// if (waitings.length > callConfigsGlobal.screenMaxDisplayPatients) {
// final newList = waitings.sublist(0, callConfigsGlobal.screenMaxDisplayPatients );
// print("wlength: ${newList.length}");
// }
if (waitings.isEmpty) {
Widget dataContent({required AppProvider appProvider}) {
if (appProvider.patientTickets.isEmpty) {
// No Patient in Queue
return noPatientInQueue();
} else if (waitings.length > 3) {
} else if (appProvider.patientTickets.length > 3) {
// Return Content With Side List
return priorityTicketsWithSideList(waitings, callConfigsGlobal);
return priorityTicketsWithSideList(tickets: appProvider.patientTickets, callConfig: appProvider.patientCallConfigurations);
} else {
// Return Content In Center Aligned
return priorityTickets(waitings, callConfigsGlobal);
}
}
String getCallTypeText(Tickets ticket, CallConfig callConfig) {
final callType = ticket.getCallType();
final language = callConfig.screenLanguage;
switch (callType) {
case CallType.vitalSign:
return callConfig.vitalSignText;
case CallType.doctor:
return callConfig.doctorText;
case CallType.procedure:
return callConfig.procedureText;
case CallType.vaccination:
return callConfig.vaccinationText;
case CallType.nebulization:
return callConfig.nebulizationText;
break;
default:
return callConfig.vitalSignText;
return PriorityTickets(tickets: appProvider.patientTickets, callConfig: appProvider.patientCallConfigurations);
}
}
CallByVoice voiceCaller;
int callFlag = 0;
// bool isRequiredVoice({CallType callType, bool isQueue}) {
// if (callType == CallType.DOCTOR && !isQueue) {
// return true;
// }
// if (callType == CallType.NURSE && !isQueue) {
// return true;
// }
// return false;
// }
bool isCallingInProgress = false;
voiceCall(AudioPlayer audioPlayer) async {
isCallingInProgress = true;
//DONE: After calling this voice call, we should delay for milliseconds that is given by API. After that we will check if there are more patients in isQueuePatients we will remove the patient from waiting list and then update the state
if (waitings.isNotEmpty) {
if (waitings.first.isToneReq && !waitings.first.isQueue) {
audioPlayer.setAsset("assets/tones/call_tone.mp3");
await audioPlayer.play();
await Future.delayed(const Duration(seconds: 2));
isCallingInProgress = false;
}
if (waitings.first.isVoiceReq && voiceCaller == null && !waitings.first.isQueue) {
final postVoice = getCallTypeText(waitings.first, callConfigsGlobal);
voiceCaller = CallByVoice(preVoice: "Ticket Number", ticketNo: waitings.first.queueNo.trim().toString(), postVoice: postVoice, lang: 'en');
await voiceCaller.startCalling(waitings.first.queueNo.trim().toString() != waitings.first.callNoStr.trim().toString());
voiceCaller = null;
isCallingInProgress = false;
}
}
if (isQueuePatients.isNotEmpty) {
await Future.delayed(Duration(seconds: isQueuePatients.first.concurrentCallDelaySec)).whenComplete(() async {
if (isQueuePatients.isNotEmpty) {
isQueuePatients.removeAt(0);
}
if (waitings.isNotEmpty) {
// Tickets ticket = waitings.elementAt(0);
// waitings.removeAt(0);
// waitings.add(ticket);
}
if (isQueuePatients.isNotEmpty) {
// setState(() {});
}
});
} else {
// if (isQueuePatients.isEmpty && callFlag == 1) {
// callFlag == 0;
// await Future.delayed(const Duration(seconds: 3));
// waitings.clear();
// API.getCallRequestInfoByClinicInfo(DEVICE_IP, onSuccess: (waitingCalls, isQueuePatientsCalls) {
// setState(() {
// waitings = waitingCalls;
// isQueuePatients = isQueuePatientsCalls;
// // currents = currentInClinic;
// });
//
// log("--------------------");
// log("waiting: $waitings");
// log("isQueuePatients: $isQueuePatients");
// log("--------------------");
//
// updateTickets();
// }, onFailure: (error) {});
// }
}
}
Future<void> callPatientsAPI() async {
waitings.clear();
API.getCallRequestInfoByClinicInfo(deviceIPGlobal, onSuccess: (waitingCalls, isQueuePatientsCalls, callConfigs) {
setState(() {
callConfigsGlobal = callConfigs;
if (waitingCalls.length > callConfigsGlobal.screenMaxDisplayPatients) {
waitings = waitingCalls.sublist(0, callConfigsGlobal.screenMaxDisplayPatients);
} else {
waitings = waitingCalls;
}
isQueuePatients = isQueuePatientsCalls;
// currents = currentInClinic;
});
log("--------------------");
log("waiting: $waitings");
log("isQueuePatients: $isQueuePatients");
log("--------------------");
updateTickets();
}, onFailure: (error) {});
}
onUpdateAvailable(data) async {
// if (isQueuePatients.isNotEmpty && callFlag == 0) {
// callFlag = 1;
// return;
// }
if (waitings.isNotEmpty) {
print("isCallingInProgress: ${isCallingInProgress}");
print("voiceCaller: ${voiceCaller == null}");
if ((waitings.first.isToneReq && isCallingInProgress) || (waitings.first.isVoiceReq && voiceCaller != null)) {
// if (true) {
print("I will wait now for ${callConfigsGlobal.concurrentCallDelaySec} seconds");
Timer(Duration(seconds: callConfigsGlobal.concurrentCallDelaySec), () async {
await callPatientsAPI();
});
} else {
await callPatientsAPI();
}
} else {
await callPatientsAPI();
}
}
updateTickets() {
if (waitings != null && waitings.isNotEmpty) {
List<Tickets> _ticketsToUpdate = waitings.where((t) => t.callUpdated == false).toList();
API.callUpdateNotIsQueueRecordByIDAsync(deviceIPGlobal, ticket: _ticketsToUpdate.first, onSuccess: (ticketsUpdated) {
log("[${ticketsUpdated.length}] Tickets Updated: $ticketsUpdated");
}, onFailure: (e) {
log("API UPDate Tickets Failed with : ${e.toString()}");
});
}
}
onConnect() {
log("SignalR: onConnect");
}
onDisconnect(exception) {
log("SignalR: onDisconnect");
signalRHelper.startSignalRConnection(deviceIPGlobal, onUpdateAvailable: onUpdateAvailable, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect);
}
onConnecting() {
log("SignalR: onConnecting");
}
listenNetworkConnectivity() async {
Connectivity().onConnectivityChanged.listen((event) async {
switch (event) {
case ConnectivityResult.wifi:
await getCurrentIP();
signalRHelper.connection.start();
break;
case ConnectivityResult.none:
signalRHelper.closeConnection(context);
break;
case ConnectivityResult.mobile:
break;
}
});
}
}
// if (isQueuePatients.length > 1) {
// Timer(Duration(milliseconds: int.parse(waitings.first.queueDuration)), () {
// Tickets calledTicket = Tickets();
// if (isQueuePatients.isNotEmpty) {
// calledTicket = isQueuePatients.elementAt(0);
// isQueuePatients.removeAt(0);
// }
// if (waitings.isNotEmpty) {
// // Tickets ticket = waitings.elementAt(0);
// // waitings.removeAt(0);
// // waitings.add(ticket);
// }
// if (isQueuePatients.isNotEmpty) {
// // setState(() {});
// }
// });
// }

@ -1,98 +0,0 @@
import 'package:flutter/material.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/home/priority_calls.dart';
import 'package:queuing_system/utils/call_type.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
Widget noPatientInQueue() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: AppText("Awaiting Patients Arrival", fontFamily: 'Poppins-SemiBold.ttf', fontSize: SizeConfig.getWidthMultiplier() * 9),
),
],
);
}
Widget priorityTickets(List<Tickets> tickets, CallConfig callConfig) {
return PriorityTickets(tickets, callConfig);
}
Widget priorityTicketsWithSideList(List<Tickets> tickets, CallConfig callConfig) {
final priorityTickets = tickets.sublist(0, 3);
final otherTickets = tickets.sublist(3, tickets.length);
return Row(
children: [
Expanded(flex: 7, child: PriorityTickets(priorityTickets, callConfig)),
Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 50)),
Expanded(
flex: 5,
child: ListView.builder(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 50),
itemCount: otherTickets.length,
itemBuilder: (ctx, idx) {
final itm = otherTickets[idx];
return Padding(
padding: const EdgeInsets.all(8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: SizeConfig.getWidthMultiplier() * 19,
child: AppText(
itm.queueNo.toString(),
letterSpacing: -2,
fontWeight: FontWeight.bold,
fontSize: SizeConfig.getWidthMultiplier() * 4,
textAlign: TextAlign.center,
),
),
const SizedBox(width: 5),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
width: SizeConfig.getWidthMultiplier() * 3,
child: itm.getCallType().icon(SizeConfig.getHeightMultiplier() * 2.5),
),
const SizedBox(width: 10),
SizedBox(
width: SizeConfig.getWidthMultiplier() * 28,
child: AppText(
itm.getCallType().message(callConfig),
color: itm.getCallType().color(),
letterSpacing: -1.5,
fontSize: SizeConfig.getWidthMultiplier() * 3,
fontWeight: FontWeight.w600,
fontHeight: 0.5,
),
),
Container(
color: Colors.grey.withOpacity(0.3),
width: 6,
height: SizeConfig.getHeightMultiplier() * 3,
margin: const EdgeInsets.symmetric(horizontal: 10),
),
AppText(
"Room: ${itm.roomNo}",
color: itm.getCallType().color(),
letterSpacing: -1.5,
fontSize: SizeConfig.getWidthMultiplier() * 3.3,
fontWeight: FontWeight.w600,
fontHeight: 0.5,
),
],
)
],
),
);
},
),
)
],
);
}

@ -1,8 +1,8 @@
import 'package:blinking_text/blinking_text.dart';
import 'package:flutter/material.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_models/call_config.dart';
import 'package:queuing_system/core/response_models/patient_call.dart';
import 'package:queuing_system/utils/call_type.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
@ -10,7 +10,7 @@ class PriorityTickets extends StatelessWidget {
final List<Tickets> tickets;
final CallConfig callConfig;
const PriorityTickets(this.tickets, this.callConfig, {Key key}) : super(key: key);
const PriorityTickets({required this.tickets, required this.callConfig, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -66,13 +66,13 @@ class TicketItem extends StatelessWidget {
final CallConfig callConfig;
const TicketItem({
Key key,
@required this.isClinicAdded,
@required this.ticketNo,
@required this.roomNo,
@required this.callType,
@required this.callConfig,
this.scale,
Key? key,
required this.isClinicAdded,
required this.ticketNo,
required this.roomNo,
required this.callType,
required this.callConfig,
required this.scale,
this.blink = false,
}) : super(key: key);
@ -139,3 +139,90 @@ class TicketItem extends StatelessWidget {
);
}
}
Widget noPatientInQueue() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: AppText("Awaiting Patients Arrival", fontFamily: 'Poppins-SemiBold.ttf', fontSize: SizeConfig.getWidthMultiplier() * 9),
),
],
);
}
Widget priorityTicketsWithSideList({required List<Tickets> tickets, required CallConfig callConfig}) {
final priorityTickets = tickets.sublist(0, 3);
final otherTickets = tickets.sublist(3, tickets.length);
return Row(
children: [
Expanded(flex: 7, child: PriorityTickets(callConfig: callConfig, tickets: priorityTickets)),
Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 50)),
Expanded(
flex: 5,
child: ListView.builder(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 50),
itemCount: otherTickets.length,
itemBuilder: (ctx, idx) {
final itm = otherTickets[idx];
return Padding(
padding: const EdgeInsets.all(8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: SizeConfig.getWidthMultiplier() * 19,
child: AppText(
itm.queueNo.toString(),
letterSpacing: -2,
fontWeight: FontWeight.bold,
fontSize: SizeConfig.getWidthMultiplier() * 4,
textAlign: TextAlign.center,
),
),
const SizedBox(width: 5),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
width: SizeConfig.getWidthMultiplier() * 3,
child: itm.getCallType().icon(SizeConfig.getHeightMultiplier() * 2.5),
),
const SizedBox(width: 10),
SizedBox(
width: SizeConfig.getWidthMultiplier() * 28,
child: AppText(
itm.getCallType().message(callConfig),
color: itm.getCallType().color(),
letterSpacing: -1.5,
fontSize: SizeConfig.getWidthMultiplier() * 3,
fontWeight: FontWeight.w600,
fontHeight: 0.5,
),
),
Container(
color: Colors.grey.withOpacity(0.3),
width: 6,
height: SizeConfig.getHeightMultiplier() * 3,
margin: const EdgeInsets.symmetric(horizontal: 10),
),
AppText(
"Room: ${itm.roomNo}",
color: itm.getCallType().color(),
letterSpacing: -1.5,
fontSize: SizeConfig.getWidthMultiplier() * 3.3,
fontWeight: FontWeight.w600,
fontHeight: 0.5,
),
],
)
],
),
);
},
),
)
],
);
}

@ -1,27 +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 QueItemList extends StatelessWidget {
// const QueItemList({Key key}) : super(key: key);
//
// @override
// Widget build(BuildContext context) {
// return SizedBox(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// 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: 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: true, haveListOfPatient: false,),
// const TicketItem(queNo: "OBG-T45", isInListLine: true, isNurseVisit: false, haveListOfPatient: false,),
//
// ],),
// );
// }
// }

@ -3,14 +3,14 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:queuing_system/core/api.dart';
import 'package:queuing_system/home/app_provider.dart';
import 'package:wakelock/wakelock.dart';
import 'core/base/project_view_model.dart';
import 'core/config/size_config.dart';
import 'home/home_screen.dart';
// import 'home/home_screen_bkp.dart';
void main() {
//TODO: WE HAVE TO UPDATE THIS BEFORE GOING LIVE.
HttpOverrides.global = MyHttpOverrides();
WidgetsFlutterBinding.ensureInitialized();
@ -23,7 +23,7 @@ void main() {
//TODO: WE NEED TO IMPLEMENT THE AVAILABILITY MONITORING OF THE SCREENS LIKE IF THEY ARE TURNED ON OR NOT!!
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
@ -33,28 +33,23 @@ class MyApp extends StatelessWidget {
return OrientationBuilder(builder: (context, orientation) {
SizeConfig().init(constraints, orientation);
return MultiProvider(
providers: [
ChangeNotifierProvider<ProjectViewModel>(
create: (context) => ProjectViewModel(),
),
],
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(
showSemanticsDebugger: false,
title: 'Doctors App',
theme: ThemeData(
primaryColor: Colors.grey,
fontFamily: 'Poppins',
dividerColor: Colors.grey[350], colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.grey).copyWith(background: const Color.fromRGBO(255, 255, 255, 1)),
),
home:const MyHomePage() ,
debugShowCheckedModeBanner: false,
)),
);
providers: [
ChangeNotifierProvider<AppProvider>(create: (context) => AppProvider()),
],
child: MaterialApp(
showSemanticsDebugger: false,
title: 'Doctors App',
theme: ThemeData(
primaryColor: Colors.grey,
fontFamily: 'Poppins',
dividerColor: Colors.grey[350],
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.grey).copyWith(background: const Color.fromRGBO(255, 255, 255, 1)),
),
home: const MyHomePage(),
debugShowCheckedModeBanner: false,
));
});
},
);
}
}

@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'dart:developer';
import 'package:flutter_tts/flutter_tts.dart';
class CallByVoice {
@ -7,7 +8,7 @@ class CallByVoice {
final String ticketNo;
final String postVoice;
CallByVoice({this.lang = 'en', @required this.ticketNo, @required this.preVoice, @required this.postVoice});
CallByVoice({this.lang = 'en', required this.ticketNo, required this.preVoice, required this.postVoice});
final FlutterTts textToSpeech = FlutterTts();
@ -16,10 +17,9 @@ class CallByVoice {
double rate = 0.2;
startCalling(bool isClinicNameAdded) async {
// print("langs: ${(await textToSpeech.setEngine("com.google.android.tts"))}");
print("langs: ${(await textToSpeech.getVoices).toString()}");
print("langs: ${(await textToSpeech.getLanguages).toString()}");
print("langs: ${(await textToSpeech.getEngines).toString()}");
log("langs: ${(await textToSpeech.getVoices).toString()}");
log("langs: ${(await textToSpeech.getLanguages).toString()}");
log("langs: ${(await textToSpeech.getEngines).toString()}");
String clinicName = "";
String patientAlpha = "";

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.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_models/call_config.dart';
enum CallType { vitalSign, doctor, procedure, vaccination, nebulization, none }
@ -43,9 +43,7 @@ extension XCallType on CallType {
}
}
SvgPicture icon(
double height,
) {
SvgPicture icon(double height) {
if (this == CallType.vitalSign) {
return SvgPicture.asset("assets/images/nurseicon.svg", height: height, color: color());
} else if (this == CallType.doctor) {

@ -1,3 +1,4 @@
import 'dart:developer';
import 'dart:io';
import 'package:flutter/material.dart';
@ -23,13 +24,11 @@ class SignalRHelper {
// String hubBaseURL = "https://vcallapi.hmg.com/PatientCallingHub?IPAddress=10.10.14.20";
// "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273";
String msg = "Awaiting Patients Arrival";
HubConnection connection;
HubConnection? connection;
startSignalRConnection(String deviceIp,
{@required Function(dynamic) onUpdateAvailable, @required VoidCallback onConnect, @required Function(dynamic) onDisconnect, @required VoidCallback onConnecting}) async {
// Hardcoded IP For Testing
// deviceIp = "10.10.14.11";
print("Connecting Signal R with: $deviceIp");
{required Function(dynamic) onUpdateAvailable, required VoidCallback onConnect, required Function(dynamic) onDisconnect, required VoidCallback onConnecting}) async {
log("Connecting Signal R with: $deviceIp");
final url = hubBaseURL + "?IPAddress=$deviceIp";
// final url = hubBaseURL;
@ -39,47 +38,41 @@ class SignalRHelper {
HttpConnectionOptions(
client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true),
transport: HttpTransportType.serverSentEvents,
logging: (level, message) => {
print(message),
},
logging: (level, message) => log(message),
))
.build();
connection.onclose(onDisconnect);
connection.onreconnecting((exception) => onConnecting());
connection.onreconnected((connectionId) => onConnect());
connection!.onclose(onDisconnect);
connection!.onreconnecting((exception) => onConnecting());
connection!.onreconnected((connectionId) => onConnect());
connection.on('addChatMessage', (message) {
onUpdateAvailable(message);
});
connection!.on('addChatMessage', (message) => onUpdateAvailable(message));
// try {
await connection.start();
// } catch (e, s) {
// print("Here the error: ${e.toString()}");
// }
await connection!.start();
}
void sendMessage(List<dynamic> args) async {
await connection.invoke('SendMessage', args: args); //['Bob', 'Says hi!']
await connection!.invoke('SendMessage', args: args); //['Bob', 'Says hi!']
}
bool getConnectionState() {
if (connection == null) return false;
if (connection.state == HubConnectionState.connected || connection.state == HubConnectionState.connecting) return true;
if (connection.state == HubConnectionState.disconnected || connection.state == HubConnectionState.disconnecting) return false;
log("connectionState: ${connection!.state}");
if (connection!.state == HubConnectionState.connected || connection!.state == HubConnectionState.connecting) return true;
if (connection!.state == HubConnectionState.disconnected || connection!.state == HubConnectionState.disconnecting) return false;
return false;
}
closeConnection(BuildContext context) async {
if (connection.state == HubConnectionState.connected || connection.state == HubConnectionState.connecting) {
await connection.stop();
closeConnection() async {
if (connection!.state == HubConnectionState.connected || connection!.state == HubConnectionState.connecting) {
await connection!.stop();
}
}
startConnection(BuildContext context) async {
if (connection.state == HubConnectionState.connected || connection.state == HubConnectionState.connecting) {
connection.off('addChatMessage');
await connection.start();
if (connection!.state == HubConnectionState.connected || connection!.state == HubConnectionState.connecting) {
connection!.off('addChatMessage');
await connection!.start();
}
}
}

@ -1,30 +1,11 @@
import 'package:connectivity/connectivity.dart';
import 'package:queuing_system/core/base/locater.dart';
import 'package:queuing_system/core/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Utils {
static TextStyle textStyle(context) =>
TextStyle(color: Theme.of(context).primaryColor);
static Future<bool> checkConnection() async {
ConnectivityResult connectivityResult =
await (Connectivity().checkConnectivity());
if ((connectivityResult == ConnectivityResult.mobile) ||
(connectivityResult == ConnectivityResult.wifi)) {
return true;
} else {
return false;
}
static getHeight() {
return SizeConfig.getHeightMultiplier() * 7;
}
static generateContactAdminMsg([err = null]) {
//TODO: Add translation
String localMsg = 'Something wrong happened, please contact the admin';
@ -34,150 +15,151 @@ class Utils {
return localMsg;
}
static getCardBoxDecoration() {
return BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
shape: BoxShape.rectangle,
boxShadow: [
BoxShadow(
color: Color(0xFF0000000D),
spreadRadius: 10,
blurRadius: 27,
offset: Offset(0, -3), // changes position of shadow
),
],
);
}
navigateToUpdatePage(String message, String androidLink, iosLink) {
// locator<NavigationService>().pushAndRemoveUntil(
// FadePage(
// page: UpdatePage(
// message: message,
// androidLink: androidLink,
// iosLink: iosLink,
// ),
// ),
// );
// Navigator.pushAndRemoveUntil(
// AppGlobal.CONTEX,
// FadePage(
// page: UpdatePage(
// message: message,
// androidLink: androidLink,
// iosLink: iosLink,
// ),
// ),
// (r) => false);
}
static InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon, Color dropDownColor}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.arrow_drop_down,
color: dropDownColor != null ? dropDownColor : Colors.black,
)
: null,
hintStyle: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
),
);
}
static BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor,
{double borderWidth = -1}) {
return BoxDecoration(
color: containerColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
border: Border.fromBorderSide(BorderSide(
color: borderColor,
width: borderWidth == -1 ? 2.0 : borderWidth,
)),
);
}
/// hides the keyboard if its already open
static hideKeyboard(BuildContext context) {
FocusScope.of(context).unfocus();
}
static String capitalize(str) {
if (str != "") {
return "${str[0].toUpperCase()}${str.substring(1).toLowerCase()}";
static Future<bool> checkConnection() async {
ConnectivityResult connectivityResult = await (Connectivity().checkConnectivity());
if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) {
return true;
} else {
return str;
}
}
static bool isTextHtml(String text) {
var htmlRegex = RegExp("<(“[^”]*”|'[^]*|[^'”>])*>");
return htmlRegex.hasMatch(text);
}
static String timeFrom({Duration duration}) {
String twoDigits(int n) => n.toString().padLeft(2, "0");
String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60));
String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
return "$twoDigitMinutes:$twoDigitSeconds";
}
static String convertToTitleCase(String text) {
if (text == null) {
return null;
}
if (text.length <= 1) {
return text.toUpperCase();
return false;
}
// Split string into multiple words
final List<String> words = text.split(' ');
// Capitalize first letter of each words
final capitalizedWords = words.map((word) {
if (word.trim().isNotEmpty) {
final String firstLetter = word.trim().substring(0, 1).toUpperCase();
final String remainingLetters = word.trim().substring(1).toLowerCase();
return '$firstLetter$remainingLetters';
}
return '';
});
// Join/Merge all words back to one String
return capitalizedWords.join(' ');
}
static getHeight() {
return SizeConfig.getHeightMultiplier()*7;
}
// static TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor);
//
//
//
// static getCardBoxDecoration() {
// return BoxDecoration(
// borderRadius: BorderRadius.circular(10),
// color: Colors.white,
// shape: BoxShape.rectangle,
// boxShadow: [
// BoxShadow(
// color: Color(0xFF0000000D),
// spreadRadius: 10,
// blurRadius: 27,
// offset: Offset(0, -3), // changes position of shadow
// ),
// ],
// );
// }
//
// navigateToUpdatePage(String message, String androidLink, iosLink) {
// // locator<NavigationService>().pushAndRemoveUntil(
// // FadePage(
// // page: UpdatePage(
// // message: message,
// // androidLink: androidLink,
// // iosLink: iosLink,
// // ),
// // ),
// // );
//
// // Navigator.pushAndRemoveUntil(
// // AppGlobal.CONTEX,
// // FadePage(
// // page: UpdatePage(
// // message: message,
// // androidLink: androidLink,
// // iosLink: iosLink,
// // ),
// // ),
// // (r) => false);
// }
//
// static InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon suffixIcon, Color dropDownColor}) {
// return InputDecoration(
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
// borderRadius: BorderRadius.circular(8),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
// borderRadius: BorderRadius.circular(8),
// ),
// disabledBorder: OutlineInputBorder(
// borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
// borderRadius: BorderRadius.circular(8),
// ),
// hintText: selectedText != null ? selectedText : hintText,
// suffixIcon: isDropDown
// ? suffixIcon != null
// ? suffixIcon
// : Icon(
// Icons.arrow_drop_down,
// color: dropDownColor != null ? dropDownColor : Colors.black,
// )
// : null,
// hintStyle: TextStyle(
// fontSize: 14,
// color: Colors.grey.shade600,
// ),
// );
// }
//
// static BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor, {double borderWidth = -1}) {
// return BoxDecoration(
// color: containerColor,
// shape: BoxShape.rectangle,
// borderRadius: BorderRadius.all(Radius.circular(8)),
// border: Border.fromBorderSide(BorderSide(
// color: borderColor,
// width: borderWidth == -1 ? 2.0 : borderWidth,
// )),
// );
// }
//
// /// hides the keyboard if its already open
// static hideKeyboard(BuildContext context) {
// FocusScope.of(context).unfocus();
// }
//
// static String capitalize(str) {
// if (str != "") {
// return "${str[0].toUpperCase()}${str.substring(1).toLowerCase()}";
// } else {
// return str;
// }
// }
//
// static bool isTextHtml(String text) {
// var htmlRegex = RegExp("<(“[^”]*”|'[^]*|[^'”>])*>");
// return htmlRegex.hasMatch(text);
// }
//
// static String timeFrom({Duration duration}) {
// String twoDigits(int n) => n.toString().padLeft(2, "0");
// String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60));
// String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
// return "$twoDigitMinutes:$twoDigitSeconds";
// }
//
// static String convertToTitleCase(String text) {
// if (text == null) {
// return null;
// }
//
// if (text.length <= 1) {
// return text.toUpperCase();
// }
//
// // Split string into multiple words
// final List<String> words = text.split(' ');
//
// // Capitalize first letter of each words
// final capitalizedWords = words.map((word) {
// if (word.trim().isNotEmpty) {
// final String firstLetter = word.trim().substring(0, 1).toUpperCase();
// final String remainingLetters = word.trim().substring(1).toLowerCase();
//
// return '$firstLetter$remainingLetters';
// }
// return '';
// });
//
// // Join/Merge all words back to one String
// return capitalizedWords.join(' ');
// }
//
}

@ -1,32 +1,32 @@
import 'package:flutter/material.dart';
import 'package:queuing_system/widget/loader/gif_loader_container.dart';
class AppLoaderWidget extends StatefulWidget {
AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key);
final String title;
final Color containerColor;
@override
_AppLoaderWidgetState createState() => _AppLoaderWidgetState();
}
class _AppLoaderWidgetState extends State<AppLoaderWidget> {
@override
Widget build(BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height,
child: Stack(
children: [
Container(
color: widget.containerColor ?? Colors.grey.withOpacity(0.6),
),
Container(
child: GifLoaderContainer(),
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).size.height * 0.09))
],
),
);
}
}
// import 'package:flutter/material.dart';
// import 'package:queuing_system/widget/loader/gif_loader_container.dart';
//
// class AppLoaderWidget extends StatefulWidget {
// AppLoaderWidget({Key? key, this.title, this.containerColor}) : super(key: key);
//
// final String title;
// final Color containerColor;
//
// @override
// _AppLoaderWidgetState createState() => _AppLoaderWidgetState();
// }
//
// class _AppLoaderWidgetState extends State<AppLoaderWidget> {
// @override
// Widget build(BuildContext context) {
// return SizedBox(
// height: MediaQuery.of(context).size.height,
// child: Stack(
// children: [
// Container(
// color: widget.containerColor ?? Colors.grey.withOpacity(0.6),
// ),
// Container(
// child: GifLoaderContainer(),
// margin: EdgeInsets.only(
// bottom: MediaQuery.of(context).size.height * 0.09))
// ],
// ),
// );
// }
// }

@ -3,35 +3,36 @@ import 'package:queuing_system/core/config/size_config.dart';
class AppText extends StatefulWidget {
final String text;
final String variant;
final String? variant;
final Color color;
final FontWeight fontWeight;
final double fontSize;
final double fontHeight;
final FontWeight? fontWeight;
final double? fontSize;
final double? fontHeight;
final String fontFamily;
final int maxLength;
final bool italic;
final double margin;
final double? margin;
final double marginTop;
final double marginRight;
final double marginBottom;
final double marginLeft;
final double letterSpacing;
final TextAlign textAlign;
final bool bold;
final bool regular;
final bool medium;
final int maxLines;
final double? letterSpacing;
final TextAlign? textAlign;
final bool? bold;
final bool? regular;
final bool? medium;
final int? maxLines;
final bool readMore;
final String style;
final String? style;
final bool allowExpand;
final bool visibility;
final TextOverflow textOverflow;
final TextDecoration textDecoration;
final TextOverflow? textOverflow;
final TextDecoration? textDecoration;
final bool isCopyable;
const AppText(
this.text, {Key key,
this.text, {
Key? key,
this.color = Colors.black,
this.fontWeight,
this.variant,
@ -95,13 +96,7 @@ class _AppTextState extends State<AppText> {
Widget build(BuildContext context) {
return GestureDetector(
child: Container(
margin: widget.margin != null
? EdgeInsets.all(widget.margin)
: EdgeInsets.only(
top: widget.marginTop,
right: widget.marginRight,
bottom: widget.marginBottom,
left: widget.marginLeft),
margin: widget.margin != null ? EdgeInsets.all(widget.margin!) : EdgeInsets.only(top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
@ -116,21 +111,16 @@ class _AppTextState extends State<AppText> {
right: 0,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context).backgroundColor,
Theme.of(context).backgroundColor.withOpacity(0),
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter)),
gradient: LinearGradient(colors: [
Theme.of(context).colorScheme.background,
Theme.of(context).colorScheme.background.withOpacity(0),
], begin: Alignment.bottomCenter, end: Alignment.topCenter)),
height: 30,
),
)
],
),
if (widget.allowExpand &&
widget.readMore &&
text.length > widget.maxLength)
if (widget.allowExpand && widget.readMore && text.length > widget.maxLength)
Padding(
padding: const EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0),
child: InkWell(
@ -140,7 +130,7 @@ class _AppTextState extends State<AppText> {
});
},
child: Text(hidden ? "Read More" : "Read less",
style: _getFontStyle().copyWith(
style: _getFontStyle()?.copyWith(
color: Colors.white,
fontWeight: FontWeight.w800,
fontFamily: "Poppins",
@ -160,13 +150,7 @@ class _AppTextState extends State<AppText> {
textSelectionTheme: const TextSelectionThemeData(selectionColor: Colors.lightBlueAccent),
),
child: SelectableText(
!hidden
? text
: (text.substring(
0,
text.length > widget.maxLength
? widget.maxLength
: text.length)),
!hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)),
textAlign: widget.textAlign,
// overflow: widget.maxLines != null
// ? ((widget.maxLines > 1)
@ -175,18 +159,12 @@ class _AppTextState extends State<AppText> {
// : null,
maxLines: widget.maxLines,
style: widget.style != null
? _getFontStyle().copyWith(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color,
fontWeight: widget.fontWeight ?? _getFontWeight(),
height: widget.fontHeight)
? _getFontStyle()?.copyWith(fontStyle: widget.italic ? FontStyle.italic : null, color: widget.color, fontWeight: widget.fontWeight ?? _getFontWeight(), height: widget.fontHeight)
: TextStyle(
fontStyle: widget.italic ? FontStyle.italic : null,
color:
widget.color ?? const Color(0xff000000),
color: widget.color ?? const Color(0xff000000),
fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing: widget.letterSpacing ??
(widget.variant == "overline" ? 1.5 : null),
letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null),
fontWeight: widget.fontWeight ?? _getFontWeight(),
fontFamily: widget.fontFamily ?? 'Poppins',
decoration: widget.textDecoration,
@ -195,32 +173,22 @@ class _AppTextState extends State<AppText> {
);
} else {
return Text(
!hidden
? text
: (text.substring(
0,
text.length > widget.maxLength
? widget.maxLength
: text.length)),
!hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)),
textAlign: widget.textAlign,
overflow: widget.maxLines != null
? ((widget.maxLines > 1)
? TextOverflow.fade
: TextOverflow.ellipsis)
: null,
overflow: widget.maxLines != null ? ((widget.maxLines! > 1) ? TextOverflow.fade : TextOverflow.ellipsis) : null,
maxLines: widget.maxLines,
style: widget.style != null
? _getFontStyle().copyWith(
? _getFontStyle()?.copyWith(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color,
fontWeight: widget.fontWeight ?? _getFontWeight(),
height: widget.fontHeight)
height: widget.fontHeight,
)
: TextStyle(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color ?? Colors.black,
fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing: widget.letterSpacing ??
(widget.variant == "overline" ? 1.5 : null),
letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null),
fontWeight: widget.fontWeight ?? _getFontWeight(),
fontFamily: widget.fontFamily ?? 'Poppins',
decoration: widget.textDecoration,
@ -229,30 +197,30 @@ class _AppTextState extends State<AppText> {
}
}
TextStyle _getFontStyle() {
TextStyle? _getFontStyle() {
switch (widget.style) {
case "headline2":
return Theme.of(context).textTheme.headline2;
return Theme.of(context).textTheme.displayMedium;
case "headline3":
return Theme.of(context).textTheme.headline3;
return Theme.of(context).textTheme.displaySmall;
case "headline4":
return Theme.of(context).textTheme.headline4;
return Theme.of(context).textTheme.headlineMedium;
case "headline5":
return Theme.of(context).textTheme.headline5;
return Theme.of(context).textTheme.headlineSmall;
case "headline6":
return Theme.of(context).textTheme.headline6;
return Theme.of(context).textTheme.titleLarge;
case "bodyText2":
return Theme.of(context).textTheme.bodyText2;
return Theme.of(context).textTheme.bodyMedium;
case "bodyText_15":
return Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 15.0);
return Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 15.0);
case "bodyText1":
return Theme.of(context).textTheme.bodyText1;
return Theme.of(context).textTheme.bodyLarge;
case "caption":
return Theme.of(context).textTheme.caption;
return Theme.of(context).textTheme.bodySmall;
case "overline":
return Theme.of(context).textTheme.overline;
return Theme.of(context).textTheme.labelSmall;
case "button":
return Theme.of(context).textTheme.button;
return Theme.of(context).textTheme.labelLarge;
default:
return const TextStyle();
}
@ -291,11 +259,11 @@ class _AppTextState extends State<AppText> {
case "date":
return 24.0;
default:
return SizeConfig.textMultiplier * 2.8;
return SizeConfig.textMultiplier! * 2.8;
}
}
FontWeight _getFontWeight() {
FontWeight? _getFontWeight() {
if (widget.bold ?? false) {
return FontWeight.w900;
} else if (widget.regular ?? false) {

@ -1,43 +1,36 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
class ErrorMessage extends StatelessWidget {
const ErrorMessage({
Key key,
@required this.error,
}) : super(key: key);
final String error;
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 100,
),
SvgPicture.asset('assets/images/svgs/no data.svg'),
Center(
child: Center(
child: Padding(
padding: const EdgeInsets.only(
top: 12, bottom: 12, right: 20, left: 30),
child: Center(
child: AppText(
error ?? '',
textAlign: TextAlign.center,
)),
),
),
)
],
),
),
);
}
}
// import 'package:flutter/material.dart';
// import 'package:flutter_svg/flutter_svg.dart';
// import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
//
// class ErrorMessage extends StatelessWidget {
// const ErrorMessage({Key? key, this.error = ''}) : super(key: key);
//
// final String error;
//
// @override
// Widget build(BuildContext context) {
// return SingleChildScrollView(
// child: Center(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// const SizedBox(height: 100),
// SvgPicture.asset('assets/images/svgs/no data.svg'),
// Center(
// child: Center(
// child: Padding(
// padding: const EdgeInsets.only(top: 12, bottom: 12, right: 20, left: 30),
// child: Center(
// child: AppText(
// error ?? '',
// textAlign: TextAlign.center,
// )),
// ),
// ),
// )
// ],
// ),
// ),
// );
// }
// }

@ -1,43 +1,43 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_gifimage/flutter_gifimage.dart';
class GifLoaderContainer extends StatefulWidget {
@override
_GifLoaderContainerState createState() => _GifLoaderContainerState();
}
class _GifLoaderContainerState extends State<GifLoaderContainer>
with TickerProviderStateMixin {
GifController controller1;
@override
void initState() {
controller1 = GifController(vsync: this);
WidgetsBinding.instance.addPostFrameCallback((_) {
controller1.repeat(
min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true);
});
super.initState();
}
@override
void dispose() {
controller1.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Center(
//progress-loading.gif
child: Container(
// margin: EdgeInsets.only(bottom: 40),
child: GifImage(
controller: controller1,
image: AssetImage(
"assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"),
),
));
}
}
// import 'package:flutter/cupertino.dart';
// import 'package:flutter_gifimage/flutter_gifimage.dart';
//
// class GifLoaderContainer extends StatefulWidget {
// @override
// _GifLoaderContainerState createState() => _GifLoaderContainerState();
// }
//
// class _GifLoaderContainerState extends State<GifLoaderContainer>
// with TickerProviderStateMixin {
// GifController controller1;
//
// @override
// void initState() {
// controller1 = GifController(vsync: this);
//
// WidgetsBinding.instance.addPostFrameCallback((_) {
// controller1.repeat(
// min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true);
// });
// super.initState();
// }
//
// @override
// void dispose() {
// controller1.dispose();
// super.dispose();
// }
//
// @override
// Widget build(BuildContext context) {
// return Center(
// //progress-loading.gif
// child: Container(
// // margin: EdgeInsets.only(bottom: 40),
// child: GifImage(
// controller: controller1,
// image: AssetImage(
// "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"),
// ),
// ));
// }
// }

@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'gif_loader_container.dart';
class GifLoaderDialogUtils {
static showMyDialog(BuildContext context) {
showDialog(context: context, builder: (ctx) => GifLoaderContainer());
}
static hideDialog(BuildContext context) {
if (Navigator.canPop(context)) Navigator.of(context).pop();
}
}
// import 'package:flutter/material.dart';
// import 'gif_loader_container.dart';
// class GifLoaderDialogUtils {
// static showMyDialog(BuildContext context) {
// showDialog(context: context, builder: (ctx) => GifLoaderContainer());
// }
//
// static hideDialog(BuildContext context) {
// if (Navigator.canPop(context)) Navigator.of(context).pop();
// }
// }

@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: audio_session
sha256: e4acc4e9eaa32436dfc5d7aed7f0a370f2d7bb27ee27de30d6c4f220c2a05c73
sha256: "8a2bc5e30520e18f3fb0e366793d78057fb64cd5287862c76af0c8771f2a52ad"
url: "https://pub.dev"
source: hosted
version: "0.1.13"
version: "0.1.16"
blinking_text:
dependency: "direct main"
description:
@ -41,14 +41,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
url: "https://pub.dev"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
@ -101,18 +93,18 @@ packages:
dependency: transitive
description:
name: crypto
sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.3"
equatable:
dependency: transitive
description:
name: equatable
sha256: c6094fd1efad3046334a9c40bee022147e55c25401ccd89b94e373e3edadd375
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
url: "https://pub.dev"
source: hosted
version: "2.0.3"
version: "2.0.5"
fake_async:
dependency: transitive
description:
@ -125,18 +117,10 @@ packages:
dependency: transitive
description:
name: ffi
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978
url: "https://pub.dev"
source: hosted
version: "2.0.1"
file:
dependency: transitive
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
url: "https://pub.dev"
source: hosted
version: "6.1.4"
version: "2.0.2"
flutter:
dependency: "direct main"
description: flutter
@ -162,10 +146,10 @@ packages:
dependency: "direct main"
description:
name: flutter_svg
sha256: c9bb2757b8a0bbf8e45f4069a90d2b9dbafc80b1a5e28d43e29088be533e6df4
sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2"
url: "https://pub.dev"
source: hosted
version: "1.0.3"
version: "1.1.6"
flutter_test:
dependency: "direct dev"
description: flutter
@ -175,10 +159,10 @@ packages:
dependency: "direct main"
description:
name: flutter_tts
sha256: e91ad17793ad12cca9c3066accf99ceb353bf0355ad06b767176f178b5c428f6
sha256: "23d47e1335c632228b80d9693e2494a834393fff5893b66e8ae494dcce4e9867"
url: "https://pub.dev"
source: hosted
version: "3.6.3"
version: "3.8.3"
flutter_web_plugins:
dependency: transitive
description: flutter
@ -188,26 +172,26 @@ packages:
dependency: "direct main"
description:
name: get_it
sha256: "290fde3a86072e4b37dbb03c07bec6126f0ecc28dad403c12ffe2e5a2d751ab7"
sha256: "529de303c739fca98cd7ece5fca500d8ff89649f1bb4b4e94fb20954abcd7468"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
version: "7.6.0"
http:
dependency: "direct main"
description:
name: http
sha256: "2ed163531e071c2c6b7c659635112f24cb64ecbebf6af46b550d536c0b1aa112"
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
url: "https://pub.dev"
source: hosted
version: "0.13.4"
version: "0.13.6"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "4.0.2"
js:
dependency: transitive
description:
@ -220,26 +204,26 @@ packages:
dependency: "direct main"
description:
name: just_audio
sha256: "7a5057a4d05c8f88ee968cec6fdfe1015577d5184e591d5ac15ab16d8f5ecb17"
sha256: "5ed0cd723e17dfd8cd4b0253726221e67f6546841ea4553635cf895061fc335b"
url: "https://pub.dev"
source: hosted
version: "0.9.31"
version: "0.9.35"
just_audio_platform_interface:
dependency: transitive
description:
name: just_audio_platform_interface
sha256: eff112d5138bea3ba544b6338b1e0537a32b5e1425e4d0dc38f732771cda7c84
sha256: d8409da198bbc59426cd45d4c92fca522a2ec269b576ce29459d6d6fcaeb44df
url: "https://pub.dev"
source: hosted
version: "4.2.0"
version: "4.2.1"
just_audio_web:
dependency: transitive
description:
name: just_audio_web
sha256: "89d8db6f19f3821bb6bf908c4bfb846079afb2ab575b783d781a6bf119e3abaf"
sha256: ff62f733f437b25a0ff590f0e295fa5441dcb465f1edbdb33b3dea264705bc13
url: "https://pub.dev"
source: hosted
version: "0.4.7"
version: "0.4.8"
lints:
dependency: transitive
description:
@ -252,10 +236,10 @@ packages:
dependency: transitive
description:
name: logging
sha256: "293ae2d49fd79d4c04944c3a26dfd313382d5f52e821ec57119230ae16031ad4"
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "1.2.0"
matcher:
dependency: transitive
description:
@ -300,114 +284,98 @@ packages:
dependency: transitive
description:
name: path_drawing
sha256: a19347362f85a45aadf6bdfa3c04f18ff6676c445375eecd6251f9e09b9db551
sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977
url: "https://pub.dev"
source: hosted
version: "1.0.0"
version: "1.0.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
sha256: "9508ebdf1c3ac3a68ad5fb15edab8b026382999f18f77352349e56fbd74183ac"
sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
url: "https://pub.dev"
source: hosted
version: "1.0.0"
version: "1.0.1"
path_provider:
dependency: transitive
description:
name: path_provider
sha256: "04890b994ee89bfa80bf3080bfec40d5a92c5c7a785ebb02c13084a099d2b6f9"
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
url: "https://pub.dev"
source: hosted
version: "2.0.13"
version: "2.1.1"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "019f18c9c10ae370b08dce1f3e3b73bc9f58e7f087bb5e921f06529438ac0ae7"
sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1"
url: "https://pub.dev"
source: hosted
version: "2.0.24"
version: "2.2.0"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "026b97a6c29da75181a37aae2eba9227f5fe13cb2838c6b975ce209328b8ab4e"
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.3.1"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1"
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.dev"
source: hosted
version: "2.1.10"
version: "2.2.1"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec"
sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c"
url: "https://pub.dev"
source: hosted
version: "2.0.6"
version: "2.1.1"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: f53720498d5a543f9607db4b0e997c4b5438884de25b0f73098cc2671a51b130
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.dev"
source: hosted
version: "2.1.5"
version: "2.2.1"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: "1a914995d4ef10c94ff183528c120d35ed43b5eaa8713fc6766a9be4570782e2"
sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4"
url: "https://pub.dev"
source: hosted
version: "4.4.0"
version: "5.1.0"
platform:
dependency: transitive
description:
name: platform
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.1.2"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "075f927ebbab4262ace8d0b283929ac5410c0ac4e7fc123c76429564facfb757"
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
url: "https://pub.dev"
source: hosted
version: "2.1.2"
process:
dependency: transitive
description:
name: process
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
url: "https://pub.dev"
source: hosted
version: "4.2.4"
version: "2.1.6"
provider:
dependency: "direct main"
description:
name: provider
sha256: "7896193cf752c40ba7f7732a95264319a787871e5d628225357f5c909182bc06"
sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f
url: "https://pub.dev"
source: hosted
version: "6.0.2"
quiver:
dependency: transitive
description:
name: quiver
sha256: "616b691d1c8f5c53b7b39ce3542f6a25308d7900bf689d0210e72a644a10387e"
url: "https://pub.dev"
source: hosted
version: "3.0.1+1"
version: "6.0.5"
rxdart:
dependency: transitive
description:
@ -437,6 +405,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.1"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
sse_client:
dependency: transitive
description:
@ -489,26 +465,26 @@ packages:
dependency: transitive
description:
name: tuple
sha256: fe3ae4f0dca3f9aac0888e2e0d117b642ce283a82d7017b54136290c0a3b0dd3
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "2.0.2"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee"
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.3.2"
uuid:
dependency: transitive
description:
name: uuid
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
sha256: e03928880bdbcbf496fb415573f5ab7b1ea99b9b04f669c01104d085893c3134
url: "https://pub.dev"
source: hosted
version: "3.0.7"
version: "4.0.0"
vector_math:
dependency: transitive
description:
@ -561,34 +537,34 @@ packages:
dependency: transitive
description:
name: web_socket_channel
sha256: "0c2ada1b1aeb2ad031ca81872add6be049b8cb479262c6ad3c4b0f9c24eaab2f"
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.4.0"
win32:
dependency: transitive
description:
name: win32
sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46
sha256: a6f0236dbda0f63aa9a25ad1ff9a9d8a4eaaa5012da0dc59d21afdb1dc361ca4
url: "https://pub.dev"
source: hosted
version: "3.1.3"
version: "3.1.4"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1
sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
version: "1.0.3"
xml:
dependency: transitive
description:
name: xml
sha256: baa23bcba1ba4ce4b22c0c7a1d9c861e7015cb5169512676da0b85138e72840c
sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
url: "https://pub.dev"
source: hosted
version: "5.3.1"
version: "6.2.2"
sdks:
dart: ">=2.18.0 <3.0.0"
flutter: ">=3.0.0"
dart: ">=2.19.0 <3.0.0"
flutter: ">=3.7.0"

@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 4.3.5+1
environment:
sdk: ">=2.7.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions

Loading…
Cancel
Save