You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
5.7 KiB
Dart
157 lines
5.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:queuing_system/core/base/app_scaffold_widget.dart';
|
|
import 'package:queuing_system/core/config/config.dart';
|
|
import 'package:queuing_system/core/config/size_config.dart';
|
|
import 'package:queuing_system/footer/app_footer.dart';
|
|
import 'package:queuing_system/header/app_header.dart';
|
|
import 'package:queuing_system/home/app_provider.dart';
|
|
import 'package:queuing_system/home/priority_calls_components.dart';
|
|
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
|
|
|
class MyHomePage extends StatelessWidget {
|
|
const MyHomePage({Key? key}) : super(key: key);
|
|
|
|
getWeatherWidget() {
|
|
return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) {
|
|
if (appProvider.currentWeathersWidgetModel.maxTemp == null || appProvider.currentWeathersWidgetModel.minTemp == null || appProvider.currentWeathersWidgetModel.iconPhrase == null) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
return Container(
|
|
constraints: BoxConstraints(
|
|
minWidth: SizeConfig.getWidthMultiplier() * 30,
|
|
minHeight: SizeConfig.getHeightMultiplier() * 5.5,
|
|
),
|
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
|
decoration: AppGlobal.configWidgetDecoration,
|
|
child: Directionality(
|
|
textDirection: appProvider.patientCallConfigurations.textDirection,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
appProvider.patientCallConfigurations.weatherText,
|
|
color: Colors.grey,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 1.5,
|
|
),
|
|
AppText(
|
|
// "Max: 40C , Min: 38C",
|
|
"${appProvider.patientCallConfigurations.maxText}: ${appProvider.currentWeathersWidgetModel.maxTemp}°C , ${appProvider.patientCallConfigurations.minText}: ${appProvider.currentWeathersWidgetModel.minTemp}°C",
|
|
fontSize: SizeConfig.getHeightMultiplier() * 1.3,
|
|
fontHeight: 1,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(width: 15),
|
|
SvgPicture.asset(
|
|
appProvider.currentWeathersWidgetModel.weatherIconPath ?? AppGlobal.weatherIcon,
|
|
height: SizeConfig.getHeightMultiplier() * 3,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
|
|
getPrayerWidget() {
|
|
return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) {
|
|
if (appProvider.nextPrayerToShowWithTime.isEmpty) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
return Container(
|
|
constraints: BoxConstraints(
|
|
minWidth: SizeConfig.getWidthMultiplier() * 25,
|
|
minHeight: SizeConfig.getHeightMultiplier() * 5,
|
|
),
|
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
|
decoration: AppGlobal.configWidgetDecoration,
|
|
child: Directionality(
|
|
textDirection: appProvider.patientCallConfigurations.textDirection,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
appProvider.patientCallConfigurations.nextPrayerText,
|
|
color: Colors.grey,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 1.5,
|
|
),
|
|
AppText(
|
|
appProvider.nextPrayerToShowWithTime,
|
|
fontSize: SizeConfig.getHeightMultiplier() * 1.3,
|
|
fontHeight: 1,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(width: 15),
|
|
SvgPicture.asset(
|
|
AppGlobal.mosqueIcon,
|
|
height: SizeConfig.getHeightMultiplier() * 3,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
|
|
getBody(AppProvider appProvider) {
|
|
return Column(
|
|
children: [
|
|
const SizedBox(height: 12),
|
|
Expanded(
|
|
flex: 1,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
|
child: Row(
|
|
children: [
|
|
getWeatherWidget(),
|
|
const SizedBox(width: 35),
|
|
getPrayerWidget(),
|
|
],
|
|
),
|
|
)),
|
|
const SizedBox(height: 20),
|
|
Expanded(
|
|
flex: 9,
|
|
child: dataContent(appProvider: appProvider),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final appProvider = context.watch<AppProvider>();
|
|
return AppScaffold(
|
|
appProvider: appProvider,
|
|
appBar: const AppHeader(),
|
|
body: getBody(appProvider),
|
|
bottomNavigationBar: const AppFooter(),
|
|
);
|
|
}
|
|
|
|
Widget dataContent({required AppProvider appProvider}) {
|
|
// if (true) {
|
|
// return qamarsBirthdayWidget();
|
|
// }
|
|
if (appProvider.patientTickets.isEmpty) {
|
|
// No Patient in Queue
|
|
return noPatientInQueue();
|
|
} else if (appProvider.patientTickets.length > 3) {
|
|
// Return Content With Side List
|
|
return priorityTicketsWithSideList(tickets: appProvider.patientTickets, callConfig: appProvider.patientCallConfigurations);
|
|
} else {
|
|
// Return Content In Center Aligned
|
|
return PriorityTickets(tickets: appProvider.patientTickets, callConfig: appProvider.patientCallConfigurations);
|
|
}
|
|
}
|
|
}
|