Added Weather

master
FaizHashmiCS22 2 years ago
parent 3025c26d94
commit 74aefd4b05

@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m446 197.13c0-59.753-57.124-102.292-113.73-86.18-18.129-37.341-56.103-62.95-100.27-62.95-59.66 0-108.52 47.18-111.21 106.19-55.263 12.6-90.284 67.546-78.626 122.735.805 3.809 5.417 5.306 8.287 2.677 18.306-16.769 42.879-25.547 68.323-23.59 1.721.132 3.395-.651 4.39-2.061 6.488-9.189 14.399-17.397 23.417-24.181 63.659-47.887 156.005-12.625 171.578 65.186.322 1.611 1.437 2.961 2.959 3.581 25.729 10.47 46.661 31.34 56.951 57.868.743 1.917 2.592 3.175 4.648 3.175h46.389c44.913 0 82.17-35.751 82.884-80.658.648-40.766-28.296-74.373-65.99-81.792z"/><path d="m287.976 323.208c3.99-44.956-31.448-83.208-76.176-83.208-34.515 0-63.687 22.834-73.203 54.2-43.5-22.291-94.324 15.546-84.468 64.043-32.262 0-54.129 25.084-54.129 52.878 0 29.228 23.73 52.879 52.95 52.879h229.45c38.972 0 70.6-31.547 70.6-70.505 0-37.065-28.64-67.448-65.024-70.287z"/></g></svg>

After

Width:  |  Height:  |  Size: 998 B

@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m160 344.44v-280.44c0-35.29-28.71-64-64-64s-64 28.71-64 64v280.44c-20.43 18.2-32 43.85-32 71.56 0 52.93 43.07 96 96 96s96-43.07 96-96c0-27.71-11.57-53.36-32-71.56zm-103.932 73.92c-.941-16.281 7.923-30.621 21.216-37.694 1.65-.878 2.716-2.558 2.716-4.427v-47.79c0-8.618 6.626-16.03 15.235-16.431 9.188-.428 16.765 6.888 16.765 15.982v48.242c0 1.862 1.054 3.541 2.698 4.415 12.657 6.726 21.302 20.038 21.302 35.343 0 23.009-19.516 41.535-42.867 39.899-19.89-1.393-35.915-17.633-37.065-37.539z"/><path d="m496 144h-25.37l12.68-12.69c6.25-6.25 6.25-16.38 0-22.62-6.24-6.25-16.37-6.25-22.62 0l-35.32 35.31h-19.71c-2.54-8.5-7.05-16.15-13-22.44l9.88-17.1 48.24-12.93c8.54-2.29 13.6-11.06 11.32-19.6-2.29-8.53-11.06-13.6-19.6-11.31l-17.33 4.64 12.69-21.97c4.41-7.65 1.79-17.44-5.86-21.86-7.65-4.41-17.44-1.79-21.86 5.86l-12.68 21.97-4.65-17.33c-2.28-8.53-11.05-13.6-19.59-11.31s-13.6 11.06-11.32 19.6l12.93 48.23-9.86 17.08c-8.589-2.039-17.345-2.041-25.94 0l-9.86-17.08 12.93-48.23c2.28-8.54-2.78-17.31-11.32-19.6-8.53-2.29-17.31 2.78-19.59 11.32l-4.65 17.32-12.68-21.97c-4.42-7.65-14.21-10.27-21.86-5.86-7.65 4.42-10.27 14.21-5.86 21.86l12.69 21.98-17.33-4.65c-8.54-2.29-17.31 2.78-19.6 11.32-2.28 8.53 2.78 17.3 11.32 19.59l48.24 12.93 9.88 17.1c-5.95 6.29-10.46 13.94-13 22.44h-19.71l-35.32-35.31c-6.24-6.25-16.38-6.25-22.62 0-6.25 6.24-6.25 16.38 0 22.62l12.68 12.69h-25.37c-8.84 0-16 7.16-16 16s7.16 16 16 16h25.37l-12.68 12.69c-10.109 10.093-2.807 27.31 11.31 27.31 4.09 0 8.19-1.56 11.31-4.69l35.32-35.31h19.71c2.54 8.5 7.05 16.15 13 22.44l-9.88 17.1-48.24 12.93c-8.54 2.29-13.6 11.06-11.32 19.59 2.29 8.54 11.06 13.6 19.6 11.32l17.33-4.65-12.69 21.98c-6.172 10.707 1.641 24 13.85 24 5.52 0 10.9-2.87 13.87-8l12.68-21.97 4.65 17.32c1.91 7.15 8.38 11.87 15.44 11.87 10.498 0 18.189-9.967 15.47-20.15l-12.93-48.23 9.86-17.08c8.59 2.039 17.345 2.041 25.94 0l9.86 17.08-12.93 48.23c-2.719 10.184 4.972 20.15 15.47 20.15 7.06 0 13.53-4.72 15.44-11.86l4.65-17.33 12.68 21.97c2.97 5.13 8.34 8 13.87 8 12.213 0 20.021-13.296 13.85-24l-12.69-21.98 17.33 4.65c8.53 2.29 17.31-2.78 19.6-11.31 2.28-8.54-2.78-17.31-11.32-19.6l-48.24-12.93-9.88-17.1c5.95-6.29 10.46-13.94 13-22.44h19.71l35.32 35.31c3.12 3.13 7.22 4.69 11.31 4.69 14.117 0 21.419-17.217 11.31-27.31l-12.68-12.69h25.37c8.84 0 16-7.16 16-16s-7.16-16-16-16zm-144 40c-13.23 0-24-10.77-24-24s10.77-24 24-24 24 10.77 24 24-10.77 24-24 24z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m160 344.44v-280.44c0-35.29-28.71-64-64-64s-64 28.71-64 64v280.44c-20.43 18.2-32 43.85-32 71.56 0 52.93 43.07 96 96 96s96-43.07 96-96c0-27.71-11.57-53.36-32-71.56zm-103.932 73.92c-.94-16.281 7.923-30.621 21.216-37.694 1.65-.878 2.716-2.558 2.716-4.427v-199.79c0-8.618 6.626-16.03 15.235-16.431 9.188-.428 16.765 6.888 16.765 15.982v200.242c0 1.862 1.054 3.541 2.698 4.415 12.657 6.726 21.302 20.038 21.302 35.343 0 23.009-19.516 41.535-42.868 39.899-19.89-1.393-35.914-17.633-37.064-37.539z"/><circle cx="352" cy="160" r="80"/><path d="m352 53c8.836 0 16-7.164 16-16v-21c0-8.836-7.164-16-16-16s-16 7.164-16 16v21c0 8.836 7.164 16 16 16z"/><path d="m352 267c-8.836 0-16 7.164-16 16v21c0 8.836 7.164 16 16 16s16-7.164 16-16v-21c0-8.836-7.164-16-16-16z"/><path d="m245 160c0-8.836-7.164-16-16-16h-21c-8.836 0-16 7.164-16 16s7.164 16 16 16h21c8.836 0 16-7.164 16-16z"/><path d="m496 144h-21c-8.836 0-16 7.164-16 16s7.164 16 16 16h21c8.836 0 16-7.164 16-16s-7.164-16-16-16z"/><path d="m253.409 84.036c6.247 6.248 16.379 6.249 22.627 0 6.249-6.248 6.249-16.379 0-22.627l-14.546-14.546c-6.248-6.249-16.379-6.249-22.627 0-6.249 6.248-6.249 16.379 0 22.627z"/><path d="m450.591 235.964c-6.248-6.249-16.379-6.249-22.627 0-6.249 6.248-6.249 16.379 0 22.627l14.546 14.546c3.124 3.125 7.219 4.687 11.313 4.687 14.126 0 21.421-17.206 11.313-27.313z"/><path d="m253.409 235.964-14.546 14.546c-6.249 6.248-6.249 16.379 0 22.627 6.247 6.248 16.379 6.249 22.627 0l14.546-14.546c6.249-6.248 6.249-16.379 0-22.627-6.248-6.249-16.379-6.249-22.627 0z"/><path d="m439.277 88.723c4.095 0 8.189-1.562 11.313-4.687l14.546-14.546c6.249-6.248 6.249-16.379 0-22.627-6.248-6.249-16.379-6.249-22.627 0l-14.546 14.546c-10.109 10.109-2.811 27.314 11.314 27.314z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 513.003 513.003" height="512" viewBox="0 0 513.003 513.003" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m512.502 249c0-43.06-31.09-79-72.01-86.54 1.293-63.285-60.26-112.244-123.37-93.46-19.108-40.448-60.069-69-108.62-69-64.68 0-117.58 51.44-119.92 115.56-51.031 11.108-88.08 56.453-88.08 109.44 0 61.76 50.24 112 112 112h312c48.52 0 88-39.48 88-88z"/><path d="m351.657 362.689c-7.902-3.951-17.515-.749-21.466 7.156l-32 64c-5.356 10.712 2.54 23.159 14.299 23.159 5.869 0 11.52-3.242 14.323-8.848l32-64c3.951-7.904.748-17.515-7.156-21.467z"/><path d="m495.657 362.689c-7.903-3.951-17.515-.749-21.466 7.156l-32 64c-5.356 10.712 2.54 23.159 14.299 23.159 5.869 0 11.52-3.242 14.323-8.848l32-64c3.951-7.904.748-17.515-7.156-21.467z"/><path d="m207.657 362.689c-7.902-3.951-17.515-.749-21.466 7.156l-32 64c-5.356 10.712 2.54 23.159 14.299 23.159 5.869 0 11.52-3.242 14.323-8.848l32-64c3.951-7.904.748-17.515-7.156-21.467z"/><path d="m63.657 362.689c-7.902-3.951-17.515-.749-21.466 7.156l-32 64c-5.356 10.712 2.54 23.159 14.299 23.159 5.869 0 11.52-3.242 14.323-8.848l32-64c3.951-7.904.748-17.515-7.156-21.467z"/><path d="m255.657 418.689c-7.903-3.951-17.515-.748-21.466 7.156l-32 64c-5.356 10.712 2.54 23.159 14.299 23.159 5.869 0 11.52-3.242 14.323-8.848l32-64c3.951-7.904.748-17.515-7.156-21.467z"/><path d="m399.657 418.689c-7.903-3.951-17.515-.748-21.466 7.156l-32 64c-5.356 10.712 2.54 23.159 14.299 23.159 5.869 0 11.52-3.242 14.323-8.848l32-64c3.951-7.904.748-17.515-7.156-21.467z"/><path d="m111.657 418.689c-7.903-3.951-17.515-.748-21.466 7.156l-32 64c-5.356 10.712 2.54 23.159 14.299 23.159 5.869 0 11.52-3.242 14.323-8.848l32-64c3.951-7.904.748-17.515-7.156-21.467z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m287.653 244.814c36.216-4.547 71.928 10.028 94.831 38.241 1.681 2.071 4.681 2.524 6.835.951 10.375-7.581 19.307-17.052 26.311-27.985 43.648-68.101-4.822-160.021-87.63-160.021-54.036 0-98.574 41.411-103.531 94.167-.2 2.131.977 4.166 2.935 5.031 22.605 9.998 41.917 26.471 55.483 47.414 1.028 1.589 2.889 2.437 4.766 2.202z"/><path d="m328 80c8.837 0 16-7.164 16-16v-32c0-8.836-7.163-16-16-16s-16 7.164-16 16v32c0 8.836 7.163 16 16 16z"/><path d="m496 184h-32c-8.837 0-16 7.164-16 16s7.163 16 16 16h32c8.837 0 16-7.164 16-16s-7.163-16-16-16z"/><path d="m435.48 284.853c-6.247-6.248-16.378-6.248-22.627 0-6.249 6.249-6.249 16.379 0 22.627l22.627 22.627c3.124 3.125 7.218 4.687 11.313 4.687 14.128 0 21.421-17.207 11.313-27.313z"/><path d="m220.52 115.147c6.248 6.249 16.378 6.249 22.627 0s6.249-16.379 0-22.627l-22.627-22.627c-6.246-6.248-16.377-6.248-22.627 0-6.249 6.249-6.249 16.379 0 22.627z"/><path d="m424.167 119.833c4.095 0 8.189-1.562 11.313-4.687l22.627-22.627c6.249-6.249 6.249-16.379 0-22.627-6.248-6.248-16.379-6.249-22.627 0l-22.626 22.628c-10.11 10.109-2.813 27.313 11.313 27.313z"/><path d="m372.53 364c12.335-60.774-51.311-107.63-105.285-79.934-11.863-39.149-48.223-67.649-91.245-67.649-55.834 0-99.914 47.819-94.95 103.856-45.352 3.543-81.05 41.465-81.05 87.727 0 48.466 39.265 88 88 88h286c36.451 0 66-29.549 66-66 0-34.838-27.413-66-67.47-66z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m296 312h-216c-8.836 0-16 7.164-16 16s7.164 16 16 16h216c22.158 0 40 17.944 40 40 0 35.761-43.299 53.248-68.292 28.281-6.252-6.245-16.382-6.24-22.627.011s-6.24 16.382.011 22.627c13.608 13.595 31.687 21.081 50.908 21.081 39.701 0 72-32.299 72-72 0-39.806-32.225-72-72-72z"/><path d="m48 216h160c35.353 0 64-28.6 64-64 0-35.29-28.71-64-64-64-17.107 0-33.181 6.66-45.26 18.753-6.245 6.251-6.239 16.382.013 22.627 6.252 6.246 16.383 6.24 22.627-.013 6.034-6.04 14.067-9.367 22.62-9.367 28.663 0 42.576 34.699 22.62 54.633-6.034 6.04-14.067 9.367-22.62 9.367h-160c-8.836 0-16 7.164-16 16s7.164 16 16 16z"/><path d="m420.969 279.204c50.532-6.247 91.031-49.377 91.031-103.204 0-57.346-46.654-104-104-104-27.784 0-53.9 10.821-73.537 30.469-6.247 6.25-6.244 16.381.006 22.627s16.381 6.244 22.627-.006c13.593-13.6 31.671-21.09 50.904-21.09 39.701 0 72 32.299 72 72 0 39.774-32.2 72-72 72h-392c-8.836 0-16 7.164-16 16s7.164 16 16 16c428.098 0 401.176.442 404.969-.796z"/><path d="m56 128c4.095 0 8.189-1.562 11.313-4.687l11.314-11.313h17.373c39.7 0 72-32.3 72-72v-24c0-8.84-7.16-16-16-16h-24c-39.7 0-72 32.3-72 72v17.373l-11.313 11.313c-10.11 10.109-2.812 27.314 11.313 27.314z"/><path d="m132.687 388.687-11.314 11.313h-17.373c-39.7 0-72 32.3-72 72v24c0 8.84 7.16 16 16 16h24c39.7 0 72-32.3 72-72v-17.373l11.313-11.313c6.249-6.248 6.249-16.379 0-22.627-6.248-6.249-16.378-6.249-22.626 0z"/><path d="m440 336h-17.373l-11.313-11.313c-6.248-6.249-16.379-6.249-22.627 0-6.249 6.248-6.249 16.379 0 22.627l11.313 11.313v17.373c0 39.7 32.3 72 72 72h24c8.84 0 16-7.16 16-16v-24c0-39.7-32.3-72-72-72z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -5,9 +5,15 @@ import 'package:queuing_system/core/base/base_app_client.dart';
import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/core/response_models/call_config_model.dart';
import 'package:queuing_system/core/response_models/patient_ticket_model.dart';
import 'package:queuing_system/core/response_models/prayers_widget_model.dart';
import 'package:queuing_system/core/response_models/weathers_widget_model.dart';
import 'package:queuing_system/core/response_models/widgets_config_model.dart';
const _getCallRequestInfoByClinicInfo = "/GetCallRequestInfo_ByIP";
const _callUpdateNotIsQueueRecordByIDAsync = "/CallRequest_QueueUpdate";
const _waitingAreaScreenConfigGet = "/WaitingAreaScreen_Config_Get";
const _weatherForecastGetBy5Days = "/WeatherForecast_GetBy5Days";
const _prayerTimeToday = "/PrayerTime_Today";
class MyHttpOverrides extends HttpOverrides {
@override
@ -20,7 +26,7 @@ class API {
static getCallRequestInfoByClinicInfo(String deviceIp,
{required Function(List<PatientTicketModel>, List<PatientTicketModel>, CallConfig callConfig) onSuccess, required Function(dynamic) onFailure}) async {
final body = {"ipAdress": deviceIp, "apiKey": apiKey};
bool isDevMode = true;
bool isDevMode = false;
if (isDevMode) {
var callPatients = PatientTicketModel.testCallPatients;
CallConfig callConfig = CallConfig.testCallConfig;
@ -80,4 +86,51 @@ class API {
onFailure(false);
}
}
static Future<WidgetsConfigModel> getWidgetConfigsFromServer(String deviceIp, {required Function(dynamic) onFailure}) async {
final body = {"ipAddress": deviceIp};
WidgetsConfigModel widgetsConfigModel = WidgetsConfigModel();
await BaseAppClient.post(_waitingAreaScreenConfigGet,
body: body,
onSuccess: (response, status) {
if (status == 200 && response["data"] != null) {
widgetsConfigModel = (response["data"] as List).map((e) => WidgetsConfigModel.fromJson(e)).toList().first;
}
},
onFailure: (error, status) => log("error: ${error.toString()}"));
return widgetsConfigModel;
}
static Future<WeathersWidgetModel> getWeatherDetailsFromServer(String cityId, {required Function(dynamic) onFailure}) async {
final body = {"cityID": cityId};
WeathersWidgetModel weathersWidgetModel = WeathersWidgetModel();
await BaseAppClient.post(_weatherForecastGetBy5Days,
body: body,
onSuccess: (response, status) {
if (status == 200 && response["data"] != null) {
weathersWidgetModel = (response["data"] as List).map((e) => WeathersWidgetModel.fromJson(e)).toList().first;
}
},
onFailure: (error, status) => log("error: ${error.toString()}"));
return weathersWidgetModel;
}
static Future<List<PrayersWidgetModel?>> getPrayerDetailsFromServer({
required double latitude,
required double longitude,
required Function(dynamic) onFailure,
}) async {
final body = {"latitude": latitude, "longitude": longitude};
await BaseAppClient.post(_prayerTimeToday,
body: body,
onSuccess: (response, status) {
if (status == 200 && response["data"] != null) {
List<PrayersWidgetModel> prayersWidgetModel = (response["data"] as List).map((e) => PrayersWidgetModel.fromJson(e)).toList();
return prayersWidgetModel;
}
},
onFailure: (error, status) => log("error: ${error.toString()}"));
return [];
}
}

@ -24,15 +24,25 @@ class AppGlobal {
static Color nebulizationColor = const Color(0xFF3C86D0);
static Color vitalSignColor = const Color(0xFFD02127);
static Color doctorColor = const Color(0xFF52964F);
// static Color procedureColor = const Color(0xFFC99609);
static Color vaccinationColor = const Color(0xFFC99609);
static Color procedureColor = const Color(0xFF460707);
//IconPaths
static String vitalSignIcon = "assets/images/vitalsign_icon.svg";
static String nebulizationIcon = "assets/images/nebulization_icon.svg";
static String doctorIcon = "assets/images/doctor_icon.svg";
static String procedureIcon = "assets/images/procedure_icon.svg";
static String vaccinationIcon = "assets/images/vaccination_icon.svg";
//Widgets
static String mosqueIcon = "assets/icons/mosque.png";
static String weatherIcon = "assets/icons/weather.svg";
static String cloudIcon = "assets/icons/cloudy.svg";
static String coldIcon = "assets/icons/cold.svg";
static String hotIcon = "assets/icons/hot.svg";
static String rainIcon = "assets/icons/rainy.svg";
static String windIcon = "assets/icons/windy.svg";
}

@ -0,0 +1,48 @@
class PrayersWidgetModel {
String? fajr;
String? sunrise;
String? dhuhr;
String? asr;
String? sunset;
String? maghrib;
String? isha;
String? imsak;
String? midnight;
String? firstthird;
String? lastthird;
String? dateFor;
PrayersWidgetModel({this.fajr, this.sunrise, this.dhuhr, this.asr, this.sunset, this.maghrib, this.isha, this.imsak, this.midnight, this.firstthird, this.lastthird, this.dateFor});
PrayersWidgetModel.fromJson(Map<String, dynamic> json) {
fajr = json['fajr'];
sunrise = json['sunrise'];
dhuhr = json['dhuhr'];
asr = json['asr'];
sunset = json['sunset'];
maghrib = json['maghrib'];
isha = json['isha'];
imsak = json['imsak'];
midnight = json['midnight'];
firstthird = json['firstthird'];
lastthird = json['lastthird'];
dateFor = json['dateFor'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['fajr'] = fajr;
data['sunrise'] = sunrise;
data['dhuhr'] = dhuhr;
data['asr'] = asr;
data['sunset'] = sunset;
data['maghrib'] = maghrib;
data['isha'] = isha;
data['imsak'] = imsak;
data['midnight'] = midnight;
data['firstthird'] = firstthird;
data['lastthird'] = lastthird;
data['dateFor'] = dateFor;
return data;
}
}

@ -0,0 +1,65 @@
class WeathersWidgetModel {
int? id;
String? headline;
double? maxTemp;
double? minTemp;
String? iconPhrase;
String? forecastDate;
int? cityID;
String? forecastDay;
String? createDateTime;
double? windSpeed;
String? windDirection;
double? windDegrees;
WeathersWidgetModel(
{this.id,
this.headline,
this.maxTemp,
this.minTemp,
this.iconPhrase,
this.forecastDate,
this.cityID,
this.forecastDay,
this.createDateTime,
this.windSpeed,
this.windDirection,
this.windDegrees});
WeathersWidgetModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
headline = json['headline'];
maxTemp = json['maxTemp'];
minTemp = json['minTemp'];
iconPhrase = json['iconPhrase'];
forecastDate = json['forecastDate'];
cityID = json['cityID'];
forecastDay = json['forecastDay'];
createDateTime = json['createDateTime'];
windSpeed = json['windSpeed'];
windDirection = json['windDirection'];
windDegrees = json['windDegrees'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['headline'] = headline;
data['maxTemp'] = maxTemp;
data['minTemp'] = minTemp;
data['iconPhrase'] = iconPhrase;
data['forecastDate'] = forecastDate;
data['cityID'] = cityID;
data['forecastDay'] = forecastDay;
data['createDateTime'] = createDateTime;
data['windSpeed'] = windSpeed;
data['windDirection'] = windDirection;
data['windDegrees'] = windDegrees;
return data;
}
@override
String toString() {
return 'WeathersWidgetModel{id: $id, headline: $headline, maxTemp: $maxTemp, minTemp: $minTemp, iconPhrase: $iconPhrase, forecastDate: $forecastDate, cityID: $cityID, forecastDay: $forecastDay, createDateTime: $createDateTime, windSpeed: $windSpeed, windDirection: $windDirection, windDegrees: $windDegrees}';
}
}

@ -0,0 +1,53 @@
class WidgetsConfigModel {
int? waitingAreaID;
String? waitingAreaName;
bool? isWeatherReq;
bool? isPrayerTimeReq;
int? projectID;
double? projectLatitude;
double? projectLongitude;
int? cityKey;
WidgetsConfigModel({
this.waitingAreaID,
this.waitingAreaName,
this.isWeatherReq,
this.isPrayerTimeReq,
this.projectID,
this.projectLatitude,
this.projectLongitude,
this.cityKey,
});
WidgetsConfigModel.fromJson(Map<String, dynamic> json) {
print("jsonToConvert: $json");
waitingAreaID = json['waitingAreaID'];
waitingAreaName = json['waitingAreaName'];
isWeatherReq = true;
isPrayerTimeReq = true;
// isWeatherReq = json['isWeatherReq'];
// isPrayerTimeReq = json['isPrayerTimeReq'];
projectID = json['projectID'];
projectLatitude = json['projectLatitude'];
projectLongitude = json['projectLongitude'];
cityKey = json['cityKey'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['waitingAreaID'] = waitingAreaID;
data['waitingAreaName'] = waitingAreaName;
data['isWeatherReq'] = isWeatherReq;
data['isPrayerTimeReq'] = isPrayerTimeReq;
data['projectID'] = projectID;
data['projectLatitude'] = projectLatitude;
data['projectLongitude'] = projectLongitude;
data['cityKey'] = cityKey;
return data;
}
@override
String toString() {
return 'WidgetsConfigModel{waitingAreaID: $waitingAreaID, waitingAreaName: $waitingAreaName, isWeatherReq: $isWeatherReq, isPrayerTimeReq: $isPrayerTimeReq, projectLatitude: $projectLatitude,projectLongitude: $projectLongitude, cityKey: $cityKey}';
}
}

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/core/config/size_config.dart';
import 'package:queuing_system/home/app_provider.dart';
import 'package:queuing_system/utils/utils.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
@ -9,6 +10,51 @@ import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
class AppHeader extends StatelessWidget with PreferredSizeWidget {
const AppHeader({Key? key}) : super(key: key);
Widget getWeatherWidget(AppProvider appProvider) {
if (appProvider.currentWeathersWidgetModel.maxTemp == null || appProvider.currentWeathersWidgetModel.minTemp == null || appProvider.currentWeathersWidgetModel.iconPhrase == null) {
return const SizedBox.shrink();
}
return Row(
children: [
SvgPicture.asset(
AppGlobal.weatherIcon,
height: SizeConfig.getHeightMultiplier() * 2.5,
color: Colors.white,
),
const SizedBox(width: 10),
Padding(
padding: const EdgeInsets.only(top: 15),
child: AppText(
"Max: ${appProvider.currentWeathersWidgetModel.maxTemp}°C , Min: ${appProvider.currentWeathersWidgetModel.minTemp}°C",
color: Colors.white,
fontSize: SizeConfig.getHeightMultiplier() * 1.3,
),
),
],
);
}
Widget getPrayerWidget(AppProvider appProvider) {
return Row(
children: [
Image.asset(
AppGlobal.mosqueIcon,
height: SizeConfig.getHeightMultiplier() * 2.5,
color: Colors.white,
),
const SizedBox(width: 10),
Padding(
padding: const EdgeInsets.only(top: 15),
child: AppText(
"Next Prayer: Dhuhr (11:49am)",
color: Colors.white,
fontSize: SizeConfig.getHeightMultiplier() * 1.3,
),
),
],
);
}
@override
Widget build(BuildContext context) {
AppProvider appProvider = context.read<AppProvider>();
@ -36,9 +82,10 @@ class AppHeader extends StatelessWidget with PreferredSizeWidget {
child: AppText(
appProvider.patientCallConfigurations.currentServeText,
color: Colors.white,
fontFamily: 'Poppins-SemiBold.ttf',
),
),
getPrayerWidget(appProvider),
getWeatherWidget(appProvider),
SvgPicture.asset(
"assets/images/hmglogo.svg",
height: Utils.getHeight() * 0.5,

@ -9,15 +9,26 @@ import 'package:just_audio/just_audio.dart';
import 'package:queuing_system/core/api.dart';
import 'package:queuing_system/core/response_models/call_config_model.dart';
import 'package:queuing_system/core/response_models/patient_ticket_model.dart';
import 'package:queuing_system/core/response_models/prayers_widget_model.dart';
import 'package:queuing_system/core/response_models/weathers_widget_model.dart';
import 'package:queuing_system/core/response_models/widgets_config_model.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:shared_preferences/shared_preferences.dart';
class AppProvider extends ChangeNotifier {
AppProvider() {
startSignalHubConnection();
callInitializations();
}
Future<void> callInitializations() async {
await startSignalHubConnection();
await getInfoWidgetsDetailsFromServer();
await getLastTimeUpdatedFromCache();
listenNetworkConnectivity();
listenAudioPlayerEvents();
getTheWidgetsConfigurationsEveryMidnight();
}
SignalRHelper signalRHelper = SignalRHelper();
@ -57,6 +68,103 @@ class AppProvider extends ChangeNotifier {
}
}
WidgetsConfigModel? currentWidgetsConfigModel = WidgetsConfigModel();
Future<void> getInfoWidgetsConfigurationsFromServer() async {
WidgetsConfigModel? widgetsConfigModel = await API.getWidgetConfigsFromServer(currentDeviceIp, onFailure: (error) {
log("Api call failed with this error: ${error.toString()}");
});
if (widgetsConfigModel != null) {
currentWidgetsConfigModel = widgetsConfigModel;
log("I got this data: ${widgetsConfigModel.toString()}");
notifyListeners();
}
}
WeathersWidgetModel currentWeathersWidgetModel = WeathersWidgetModel();
Future<void> getWeatherDetailsFromServer() async {
log("I got this data from Weather: ");
WeathersWidgetModel? weathersWidgetModel = await API.getWeatherDetailsFromServer(
(currentWidgetsConfigModel!.cityKey ?? "").toString(),
onFailure: (error) => log("Api call failed with this error: ${error.toString()}"),
);
if (weathersWidgetModel != null) {
currentWeathersWidgetModel = weathersWidgetModel;
log("I got this data from Weather: ${weathersWidgetModel.toString()}");
notifyListeners();
}
}
PrayersWidgetModel nextPrayerToShow = PrayersWidgetModel();
Future<void> getTheNextPrayerToShow() async {
}
List<PrayersWidgetModel?> currentPrayersWidgetModel = [];
Future<void> getPrayerDetailsFromServer() async {
List<PrayersWidgetModel?> prayersWidgetModel = await API.getPrayerDetailsFromServer(
latitude: currentWidgetsConfigModel!.projectLatitude ?? 0,
longitude: currentWidgetsConfigModel!.projectLongitude ?? 0,
onFailure: (error) => log("Api call failed with this error: ${error.toString()}"));
if (prayersWidgetModel.isNotEmpty) {
currentPrayersWidgetModel = prayersWidgetModel;
log("I got this data: ${prayersWidgetModel.toString()}");
notifyListeners();
}
}
Future<void> getInfoWidgetsDetailsFromServer() async {
if (currentWidgetsConfigModel == null) return;
await getInfoWidgetsConfigurationsFromServer().whenComplete(() async {
if (currentWidgetsConfigModel!.isWeatherReq!) {
await getWeatherDetailsFromServer();
}
if (currentWidgetsConfigModel!.isPrayerTimeReq!) {
await getPrayerDetailsFromServer();
}
});
int currentDate = DateTime.now().millisecondsSinceEpoch;
await setLastTimeUpdatedInCache(lasTimeUpdated: currentDate.toString());
}
Future<void> getTheWidgetsConfigurationsEveryMidnight() async {
if (currentWidgetsConfigModel == null) return;
if (!currentWidgetsConfigModel!.isWeatherReq! && !currentWidgetsConfigModel!.isPrayerTimeReq!) {
return;
}
DateTime current = DateTime.now();
Stream timer = Stream.periodic(const Duration(hours: 1), (i) {
current = current.add(const Duration(hours: 1));
return current;
});
timer.listen((data) async {
DateTime dateTime = DateTime.parse(data.toString());
if (currentWidgetsConfigModel!.isWeatherReq!) {
if (dateTime.day > currentLastTimeUpdated.day) {
await getWeatherDetailsFromServer();
}
}
if (currentWidgetsConfigModel!.isPrayerTimeReq!) {
if (dateTime.day > currentLastTimeUpdated.day) {
await getPrayerDetailsFromServer();
}
}
});
}
Future<void> startSignalHubConnection() async {
if (!signalRHelper.getConnectionState()) {
await getCurrentIP().whenComplete(() => signalRHelper.startSignalRConnection(
@ -71,22 +179,22 @@ class AppProvider extends ChangeNotifier {
Future<void> callPatientsAPI() async {
patientTickets.clear();
API.getCallRequestInfoByClinicInfo(currentDeviceIp, onSuccess: (waitingCalls, isQueuePatientsCalls, callConfigs) async {
patientCallConfigurations = callConfigs;
if (waitingCalls.length > patientCallConfigurations.screenMaxDisplayPatients) {
patientTickets = waitingCalls.sublist(0, patientCallConfigurations.screenMaxDisplayPatients);
} else {
patientTickets = waitingCalls;
}
isQueuePatients = isQueuePatientsCalls;
notifyListeners();
if (patientTickets.isNotEmpty) {
voiceCallPatientTicket(patientTickets.first);
updatePatientTicket(patientTickets.first);
}
}, onFailure: (error) {
log("Api call failed with this error: ${error.toString()}");
});
API.getCallRequestInfoByClinicInfo(currentDeviceIp,
onSuccess: (waitingCalls, isQueuePatientsCalls, callConfigs) async {
patientCallConfigurations = callConfigs;
if (waitingCalls.length > patientCallConfigurations.screenMaxDisplayPatients) {
patientTickets = waitingCalls.sublist(0, patientCallConfigurations.screenMaxDisplayPatients);
} else {
patientTickets = waitingCalls;
}
isQueuePatients = isQueuePatientsCalls;
notifyListeners();
if (patientTickets.isNotEmpty) {
voiceCallPatientTicket(patientTickets.first);
updatePatientTicket(patientTickets.first);
}
},
onFailure: (error) => log("Api call failed with this error: ${error.toString()}"));
}
onPingReceived(data) async {
@ -286,4 +394,25 @@ class AppProvider extends ChangeNotifier {
}
});
}
//SHARED PREFERENCE HANDLING
DateTime currentLastTimeUpdated = DateTime.now();
Future<String?> getLastTimeUpdatedFromCache() async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
if (prefs.containsKey("lastTimeUpdated")) {
String? lastTimeUpdated = prefs.getString("lastTimeUpdated");
currentLastTimeUpdated = DateTime.fromMillisecondsSinceEpoch(int.parse(lastTimeUpdated!));
return lastTimeUpdated;
} else {
return null;
}
}
Future<void> setLastTimeUpdatedInCache({required String lasTimeUpdated}) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString("lastTimeUpdated", lasTimeUpdated);
}
}

@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:queuing_system/core/base/app_scaffold_widget.dart';

@ -112,6 +112,7 @@ class _AppTextState extends State<AppText> {
? _getFontStyle()?.copyWith(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color,
fontFamily: 'Poppins',
fontWeight: widget.fontWeight ?? _getFontWeight(),
height: widget.fontHeight,
)
@ -121,7 +122,7 @@ class _AppTextState extends State<AppText> {
fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null),
fontWeight: widget.fontWeight ?? _getFontWeight(),
fontFamily: widget.fontFamily ?? 'Poppins',
fontFamily: 'Poppins',
decoration: widget.textDecoration,
height: widget.fontHeight),
)

@ -10,6 +10,7 @@ import connectivity_macos
import flutter_tts
import just_audio
import path_provider_foundation
import shared_preferences_foundation
import wakelock_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
@ -18,5 +19,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
}

@ -121,6 +121,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.2"
file:
dependency: transitive
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
@ -384,6 +392,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.27.7"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: b7f41bad7e521d205998772545de63ff4e6c97714775902c199353f8bf1511ac
url: "https://pub.dev"
source: hosted
version: "2.2.1"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7"
url: "https://pub.dev"
source: hosted
version: "2.3.4"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: c2eb5bf57a2fe9ad6988121609e47d3e07bb3bdca5b6f8444e4cf302428a128a
url: "https://pub.dev"
source: hosted
version: "2.3.1"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a
url: "https://pub.dev"
source: hosted
version: "2.3.1"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
url: "https://pub.dev"
source: hosted
version: "2.2.1"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: f763a101313bd3be87edffe0560037500967de9c394a714cd598d945517f694f
url: "https://pub.dev"
source: hosted
version: "2.3.1"
signalr_core:
dependency: "direct main"
description:

@ -31,7 +31,7 @@ dependencies:
sdk: flutter
# Base packages
# Base packages
provider: ^6.0.1
get_it: ^7.1.3
connectivity: ^3.0.6
@ -42,13 +42,12 @@ dependencies:
just_audio: ^0.9.31
flutter_tts: ^3.6.3
wakelock: ^0.6.2
shared_preferences: ^2.2.1
#signalr core
signalr_core: ^1.1.1
dev_dependencies:
flutter_test:
sdk: flutter
@ -75,6 +74,7 @@ flutter:
assets:
- assets/images/
- assets/tones/
- assets/icons/
fonts:

Loading…
Cancel
Save