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.
queuing_system/lib/header/app_header.dart

118 lines
4.1 KiB
Dart

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';
class AppHeader extends StatelessWidget with PreferredSizeWidget {
const AppHeader({Key? key}) : super(key: key);
getWeatherIcon() {}
Widget 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 Directionality(
textDirection: appProvider.patientCallConfigurations.textDirection,
child: Row(
children: [
SvgPicture.asset(
appProvider.currentWeathersWidgetModel.weatherIconPath ?? AppGlobal.weatherIcon,
height: SizeConfig.getHeightMultiplier() * 2.5,
color: Colors.white,
),
const SizedBox(width: 10),
Padding(
padding: const EdgeInsets.only(top: 15),
child: AppText(
"${appProvider.patientCallConfigurations.maxText}: ${appProvider.currentWeathersWidgetModel.maxTemp}°C , ${appProvider.patientCallConfigurations.minText}: ${appProvider.currentWeathersWidgetModel.minTemp}°C",
color: Colors.white,
fontSize: SizeConfig.getHeightMultiplier() * 1.3,
),
),
],
),
);
});
}
Widget getPrayerWidget() {
return Consumer(builder: (BuildContext context, AppProvider appProvider, Widget? child) {
if (appProvider.nextPrayerToShowWithTime.isEmpty) {
return const SizedBox.shrink();
}
return Directionality(
textDirection: appProvider.patientCallConfigurations.textDirection,
child: Row(
children: [
SvgPicture.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: ${appProvider.nextPrayerToShowWithTime}",
color: Colors.white,
fontSize: SizeConfig.getHeightMultiplier() * 1.3,
),
),
],
),
);
});
}
@override
Widget build(BuildContext context) {
AppProvider appProvider = context.read<AppProvider>();
return Container(
padding: const EdgeInsets.only(
left: 0,
right: 5,
),
decoration: BoxDecoration(color: AppGlobal.vitalSignColor, border: const Border(bottom: BorderSide(color: Color(0xFFEFEFEF)))),
child: Container(
height: 100,
padding: const EdgeInsets.only(
left: 20,
right: 20,
bottom: 0,
),
child: Directionality(
textDirection: appProvider.patientCallConfigurations.textDirection,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {},
child: AppText(
appProvider.patientCallConfigurations.currentServeText,
color: Colors.white,
),
),
getPrayerWidget(),
getWeatherWidget(),
SvgPicture.asset(
"assets/images/hmglogo.svg",
height: Utils.getHeight() * 0.5,
),
],
),
),
),
);
}
@override
Size get preferredSize => Size(double.maxFinite, Utils.getHeight());
}