amend window to always include menu

This commit is contained in:
2025-05-28 10:51:43 +02:00
parent 10b77eb51c
commit 6f5a28678b
31 changed files with 565 additions and 957 deletions

View File

@@ -50,7 +50,6 @@ class _MIHTileState extends State<MIHTile> {
return MihPackageWindow(
fullscreen: false,
windowTitle: widget.tileName,
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -49,6 +49,26 @@ class _PackageToolOneState extends State<PackageToolOne> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Test No Full",
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.add,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Show New Window",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
// showTestWindow();
},
),
],
onWindowTapClose: () {
Navigator.of(context).pop();
},

View File

@@ -4,12 +4,14 @@ import 'package:mzansi_innovation_hub/main.dart';
class MihFloatingMenu extends StatefulWidget {
final IconData? icon;
final double? iconSize;
final AnimatedIconData? animatedIcon;
final SpeedDialDirection? direction;
final List<SpeedDialChild> children;
const MihFloatingMenu({
super.key,
this.icon,
this.iconSize,
this.animatedIcon,
this.direction,
required this.children,
@@ -22,26 +24,21 @@ class MihFloatingMenu extends StatefulWidget {
class _MihFloatingMenuState extends State<MihFloatingMenu> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
right: 5.0,
bottom: 5.0,
),
child: SpeedDial(
icon: widget.icon,
animatedIcon: widget.animatedIcon,
direction: widget.direction ?? SpeedDialDirection.up,
activeIcon: Icons.close,
backgroundColor: MzanziInnovationHub.of(context)!.theme.successColor(),
activeBackgroundColor:
MzanziInnovationHub.of(context)!.theme.errorColor(),
foregroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
overlayColor: Colors.black,
overlayOpacity: 0.5,
children: widget.children,
onOpen: () => debugPrint('OPENING DIAL'),
onClose: () => debugPrint('DIAL CLOSED'),
),
return SpeedDial(
icon: widget.icon,
buttonSize: Size(widget.iconSize ?? 56.0, widget.iconSize ?? 56.0),
animatedIcon: widget.animatedIcon,
direction: widget.direction ?? SpeedDialDirection.up,
activeIcon: Icons.close,
backgroundColor: MzanziInnovationHub.of(context)!.theme.successColor(),
activeBackgroundColor:
MzanziInnovationHub.of(context)!.theme.errorColor(),
foregroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
overlayColor: Colors.black,
overlayOpacity: 0.5,
children: widget.children,
onOpen: () => debugPrint('OPENING DIAL'),
onClose: () => debugPrint('DIAL CLOSED'),
);
}
}

View File

@@ -1,20 +1,20 @@
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
class MihPackageWindow extends StatefulWidget {
final String windowTitle;
final Widget windowBody;
final Widget? windowTools;
// final List<SpeedDialChild> menuOptions;
final List<SpeedDialChild>? menuOptions;
final void Function() onWindowTapClose;
final bool fullscreen;
const MihPackageWindow({
super.key,
required this.fullscreen,
required this.windowTitle,
this.windowTools,
// required this.menuOptions,
this.menuOptions,
required this.onWindowTapClose,
required this.windowBody,
});
@@ -54,66 +54,6 @@ class _MihPackageWindowState extends State<MihPackageWindow> {
}
}
Widget getWindowHeader() {
return Container(
// color: Colors.green,
alignment: Alignment.center,
height: 50,
child: Row(
children: [
Container(
// color: Colors.white,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(25), // Optional: rounds the corners
boxShadow: const [
BoxShadow(
color: Color.fromARGB(
60, 0, 0, 0), // 0.2 opacity = 51 in alpha (255 * 0.2)
spreadRadius: -5,
blurRadius: 5,
offset: Offset(0, 5),
),
],
),
child: IconButton.filled(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
MzanziInnovationHub.of(context)!.theme.errorColor()),
),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
iconSize: 20,
onPressed: () {
widget.onWindowTapClose();
},
icon: const Icon(
Icons.close,
),
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15),
// color: Colors.pink,
child: Text(
widget.windowTitle,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: windowTitleSize,
fontWeight: FontWeight.bold,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
),
widget.windowTools != null ? widget.windowTools! : Container(),
],
),
);
}
@override
void dispose() {
super.dispose();
@@ -139,44 +79,139 @@ class _MihPackageWindowState extends State<MihPackageWindow> {
),
insetAnimationCurve: Easing.emphasizedDecelerate,
insetAnimationDuration: Durations.short1,
child: Container(
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: widget.fullscreen
? Column(
mainAxisSize: MainAxisSize.max,
children: [
getWindowHeader(),
Expanded(
child: SingleChildScrollView(child: widget.windowBody)),
],
)
: Column(
mainAxisSize: MainAxisSize.min,
children: [
getWindowHeader(),
Flexible(
child: Padding(
padding: EdgeInsets.only(
left: 25,
right: 25,
bottom: vertticalWindowPadding,
),
child: ConstrainedBox(
child: Stack(
children: [
Container(
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: widget.fullscreen
? Column(
mainAxisSize: MainAxisSize.max,
children: [
const SizedBox(height: 10),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Text(
widget.windowTitle,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: windowTitleSize,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
),
],
),
const SizedBox(height: 5),
Expanded(
child:
SingleChildScrollView(child: widget.windowBody)),
],
)
: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 10),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Text(
widget.windowTitle,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: windowTitleSize,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
),
],
),
const SizedBox(height: 5),
Flexible(
child: Padding(
padding: EdgeInsets.only(
left: 25,
right: 25,
bottom: vertticalWindowPadding,
),
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: windowHeight * 0.85,
maxWidth: windowWidth * 0.85,
),
child: MihSingleChildScroll(
child: widget.windowBody))),
child:
MihSingleChildScroll(child: widget.windowBody),
),
),
),
],
),
),
Positioned(
top: 10,
left: 10,
child: Container(
// color: Colors.white,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(25), // Optional: rounds the corners
boxShadow: const [
BoxShadow(
color: Color.fromARGB(
60, 0, 0, 0), // 0.2 opacity = 51 in alpha (255 * 0.2)
spreadRadius: -2,
blurRadius: 10,
offset: Offset(0, 5),
),
],
),
child: IconButton.filled(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
MzanziInnovationHub.of(context)!.theme.errorColor()),
),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
iconSize: 20,
onPressed: () {
widget.onWindowTapClose();
},
icon: const Icon(
Icons.close,
),
),
),
),
Visibility(
visible:
widget.menuOptions != null || widget.menuOptions!.isNotEmpty,
child: Positioned(
top: 10,
right: 10,
child: MihFloatingMenu(
iconSize: 40,
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: widget.menuOptions != null ? widget.menuOptions! : [],
),
),
),
],
),
);
}

View File

@@ -15,13 +15,13 @@ abstract class AppEnviroment {
case Enviroment.dev:
{
//================= Android Dev Urls =================
baseApiUrl = "http://10.0.2.2:8080";
baseFileUrl = "http://10.0.2.2:9000";
baseAiUrl = "http://10.0.2.2:11434";
// baseApiUrl = "http://10.0.2.2:8080";
// baseFileUrl = "http://10.0.2.2:9000";
// baseAiUrl = "http://10.0.2.2:11434";
//================= Web Dev Urls =================
// baseApiUrl = "http://localhost:8080";
// baseFileUrl = "http://localhost:9000";
// baseAiUrl = "http://localhost:11434";
baseApiUrl = "http://localhost:8080";
baseFileUrl = "http://localhost:9000";
baseAiUrl = "http://localhost:11434";
whatsappAccessToken =
"EAAPINXuNFdYBOzBjTcvZA2iPXEHbHRF9uNXyP3ihkPRUcBqKNru5g9NKRRKkFaiaITEzO3BMo6CjdUmlDH4qYTW2mzDrZB4Q21ZCEZBgECZCu27vfaOXJZCYQLNxwoXkrZBRYv8ZAP37f69r3z9JxLQxdxn9gwqA3oNZAlBBRapJQzxOr6pZBTdI3bbjbu17ZBIwRcF4JCqPDCNLEZCI3bmHwEd2i2niNMYZD";
//fingerPrintPluginKey = 'h5X7a5j14iUZCobI1ZeX';

View File

@@ -279,7 +279,6 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
),
],
),
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
}),

View File

@@ -436,7 +436,6 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
),
],
),
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
}),

View File

@@ -122,7 +122,6 @@ class _TipCalcState extends State<TipCalc> {
onWindowTapClose: () {
Navigator.pop(context);
},
windowTools: null,
windowBody: Column(
children: [
Row(

View File

@@ -281,122 +281,10 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
),
],
),
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
}),
);
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) => Dialog(
// child: Stack(
// children: [
// Container(
// //padding: const EdgeInsets.all(15.0),
// width: popUpWidth,
// height: popUpheight,
// decoration: BoxDecoration(
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
// borderRadius: BorderRadius.circular(25.0),
// border: Border.all(
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// width: 5.0),
// ),
// child: SingleChildScrollView(
// padding: EdgeInsets.all(popUpPaddingSize),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// "Update Appointment Access",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: popUpTitleSize,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 15.0),
// Text(
// subtitle,
// textAlign: TextAlign.left,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: popUpBodySize,
// //fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 10.0),
// Wrap(
// runSpacing: 10,
// spacing: 10,
// children: [
// SizedBox(
// width: popUpButtonWidth,
// height: 50,
// child: MIHButton(
// onTap: () {
// updateAccessAPICall(index, "declined");
// },
// buttonText: "Decline",
// buttonColor: MzanziInnovationHub.of(context)!
// .theme
// .errorColor(),
// textColor: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// ),
// ),
// SizedBox(
// width: popUpButtonWidth,
// height: 50,
// child: MIHButton(
// onTap: () {
// updateAccessAPICall(index, "approved");
// },
// buttonText: "Approve",
// buttonColor: MzanziInnovationHub.of(context)!
// .theme
// .successColor(),
// textColor: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// ),
// ),
// ],
// )
// ],
// ),
// ),
// ),
// Positioned(
// top: 5,
// right: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// Navigator.pop(context);
// },
// icon: Icon(
// Icons.close,
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
// size: 35,
// ),
// ),
// ),
// ],
// ),
// ),
// );
}
@override

View File

@@ -6,7 +6,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_time_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -156,58 +155,44 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Appointment Details",
windowTools: Visibility(
visible: canEditAppointment(index),
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
SpeedDialChild(
child: Icon(
Icons.edit,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Edit Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
appointmentUpdateWindow(index);
},
),
SpeedDialChild(
child: Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
deleteAppointmentConfirmationWindow(index);
},
),
],
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.edit,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Edit Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
appointmentUpdateWindow(index);
},
),
),
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
deleteAppointmentConfirmationWindow(index);
},
),
],
onWindowTapClose: () {
Navigator.of(context).pop();
widget.dateController.clear();
@@ -257,38 +242,6 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
),
const SizedBox(height: 10),
// Visibility(
// visible: canEditAppointment(index),
// child: SizedBox(
// width: 500,
// height: 50,
// child: MIHButton(
// onTap: () {
// appointmentUpdateWindow(index);
// },
// buttonText: "Edit",
// buttonColor:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// textColor:
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
// ),
// ),
// ),
// SizedBox(
// width: 500,
// height: 50,
// child: MIHButton(
// onTap: () {
// addAppointmentCall();
// checkforchange();
// },
// buttonText: "Add",
// buttonColor:
// MzanziInnovationHub.of(context)!.theme.successColor(),
// textColor:
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
// ),
// ),
],
),
);
@@ -304,58 +257,44 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Appointment Details",
windowTools: Visibility(
visible: canEditAppointment(index),
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
SpeedDialChild(
child: Icon(
Icons.edit,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Edit Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
appointmentUpdateWindow(index);
},
),
SpeedDialChild(
child: Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
deleteAppointmentConfirmationWindow(index);
},
),
],
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.edit,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Edit Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
appointmentUpdateWindow(index);
},
),
),
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Appointment",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
deleteAppointmentConfirmationWindow(index);
},
),
],
onWindowTapClose: () {
Navigator.of(context).pop();
widget.dateController.clear();
@@ -414,38 +353,6 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
),
const SizedBox(height: 20),
// Visibility(
// visible: canEditAppointment(index),
// child: SizedBox(
// width: 500,
// height: 50,
// child: MIHButton(
// onTap: () {
// appointmentUpdateWindow(index);
// },
// buttonText: "Edit",
// buttonColor:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// textColor:
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
// ),
// ),
// ),
// SizedBox(
// width: 500,
// height: 50,
// child: MIHButton(
// onTap: () {
// addAppointmentCall();
// checkforchange();
// },
// buttonText: "Add",
// buttonColor:
// MzanziInnovationHub.of(context)!.theme.successColor(),
// textColor:
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
// ),
// ),
],
),
);
@@ -461,7 +368,6 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Update Appointment",
windowTools: null,
onWindowTapClose: () {
setState(() {
widget.titleController.text = widget.appointmentList[index].title;

View File

@@ -104,7 +104,6 @@ class _PatientAccessRequestState extends State<Appointments> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Add Appointment",
windowTools: null,
onWindowTapClose: () {
Navigator.of(context).pop();
_appointmentDateController.clear();

View File

@@ -3,7 +3,6 @@ import 'dart:convert';
// import 'dart:convert';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_objects/patients.dart';
import 'package:flutter/material.dart';
@@ -857,59 +856,26 @@ class _MIHHomeLegacyState extends State<MIHHomeLegacy> {
)
],
),
windowTools: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
label: "Wallet?",
labelBackgroundColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
onTap: () {},
),
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
label: "Delete File",
labelBackgroundColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
onTap: () {},
),
],
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete File",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {},
),
),
],
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -172,64 +172,64 @@ class _AiChatState extends State<AiChat> {
return MihPackageWindow(
fullscreen: false,
windowTitle: 'Mzansi AI Thoughts',
windowTools: Row(
children: [
Visibility(
visible: _aiThinking == false,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Container(
//color: MzanziInnovationHub.of(context)!.theme.successColor(),
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!
.theme
.successColor(),
borderRadius: const BorderRadius.all(
Radius.circular(100),
),
),
child: IconButton(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onPressed: () async {
print("Start TTS now");
// menuOptions: Row(
// children: [
// Visibility(
// visible: _aiThinking == false,
// child: Padding(
// padding: const EdgeInsets.all(5.0),
// child: Container(
// //color: MzanziInnovationHub.of(context)!.theme.successColor(),
// decoration: BoxDecoration(
// color: MzanziInnovationHub.of(context)!
// .theme
// .successColor(),
// borderRadius: const BorderRadius.all(
// Radius.circular(100),
// ),
// ),
// child: IconButton(
// color: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// onPressed: () async {
// print("Start TTS now");
_speakText(snapshot.requireData);
},
icon: const Icon(Icons.volume_up),
),
),
),
),
Visibility(
visible: _aiThinking == true,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Container(
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
decoration: BoxDecoration(
color:
MzanziInnovationHub.of(context)!.theme.errorColor(),
borderRadius: const BorderRadius.all(
Radius.circular(100),
),
),
child: IconButton(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onPressed: () {
//print("Start TTS now");
_flutterTts.stop();
},
icon: const Icon(Icons.volume_off),
),
),
),
),
],
),
// _speakText(snapshot.requireData);
// },
// icon: const Icon(Icons.volume_up),
// ),
// ),
// ),
// ),
// Visibility(
// visible: _aiThinking == true,
// child: Padding(
// padding: const EdgeInsets.all(5.0),
// child: Container(
// // color: MzanziInnovationHub.of(context)!.theme.errorColor(),
// decoration: BoxDecoration(
// color:
// MzanziInnovationHub.of(context)!.theme.errorColor(),
// borderRadius: const BorderRadius.all(
// Radius.circular(100),
// ),
// ),
// child: IconButton(
// color: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// onPressed: () {
// //print("Start TTS now");
// _flutterTts.stop();
// },
// icon: const Icon(Icons.volume_off),
// ),
// ),
// ),
// ),
// ],
// ),
onWindowTapClose: () {
_captureAIResponse(snapshot.requireData);
_flutterTts.stop();

View File

@@ -5,7 +5,6 @@ import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -154,33 +153,26 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Employee Details",
windowTools: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Employee",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
showDeleteWarning(index);
},
),
],
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Employee",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
showDeleteWarning(index);
},
),
),
],
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -189,7 +189,6 @@ class _BuildUserListState extends State<BuildUserList> {
const SizedBox(height: 10.0),
],
),
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
}));

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:supertokens_flutter/http.dart' as http;
@@ -155,33 +154,26 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Employee Details",
windowTools: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Employee",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
showDeleteWarning(index);
},
),
],
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Employee",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
showDeleteWarning(index);
},
),
),
],
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -190,125 +190,9 @@ class _BuildUserListState extends State<BuildUserList> {
const SizedBox(height: 10.0),
],
),
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
}));
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) => Dialog(
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.all(10.0),
// width: 700.0,
// //height: 475.0,
// decoration: BoxDecoration(
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
// borderRadius: BorderRadius.circular(25.0),
// border: Border.all(
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// width: 5.0),
// ),
// child: SingleChildScrollView(
// padding: const EdgeInsets.symmetric(horizontal: 10),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Text(
// "Add Employee",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: 35.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 25.0),
// MIHTextField(
// controller: fnameController,
// hintText: "Username Name",
// editable: false,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: lnameController,
// hintText: "Email",
// editable: false,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHDropdownField(
// controller: typeController,
// hintText: "Title",
// dropdownOptions: const ["Doctor", "Assistant"],
// required: true,
// editable: true,
// ),
// const SizedBox(height: 10.0),
// MIHDropdownField(
// controller: accessController,
// hintText: "Access",
// dropdownOptions: const ["Full", "Partial"],
// required: true,
// editable: true,
// ),
// const SizedBox(height: 30.0),
// SizedBox(
// width: 300,
// height: 50,
// child: MIHButton(
// buttonText: "Add",
// buttonColor: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// textColor: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// onTap: () {
// if (isRequiredFieldsCaptured()) {
// createBusinessUserAPICall(index);
// } else {
// showDialog(
// context: context,
// builder: (context) {
// return const MIHErrorMessage(
// errorType: "Input Error");
// },
// );
// }
// },
// ),
// )
// ],
// ),
// ),
// ),
// Positioned(
// top: 5,
// right: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// Navigator.pop(context);
// },
// icon: Icon(
// Icons.close,
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
// size: 35,
// ),
// ),
// ),
// ],
// ),
// ),
// );
}
@override

View File

@@ -6,7 +6,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
@@ -52,7 +51,6 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Edit Loyalty Card",
windowTools: null,
onWindowTapClose: () {
_cardNumberController.clear();
_nicknameController.clear();
@@ -60,6 +58,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
},
windowBody: Column(
children: [
const SizedBox(height: 10),
MIHTextField(
controller: _nicknameController,
hintText: "Card Title",
@@ -279,89 +278,79 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: widget.cardList[index].shop_name.toUpperCase(),
windowTools: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
SpeedDialChild(
child: widget.cardList[index].favourite == ""
? Icon(
Icons.favorite,
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
)
: Icon(
Icons.favorite_border,
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
label: widget.cardList[index].favourite == ""
? "Add to Favourite"
: "Remove from Favourite",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
if (widget.cardList[index].favourite == "") {
addToFavCardWindow(context, index);
} else {
removeFromFavCardWindow(context, index);
}
},
),
SpeedDialChild(
child: Icon(
Icons.edit,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Edit Card Details",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
setState(() {
_cardNumberController.text =
widget.cardList[index].card_number;
_nicknameController.text = widget.cardList[index].nickname;
});
editCardWindow(context, index);
},
),
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Card",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
deleteCardWindow(context, index);
},
),
],
menuOptions: [
SpeedDialChild(
child: widget.cardList[index].favourite == ""
? Icon(
Icons.favorite,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
)
: Icon(
Icons.favorite_border,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: widget.cardList[index].favourite == ""
? "Add to Favourite"
: "Remove from Favourite",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
if (widget.cardList[index].favourite == "") {
addToFavCardWindow(context, index);
} else {
removeFromFavCardWindow(context, index);
}
},
),
),
SpeedDialChild(
child: Icon(
Icons.edit,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Edit Card Details",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
setState(() {
_cardNumberController.text = widget.cardList[index].card_number;
_nicknameController.text = widget.cardList[index].nickname;
});
editCardWindow(context, index);
},
),
SpeedDialChild(
child: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Delete Card",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
deleteCardWindow(context, index);
},
),
],
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -84,7 +84,6 @@ class _MihCardsState extends State<MihCards> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Add New Loyalty Card",
windowTools: null,
onWindowTapClose: () {
shopController.clear();
cardNumberController.clear();

View File

@@ -170,7 +170,6 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Patient Appointment",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},
@@ -327,7 +326,6 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Patient Profile",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -103,7 +103,6 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Patient Appointment",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},
@@ -220,7 +219,6 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Patient Profile",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -225,7 +225,6 @@ class _WaitingRoomState extends State<WaitingRoom> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Appointment Type",
windowTools: null,
onWindowTapClose: () {
Navigator.of(context).pop();
},
@@ -303,7 +302,6 @@ class _WaitingRoomState extends State<WaitingRoom> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Add Appointment",
windowTools: null,
onWindowTapClose: () {
Navigator.of(context).pop();
_appointmentDateController.clear();

View File

@@ -392,7 +392,6 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Generate Claim/ Statement Document",
windowTools: null,
onWindowTapClose: () {
// medicineController.clear();
// quantityController.clear();

View File

@@ -40,7 +40,6 @@ class _ICD10SearchWindowState extends State<ICD10SearchWindow> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "ICD-10 Search",
windowTools: null,
onWindowTapClose: () {
// medicineController.clear();
// quantityController.clear();

View File

@@ -68,7 +68,6 @@ class _MedicineSearchState extends State<MedicineSearch> {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Select Medicine",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -2,7 +2,6 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_api.dart';
import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -130,14 +129,8 @@ class _BuildClaimStatementFileListState
)
],
),
windowTools: Visibility(
visible: hasAccessToDelete,
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
menuOptions: hasAccessToDelete
? [
SpeedDialChild(
child: Icon(
Icons.delete,
@@ -158,25 +151,8 @@ class _BuildClaimStatementFileListState
deleteFilePopUp(filePath, fileID);
},
),
],
),
),
),
// [
// Visibility(
// visible: hasAccessToDelete,
// child: IconButton(
// onPressed: () {
// deleteFilePopUp(filePath, fileID);
// },
// icon: Icon(
// size: 35,
// Icons.delete,
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// ),
// ),
// ),
// ],
]
: null,
onWindowTapClose: () {
Navigator.pop(context);
},

View File

@@ -115,7 +115,8 @@ class _BuildFileViewState extends State<BuildFileView> {
//double height = MediaQuery.sizeOf(context).height;
debugPrint(widget.link);
if (getExtType(widget.path).toLowerCase() == "pdf") {
return Expanded(
return SizedBox(
height: 500,
child: Stack(
fit: StackFit.expand,
children: [
@@ -185,9 +186,8 @@ class _BuildFileViewState extends State<BuildFileView> {
),
);
} else {
return Expanded(
// height: height,
// padding: const EdgeInsets.all(10.0),
return SizedBox(
height: 500,
child: Stack(
fit: StackFit.expand,
children: [

View File

@@ -1,9 +1,9 @@
import 'dart:convert';
import 'package:fl_downloader/fl_downloader.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -19,6 +19,8 @@ import 'package:mzansi_innovation_hub/mih_objects/patients.dart';
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_file_view.dart';
import 'package:flutter/material.dart';
import 'package:supertokens_flutter/http.dart' as http;
import 'package:http/http.dart' as http2;
import "package:universal_html/html.dart" as html;
class BuildFilesList extends StatefulWidget {
final AppUser signedInUser;
@@ -160,6 +162,39 @@ class _BuildFilesListState extends State<BuildFilesList> {
);
}
String getFileName(String path) {
//print(pdfLink.split(".")[1]);
return path.split("/").last;
}
void printDocument(String link, String path) async {
http2.Response response = await http.get(Uri.parse(link));
var pdfData = response.bodyBytes;
Navigator.of(context).pushNamed(
'/file-veiwer/print-preview',
arguments: PrintPreviewArguments(
pdfData,
getFileName(path),
),
);
}
void nativeFileDownload(String fileLink) async {
var permission = await FlDownloader.requestPermission();
if (permission == StoragePermissionStatus.granted) {
try {
mihLoadingPopUp();
await FlDownloader.download(fileLink);
Navigator.of(context).pop();
} on Exception catch (error) {
Navigator.of(context).pop();
print(error);
}
} else {
print("denied");
}
}
void viewFilePopUp(String fileName, String filePath, int fileID, String url) {
bool hasAccessToDelete = false;
if (widget.type == "business") {
@@ -169,29 +204,58 @@ class _BuildFilesListState extends State<BuildFilesList> {
context: context,
barrierDismissible: false,
builder: (context) => MihPackageWindow(
fullscreen: true,
fullscreen: false,
windowTitle: fileName,
windowBody: Column(
children: [
BuildFileView(
link: url,
path: filePath,
//pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
),
const SizedBox(
height: 10,
)
],
windowBody: BuildFileView(
link: url,
path: filePath,
//pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
),
windowTools: Visibility(
visible: hasAccessToDelete,
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
SpeedDialChild(
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.download,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Download",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
if (MzanziInnovationHub.of(context)!.theme.getPlatform() ==
"Web") {
html.window.open(url, 'download');
} else {
nativeFileDownload(url);
}
printDocument(url, filePath);
},
),
SpeedDialChild(
child: Icon(
Icons.print,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Print",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
printDocument(url, filePath);
},
),
hasAccessToDelete == true
? SpeedDialChild(
child: Icon(
Icons.delete,
color:
@@ -210,116 +274,42 @@ class _BuildFilesListState extends State<BuildFilesList> {
onTap: () {
deleteFilePopUp(filePath, fileID);
},
)
: SpeedDialChild(
child: Icon(
Icons.fullscreen,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
label: "Full Screen",
labelBackgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
labelStyle: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontWeight: FontWeight.bold,
),
backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
printDocument(url, filePath);
},
),
],
),
),
),
],
onWindowTapClose: () {
Navigator.pop(context);
},
),
);
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) => Dialog(
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.all(10.0),
// width: 800.0,
// //height: 475.0,
// decoration: BoxDecoration(
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
// borderRadius: BorderRadius.circular(25.0),
// border: Border.all(
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// width: 5.0),
// ),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// const SizedBox(
// height: 25,
// ),
// Text(
// fileName,
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: 35.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 25.0),
// Expanded(
// child: BuildFileView(
// link: url,
// path: filePath,
// //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
// )),
// const SizedBox(height: 30.0),
// SizedBox(
// width: 300,
// height: 50,
// child: MIHButton(
// onTap: () {
// html.window.open(
// url,
// // '${AppEnviroment.baseFileUrl}/mih/$filePath',
// 'download');
// },
// buttonText: "Dowload",
// buttonColor: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// textColor:
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
// ),
// )
// ],
// ),
// ),
// Positioned(
// top: 5,
// right: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// Navigator.pop(context);
// },
// icon: Icon(
// Icons.close,
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
// size: 35,
// ),
// ),
// ),
// Positioned(
// top: 5,
// left: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// deleteFilePopUp(filePath, fileID);
// },
// icon: Icon(
// Icons.delete,
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// ),
// ),
// ),
// ],
// ),
// ),
// );
}
void mihLoadingPopUp() {
showDialog(
context: context,
builder: (context) {
return const Mihloadingcircle();
},
);
}
@override

View File

@@ -4,7 +4,6 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -139,16 +138,10 @@ class _BuildNotesListState extends State<BuildNotesList> {
context: context,
barrierDismissible: false,
builder: (context) => MihPackageWindow(
fullscreen: true,
windowTitle: selectednote.note_name,
windowTools: Visibility(
visible: hasAccessToDelete,
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: MihFloatingMenu(
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: [
fullscreen: false,
windowTitle: "Note Details",
menuOptions: hasAccessToDelete
? [
SpeedDialChild(
child: Icon(
Icons.delete,
@@ -169,15 +162,14 @@ class _BuildNotesListState extends State<BuildNotesList> {
deletePatientPopUp(selectednote.idpatient_notes);
},
),
],
),
),
),
]
: null,
onWindowTapClose: () {
Navigator.pop(context);
},
windowBody: Column(
children: [
const SizedBox(height: 10.0),
MIHTextField(
controller: businessNameController,
hintText: "Office",
@@ -206,7 +198,8 @@ class _BuildNotesListState extends State<BuildNotesList> {
required: false,
),
const SizedBox(height: 10.0),
Expanded(
SizedBox(
height: 250,
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",

View File

@@ -87,7 +87,6 @@ class _PatientConsultationState extends State<PatientConsultation> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Add Note",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
titleController.clear();

View File

@@ -224,7 +224,6 @@ class _PatientDocumentsState extends State<PatientDocuments> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Upload File",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},
@@ -291,7 +290,6 @@ class _PatientDocumentsState extends State<PatientDocuments> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Create Medical Certificate",
windowTools: null,
onWindowTapClose: () {
Navigator.pop(context);
},
@@ -340,7 +338,6 @@ class _PatientDocumentsState extends State<PatientDocuments> {
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Create Prescription",
windowTools: null,
onWindowTapClose: () {
medicineController.clear();
quantityController.clear();