Fisrt push

faiz_kiosk
FaizHashmiCS22 10 months ago
parent 1572e88b7a
commit 185ef512a1

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
bool useTestIP = true; bool useTestIP = false;
Logger logger = Logger(printer: PrettyPrinter(printEmojis: false, colors: true, dateTimeFormat: DateTimeFormat.none)); Logger logger = Logger(printer: PrettyPrinter(printEmojis: false, colors: true, dateTimeFormat: DateTimeFormat.none));
class AppStrings { class AppStrings {

@ -50,8 +50,8 @@ class GlobalConfigurationsModel {
bool isWeatherReq = false; bool isWeatherReq = false;
bool isPrayerTimeReq = false; bool isPrayerTimeReq = false;
bool isRssFeedReq = false; bool isRssFeedReq = false;
int? qType; QTypeEnum qTypeEnum = QTypeEnum.lab;
int? screenType; ScreenTypeEnum screenTypeEnum = ScreenTypeEnum.waitingAreaScreen;
int? projectID; int? projectID;
double? projectLatitude; double? projectLatitude;
double? projectLongitude; double? projectLongitude;
@ -105,8 +105,8 @@ class GlobalConfigurationsModel {
this.isWeatherReq = false, this.isWeatherReq = false,
this.isPrayerTimeReq = false, this.isPrayerTimeReq = false,
this.isRssFeedReq = false, this.isRssFeedReq = false,
this.qType, this.qTypeEnum = QTypeEnum.lab,
this.screenType, this.screenTypeEnum = ScreenTypeEnum.waitingAreaScreen,
this.projectID, this.projectID,
this.projectLatitude, this.projectLatitude,
this.projectLongitude, this.projectLongitude,
@ -163,8 +163,8 @@ class GlobalConfigurationsModel {
isWeatherReq = json['isWeatherReq'] ?? false; isWeatherReq = json['isWeatherReq'] ?? false;
isPrayerTimeReq = json['isPrayerTimeReq'] ?? false; isPrayerTimeReq = json['isPrayerTimeReq'] ?? false;
isRssFeedReq = json['isRssFeedReq'] ?? false; isRssFeedReq = json['isRssFeedReq'] ?? false;
qType = json['qType']; qTypeEnum = (json['qType'] as int).toQTypeEnum();
screenType = json['screenType']; screenTypeEnum = (json['screenType'] as int).toScreenTypeEnum();
projectID = json['projectID']; projectID = json['projectID'];
projectLatitude = json['projectLatitude']; projectLatitude = json['projectLatitude'];
projectLongitude = json['projectLongitude']; projectLongitude = json['projectLongitude'];

@ -110,7 +110,7 @@ extension IntToLanguageEnum on int {
case 2: case 2:
return LanguageEnum.arabic; return LanguageEnum.arabic;
default: default:
throw Exception('Invalid language integer: $this'); return LanguageEnum.english;
} }
} }
} }
@ -123,7 +123,7 @@ extension LanguageEnumToInt on LanguageEnum {
case LanguageEnum.arabic: case LanguageEnum.arabic:
return 2; return 2;
default: default:
throw Exception('Invalid language Type: $this'); return 1;
} }
} }
} }

@ -54,14 +54,15 @@ class QueuingViewModel extends ChangeNotifier {
} }
Future<void> onHubConfigCall(var response) async { Future<void> onHubConfigCall(var response) async {
logger.i("onHubConfigCall: $response"); log("onHubConnected: $response");
// ScreenConfigViewModel screenConfigViewModel = getIt.get<ScreenConfigViewModel>();
// screenConfigViewModel.updateGlobalConfigurationsModel(true);
} }
Future<void> onHubReconnected(var response) async { Future<void> onHubReconnected(var response) async {
log("onHubConnected: $response"); log("onHubConnected: $response");
ScreenConfigViewModel screenConfigViewModel = getIt.get<ScreenConfigViewModel>(); ScreenConfigViewModel screenConfigViewModel = getIt.get<ScreenConfigViewModel>();
screenConfigViewModel.updateIsHubConnected(true); screenConfigViewModel.updateIsHubConnected(true);
log("screenConfigViewModel: ${screenConfigViewModel.isHubConnected}"); log("screenConfigViewModel: ${screenConfigViewModel.isHubConnected}");
screenConfigViewModel.notifyListeners(); screenConfigViewModel.notifyListeners();
} }

@ -62,6 +62,18 @@ class ScreenConfigViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
ScreenTypeEnum currentScreenTypeEnum = ScreenTypeEnum.waitingAreaScreen;
updateCurrentScreenTypeEnum(ScreenTypeEnum value) {
currentScreenTypeEnum = value;
}
QTypeEnum currentQTypeEnum = QTypeEnum.lab;
updateCurrentQTypeEnum(QTypeEnum value) {
currentQTypeEnum = value;
}
String currentScreenIP = ""; String currentScreenIP = "";
Future<void> getCurrentScreenIP() async { Future<void> getCurrentScreenIP() async {
@ -90,10 +102,19 @@ class ScreenConfigViewModel extends ChangeNotifier {
if (response == null) { if (response == null) {
return; return;
} }
globalConfigurationsModel = response; updateGlobalConfigurationsModel(value: response);
updateCurrentScreenTypeEnum(globalConfigurationsModel.screenTypeEnum);
updateCurrentQTypeEnum(globalConfigurationsModel.qTypeEnum);
notifyListeners(); notifyListeners();
} }
void updateGlobalConfigurationsModel({required var value, bool needNotify = false}) {
globalConfigurationsModel = value;
if (needNotify) {
notifyListeners();
}
}
Future<void> getInfoWidgetsDetailsFromServer() async { Future<void> getInfoWidgetsDetailsFromServer() async {
if (globalConfigurationsModel.isWeatherReq) { if (globalConfigurationsModel.isWeatherReq) {
await getWeatherDetailsFromServer(); await getWeatherDetailsFromServer();

@ -15,7 +15,7 @@ class AppFooter extends StatelessWidget {
return Consumer(builder: (BuildContext context, ScreenConfigViewModel screenConfigVM, Widget? child) { return Consumer(builder: (BuildContext context, ScreenConfigViewModel screenConfigVM, Widget? child) {
return Container( return Container(
color: Colors.grey.withOpacity(0.1), color: Colors.grey.withOpacity(0.1),
height: SizeConfig.getHeightMultiplier() * 0.5, height: SizeConfig.getHeightMultiplier() * 0.7,
width: double.infinity, width: double.infinity,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -29,8 +29,7 @@ class AppFooter extends StatelessWidget {
children: [ children: [
AppText( AppText(
AppStrings.poweredBy, AppStrings.poweredBy,
medium: true, fontSize: SizeConfig.getWidthMultiplier() * 2,
fontSize: SizeConfig.getWidthMultiplier() * 2.6,
), ),
Text(screenConfigVM.currentScreenIP, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)), Text(screenConfigVM.currentScreenIP, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
Row( Row(
@ -39,25 +38,34 @@ class AppFooter extends StatelessWidget {
onTap: () { onTap: () {
screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.portraitUp); screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.portraitUp);
}, },
child: const Icon(Icons.arrow_upward), child: Icon(
Icons.arrow_upward,
size: SizeConfig.getWidthMultiplier() * 2,
),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.landscapeRight); screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.landscapeRight);
}, },
child: const Icon(Icons.arrow_forward), child: Icon(Icons.arrow_forward, size: SizeConfig.getWidthMultiplier() * 2),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.portraitDown); screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.portraitDown);
}, },
child: const Icon(Icons.arrow_downward), child: Icon(
Icons.arrow_downward,
size: SizeConfig.getWidthMultiplier() * 2,
),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.landscapeLeft); screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.landscapeLeft);
}, },
child: const Icon(Icons.arrow_back), child: Icon(
Icons.arrow_back,
size: SizeConfig.getWidthMultiplier() * 2,
),
), ),
], ],
), ),
@ -77,7 +85,7 @@ class AppFooter extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.symmetric(horizontal: 10),
child: Marquee( child: Marquee(
text: screenConfigVM.rssFeedModel.rssFeed ?? "", text: screenConfigVM.rssFeedModel.rssFeed ?? "",
style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 5), style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 4),
scrollAxis: Axis.horizontal, scrollAxis: Axis.horizontal,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
blankSpace: 20.0, blankSpace: 20.0,

@ -18,12 +18,11 @@ class PriorityTickets extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
SizedBox(height: SizeConfig.getHeightMultiplier() * 0.7),
TicketItem( TicketItem(
ticketNo: firstTicket.ticketModel!.queueNo ?? '', ticketNo: firstTicket.ticketModel!.queueNo ?? '',
scale: 1.2, scale: 1.2,
blink: true, blink: true,
roomNo: "roomHere", roomNo: firstTicket.ticketModel!.roomNo ?? '',
roomText: globalConfigurationsModel.roomText ?? "", roomText: globalConfigurationsModel.roomText ?? "",
isClinicAdded: false, isClinicAdded: false,
textDirection: globalConfigurationsModel.textDirection, textDirection: globalConfigurationsModel.textDirection,
@ -40,7 +39,7 @@ class PriorityTickets extends StatelessWidget {
child: TicketItem( child: TicketItem(
ticketNo: ticket.ticketModel!.queueNo ?? '', ticketNo: ticket.ticketModel!.queueNo ?? '',
scale: 0.8, scale: 0.8,
roomNo: "roomHere", roomNo: firstTicket.ticketModel!.roomNo ?? '',
roomText: globalConfigurationsModel.roomText ?? "", roomText: globalConfigurationsModel.roomText ?? "",
isClinicAdded: false, isClinicAdded: false,
textDirection: globalConfigurationsModel.textDirection, textDirection: globalConfigurationsModel.textDirection,

@ -133,7 +133,13 @@ class MainQueueScreen extends StatelessWidget {
builder: (BuildContext context, ScreenConfigViewModel screenConfigViewModel, QueuingViewModel queuingViewModel, Widget? child) { builder: (BuildContext context, ScreenConfigViewModel screenConfigViewModel, QueuingViewModel queuingViewModel, Widget? child) {
Widget widget = const SizedBox(); Widget widget = const SizedBox();
// queuingViewModel.voiceCallTicket(ticketData: queuingViewModel.currentTickets.first.ticketModel); // queuingViewModel.voiceCallTicket(ticketData: queuingViewModel.currentTickets.first.ticketModel);
if (queuingViewModel.currentTickets.isEmpty) {
if (screenConfigViewModel.globalConfigurationsModel.screenTypeEnum == ScreenTypeEnum.roomLevelScreen) {
widget = PriorityTickets(
tickets: [queuingViewModel.currentTickets.first],
globalConfigurationsModel: screenConfigViewModel.globalConfigurationsModel,
);
} else if (queuingViewModel.currentTickets.isEmpty) {
widget = noPatientInQueue(); widget = noPatientInQueue();
} else if (queuingViewModel.currentTickets.length > AppConstants.thresholdForListUI) { } else if (queuingViewModel.currentTickets.length > AppConstants.thresholdForListUI) {
widget = PriorityTicketsSidelist( widget = PriorityTicketsSidelist(
@ -153,6 +159,25 @@ class MainQueueScreen extends StatelessWidget {
); );
} }
int getFlexForScreenTypes(ScreenConfigViewModel screenConfigVM) {
int flex = 1;
if (screenConfigVM.currentScreenTypeEnum == ScreenTypeEnum.roomLevelScreen) {
if (screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitUp || screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitDown) {
flex = 2;
} else {
flex = 3;
}
} else {
if (screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitUp || screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitDown) {
flex = 2;
} else {
flex = 1;
}
}
return flex;
}
Widget getBody({required BuildContext context}) { Widget getBody({required BuildContext context}) {
return Consumer<ScreenConfigViewModel>(builder: ( return Consumer<ScreenConfigViewModel>(builder: (
BuildContext context, BuildContext context,
@ -162,7 +187,7 @@ class MainQueueScreen extends StatelessWidget {
return Column( return Column(
children: [ children: [
Expanded( Expanded(
flex: (screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitUp || screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitDown) ? 2 : 1, flex: getFlexForScreenTypes(screenConfigVM),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20), padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row( child: Row(
@ -173,6 +198,7 @@ class MainQueueScreen extends StatelessWidget {
], ],
)), )),
), ),
const SizedBox(height: 12),
Expanded(flex: 10, child: dataContent(context: context)), Expanded(flex: 10, child: dataContent(context: context)),
], ],
); );

Loading…
Cancel
Save