Fisrt push

faiz_kiosk
FaizHashmiCS22 10 months ago
parent 1572e88b7a
commit 185ef512a1

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

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

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

@ -54,14 +54,15 @@ class QueuingViewModel extends ChangeNotifier {
}
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 {
log("onHubConnected: $response");
ScreenConfigViewModel screenConfigViewModel = getIt.get<ScreenConfigViewModel>();
screenConfigViewModel.updateIsHubConnected(true);
log("screenConfigViewModel: ${screenConfigViewModel.isHubConnected}");
screenConfigViewModel.notifyListeners();
}

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

@ -15,7 +15,7 @@ class AppFooter extends StatelessWidget {
return Consumer(builder: (BuildContext context, ScreenConfigViewModel screenConfigVM, Widget? child) {
return Container(
color: Colors.grey.withOpacity(0.1),
height: SizeConfig.getHeightMultiplier() * 0.5,
height: SizeConfig.getHeightMultiplier() * 0.7,
width: double.infinity,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -29,8 +29,7 @@ class AppFooter extends StatelessWidget {
children: [
AppText(
AppStrings.poweredBy,
medium: true,
fontSize: SizeConfig.getWidthMultiplier() * 2.6,
fontSize: SizeConfig.getWidthMultiplier() * 2,
),
Text(screenConfigVM.currentScreenIP, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
Row(
@ -39,25 +38,34 @@ class AppFooter extends StatelessWidget {
onTap: () {
screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.portraitUp);
},
child: const Icon(Icons.arrow_upward),
child: Icon(
Icons.arrow_upward,
size: SizeConfig.getWidthMultiplier() * 2,
),
),
InkWell(
onTap: () {
screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.landscapeRight);
},
child: const Icon(Icons.arrow_forward),
child: Icon(Icons.arrow_forward, size: SizeConfig.getWidthMultiplier() * 2),
),
InkWell(
onTap: () {
screenConfigVM.updateCurrentScreenRotation(ScreenOrientationEnum.portraitDown);
},
child: const Icon(Icons.arrow_downward),
child: Icon(
Icons.arrow_downward,
size: SizeConfig.getWidthMultiplier() * 2,
),
),
InkWell(
onTap: () {
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),
child: Marquee(
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,
crossAxisAlignment: CrossAxisAlignment.center,
blankSpace: 20.0,

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

@ -133,7 +133,13 @@ class MainQueueScreen extends StatelessWidget {
builder: (BuildContext context, ScreenConfigViewModel screenConfigViewModel, QueuingViewModel queuingViewModel, Widget? child) {
Widget widget = const SizedBox();
// 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();
} else if (queuingViewModel.currentTickets.length > AppConstants.thresholdForListUI) {
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}) {
return Consumer<ScreenConfigViewModel>(builder: (
BuildContext context,
@ -162,7 +187,7 @@ class MainQueueScreen extends StatelessWidget {
return Column(
children: [
Expanded(
flex: (screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitUp || screenConfigVM.currentScreenRotation == ScreenOrientationEnum.portraitDown) ? 2 : 1,
flex: getFlexForScreenTypes(screenConfigVM),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
@ -173,6 +198,7 @@ class MainQueueScreen extends StatelessWidget {
],
)),
),
const SizedBox(height: 12),
Expanded(flex: 10, child: dataContent(context: context)),
],
);

Loading…
Cancel
Save