NEW: MIh Alerts
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_zero.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
|
||||||
@@ -59,16 +60,21 @@ class _PackageTestState extends State<PackageTest> {
|
|||||||
|
|
||||||
MihPackageTools getTools() {
|
MihPackageTools getTools() {
|
||||||
Map<Widget, void Function()?> temp = Map();
|
Map<Widget, void Function()?> temp = Map();
|
||||||
temp[const Icon(Icons.inbox)] = () {
|
temp[const Icon(Icons.warning)] = () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selcetedIndex = 0;
|
_selcetedIndex = 0;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
temp[const Icon(Icons.outbond)] = () {
|
temp[const Icon(Icons.inbox)] = () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selcetedIndex = 1;
|
_selcetedIndex = 1;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
temp[const Icon(Icons.outbond)] = () {
|
||||||
|
setState(() {
|
||||||
|
_selcetedIndex = 2;
|
||||||
|
});
|
||||||
|
};
|
||||||
return MihPackageTools(
|
return MihPackageTools(
|
||||||
tools: temp,
|
tools: temp,
|
||||||
selcetedIndex: _selcetedIndex,
|
selcetedIndex: _selcetedIndex,
|
||||||
@@ -76,13 +82,14 @@ class _PackageTestState extends State<PackageTest> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showAlert() {
|
void showAlert() {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getToolBody() {
|
List<Widget> getToolBody() {
|
||||||
MzansiProfileProvider profileProvider =
|
MzansiProfileProvider profileProvider =
|
||||||
context.read<MzansiProfileProvider>();
|
context.read<MzansiProfileProvider>();
|
||||||
List<Widget> toolBodies = [
|
List<Widget> toolBodies = [
|
||||||
|
const PackageToolZero(),
|
||||||
PackageToolOne(
|
PackageToolOne(
|
||||||
user: profileProvider.user!,
|
user: profileProvider.user!,
|
||||||
business: profileProvider.business,
|
business: profileProvider.business,
|
||||||
@@ -94,6 +101,7 @@ class _PackageTestState extends State<PackageTest> {
|
|||||||
|
|
||||||
List<String> getToolTitle() {
|
List<String> getToolTitle() {
|
||||||
List<String> toolTitles = [
|
List<String> toolTitles = [
|
||||||
|
"Tool Zero",
|
||||||
"Tool One",
|
"Tool One",
|
||||||
"Tool Two",
|
"Tool Two",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -645,7 +645,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
|||||||
const SnackBar(content: Text("Input Valid")),
|
const SnackBar(content: Text("Input Valid")),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
|
|||||||
@@ -0,0 +1,403 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
|
|
||||||
|
class PackageToolZero extends StatefulWidget {
|
||||||
|
const PackageToolZero({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PackageToolZero> createState() => _PackageToolZeroState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageToolZeroState extends State<PackageToolZero> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MihPackageToolBody(
|
||||||
|
borderOn: false,
|
||||||
|
bodyItem: getBody(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getBody() {
|
||||||
|
return MihSingleChildScroll(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"This is Package Tool Zero to test MIH Alerts",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
"This is the message for the success message",
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Basic Success Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().successAdvancedAlert(
|
||||||
|
"Success!",
|
||||||
|
"This is the advanced alert message",
|
||||||
|
[
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
elevation: 10,
|
||||||
|
child: Text(
|
||||||
|
"Okay",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
elevation: 10,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Advanced Success Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().warningAlert(
|
||||||
|
"Warning Alert!", "This is a friendly warning mee", context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Warning Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().errorBasicAlert(
|
||||||
|
"Error!",
|
||||||
|
"Thisis the basic error alert message",
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Basic Error Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().errorAdvancedAlert(
|
||||||
|
"Error!",
|
||||||
|
"This is the advanced alert message",
|
||||||
|
[
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
elevation: 10,
|
||||||
|
child: Text(
|
||||||
|
"Okay",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
elevation: 10,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Advanced Error Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().deleteConfirmationAlert(
|
||||||
|
"THis is a delete confirmation",
|
||||||
|
() {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Delete Confirmation Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Internet Connection Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().locationPermissionAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Location Permission Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().inputErrorAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Input Error Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().passwordRequirementAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: FittedBox(
|
||||||
|
child: Text(
|
||||||
|
"Password Requirement Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().passwordMatchAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Password Match Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().loginErrorAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Login Error Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().emailExistsAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Email Exists Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
MihAlertServices().invalidEmailAlert(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Invalid Email Alert",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,7 +43,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
|||||||
arguments: widget.signedInUser,
|
arguments: widget.signedInUser,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
|
|
||||||
class MihPackageAlert extends StatefulWidget {
|
|
||||||
final Widget alertIcon;
|
|
||||||
final String alertTitle;
|
|
||||||
final Widget alertBody;
|
|
||||||
final Color alertColour;
|
|
||||||
const MihPackageAlert({
|
|
||||||
super.key,
|
|
||||||
required this.alertIcon,
|
|
||||||
required this.alertTitle,
|
|
||||||
required this.alertBody,
|
|
||||||
required this.alertColour,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MihPackageAlert> createState() => _MihPackageAlertState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MihPackageAlertState extends State<MihPackageAlert> {
|
|
||||||
late double popUpWidth;
|
|
||||||
late double? popUpheight;
|
|
||||||
late double popUpTitleSize;
|
|
||||||
late double popUpSubtitleSize;
|
|
||||||
late double popUpBodySize;
|
|
||||||
late double popUpIconSize;
|
|
||||||
late double popUpPaddingSize;
|
|
||||||
Size? size;
|
|
||||||
|
|
||||||
void checkScreenSize() {
|
|
||||||
if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") {
|
|
||||||
setState(() {
|
|
||||||
popUpWidth = (size!.width / 4) * 2;
|
|
||||||
popUpheight = null;
|
|
||||||
popUpTitleSize = 30.0;
|
|
||||||
popUpSubtitleSize = 20.0;
|
|
||||||
popUpBodySize = 15;
|
|
||||||
popUpPaddingSize = 25.0;
|
|
||||||
popUpIconSize = 100;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
popUpWidth = size!.width - (size!.width * 0.1);
|
|
||||||
popUpheight = null;
|
|
||||||
popUpTitleSize = 25.0;
|
|
||||||
popUpSubtitleSize = 18.0;
|
|
||||||
popUpBodySize = 15;
|
|
||||||
popUpPaddingSize = 15.0;
|
|
||||||
popUpIconSize = 100;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
size = MediaQuery.of(context).size;
|
|
||||||
checkScreenSize();
|
|
||||||
return Dialog(
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(popUpPaddingSize),
|
|
||||||
width: popUpWidth,
|
|
||||||
height: popUpheight,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
|
||||||
border: Border.all(color: widget.alertColour, width: 5.0),
|
|
||||||
),
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
widget.alertIcon,
|
|
||||||
//const SizedBox(height: 5),
|
|
||||||
Text(
|
|
||||||
widget.alertTitle,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: widget.alertColour,
|
|
||||||
fontSize: popUpTitleSize,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
widget.alertBody,
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 5,
|
|
||||||
right: 5,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.close,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
size: 35,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,11 +3,11 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:local_auth/local_auth.dart';
|
import 'package:local_auth/local_auth.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_yt_video_player.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_yt_video_player.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
|
|
||||||
class MihPackageTile extends StatefulWidget {
|
class MihPackageTile extends StatefulWidget {
|
||||||
final String appName;
|
final String appName;
|
||||||
@@ -40,6 +40,7 @@ class _MihPackageTileState extends State<MihPackageTile> {
|
|||||||
void displayHint() {
|
void displayHint() {
|
||||||
if (widget.ytVideoID != null) {
|
if (widget.ytVideoID != null) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihPackageWindow(
|
return MihPackageWindow(
|
||||||
@@ -89,82 +90,67 @@ class _MihPackageTileState extends State<MihPackageTile> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void authErrorPopUp() {
|
void authErrorPopUp() {
|
||||||
Widget alertpopUp = MihPackageAlert(
|
MihAlertServices().errorAdvancedAlert(
|
||||||
alertIcon: Icon(
|
"Biometric Authentication Required",
|
||||||
Icons.fingerprint,
|
"Hi there! To jump into the ${widget.appName} Package, you'll need to authenticate yourself with your devices biometrics, please set up biometric authentication (like fingerprint, face ID, pattern or pin) on your device first.\n\nIf you have already set up biometric authentication, press \"Authenticate now\" to try again or press \"Set Up Authentication\" to go to your device settings.",
|
||||||
color: MihColors.getRedColor(
|
[
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MihButton(
|
||||||
size: 100,
|
onPressed: () {
|
||||||
),
|
Navigator.of(context).pop();
|
||||||
alertTitle: "Biometric Authentication Required",
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
children: [
|
width: 300,
|
||||||
Text(
|
child: Text(
|
||||||
"Hi there! To jump into the ${widget.appName} Package, you'll need to authenticate yourself with your devices biometrics, please set up biometric authentication (like fingerprint, face ID, pattern or pin) on your device first.\n\nIf you have already set up biometric authentication, press \"Authenticate now\" to try again or press \"Set Up Authentication\" to go to your device settings.",
|
"Dismiss",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15,
|
color: MihColors.getPrimaryColor(
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
Wrap(
|
MihButton(
|
||||||
runAlignment: WrapAlignment.center,
|
onPressed: () {
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
AppSettings.openAppSettings(
|
||||||
spacing: 10,
|
type: AppSettingsType.security,
|
||||||
runSpacing: 10,
|
);
|
||||||
children: [
|
Navigator.of(context).pop();
|
||||||
MihButton(
|
},
|
||||||
onPressed: () {
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
AppSettings.openAppSettings(
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
type: AppSettingsType.security,
|
width: 300,
|
||||||
);
|
child: Text(
|
||||||
Navigator.of(context).pop();
|
"Set Up Authentication",
|
||||||
},
|
style: TextStyle(
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
width: 300,
|
fontSize: 20,
|
||||||
child: Text(
|
fontWeight: FontWeight.bold,
|
||||||
"Set Up Authentication",
|
),
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
authenticateUser();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Authenticate Now",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
MihButton(
|
||||||
alertColour: MihColors.getRedColor(
|
onPressed: () {
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
Navigator.of(context).pop();
|
||||||
);
|
authenticateUser();
|
||||||
showDialog(
|
},
|
||||||
context: context,
|
buttonColor: MihColors.getGreenColor(
|
||||||
builder: (context) {
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
return alertpopUp;
|
width: 300,
|
||||||
},
|
child: Text(
|
||||||
|
"Authenticate Now",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
@@ -68,78 +67,16 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
|
|||||||
message =
|
message =
|
||||||
"You've declined the access request. ${widget.accessRequests[index].Name} will not have access to your profile.";
|
"You've declined the access request. ${widget.accessRequests[index].Name} will not have access to your profile.";
|
||||||
}
|
}
|
||||||
successPopUp(message);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: popUpIconSize,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: popUpTitleSize,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: popUpBodySize,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget displayQueue(int index) {
|
Widget displayQueue(int index) {
|
||||||
String line1 =
|
String line1 =
|
||||||
"Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}";
|
"Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}";
|
||||||
@@ -210,7 +147,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
|
|||||||
// ),
|
// ),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (access == "CANCELLED") {
|
if (access == "CANCELLED") {
|
||||||
MihAlertServices().warningMessage(
|
MihAlertServices().warningAlert(
|
||||||
"Access Cancelled",
|
"Access Cancelled",
|
||||||
"This appointment has been canceled. As a result, access has been cancelled and the doctor no longer have access to the patient's profile. If you would like them to view the patient's profile again, please book a new appointment through them.",
|
"This appointment has been canceled. As a result, access has been cancelled and the doctor no longer have access to the patient's profile. If you would like them to view the patient's profile again, please book a new appointment through them.",
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -350,7 +349,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
|
|||||||
successPopUp("Successfully Actioned Request",
|
successPopUp("Successfully Actioned Request",
|
||||||
"You have successfully Declined access request");
|
"You have successfully Declined access request");
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getRedColor(
|
buttonColor: MihColors.getRedColor(
|
||||||
@@ -391,7 +390,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
|
|||||||
successPopUp("Successfully Actioned Request",
|
successPopUp("Successfully Actioned Request",
|
||||||
"You have successfully Accepted access request");
|
"You have successfully Accepted access request");
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -424,60 +423,34 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
KenLogger.warning("dismissing pop up and refreshing list");
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
if (widget.onSuccessUpate != null) {
|
||||||
),
|
widget.onSuccessUpate!();
|
||||||
alertTitle: title,
|
}
|
||||||
alertBody: Column(
|
},
|
||||||
children: [
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
KenLogger.warning("dismissing pop up and refreshing list");
|
|
||||||
if (widget.onSuccessUpate != null) {
|
|
||||||
widget.onSuccessUpate!();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
|||||||
final String companyName = 'Mzansi Innovation Hub';
|
final String companyName = 'Mzansi Innovation Hub';
|
||||||
|
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MihPackageWindow(
|
builder: (context) => MihPackageWindow(
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
@@ -383,7 +384,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
|||||||
FocusScope.of(context)
|
FocusScope.of(context)
|
||||||
.requestFocus(FocusNode());
|
.requestFocus(FocusNode());
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ class _TipCalcState extends State<TipCalc> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
validateInput();
|
validateInput();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/access_request.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/access_request.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
@@ -68,78 +67,16 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
|
|||||||
message =
|
message =
|
||||||
"You've declined the access request. ${widget.accessRequests[index].Name} will not have access to your profile.";
|
"You've declined the access request. ${widget.accessRequests[index].Name} will not have access to your profile.";
|
||||||
}
|
}
|
||||||
successPopUp(message);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: popUpIconSize,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: popUpTitleSize,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: popUpBodySize,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget displayQueue(int index) {
|
Widget displayQueue(int index) {
|
||||||
String line1 =
|
String line1 =
|
||||||
"Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}";
|
"Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}";
|
||||||
@@ -210,7 +147,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
|
|||||||
// ),
|
// ),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (access == "CANCELLED") {
|
if (access == "CANCELLED") {
|
||||||
MihAlertServices().warningMessage(
|
MihAlertServices().warningAlert(
|
||||||
"Access Cancelled",
|
"Access Cancelled",
|
||||||
"This appointment has been canceled. As a result, access has been cancelled and the doctor no longer have access to the patient's profile. If you would like them to view the patient's profile again, please book a new appointment through them.",
|
"This appointment has been canceled. As a result, access has been cancelled and the doctor no longer have access to the patient's profile. If you would like them to view the patient's profile again, please book a new appointment through them.",
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/appointment.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/appointment.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -523,7 +522,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
updateAppointmentCall(mzansiProfileProvider,
|
updateAppointmentCall(mzansiProfileProvider,
|
||||||
mihCalendarProvider, index);
|
mihCalendarProvider, index);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -569,7 +568,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
MzansiProfileProvider mzansiProfileProvider,
|
MzansiProfileProvider mzansiProfileProvider,
|
||||||
MihCalendarProvider mihCalendarProvider,
|
MihCalendarProvider mihCalendarProvider,
|
||||||
int index) {
|
int index) {
|
||||||
MihAlertServices().deleteConfirmationMessage(
|
MihAlertServices().deleteConfirmationAlert(
|
||||||
"This appointment will be deleted permanently from your calendar. Are you certain you want to delete it?",
|
"This appointment will be deleted permanently from your calendar. Are you certain you want to delete it?",
|
||||||
() {
|
() {
|
||||||
deleteAppointmentCall(
|
deleteAppointmentCall(
|
||||||
@@ -635,10 +634,10 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
successPopUp("Successfully Updated Appointment",
|
successPopUp("Successfully Updated Appointment",
|
||||||
"You appointment has been successfully updated.");
|
"You appointment has been successfully updated.");
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,65 +661,40 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
if (statucCode == 200) {
|
if (statucCode == 200) {
|
||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
successPopUp("Successfully Deleted Appointment",
|
clearControllers();
|
||||||
"You appointment has been successfully deleted from your calendar.");
|
// successPopUp("Successfully Deleted Appointment",
|
||||||
|
// "You appointment has been successfully deleted from your calendar.");
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
clearControllers();
|
||||||
color: MihColors.getGreenColor(
|
Navigator.of(context).pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
},
|
||||||
),
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
alertTitle: title,
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
clearControllers();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_calendar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_calendar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -212,7 +211,7 @@ class _PatientAccessRequestState extends State<Appointments> {
|
|||||||
addAppointmentCall(
|
addAppointmentCall(
|
||||||
mzansiProfileProvider, mihCalendarProvider);
|
mzansiProfileProvider, mihCalendarProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -301,71 +300,45 @@ class _PatientAccessRequestState extends State<Appointments> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
checkforchange();
|
checkforchange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
setState(() {
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
_appointmentDateController.clear();
|
||||||
),
|
_appointmentTimeController.clear();
|
||||||
alertTitle: title,
|
_appointmentTitleController.clear();
|
||||||
alertBody: Column(
|
_appointmentDescriptionIDController.clear();
|
||||||
children: [
|
});
|
||||||
Text(
|
},
|
||||||
message,
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
setState(() {
|
|
||||||
_appointmentDateController.clear();
|
|
||||||
_appointmentTimeController.clear();
|
|
||||||
_appointmentTitleController.clear();
|
|
||||||
_appointmentDescriptionIDController.clear();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
@@ -49,123 +48,69 @@ class _MihForgotPasswordState extends State<MihForgotPassword> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void prePassResteWarning() {
|
void prePassResteWarning() {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
"Password Reset Confirmation",
|
||||||
builder: (context) {
|
"Before you reset your password, please be aware that you'll receive an email with a link to confirm your identity and set a new password. Make sure to check your inbox, including spam or junk folders. If you don't receive the email within a few minutes, please try resending the reset request.",
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.warning_amber_rounded,
|
onPressed: () {
|
||||||
size: 100,
|
setState(() {
|
||||||
color: MihColors.getSecondaryColor(
|
acceptWarning = true;
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
});
|
||||||
),
|
context.pop();
|
||||||
alertTitle: "Password Reset Confirmation",
|
validateInput();
|
||||||
alertBody: Column(
|
},
|
||||||
//mainAxisSize: MainAxisSize.max,
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 25.0),
|
|
||||||
child: Text(
|
|
||||||
"Before you reset your password, please be aware that you'll receive an email with a link to confirm your identity and set a new password. Make sure to check your inbox, including spam or junk folders. If you don't receive the email within a few minutes, please try resending the reset request.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
acceptWarning = true;
|
|
||||||
});
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
validateInput();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Continue",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
width: 300,
|
||||||
},
|
child: Text(
|
||||||
|
"Continue",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetLinkSentSuccessfully() {
|
void resetLinkSentSuccessfully() {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
"Successfully Sent Reset Link",
|
||||||
builder: (context) {
|
"We've sent a password reset link to your email address. Please check your inbox, including spam or junk folders.\n\nOnce you find the email, click on the link to reset your password.\n\nIf you don't receive the email within a few minutes, please try resending the reset request.\n\nThe reset link will expire after 2 hours",
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.goNamed(
|
||||||
color: MihColors.getGreenColor(
|
'mihHome',
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
extra: true,
|
||||||
),
|
);
|
||||||
alertTitle: "Successfully Sent Reset Link",
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"We've sent a password reset link to your email address. Please check your inbox, including spam or junk folders.\n\nOnce you find the email, click on the link to reset your password.\n\nIf you don't receive the email within a few minutes, please try resending the reset request.\n\nThe reset link will expire after 2 hours",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.goNamed(
|
|
||||||
'mihHome',
|
|
||||||
extra: true,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
width: 300,
|
||||||
},
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateInput() async {
|
void validateInput() async {
|
||||||
if (emailController.text.isEmpty) {
|
if (emailController.text.isEmpty) {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
} else {
|
} else {
|
||||||
await submitPasswodReset();
|
await submitPasswodReset();
|
||||||
if (successfulForgotPassword) {
|
if (successfulForgotPassword) {
|
||||||
@@ -254,7 +199,7 @@ class _MihForgotPasswordState extends State<MihForgotPassword> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
prePassResteWarning();
|
prePassResteWarning();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
@@ -77,9 +76,9 @@ class _MihRegisterState extends State<MihRegister> {
|
|||||||
Future<void> signUserUp() async {
|
Future<void> signUserUp() async {
|
||||||
context.read<MzansiProfileProvider>().reset();
|
context.read<MzansiProfileProvider>().reset();
|
||||||
if (!validEmail()) {
|
if (!validEmail()) {
|
||||||
MihAlertServices().invalidEmailError(context);
|
MihAlertServices().invalidEmailAlert(context);
|
||||||
} else if (passwordController.text != confirmPasswordController.text) {
|
} else if (passwordController.text != confirmPasswordController.text) {
|
||||||
MihAlertServices().passwordMatchError(context);
|
MihAlertServices().passwordMatchAlert(context);
|
||||||
} else {
|
} else {
|
||||||
//var _backgroundColor = Colors.transparent;
|
//var _backgroundColor = Colors.transparent;
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -99,7 +98,7 @@ class _MihRegisterState extends State<MihRegister> {
|
|||||||
var userExists = jsonDecode(response.body);
|
var userExists = jsonDecode(response.body);
|
||||||
if (userExists["exists"]) {
|
if (userExists["exists"]) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
MihAlertServices().emailExistsError(context);
|
MihAlertServices().emailExistsAlert(context);
|
||||||
} else {
|
} else {
|
||||||
var response2 = await http.post(
|
var response2 = await http.post(
|
||||||
Uri.parse("$baseAPI/auth/signup"),
|
Uri.parse("$baseAPI/auth/signup"),
|
||||||
@@ -126,10 +125,10 @@ class _MihRegisterState extends State<MihRegister> {
|
|||||||
//print("Here1");
|
//print("Here1");
|
||||||
} else if (userCreated["status"] == "FIELD_ERROR") {
|
} else if (userCreated["status"] == "FIELD_ERROR") {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
MihAlertServices().passwordRequiredError(context);
|
MihAlertServices().passwordRequirementAlert(context);
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,29 +154,29 @@ class _MihRegisterState extends State<MihRegister> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loginError(error) {
|
void loginError(error) {
|
||||||
showDialog(
|
MihAlertServices().errorAdvancedAlert(
|
||||||
context: context,
|
"Sign Up Error",
|
||||||
builder: (context) {
|
"An error occurred while signing up: $error Please try again later.",
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.warning_amber_rounded,
|
onPressed: () {
|
||||||
color: MihColors.getRedColor(
|
Navigator.of(context).pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
},
|
||||||
size: 100,
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
alertTitle: "Error While Signing Up",
|
width: 200,
|
||||||
alertBody: Text(
|
child: Text(
|
||||||
"An error occurred while signing up. Please try again later.",
|
"Dismiss",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getPrimaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
alertColour: MihColors.getRedColor(
|
),
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
],
|
||||||
);
|
context,
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +199,7 @@ class _MihRegisterState extends State<MihRegister> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitFormInput();
|
submitFormInput();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -302,7 +301,7 @@ class _MihRegisterState extends State<MihRegister> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitFormInput();
|
submitFormInput();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
@@ -32,7 +31,7 @@ class _MihResetPasswordState extends State<MihResetPassword> {
|
|||||||
|
|
||||||
void submitFormInput() async {
|
void submitFormInput() async {
|
||||||
if (passwordController.text != confirmPasswordController.text) {
|
if (passwordController.text != confirmPasswordController.text) {
|
||||||
MihAlertServices().passwordMatchError(context);
|
MihAlertServices().passwordMatchAlert(context);
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -46,65 +45,39 @@ class _MihResetPasswordState extends State<MihResetPassword> {
|
|||||||
if (successfulResetPassword) {
|
if (successfulResetPassword) {
|
||||||
resetSuccessfully();
|
resetSuccessfully();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetSuccessfully() {
|
void resetSuccessfully() {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
"Successfully Reset Password",
|
||||||
builder: (context) {
|
"Great news! Your password reset is complete. You can now log in to Mzansi Innovation Hub using your new password.",
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.goNamed(
|
||||||
color: MihColors.getGreenColor(
|
'mihHome',
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
extra: true,
|
||||||
),
|
);
|
||||||
alertTitle: "Successfully Reset Password",
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Great news! Your password reset is complete. You can now log in to Mzansi Innovation Hub using your new password.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.goNamed(
|
|
||||||
'mihHome',
|
|
||||||
extra: true,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +100,7 @@ class _MihResetPasswordState extends State<MihResetPassword> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitFormInput();
|
submitFormInput();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -212,7 +185,7 @@ class _MihResetPasswordState extends State<MihResetPassword> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitFormInput();
|
submitFormInput();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ class _MihSignInState extends State<MihSignIn> {
|
|||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
if (!successfulSignIn) {
|
if (!successfulSignIn) {
|
||||||
MihAlertServices().loginErrorMessage(context);
|
MihAlertServices().loginErrorAlert(context);
|
||||||
passwordController.clear();
|
passwordController.clear();
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
passwordController.clear();
|
passwordController.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ class _MihSignInState extends State<MihSignIn> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitSignInForm();
|
submitSignInForm();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appName: "Patient",
|
appName: "Patient",
|
||||||
@@ -100,7 +100,7 @@ class _MihSignInState extends State<MihSignIn> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitSignInForm();
|
submitSignInForm();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appName: "Doctor",
|
appName: "Doctor",
|
||||||
@@ -124,7 +124,7 @@ class _MihSignInState extends State<MihSignIn> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitSignInForm();
|
submitSignInForm();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appName: "Business",
|
appName: "Business",
|
||||||
@@ -147,7 +147,7 @@ class _MihSignInState extends State<MihSignIn> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitSignInForm();
|
submitSignInForm();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appName: "Test",
|
appName: "Test",
|
||||||
@@ -201,7 +201,7 @@ class _MihSignInState extends State<MihSignIn> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitSignInForm();
|
submitSignInForm();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -359,7 +359,7 @@ class _MihSignInState extends State<MihSignIn> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitSignInForm();
|
submitSignInForm();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'package:mzansi_innovation_hub/mih_objects/user_consent.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
@@ -129,38 +128,8 @@ class _MihHomeState extends State<MihHome> {
|
|||||||
children: [
|
children: [
|
||||||
MihPackageWindow(
|
MihPackageWindow(
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: "Privacy Policy & Terms Of Service Alert!",
|
windowTitle: null,
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: null,
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageAlert(
|
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.warning_amber_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
alertTitle: "Oops, Looks like you missed a step!",
|
|
||||||
alertBody: Text(
|
|
||||||
"We're excited for you to keep using the MIH app! Before you do, please take a moment to accept our Privacy Policy and Terms of Service. Thanks for helping us keep your experience great!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark",
|
|
||||||
),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
windowBody: Column(
|
windowBody: Column(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
@@ -190,7 +159,7 @@ class _MihHomeState extends State<MihHome> {
|
|||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
|
||||||
),
|
),
|
||||||
fontSize: 15,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class MihMineSweeperLeaderBoard extends StatefulWidget {
|
|||||||
|
|
||||||
class _MihMineSweeperLeaderBoardState extends State<MihMineSweeperLeaderBoard> {
|
class _MihMineSweeperLeaderBoardState extends State<MihMineSweeperLeaderBoard> {
|
||||||
TextEditingController filterController = TextEditingController();
|
TextEditingController filterController = TextEditingController();
|
||||||
|
bool isLoading = true;
|
||||||
Future<void> initialiseLeaderboard() async {
|
Future<void> initialiseLeaderboard() async {
|
||||||
MihMineSweeperProvider mineSweeperProvider =
|
MihMineSweeperProvider mineSweeperProvider =
|
||||||
context.read<MihMineSweeperProvider>();
|
context.read<MihMineSweeperProvider>();
|
||||||
@@ -39,10 +39,16 @@ class _MihMineSweeperLeaderBoardState extends State<MihMineSweeperLeaderBoard> {
|
|||||||
}
|
}
|
||||||
mineSweeperProvider.setLeaderboardUserPictures(
|
mineSweeperProvider.setLeaderboardUserPictures(
|
||||||
leaderboardUserPictures: userPictures);
|
leaderboardUserPictures: userPictures);
|
||||||
|
setState(() {
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshLeaderBoard(
|
void refreshLeaderBoard(
|
||||||
MihMineSweeperProvider mineSweeperProvider, String difficulty) {
|
MihMineSweeperProvider mineSweeperProvider, String difficulty) {
|
||||||
|
setState(() {
|
||||||
|
isLoading = true;
|
||||||
|
});
|
||||||
mineSweeperProvider.setDifficulty(difficulty);
|
mineSweeperProvider.setDifficulty(difficulty);
|
||||||
mineSweeperProvider.setLeaderboard(leaderboard: null);
|
mineSweeperProvider.setLeaderboard(leaderboard: null);
|
||||||
mineSweeperProvider.setMyScoreboard(myScoreboard: null);
|
mineSweeperProvider.setMyScoreboard(myScoreboard: null);
|
||||||
@@ -80,7 +86,7 @@ class _MihMineSweeperLeaderBoardState extends State<MihMineSweeperLeaderBoard> {
|
|||||||
return Consumer<MihMineSweeperProvider>(
|
return Consumer<MihMineSweeperProvider>(
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
MihMineSweeperProvider mineSweeperProvider, Widget? child) {
|
MihMineSweeperProvider mineSweeperProvider, Widget? child) {
|
||||||
if (mineSweeperProvider.leaderboard == null) {
|
if (isLoading) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Mihloadingcircle(),
|
child: Mihloadingcircle(),
|
||||||
);
|
);
|
||||||
@@ -121,7 +127,7 @@ class _MihMineSweeperLeaderBoardState extends State<MihMineSweeperLeaderBoard> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
mineSweeperProvider.leaderboard!.isEmpty
|
!isLoading && mineSweeperProvider.leaderboard!.isEmpty
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart'
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart';
|
||||||
@@ -130,6 +130,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
// Intermediate - 10 * 15 & 23 bombs
|
// Intermediate - 10 * 15 & 23 bombs
|
||||||
// Hard - 10 * 20 & 30 bombs
|
// Hard - 10 * 20 & 30 bombs
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihMineSweeperStartGameWindow(
|
return MihMineSweeperStartGameWindow(
|
||||||
@@ -252,99 +253,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
board[r][c].isOpened = true;
|
board[r][c].isOpened = true;
|
||||||
isGameOver = true;
|
isGameOver = true;
|
||||||
// lose alert
|
// lose alert
|
||||||
showDialog(
|
loseAlert(mihMineSweeperProvider);
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageAlert(
|
|
||||||
alertIcon: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Icon(
|
|
||||||
FontAwesomeIcons.bomb,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
size: 100,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
alertTitle: "Better Luck Next Time",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Your lost this game of MIH Minesweeper!!!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Text(
|
|
||||||
"Please feel free to start a New Game or check out the Leader Board to find out who's the best in Mzansi.",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Wrap(
|
|
||||||
runAlignment: WrapAlignment.center,
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
|
||||||
spacing: 10,
|
|
||||||
runSpacing: 10,
|
|
||||||
children: [
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
showStartGameWindow(mihMineSweeperProvider);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"New Game",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
mihMineSweeperProvider.setToolIndex(1);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getOrangeColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Leader Board",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -384,111 +293,7 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
isGameWon = true;
|
isGameWon = true;
|
||||||
isGameOver = true;
|
isGameOver = true;
|
||||||
// win alert
|
// win alert
|
||||||
showDialog(
|
winAlert(mihMineSweeperProvider);
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageAlert(
|
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.celebration,
|
|
||||||
color: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
size: 100,
|
|
||||||
),
|
|
||||||
alertTitle: "Congratulations",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Your won this game of MIH Minesweeper!!!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
// Text(
|
|
||||||
// "You took ${_formatTime()} to complete the game on ${mihMineSweeperProvider.difficulty} mode.",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 15,
|
|
||||||
// color: MihColors.getSecondaryColor(
|
|
||||||
// MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 10),
|
|
||||||
Text(
|
|
||||||
"Time Taken: ${_formatTime().replaceAll("00:", "")}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Text(
|
|
||||||
"Score: ${calculateGameScore(mihMineSweeperProvider)}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Wrap(
|
|
||||||
runAlignment: WrapAlignment.center,
|
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
|
||||||
spacing: 10,
|
|
||||||
runSpacing: 10,
|
|
||||||
children: [
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
showStartGameWindow(mihMineSweeperProvider);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"New Game",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
mihMineSweeperProvider.setToolIndex(1);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getOrangeColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Leader Board",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
@@ -530,6 +335,264 @@ class _MineSweeperGameState extends State<MineSweeperGame> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loseAlert(MihMineSweeperProvider mihMineSweeperProvider) {
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return MihPackageWindow(
|
||||||
|
fullscreen: false,
|
||||||
|
windowTitle: null,
|
||||||
|
onWindowTapClose: null,
|
||||||
|
backgroundColor: MihColors.getRedColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||||
|
windowBody: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Icon(
|
||||||
|
FontAwesomeIcons.bomb,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
size: 125,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Better Luck Next Time",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
"Your lost this game of MIH Minesweeper!!!",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Text(
|
||||||
|
"Please feel free to start a New Game or check out the Leader Board to find out who's the best in Mzansi.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Wrap(
|
||||||
|
runAlignment: WrapAlignment.center,
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
spacing: 10,
|
||||||
|
runSpacing: 10,
|
||||||
|
children: [
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
mihMineSweeperProvider.setToolIndex(1);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGoldColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Leader Board",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"View Board",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
showStartGameWindow(mihMineSweeperProvider);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"New Game",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void winAlert(MihMineSweeperProvider mihMineSweeperProvider) {
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return MihPackageWindow(
|
||||||
|
fullscreen: false,
|
||||||
|
windowTitle: null,
|
||||||
|
onWindowTapClose: null,
|
||||||
|
backgroundColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
windowBody: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Icon(
|
||||||
|
Icons.celebration,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
size: 150,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Congratulations",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Text(
|
||||||
|
"Your won this game of MIH Minesweeper!!!",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Time Taken: ${_formatTime().replaceAll("00:", "")}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Score: ${calculateGameScore(mihMineSweeperProvider)}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Wrap(
|
||||||
|
runAlignment: WrapAlignment.center,
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
spacing: 10,
|
||||||
|
runSpacing: 10,
|
||||||
|
children: [
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
mihMineSweeperProvider.setLeaderboard(leaderboard: null);
|
||||||
|
context.pop();
|
||||||
|
mihMineSweeperProvider.setToolIndex(1);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGoldColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Leader Board",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"View Board",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
showStartGameWindow(mihMineSweeperProvider);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"New Game",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
|
|||||||
@@ -1,896 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_radio_options.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_chat_ui/flutter_chat_ui.dart';
|
|
||||||
import 'package:flutter_chat_types/flutter_chat_types.dart' as types;
|
|
||||||
import 'package:flutter/services.dart' show rootBundle;
|
|
||||||
import 'package:flutter_tts/flutter_tts.dart';
|
|
||||||
import 'package:ollama_dart/ollama_dart.dart' as ollama;
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:uuid/uuid.dart';
|
|
||||||
|
|
||||||
class AiChat extends StatefulWidget {
|
|
||||||
const AiChat({
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AiChat> createState() => _AiChatState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AiChatState extends State<AiChat> {
|
|
||||||
final TextEditingController _modelController = TextEditingController();
|
|
||||||
final TextEditingController _fontSizeController = TextEditingController();
|
|
||||||
final TextEditingController _ttsVoiceController = TextEditingController();
|
|
||||||
final ValueNotifier<bool> _showModelOptions = ValueNotifier(false);
|
|
||||||
FlutterTts _flutterTts = FlutterTts();
|
|
||||||
final ValueNotifier<String> _ttsVoiceName = ValueNotifier("");
|
|
||||||
// bool _ttsOn = false;
|
|
||||||
String? textStream;
|
|
||||||
List<Map> _voices = [];
|
|
||||||
List<String> _voicesString = [];
|
|
||||||
List<types.Message> _messages = [];
|
|
||||||
late types.User _user;
|
|
||||||
late types.User _mihAI;
|
|
||||||
String systemPromt = "0";
|
|
||||||
bool _aiThinking = false;
|
|
||||||
final client = ollama.OllamaClient(
|
|
||||||
baseUrl: "${AppEnviroment.baseAiUrl}/api",
|
|
||||||
);
|
|
||||||
List<ollama.Message> _chatHistory = [];
|
|
||||||
double _chatFrontSize = 15;
|
|
||||||
|
|
||||||
String getModel() {
|
|
||||||
return AppEnviroment.getEnv() == "Prod" ? 'gemma3n:e4b' : "gemma3:1b";
|
|
||||||
}
|
|
||||||
|
|
||||||
String setSystemPromt() {
|
|
||||||
String temp = "";
|
|
||||||
temp +=
|
|
||||||
"You are Mzansi AI, a helpful and friendly AI assistant running on the 'MIH App'.\n";
|
|
||||||
temp +=
|
|
||||||
"The MIH App was created by 'Mzansi Innovation Hub', a South African-based startup company.";
|
|
||||||
temp +=
|
|
||||||
"Your primary purpose is to assist users by answering general questions and helping with creative writing tasks or any other task a user might have for you.\n";
|
|
||||||
temp +=
|
|
||||||
"Maintain a casual and friendly tone, but always remain professional.\n";
|
|
||||||
temp +=
|
|
||||||
"Strive for a balance between being empathetic and delivering factual information accurately.\n";
|
|
||||||
temp +=
|
|
||||||
"You may use lighthearted or playful language if the context is appropriate and enhances the user experience.\n";
|
|
||||||
temp += "You operate within the knowledge domain of the 'MIH App'.\n";
|
|
||||||
temp += "Here is a description of the MIH App and its features:\n";
|
|
||||||
temp +=
|
|
||||||
"MIH App Description: MIH is the first super app of Mzansi, designed to streamline both personal and business life. It's an all-in-one platform for managing professional profiles, teams, appointments, and quick calculations. \n";
|
|
||||||
temp += "Key Features:\n";
|
|
||||||
temp +=
|
|
||||||
"- Mzansi Profile: Central hub for managing personal and business information, including business team details.";
|
|
||||||
temp += "- Mzansi Wallet: Digitally store loyalty cards.\n";
|
|
||||||
temp +=
|
|
||||||
"- Patient Manager (For Medical Practices): Seamless patient appointment scheduling and data management.\n";
|
|
||||||
temp +=
|
|
||||||
"- Mzansi AI: Your friendly AI assistant for quick answers and support (that's you!).\n";
|
|
||||||
temp +=
|
|
||||||
"- Mzansi Directory: A place to search and find out more about the people and businesses across Mzansi.\n";
|
|
||||||
temp +=
|
|
||||||
"- Calendar: Integrated calendar for managing personal and business appointments.\n";
|
|
||||||
temp +=
|
|
||||||
"- Calculator: Simple calculator with tip and forex calculation functionality.\n";
|
|
||||||
temp += "- MIH Access: Manage and view profile access security.\n";
|
|
||||||
temp +=
|
|
||||||
"- MIH Minesweeper: The first game from MIH! It's the classic brain-teaser ready to entertain you no matter where you are.\n";
|
|
||||||
temp += "**Core Rules and Guidelines:**\n";
|
|
||||||
temp +=
|
|
||||||
"- **Accuracy First:** Always prioritize providing correct information.\n";
|
|
||||||
temp +=
|
|
||||||
"- **Uncertainty Handling:** If you are unsure about an answer, politely respond with: 'Please bear with us as we are still learning and do not have all the answers.'\n";
|
|
||||||
temp +=
|
|
||||||
"- **Response Length:** Aim to keep responses under 250 words. If a more comprehensive answer is required, exceed this limit but offer to elaborate further (e.g., 'Would you like me to elaborate on this topic?').\n";
|
|
||||||
temp +=
|
|
||||||
"- **Language & Safety:** Never use offensive language or generate harmful content. If a user presses for information that is inappropriate or out of bounds, clearly state why you cannot provide it (e.g., 'I cannot assist with that request as it goes against my safety guidelines.').\n";
|
|
||||||
temp +=
|
|
||||||
"- **Out-of-Scope Questions:** - If a question is unclear, ask the user to rephrase or clarify it. - If a question is entirely out of your scope and you cannot provide a useful answer, admit you don't know. - If a user is unhappy with your response or needs further assistance beyond your capabilities, suggest they visit the 'Mzansi Innovation Hub Social Media Pages' for more direct support. Do not provide specific links, just refer to the pages generally.\n";
|
|
||||||
temp +=
|
|
||||||
"- **Target Audience:** Adapt your explanations to beginners and intermediate users, but be prepared for more complex questions from expert users. Ensure your language is clear and easy to understand.\n";
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _addMessage(types.Message message) {
|
|
||||||
setState(() {
|
|
||||||
_messages.insert(0, message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _loadMessages() async {
|
|
||||||
final response = await rootBundle.loadString('assets/messages.json');
|
|
||||||
final messages = (jsonDecode(response) as List)
|
|
||||||
.map((e) => types.Message.fromJson(e as Map<String, dynamic>))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_messages = messages;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _handleSendPressed(types.PartialText message) {
|
|
||||||
FocusScope.of(context).unfocus();
|
|
||||||
final textMessage = types.TextMessage(
|
|
||||||
author: _user,
|
|
||||||
createdAt: DateTime.now().millisecondsSinceEpoch,
|
|
||||||
id: const Uuid().v4(),
|
|
||||||
text: message.text,
|
|
||||||
);
|
|
||||||
//Add user prompt to history
|
|
||||||
setState(() {
|
|
||||||
_chatHistory.add(
|
|
||||||
ollama.Message(
|
|
||||||
role: ollama.MessageRole.user,
|
|
||||||
content: message.text,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
_addMessage(textMessage);
|
|
||||||
|
|
||||||
_handleMessageBack(message.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _handleMessageBack(String userMessage) async {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return const Mihloadingcircle();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
Stream<String> aiChatStream =
|
|
||||||
_generateChatCompletionWithHistoryStream(userMessage, client);
|
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: false,
|
|
||||||
builder: (context) {
|
|
||||||
return responseWindow(aiChatStream);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget responseWindow(
|
|
||||||
Stream<String> aiChatStream,
|
|
||||||
) {
|
|
||||||
return StreamBuilder(
|
|
||||||
stream: aiChatStream,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.hasData) {
|
|
||||||
textStream = snapshot.requireData;
|
|
||||||
// print("Text: $textStream");
|
|
||||||
// _speakText(textStream!);
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: 'Mzansi AI Thoughts',
|
|
||||||
menuOptions: _aiThinking == true
|
|
||||||
? null
|
|
||||||
: [
|
|
||||||
SpeedDialChild(
|
|
||||||
child: Icon(
|
|
||||||
Icons.volume_up,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
label: "Read Aloud",
|
|
||||||
labelBackgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
onTap: () {
|
|
||||||
_speakText(snapshot.requireData);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
onWindowTapClose: () {
|
|
||||||
_captureAIResponse(snapshot.requireData);
|
|
||||||
_flutterTts.stop();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
windowBody: SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
// color: Colors.black,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
// SelectionArea(
|
|
||||||
// child: GptMarkdown(
|
|
||||||
// snapshot.requireData,
|
|
||||||
// textAlign: TextAlign.left,
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: MihColors.getSecondaryColor(
|
|
||||||
// MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
// "Dark"),
|
|
||||||
// fontSize: _chatFrontSize,
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
SelectionArea(
|
|
||||||
child: Text(
|
|
||||||
snapshot.requireData,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: _chatFrontSize,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: 'Mzansi AI Thoughts',
|
|
||||||
// windowTools: [],
|
|
||||||
onWindowTapClose: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
windowBody: Mihloadingcircle(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _captureAIResponse(String responseMessage) {
|
|
||||||
types.TextMessage textMessage;
|
|
||||||
setState(() {
|
|
||||||
_chatHistory.add(
|
|
||||||
ollama.Message(
|
|
||||||
role: ollama.MessageRole.assistant,
|
|
||||||
content: responseMessage,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
textMessage = types.TextMessage(
|
|
||||||
author: _mihAI,
|
|
||||||
createdAt: DateTime.now().millisecondsSinceEpoch,
|
|
||||||
id: const Uuid().v4(),
|
|
||||||
|
|
||||||
text: responseMessage
|
|
||||||
.replaceAll("<think>\n\n", "**Thinking:**\n")
|
|
||||||
.replaceAll("<think>\n", "**Thinking:**\n")
|
|
||||||
.replaceAll("</think>\n\n", "\n**Answer:**\n"), //message.text,
|
|
||||||
);
|
|
||||||
|
|
||||||
_addMessage(textMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
Stream<String> _generateChatCompletionWithHistoryStream(
|
|
||||||
String userMessage,
|
|
||||||
final ollama.OllamaClient client,
|
|
||||||
) async* {
|
|
||||||
final aiStream = client.generateChatCompletionStream(
|
|
||||||
request: ollama.GenerateChatCompletionRequest(
|
|
||||||
model: _modelController.text,
|
|
||||||
messages: _chatHistory,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
String text = '';
|
|
||||||
setState(() {
|
|
||||||
_aiThinking = true;
|
|
||||||
});
|
|
||||||
await for (final res in aiStream) {
|
|
||||||
text += (res.message.content);
|
|
||||||
yield text;
|
|
||||||
}
|
|
||||||
setState(() {
|
|
||||||
_aiThinking = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _resetChat() {
|
|
||||||
setState(() {
|
|
||||||
_messages = [];
|
|
||||||
_chatHistory = [];
|
|
||||||
_loadMessages();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatTheme getChatTheme() {
|
|
||||||
return DarkChatTheme(
|
|
||||||
backgroundColor: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
inputBackgroundColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
inputTextColor: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
inputTextCursorColor: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
primaryColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
secondaryColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
errorColor: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
sentMessageBodyTextStyle: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: _chatFrontSize,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
fontFamily: 'Segoe UI',
|
|
||||||
),
|
|
||||||
receivedMessageBodyTextStyle: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: _chatFrontSize,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
fontFamily: 'Segoe UI',
|
|
||||||
),
|
|
||||||
emptyChatPlaceholderTextStyle: TextStyle(
|
|
||||||
color: MihColors.getGreyColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: _chatFrontSize,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
fontFamily: 'Segoe UI',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _getSettings() {
|
|
||||||
return ValueListenableBuilder(
|
|
||||||
valueListenable: _showModelOptions,
|
|
||||||
builder: (BuildContext context, bool value, Widget? child) {
|
|
||||||
return Visibility(
|
|
||||||
visible: value,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: FittedBox(
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
|
||||||
border: Border.all(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
width: 3.0),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Settings",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 300,
|
|
||||||
child: MihRadioOptions(
|
|
||||||
controller: _modelController,
|
|
||||||
hintText: "AI Model",
|
|
||||||
fillColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
secondaryFillColor: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
requiredText: true,
|
|
||||||
radioOptions: [getModel()],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 230,
|
|
||||||
child: MihDropdownField(
|
|
||||||
controller: _ttsVoiceController,
|
|
||||||
hintText: "AI Voice",
|
|
||||||
dropdownOptions: _voicesString,
|
|
||||||
editable: true,
|
|
||||||
enableSearch: true,
|
|
||||||
requiredText: true,
|
|
||||||
validator: (value) {
|
|
||||||
return MihValidationServices().isEmpty(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Container(
|
|
||||||
// color: Colors.white,
|
|
||||||
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: Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 2.0,
|
|
||||||
left: 5.0,
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton.filled(
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor:
|
|
||||||
WidgetStateProperty.all<Color>(
|
|
||||||
MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.mode ==
|
|
||||||
"Dark")),
|
|
||||||
),
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.mode ==
|
|
||||||
"Dark"),
|
|
||||||
iconSize: 25,
|
|
||||||
onPressed: () {
|
|
||||||
print("Start TTS now");
|
|
||||||
_speakText(
|
|
||||||
"This is the sample of the Mzansi A.I Voice.");
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.volume_up,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 300,
|
|
||||||
child: MihNumericStepper(
|
|
||||||
controller: _fontSizeController,
|
|
||||||
fillColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
inputColor: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
hintText: "Font Size",
|
|
||||||
requiredText: true,
|
|
||||||
minValue: 1,
|
|
||||||
// maxValue: 5,
|
|
||||||
validationOn: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadingPopUp(BuildContext context) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return const Mihloadingcircle();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _speakText(String text) async {
|
|
||||||
try {
|
|
||||||
loadingPopUp(context);
|
|
||||||
await _flutterTts.stop(); // Stop any ongoing speech
|
|
||||||
await _flutterTts.speak(text).then((value) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}); // Speak the new text
|
|
||||||
} catch (e) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
print("TTS Error: $e");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTtsVoice(String voiceName) {
|
|
||||||
_flutterTts.setVoice(
|
|
||||||
{
|
|
||||||
"name": voiceName,
|
|
||||||
"locale": _voices
|
|
||||||
.where((_voice) => _voice["name"].contains(voiceName))
|
|
||||||
.first["locale"]
|
|
||||||
},
|
|
||||||
);
|
|
||||||
_ttsVoiceController.text = voiceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void voiceSelected() {
|
|
||||||
if (_ttsVoiceController.text.isNotEmpty) {
|
|
||||||
_ttsVoiceName.value = _ttsVoiceController.text;
|
|
||||||
// print(
|
|
||||||
// "======================================== Voice Set ========================================");
|
|
||||||
setTtsVoice(_ttsVoiceController.text);
|
|
||||||
} else {
|
|
||||||
_ttsVoiceName.value = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void fontSizeChanged() {
|
|
||||||
setState(() {
|
|
||||||
_chatFrontSize = double.parse(_fontSizeController.text);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
_modelController.dispose();
|
|
||||||
_fontSizeController.dispose();
|
|
||||||
_ttsVoiceController.dispose();
|
|
||||||
_ttsVoiceController.removeListener(voiceSelected);
|
|
||||||
_fontSizeController.removeListener(fontSizeChanged);
|
|
||||||
client.endSession();
|
|
||||||
_flutterTts.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void initTTS() {
|
|
||||||
_flutterTts.setVolume(1);
|
|
||||||
_fontSizeController.addListener(fontSizeChanged);
|
|
||||||
// _flutterTts.setSpeechRate(0.6);
|
|
||||||
// _flutterTts.setPitch(1.0);
|
|
||||||
_flutterTts.getVoices.then(
|
|
||||||
(data) {
|
|
||||||
try {
|
|
||||||
_voices = List<Map>.from(data);
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_voices = _voices
|
|
||||||
.where(
|
|
||||||
(_voice) => _voice["name"].toLowerCase().contains("en-us"))
|
|
||||||
.toList();
|
|
||||||
_voicesString =
|
|
||||||
_voices.map((_voice) => _voice["name"] as String).toList();
|
|
||||||
_voicesString.sort();
|
|
||||||
setTtsVoice(_voicesString.first);
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
print(e);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
MzansiAiProvider mzansiAiProvider = context.read<MzansiAiProvider>();
|
|
||||||
MzansiProfileProvider mzansiProfileProvider =
|
|
||||||
context.read<MzansiProfileProvider>();
|
|
||||||
_user = types.User(
|
|
||||||
firstName: mzansiProfileProvider.user!.fname,
|
|
||||||
id: mzansiProfileProvider
|
|
||||||
.user!.app_id, //'82091008-a484-4a89-ae75-a22bf8d6f3ac',
|
|
||||||
);
|
|
||||||
_mihAI = types.User(
|
|
||||||
firstName: "Mzansi AI",
|
|
||||||
id: const Uuid().v4(),
|
|
||||||
);
|
|
||||||
_modelController.text = getModel();
|
|
||||||
_fontSizeController.text = _chatFrontSize.ceil().toString();
|
|
||||||
systemPromt = setSystemPromt();
|
|
||||||
_chatHistory.add(
|
|
||||||
ollama.Message(
|
|
||||||
role: ollama.MessageRole.system,
|
|
||||||
content: systemPromt,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
initTTS();
|
|
||||||
_ttsVoiceController.addListener(voiceSelected);
|
|
||||||
if (mzansiAiProvider.startUpQuestion != null &&
|
|
||||||
mzansiAiProvider.startUpQuestion!.isNotEmpty) {
|
|
||||||
final partialText =
|
|
||||||
types.PartialText(text: mzansiAiProvider.startUpQuestion!);
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
_handleSendPressed(partialText);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return MihPackageToolBody(
|
|
||||||
borderOn: false,
|
|
||||||
bodyItem: getBody(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget getBody() {
|
|
||||||
return Stack(
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
_getSettings(),
|
|
||||||
Expanded(
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
if (_showModelOptions.value == true) {
|
|
||||||
setState(() {
|
|
||||||
_showModelOptions.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Chat(
|
|
||||||
messages: _messages,
|
|
||||||
emptyState: noMessagescDisplay(),
|
|
||||||
// onAttachmentPressed: _handleAttachmentPressed,
|
|
||||||
// onMessageTap: _handleMessageTap,
|
|
||||||
// onPreviewDataFetched: _handlePreviewDataFetched,
|
|
||||||
onSendPressed: _handleSendPressed,
|
|
||||||
showUserAvatars: false,
|
|
||||||
showUserNames: false,
|
|
||||||
user: _user,
|
|
||||||
theme: getChatTheme(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
left: 15,
|
|
||||||
top: 15,
|
|
||||||
child: Visibility(
|
|
||||||
visible: _showModelOptions.value == true,
|
|
||||||
child: Container(
|
|
||||||
// color: Colors.white,
|
|
||||||
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: Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 2.0,
|
|
||||||
left: 5.0,
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
width: 40,
|
|
||||||
child: IconButton.filled(
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStateProperty.all<Color>(
|
|
||||||
MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark")),
|
|
||||||
),
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
iconSize: 20,
|
|
||||||
onPressed: () {
|
|
||||||
if (_showModelOptions.value == true) {
|
|
||||||
setState(() {
|
|
||||||
_showModelOptions.value = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
_showModelOptions.value = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.close,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// IconButton.filled(
|
|
||||||
// iconSize: 20,
|
|
||||||
// onPressed: () {
|
|
||||||
// if (_showModelOptions.value == true) {
|
|
||||||
// setState(() {
|
|
||||||
// _showModelOptions.value = false;
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// setState(() {
|
|
||||||
// _showModelOptions.value = true;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// icon: const Icon(
|
|
||||||
// Icons.settings,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 10,
|
|
||||||
bottom: 80,
|
|
||||||
child: MihFloatingMenu(
|
|
||||||
animatedIcon: AnimatedIcons.menu_close,
|
|
||||||
children: [
|
|
||||||
SpeedDialChild(
|
|
||||||
child: Icon(
|
|
||||||
Icons.refresh,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
label: "New Chat",
|
|
||||||
labelBackgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
onTap: () {
|
|
||||||
_resetChat();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SpeedDialChild(
|
|
||||||
child: Icon(
|
|
||||||
Icons.settings,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
label: "Settings",
|
|
||||||
labelBackgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
onTap: () {
|
|
||||||
if (_showModelOptions.value == true) {
|
|
||||||
setState(() {
|
|
||||||
_showModelOptions.value = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
_showModelOptions.value = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget? noMessagescDisplay() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
// const SizedBox(height: 50),
|
|
||||||
Icon(
|
|
||||||
MihIcons.mzansiAi,
|
|
||||||
size: 165,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Text(
|
|
||||||
"Mzansi AI is here to help",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
overflow: TextOverflow.visible,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
"Send us a message and we'll try our best to assist you"),
|
|
||||||
// WidgetSpan(
|
|
||||||
// alignment: PlaceholderAlignment.middle,
|
|
||||||
// child: Icon(
|
|
||||||
// Icons.menu,
|
|
||||||
// size: 20,
|
|
||||||
// color: MzansiInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .secondaryColor(),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// TextSpan(text: " to add your first loyalty card."),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -240,7 +240,7 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
searchPressed(
|
searchPressed(
|
||||||
profileProvider, directoryProvider);
|
profileProvider, directoryProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().errorAlert(
|
MihAlertServices().errorBasicAlert(
|
||||||
"Business Type Not Selected",
|
"Business Type Not Selected",
|
||||||
"Please ensure you have selected a Business Type before seareching for Businesses of Mzansi",
|
"Please ensure you have selected a Business Type before seareching for Businesses of Mzansi",
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -25,6 +27,26 @@ class MihAddBookmarkAlert extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
||||||
|
Future<void> getFavouriteBusinesses() async {
|
||||||
|
MzansiDirectoryProvider directoryProvider =
|
||||||
|
context.read<MzansiDirectoryProvider>();
|
||||||
|
MzansiProfileProvider profileProvider =
|
||||||
|
context.read<MzansiProfileProvider>();
|
||||||
|
await MihMzansiDirectoryServices().getAllUserBookmarkedBusiness(
|
||||||
|
profileProvider.user!.app_id,
|
||||||
|
directoryProvider,
|
||||||
|
);
|
||||||
|
List<Business> favBus = [];
|
||||||
|
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||||
|
await MihBusinessDetailsServices()
|
||||||
|
.getBusinessDetailsByBusinessId(bus.business_id)
|
||||||
|
.then((business) {
|
||||||
|
favBus.add(business!);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
directoryProvider.setFavouriteBusinesses(businesses: favBus);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> addBookmark(
|
Future<void> addBookmark(
|
||||||
MzansiProfileProvider profileProvider, String business_id) async {
|
MzansiProfileProvider profileProvider, String business_id) async {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -43,7 +65,7 @@ class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
|||||||
"${widget.business.Name} has successfully been added to favourite businessess in the Mzansi Directory.",
|
"${widget.business.Name} has successfully been added to favourite businessess in the Mzansi Directory.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().errorAlert(
|
MihAlertServices().errorBasicAlert(
|
||||||
"Error Adding Bookmark",
|
"Error Adding Bookmark",
|
||||||
"An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.",
|
"An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.",
|
||||||
context,
|
context,
|
||||||
@@ -53,58 +75,33 @@ class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () async {
|
||||||
size: 150,
|
await getFavouriteBusinesses();
|
||||||
color: MihColors.getGreenColor(
|
widget.onSuccessDismissPressed!.call();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
context.pop();
|
||||||
),
|
context.pop();
|
||||||
alertTitle: title,
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
widget.onSuccessDismissPressed!.call();
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,24 +110,35 @@ class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
|||||||
return Consumer<MzansiProfileProvider>(
|
return Consumer<MzansiProfileProvider>(
|
||||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||||
Widget? child) {
|
Widget? child) {
|
||||||
return MihPackageAlert(
|
return MihPackageWindow(
|
||||||
alertColour: MihColors.getSecondaryColor(
|
fullscreen: false,
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
windowTitle: null,
|
||||||
alertIcon: Icon(
|
onWindowTapClose: null,
|
||||||
Icons.warning_rounded,
|
windowBody: Column(
|
||||||
size: 100,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Bookmark Business",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.warning_rounded,
|
||||||
|
size: 150,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Bookmark Business",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
Text(
|
Text(
|
||||||
"Are you sure you want to save ${widget.business.Name} to your Mzansi Directory?",
|
"Are you sure you want to save ${widget.business.Name} to your Mzansi Directory?",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
fontSize: 15,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -45,62 +44,36 @@ class _MihAddEmployeeWindowState extends State<MihAddEmployeeWindow> {
|
|||||||
"${widget.user.username} is now apart of your team with ${accessController.text} access to ${mzansiProfileProvider.business!.Name}";
|
"${widget.user.username} is now apart of your team with ${accessController.text} access to ${mzansiProfileProvider.business!.Name}";
|
||||||
successPopUp(message, false);
|
successPopUp(message, false);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message, bool stayOnPersonalSide) {
|
void successPopUp(String message, bool stayOnPersonalSide) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
"Successfully Added Employee",
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
},
|
||||||
),
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
alertTitle: "Successfully Updated Profile",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,10 +166,10 @@ class _MihAddEmployeeWindowState extends State<MihAddEmployeeWindow> {
|
|||||||
if (isRequiredFieldsCaptured()) {
|
if (isRequiredFieldsCaptured()) {
|
||||||
createBusinessUserAPICall(mzansiProfileProvider);
|
createBusinessUserAPICall(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -58,34 +60,11 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
if (await canLaunchUrl(url)) {
|
if (await canLaunchUrl(url)) {
|
||||||
await launchUrl(url);
|
await launchUrl(url);
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Error Making Call",
|
||||||
builder: (context) {
|
"We couldn't open your phone app to call $formattedNumber. To fix this, make sure you have a phone application installed and it's set as your default dialer.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
);
|
||||||
Icons.warning_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Making Call",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"We couldn't open your phone app to call ${widget.business.contact_no}. To fix this, make sure you have a phone application installed and it's set as your default dialer.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,34 +89,11 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
if (await canLaunchUrl(emailLaunchUri)) {
|
if (await canLaunchUrl(emailLaunchUri)) {
|
||||||
await launchUrl(emailLaunchUri);
|
await launchUrl(emailLaunchUri);
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Error Creating Email",
|
||||||
builder: (context) {
|
"We couldn't launch your email app to send a message to $recipient. To fix this, please confirm that you have an email application installed and that it's set as your default.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
);
|
||||||
Icons.warning_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Creating Email",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"We couldn't launch your email app to send a message to ${widget.business.bus_email}. To fix this, please confirm that you have an email application installed and that it's set as your default.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,64 +109,18 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
if (await canLaunchUrl(googleMapsUrl)) {
|
if (await canLaunchUrl(googleMapsUrl)) {
|
||||||
await launchUrl(googleMapsUrl);
|
await launchUrl(googleMapsUrl);
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Error Opening Maps",
|
||||||
builder: (context) {
|
"There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
);
|
||||||
Icons.warning_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Creating Maps",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Error Opening Maps",
|
||||||
builder: (context) {
|
"There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
);
|
||||||
Icons.warning_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Creating Maps",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,65 +134,18 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
if (await canLaunchUrl(url)) {
|
if (await canLaunchUrl(url)) {
|
||||||
await launchUrl(url);
|
await launchUrl(url);
|
||||||
} else {
|
} else {
|
||||||
print('Could not launch $urlString');
|
MihAlertServices().errorBasicAlert(
|
||||||
showDialog(
|
"Error Opening Website",
|
||||||
context: context,
|
"We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.",
|
||||||
builder: (context) {
|
context,
|
||||||
return MihPackageAlert(
|
);
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.warning_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Opening Website",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Error Opening Website",
|
||||||
builder: (context) {
|
"We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
);
|
||||||
Icons.warning_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Opening Website",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,9 +273,9 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// double screenWidth = MediaQuery.of(context).size.width;
|
// double screenWidth = MediaQuery.of(context).size.width;
|
||||||
return Consumer<MzansiDirectoryProvider>(
|
return Consumer2<MzansiProfileProvider, MzansiDirectoryProvider>(
|
||||||
builder: (BuildContext context, MzansiDirectoryProvider directoryProvider,
|
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||||
Widget? child) {
|
MzansiDirectoryProvider directoryProvider, Widget? child) {
|
||||||
return Material(
|
return Material(
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
|
||||||
@@ -698,6 +561,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
double width) async {
|
double width) async {
|
||||||
if (_isUserSignedIn) {
|
if (_isUserSignedIn) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MihReviewBusinessWindow(
|
builder: (context) => MihReviewBusinessWindow(
|
||||||
business: widget.business,
|
business: widget.business,
|
||||||
@@ -725,13 +589,12 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
void showAddBookmarkAlert() {
|
void showAddBookmarkAlert() {
|
||||||
if (_isUserSignedIn) {
|
if (_isUserSignedIn) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MihAddBookmarkAlert(
|
builder: (context) => MihAddBookmarkAlert(
|
||||||
business: widget.business,
|
business: widget.business,
|
||||||
onSuccessDismissPressed: () {
|
onSuccessDismissPressed: () async {
|
||||||
setState(() {
|
_bookmarkedBusinessFuture = getUserBookmark();
|
||||||
_bookmarkedBusinessFuture = getUserBookmark();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -743,14 +606,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
void showDeleteBookmarkAlert(BookmarkedBusiness? bookmarkBusiness) {
|
void showDeleteBookmarkAlert(BookmarkedBusiness? bookmarkBusiness) {
|
||||||
if (_isUserSignedIn) {
|
if (_isUserSignedIn) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MihDeleteBookmarkAlert(
|
builder: (context) => MihDeleteBookmarkAlert(
|
||||||
business: widget.business,
|
business: widget.business,
|
||||||
bookmarkBusiness: bookmarkBusiness,
|
bookmarkBusiness: bookmarkBusiness,
|
||||||
onSuccessDismissPressed: () {
|
onSuccessDismissPressed: () {
|
||||||
setState(() {
|
_bookmarkedBusinessFuture = getUserBookmark();
|
||||||
_bookmarkedBusinessFuture = getUserBookmark();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// startUpSearch: widget.startUpSearch,
|
// startUpSearch: widget.startUpSearch,
|
||||||
));
|
));
|
||||||
@@ -761,59 +623,72 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
|
|
||||||
void showSignInRequiredAlert() {
|
void showSignInRequiredAlert() {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MihPackageAlert(
|
builder: (context) {
|
||||||
alertIcon: Column(
|
return MihPackageWindow(
|
||||||
children: [
|
fullscreen: false,
|
||||||
Icon(
|
windowTitle: null,
|
||||||
MihIcons.mihLogo,
|
onWindowTapClose: () {
|
||||||
size: 125,
|
context.pop();
|
||||||
color: MihColors.getSecondaryColor(
|
},
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
windowBody: Column(
|
||||||
),
|
children: [
|
||||||
const SizedBox(height: 10),
|
Icon(
|
||||||
],
|
MihIcons.mihLogo,
|
||||||
),
|
size: 125,
|
||||||
alertTitle: "Let's Get Started",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
fontSize: 15,
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 10),
|
||||||
const SizedBox(height: 25),
|
Text(
|
||||||
Center(
|
"Let's Get Started",
|
||||||
child: MihButton(
|
textAlign: TextAlign.center,
|
||||||
onPressed: () {
|
style: TextStyle(
|
||||||
context.goNamed(
|
color: MihColors.getSecondaryColor(
|
||||||
'mihHome',
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
extra: true,
|
fontSize: 25,
|
||||||
);
|
fontWeight: FontWeight.bold,
|
||||||
},
|
),
|
||||||
buttonColor: MihColors.getGreenColor(
|
),
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
const SizedBox(height: 15),
|
||||||
elevation: 10,
|
Text(
|
||||||
width: 300,
|
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
|
||||||
child: Text(
|
style: TextStyle(
|
||||||
"Sign In/ Create Account",
|
color: MihColors.getSecondaryColor(
|
||||||
style: TextStyle(
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
color: MihColors.getPrimaryColor(
|
fontSize: 15,
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
),
|
||||||
fontSize: 20,
|
),
|
||||||
fontWeight: FontWeight.bold,
|
const SizedBox(height: 25),
|
||||||
|
Center(
|
||||||
|
child: MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.goNamed(
|
||||||
|
'mihHome',
|
||||||
|
extra: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
elevation: 10,
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Sign In/ Create Account",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
alertColour: MihColors.getSecondaryColor(
|
},
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ import 'package:mzansi_innovation_hub/main.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MihDeleteBookmarkAlert extends StatefulWidget {
|
class MihDeleteBookmarkAlert extends StatefulWidget {
|
||||||
final Business business;
|
final Business business;
|
||||||
@@ -28,6 +32,26 @@ class MihDeleteBookmarkAlert extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
||||||
|
Future<void> getFavouriteBusinesses() async {
|
||||||
|
MzansiDirectoryProvider directoryProvider =
|
||||||
|
context.read<MzansiDirectoryProvider>();
|
||||||
|
MzansiProfileProvider profileProvider =
|
||||||
|
context.read<MzansiProfileProvider>();
|
||||||
|
await MihMzansiDirectoryServices().getAllUserBookmarkedBusiness(
|
||||||
|
profileProvider.user!.app_id,
|
||||||
|
directoryProvider,
|
||||||
|
);
|
||||||
|
List<Business> favBus = [];
|
||||||
|
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||||
|
await MihBusinessDetailsServices()
|
||||||
|
.getBusinessDetailsByBusinessId(bus.business_id)
|
||||||
|
.then((business) {
|
||||||
|
favBus.add(business!);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
directoryProvider.setFavouriteBusinesses(businesses: favBus);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> deleteBookmark(int idbookmarked_businesses) async {
|
Future<void> deleteBookmark(int idbookmarked_businesses) async {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -45,7 +69,7 @@ class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
|||||||
"${widget.business.Name} has successfully been removed your favourite businessess in the Mzansi Directory.",
|
"${widget.business.Name} has successfully been removed your favourite businessess in the Mzansi Directory.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().errorAlert(
|
MihAlertServices().errorBasicAlert(
|
||||||
"Error Adding Bookmark",
|
"Error Adding Bookmark",
|
||||||
"An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.",
|
"An error occured while add ${widget.business.Name} to you Mzansi Directory, Please try again later.",
|
||||||
context,
|
context,
|
||||||
@@ -55,89 +79,67 @@ class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () async {
|
||||||
size: 150,
|
await getFavouriteBusinesses();
|
||||||
color: MihColors.getGreenColor(
|
widget.onSuccessDismissPressed!.call();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
context.pop();
|
||||||
),
|
context.pop();
|
||||||
alertTitle: title,
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
// context.goNamed(
|
|
||||||
// "mzansiDirectory",
|
|
||||||
// extra: MzansiDirectoryArguments(
|
|
||||||
// personalSearch: false,
|
|
||||||
// startSearchText: widget.business.Name,
|
|
||||||
// packageIndex: 1,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
widget.onSuccessDismissPressed!.call();
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihPackageAlert(
|
return MihPackageWindow(
|
||||||
alertColour: MihColors.getSecondaryColor(
|
fullscreen: false,
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
windowTitle: null,
|
||||||
alertIcon: Icon(
|
onWindowTapClose: null,
|
||||||
Icons.warning_rounded,
|
windowBody: Column(
|
||||||
size: 100,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Remove Bookmark",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.warning_rounded,
|
||||||
|
size: 150,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Remove Bookmark",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
Text(
|
Text(
|
||||||
"Are you sure you want to remove ${widget.business.Name} from your Mzansi Directory?",
|
"Are you sure you want to remove ${widget.business.Name} from your Mzansi Directory?",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
fontSize: 15,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:mzansi_innovation_hub/mih_objects/business_employee.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -48,7 +47,7 @@ class _MihEditEmployeeDetailsWindowState
|
|||||||
String message = "Your employees details have been updated.";
|
String message = "Your employees details have been updated.";
|
||||||
successPopUp(message, false);
|
successPopUp(message, false);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,14 +60,15 @@ class _MihEditEmployeeDetailsWindowState
|
|||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
String message =
|
String message =
|
||||||
"The employee has been deleted successfully. This means they will no longer have access to your business profile";
|
"The employee has been deleted successfully. This means they will no longer have access to your business profile";
|
||||||
|
context.pop();
|
||||||
successPopUp(message, false);
|
successPopUp(message, false);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDeleteWarning() {
|
void showDeleteWarning() {
|
||||||
MihAlertServices().deleteConfirmationMessage(
|
MihAlertServices().deleteConfirmationAlert(
|
||||||
"This team member will be deleted permanently from the business profile. Are you certain you want to delete it?",
|
"This team member will be deleted permanently from the business profile. Are you certain you want to delete it?",
|
||||||
() {
|
() {
|
||||||
deleteEmployeeApiCall();
|
deleteEmployeeApiCall();
|
||||||
@@ -78,57 +78,31 @@ class _MihEditEmployeeDetailsWindowState
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message, bool stayOnPersonalSide) {
|
void successPopUp(String message, bool stayOnPersonalSide) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
"Successfully Updated Employee Details",
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
},
|
||||||
),
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
alertTitle: "Successfully Updated Profile",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,10 +237,10 @@ class _MihEditEmployeeDetailsWindowState
|
|||||||
if (isRequiredFieldsCaptured()) {
|
if (isRequiredFieldsCaptured()) {
|
||||||
updateEmployeeAPICall(mzansiProfileProvider);
|
updateEmployeeAPICall(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
@@ -53,104 +52,75 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
|||||||
final ValueNotifier<int> _counter = ValueNotifier<int>(0);
|
final ValueNotifier<int> _counter = ValueNotifier<int>(0);
|
||||||
|
|
||||||
void showDeleteReviewAlert(MzansiDirectoryProvider directoryProvider) {
|
void showDeleteReviewAlert(MzansiDirectoryProvider directoryProvider) {
|
||||||
showDialog(
|
MihAlertServices().errorAdvancedAlert(
|
||||||
context: context,
|
"Delete Review",
|
||||||
builder: (context) => MihPackageAlert(
|
"Are you sure you want to delete this review? This action cannot be undone.",
|
||||||
alertColour: MihColors.getRedColor(
|
[
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MihButton(
|
||||||
alertIcon: Icon(
|
width: 300,
|
||||||
Icons.warning_rounded,
|
onPressed: () async {
|
||||||
size: 100,
|
showDialog(
|
||||||
color: MihColors.getRedColor(
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await MihMzansiDirectoryServices()
|
||||||
|
.deleteBusinessReview(
|
||||||
|
widget.businessReview!.idbusiness_ratings,
|
||||||
|
widget.businessReview!.business_id,
|
||||||
|
widget.businessReview!.rating_score,
|
||||||
|
widget.business.rating,
|
||||||
|
)
|
||||||
|
.then((statusCode) async {
|
||||||
|
context.pop(); //Remove loading dialog
|
||||||
|
context.pop(); //Remove delete dialog
|
||||||
|
if (statusCode == 200) {
|
||||||
|
await refreshBusiness(directoryProvider);
|
||||||
|
successPopUp(
|
||||||
|
"Successfully Deleted Review!",
|
||||||
|
"Your review has successfully been delete and will no longer appear under the business.",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
MihAlertServices().errorBasicAlert(
|
||||||
|
"Error Deleting Review",
|
||||||
|
"There was an error deleting your review. Please try again later.",
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
),
|
child: Text(
|
||||||
alertTitle: "Delete Review",
|
"Delete",
|
||||||
alertBody: Column(
|
style: TextStyle(
|
||||||
children: [
|
color: MihColors.getPrimaryColor(
|
||||||
Text(
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
"Are you sure you want to delete this review? This action cannot be undone.",
|
fontSize: 20,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
),
|
||||||
Wrap(
|
|
||||||
spacing: 10,
|
|
||||||
runSpacing: 10,
|
|
||||||
children: [
|
|
||||||
MihButton(
|
|
||||||
width: 300,
|
|
||||||
onPressed: () async {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return const Mihloadingcircle();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await MihMzansiDirectoryServices()
|
|
||||||
.deleteBusinessReview(
|
|
||||||
widget.businessReview!.idbusiness_ratings,
|
|
||||||
widget.businessReview!.business_id,
|
|
||||||
widget.businessReview!.rating_score,
|
|
||||||
widget.business.rating,
|
|
||||||
)
|
|
||||||
.then((statusCode) async {
|
|
||||||
context.pop(); //Remove loading dialog
|
|
||||||
context.pop(); //Remove delete dialog
|
|
||||||
if (statusCode == 200) {
|
|
||||||
await refreshBusiness(directoryProvider);
|
|
||||||
context.pop(); //Remove window
|
|
||||||
successPopUp(
|
|
||||||
"Successfully Deleted Review!",
|
|
||||||
"Your review has successfully been delete and will no longer appear under the business.",
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
MihAlertServices().errorAlert(
|
|
||||||
"Error Deleting Review",
|
|
||||||
"There was an error deleting your review. Please try again later.",
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
child: Text(
|
|
||||||
"Delete",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MihButton(
|
|
||||||
width: 300,
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
child: Text(
|
|
||||||
"Cancel",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
MihButton(
|
||||||
|
width: 300,
|
||||||
|
onPressed: () {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
child: Text(
|
||||||
|
"Cancel",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,13 +168,12 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
|||||||
context.pop(); //Remove loading dialog
|
context.pop(); //Remove loading dialog
|
||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
await refreshBusiness(directoryProvider);
|
await refreshBusiness(directoryProvider);
|
||||||
context.pop();
|
|
||||||
successPopUp(
|
successPopUp(
|
||||||
"Successfully Updated Review!",
|
"Successfully Updated Review!",
|
||||||
"Your review has successfully been updated and will now appear under the business.",
|
"Your review has successfully been updated and will now appear under the business.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().errorAlert(
|
MihAlertServices().errorBasicAlert(
|
||||||
"Error Updating Review",
|
"Error Updating Review",
|
||||||
"There was an error updating your review. Please try again later.",
|
"There was an error updating your review. Please try again later.",
|
||||||
context,
|
context,
|
||||||
@@ -225,13 +194,12 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
|||||||
context.pop(); //Remove loading dialog
|
context.pop(); //Remove loading dialog
|
||||||
if (statusCode == 201) {
|
if (statusCode == 201) {
|
||||||
await refreshBusiness(directoryProvider);
|
await refreshBusiness(directoryProvider);
|
||||||
context.pop();
|
|
||||||
successPopUp(
|
successPopUp(
|
||||||
"Successfully Added Review!",
|
"Successfully Added Review!",
|
||||||
"Your review has successfully been added and will now appear under the business.",
|
"Your review has successfully been added and will now appear under the business.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().errorAlert(
|
MihAlertServices().errorBasicAlert(
|
||||||
"Error Adding Review",
|
"Error Adding Review",
|
||||||
"There was an error adding your review. Please try again later.",
|
"There was an error adding your review. Please try again later.",
|
||||||
context,
|
context,
|
||||||
@@ -242,64 +210,32 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
widget.onSuccessDismissPressed!.call();
|
||||||
),
|
},
|
||||||
alertTitle: title,
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
// context.goNamed(
|
|
||||||
// "mzansiDirectory",
|
|
||||||
// extra: MzansiDirectoryArguments(
|
|
||||||
// personalSearch: false,
|
|
||||||
// startSearchText: widget.business.Name,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
widget.onSuccessDismissPressed!.call();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +513,7 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
|||||||
directoryProvider,
|
directoryProvider,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'package:mzansi_innovation_hub/main.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
@@ -134,56 +133,10 @@ class _MihUpdateBusinessDetailsWindowState
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message, bool stayOnPersonalSide) {
|
void successPopUp(String message, bool stayOnPersonalSide) {
|
||||||
showDialog(
|
MihAlertServices().successBasicAlert(
|
||||||
context: context,
|
"Success!",
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 150,
|
|
||||||
color: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Successfully Updated Profile",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,41 +216,19 @@ class _MihUpdateBusinessDetailsWindowState
|
|||||||
} else {
|
} else {
|
||||||
context.pop();
|
context.pop();
|
||||||
// File upload failed
|
// File upload failed
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Error Updating Business Details",
|
||||||
builder: (context) {
|
"An error occurred while updating the business details. Please try again.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.warning_rounded,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Updating Business Details",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"An error occurred while updating the business details. Please check internet connection and try again.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
context.pop();
|
context.pop();
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +587,7 @@ class _MihUpdateBusinessDetailsWindowState
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitForm(mzansiProfileProvider);
|
submitForm(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
|
|||||||
void editBizProfileWindow(
|
void editBizProfileWindow(
|
||||||
MzansiProfileProvider mzansiProfileProvider, double width) {
|
MzansiProfileProvider mzansiProfileProvider, double width) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MihUpdateBusinessDetailsWindow(width: width),
|
builder: (context) => MihUpdateBusinessDetailsWindow(width: width),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
@@ -64,7 +63,7 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
|||||||
if (isFieldsFilled()) {
|
if (isFieldsFilled()) {
|
||||||
createBusinessProfileAPICall(mzansiProfileProvider);
|
createBusinessProfileAPICall(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +96,7 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
|||||||
}
|
}
|
||||||
await createBusinessUserAPICall(mzansiProfileProvider);
|
await createBusinessUserAPICall(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,10 +122,10 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
|||||||
"Your business profile is now live! You can now start connecting with customers and growing your business.";
|
"Your business profile is now live! You can now start connecting with customers and growing your business.";
|
||||||
successPopUp(message, false);
|
successPopUp(message, false);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,59 +191,33 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message, bool stayOnPersonalSide) {
|
void successPopUp(String message, bool stayOnPersonalSide) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
"Successfully Updated Profile",
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.goNamed(
|
||||||
color: MihColors.getGreenColor(
|
'mihHome',
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
extra: stayOnPersonalSide,
|
||||||
),
|
);
|
||||||
alertTitle: "Successfully Updated Profile",
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.goNamed(
|
|
||||||
'mihHome',
|
|
||||||
extra: stayOnPersonalSide,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +297,7 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitForm(mzansiProfileProvider);
|
submitForm(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -784,7 +757,7 @@ class _MihBusinessDetailsSetUpState extends State<MihBusinessDetailsSetUp> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitForm(mzansiProfileProvider);
|
submitForm(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -111,59 +111,69 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||||||
|
|
||||||
void showSignInRequiredAlert() {
|
void showSignInRequiredAlert() {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => MihPackageAlert(
|
builder: (context) {
|
||||||
alertIcon: Column(
|
return MihPackageWindow(
|
||||||
children: [
|
fullscreen: false,
|
||||||
Icon(
|
windowTitle: null,
|
||||||
MihIcons.mihLogo,
|
onWindowTapClose: null,
|
||||||
size: 125,
|
windowBody: Column(
|
||||||
color: MihColors.getSecondaryColor(
|
children: [
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
Icon(
|
||||||
),
|
MihIcons.mihLogo,
|
||||||
const SizedBox(height: 10),
|
size: 100,
|
||||||
],
|
|
||||||
),
|
|
||||||
alertTitle: "Let's Get Started",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
fontSize: 15,
|
|
||||||
),
|
),
|
||||||
),
|
Text(
|
||||||
const SizedBox(height: 25),
|
"Let's Get Started",
|
||||||
Center(
|
textAlign: TextAlign.center,
|
||||||
child: MihButton(
|
style: TextStyle(
|
||||||
onPressed: () {
|
color: MihColors.getPrimaryColor(
|
||||||
context.goNamed(
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
'mihHome',
|
fontSize: 25,
|
||||||
extra: true,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Sign In/ Create Account",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
const SizedBox(height: 15),
|
||||||
],
|
Text(
|
||||||
),
|
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
|
||||||
alertColour: MihColors.getSecondaryColor(
|
style: TextStyle(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
color: MihColors.getSecondaryColor(
|
||||||
),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
Center(
|
||||||
|
child: MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.goNamed(
|
||||||
|
'mihHome',
|
||||||
|
extra: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
elevation: 10,
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Sign In/ Create Account",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
|||||||
// showDialog(context: context, builder: (context)=> )
|
// showDialog(context: context, builder: (context)=> )
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihReviewBusinessWindow(
|
return MihReviewBusinessWindow(
|
||||||
business: business,
|
business: business,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -13,7 +12,6 @@ import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_sc
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
@@ -110,93 +108,25 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
String message = "Business details updated successfully";
|
String message = "Business details updated successfully";
|
||||||
successPopUp(message, false);
|
successPopUp(message, false);
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Error Updating Business User Details",
|
||||||
builder: (context) {
|
"An error occurred while updating the business User details. Please check internet connection and try again.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.warning_rounded,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Error Updating Business User Details",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"An error occurred while updating the business User details. Please check internet connection and try again.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message, bool stayOnPersonalSide) {
|
void successPopUp(String message, bool stayOnPersonalSide) {
|
||||||
showDialog(
|
MihAlertServices().successBasicAlert(
|
||||||
context: context,
|
"Success!",
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 150,
|
|
||||||
color: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Successfully Updated Profile",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +348,7 @@ class _MihMyBusinessUserState extends State<MihMyBusinessUser> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitForm(mzansiProfileProvider);
|
submitForm(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
||||||
@@ -105,7 +104,7 @@ class _MihEditPersonalProfileWindowState
|
|||||||
message,
|
message,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +120,7 @@ class _MihEditPersonalProfileWindowState
|
|||||||
if (response == 200) {
|
if (response == 200) {
|
||||||
deleteFileApiCall(mzansiProfileProvider, oldProPicName);
|
deleteFileApiCall(mzansiProfileProvider, oldProPicName);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +136,7 @@ class _MihEditPersonalProfileWindowState
|
|||||||
if (response == 200) {
|
if (response == 200) {
|
||||||
//SQL delete
|
//SQL delete
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,63 +162,36 @@ class _MihEditPersonalProfileWindowState
|
|||||||
MzansiProfileProvider profileProvider,
|
MzansiProfileProvider profileProvider,
|
||||||
String message,
|
String message,
|
||||||
) {
|
) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
"Successfully Updated Profile",
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
if (profileProvider.user!.type.toLowerCase() == "business" &&
|
||||||
color: MihColors.getGreenColor(
|
profileProvider.business == null) {
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
setupBusinessPopUp(profileProvider);
|
||||||
),
|
} else {
|
||||||
alertTitle: "Successfully Updated Profile",
|
context.pop();
|
||||||
alertBody: Column(
|
context.pop();
|
||||||
children: [
|
}
|
||||||
Text(
|
},
|
||||||
message,
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (profileProvider.user!.type.toLowerCase() ==
|
|
||||||
"business" &&
|
|
||||||
profileProvider.business == null) {
|
|
||||||
setupBusinessPopUp(profileProvider);
|
|
||||||
} else {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,17 +200,31 @@ class _MihEditPersonalProfileWindowState
|
|||||||
) {
|
) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihPackageAlert(
|
return MihPackageWindow(
|
||||||
alertIcon: Icon(
|
fullscreen: false,
|
||||||
MihIcons.businessSetup,
|
windowTitle: null,
|
||||||
size: 150,
|
onWindowTapClose: null,
|
||||||
color: MihColors.getSecondaryColor(
|
windowBody: Column(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Setup Business Profile?",
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
children: [
|
||||||
|
Icon(
|
||||||
|
MihIcons.businessSetup,
|
||||||
|
size: 150,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Setup Business Profile?",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
Text(
|
Text(
|
||||||
"It looks like this is the first time activating your business account. Would you like to set up your business now or would you like to do it later?",
|
"It looks like this is the first time activating your business account. Would you like to set up your business now or would you like to do it later?",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -307,35 +293,16 @@ class _MihEditPersonalProfileWindowState
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
alertColour: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notUniqueAlert() {
|
void notUniqueAlert() {
|
||||||
showDialog(
|
MihAlertServices().errorBasicAlert(
|
||||||
context: context,
|
"Too Slow, That Username is Taken",
|
||||||
builder: (context) {
|
"The username you have entered is already taken by another member of Mzansi. Please choose a different username and try again.",
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.warning_amber_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: "Too Slow, That Username is Taken",
|
|
||||||
alertBody: const Text(
|
|
||||||
"The username you have entered is already taken by another member of Mzansi. Please choose a different username and try again.",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,7 +495,7 @@ class _MihEditPersonalProfileWindowState
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
submitForm(mzansiProfileProvider);
|
submitForm(mzansiProfileProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||||
@@ -26,17 +25,10 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
|||||||
void editProfileWindow(double width) {
|
void editProfileWindow(double width) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) => Consumer<MzansiProfileProvider>(
|
builder: (context) => Consumer<MzansiProfileProvider>(
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
||||||
// usernameController.text = mzansiProfileProvider.user!.username;
|
|
||||||
// fnameController.text = mzansiProfileProvider.user!.fname;
|
|
||||||
// lnameController.text = mzansiProfileProvider.user!.lname;
|
|
||||||
// purposeController.text = mzansiProfileProvider.user!.purpose;
|
|
||||||
// proPicController.text =
|
|
||||||
// mzansiProfileProvider.user!.pro_pic_path.isNotEmpty
|
|
||||||
// ? mzansiProfileProvider.user!.pro_pic_path.split("/").last
|
|
||||||
// : "";
|
|
||||||
return MihEditPersonalProfileWindow();
|
return MihEditPersonalProfileWindow();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -62,13 +54,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
|||||||
return Center(
|
return Center(
|
||||||
child: Mihloadingcircle(),
|
child: Mihloadingcircle(),
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
// else if (mzansiProfileProvider.user!.username.isEmpty) {
|
|
||||||
// editProfileWindow(width);
|
|
||||||
// }
|
|
||||||
else {
|
|
||||||
KenLogger.success(
|
|
||||||
mzansiProfileProvider.userProfilePicture.toString());
|
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -22,101 +22,64 @@ class MihPersonalSettings extends StatefulWidget {
|
|||||||
class _MihPersonalSettingsState extends State<MihPersonalSettings> {
|
class _MihPersonalSettingsState extends State<MihPersonalSettings> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihPackageToolBody(
|
return Consumer<MzansiProfileProvider>(
|
||||||
borderOn: false,
|
builder: (BuildContext context,
|
||||||
innerHorizontalPadding: 10,
|
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
||||||
bodyItem: getBody(),
|
return MihPackageToolBody(
|
||||||
);
|
borderOn: false,
|
||||||
}
|
innerHorizontalPadding: 10,
|
||||||
|
bodyItem: getBody(mzansiProfileProvider),
|
||||||
void deleteAccountPopUp(BuildContext ctxtd) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: false,
|
|
||||||
builder: (context) {
|
|
||||||
return Consumer<MzansiProfileProvider>(
|
|
||||||
builder: (BuildContext context,
|
|
||||||
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
|
|
||||||
return MihPackageAlert(
|
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.warning_amber_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle:
|
|
||||||
"Are you sure you want to permanently delete your MIH account?",
|
|
||||||
alertBody: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"This action will remove all of your data, and it cannot be recovered. We understand this is a big decision, so please take a moment to double-check.\n\nIf you're certain, please confirm below. If you've changed your mind, you can simply close this window.",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Wrap(
|
|
||||||
spacing: 10,
|
|
||||||
runSpacing: 10,
|
|
||||||
children: [
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
MihUserServices.deleteAccount(
|
|
||||||
mzansiProfileProvider, context);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Delete",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Cancel",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getBody() {
|
void deleteAccountPopUp(
|
||||||
|
MzansiProfileProvider mzansiProfileProvider, BuildContext ctxtd) {
|
||||||
|
MihAlertServices().errorAdvancedAlert(
|
||||||
|
"Are you sure you want to permanently delete your MIH account?",
|
||||||
|
"This action will remove all of your data, and it cannot be recovered. We understand this is a big decision, so please take a moment to double-check.\n\nIf you're certain, please confirm below. If you've changed your mind, you can simply close this window.",
|
||||||
|
[
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
MihUserServices.deleteAccount(mzansiProfileProvider, context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Delete",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Cancel",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
ctxtd,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getBody(MzansiProfileProvider mzansiProfileProvider) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -142,7 +105,7 @@ class _MihPersonalSettingsState extends State<MihPersonalSettings> {
|
|||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
MihButton(
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
deleteAccountPopUp(context);
|
deleteAccountPopUp(mzansiProfileProvider, context);
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getRedColor(
|
buttonColor: MihColors.getRedColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_wallet_services.da
|
|||||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
|
||||||
@@ -158,11 +157,16 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
"You have successfully updated the loyalty card details.",
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -192,7 +196,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
|
|
||||||
void deleteCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
void deleteCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
||||||
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
||||||
MihAlertServices().deleteConfirmationMessage(
|
MihAlertServices().deleteConfirmationAlert(
|
||||||
"This Card will be deleted permanently from your Mzansi Wallet. Are you certain you want to delete it?",
|
"This Card will be deleted permanently from your Mzansi Wallet. Are you certain you want to delete it?",
|
||||||
() async {
|
() async {
|
||||||
int statusCode = await MIHMzansiWalletApis.deleteLoyaltyCardAPICall(
|
int statusCode = await MIHMzansiWalletApis.deleteLoyaltyCardAPICall(
|
||||||
@@ -204,9 +208,14 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
"You have successfully deleted the loyalty card from your Mzansi Wallet.",
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
context.pop();
|
context.pop();
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
context,
|
context,
|
||||||
@@ -215,153 +224,147 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
|
|
||||||
void addToFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
void addToFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
||||||
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
// "Card Added to Favourites",
|
||||||
barrierDismissible: false,
|
"Add Card to Favourites?",
|
||||||
builder: (context) {
|
"Would you like to add this card to your favourites for quick access?",
|
||||||
return MihPackageAlert(
|
// "You have successfully added the loyalty card to your favourites.",
|
||||||
alertColour: MihColors.getGreenColor(
|
[
|
||||||
|
MihButton(
|
||||||
|
onPressed: () async {
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getRedColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
alertIcon: Icon(
|
width: 300,
|
||||||
Icons.favorite,
|
child: Text(
|
||||||
color: MihColors.getGreenColor(
|
"Cancel",
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
style: TextStyle(
|
||||||
size: 100,
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
alertTitle: "Add to Favourites",
|
),
|
||||||
alertBody: Column(
|
MihButton(
|
||||||
children: [
|
onPressed: () async {
|
||||||
Text(
|
int statusCode = await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
||||||
"Are you sure you want to add this card to your favourites?",
|
walletProvider,
|
||||||
style: TextStyle(
|
mzansiProfileProvider.user!,
|
||||||
fontSize: 20,
|
widget.cardList[index].idloyalty_cards,
|
||||||
color: MihColors.getSecondaryColor(
|
widget.cardList[index].shop_name,
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
"Yes",
|
||||||
),
|
_noFavourites,
|
||||||
),
|
widget.cardList[index].nickname,
|
||||||
const SizedBox(
|
widget.cardList[index].card_number,
|
||||||
height: 15,
|
ctxt,
|
||||||
),
|
);
|
||||||
MihButton(
|
if (statusCode == 200) {
|
||||||
onPressed: () async {
|
context.pop();
|
||||||
int statusCode =
|
context.pop();
|
||||||
await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
||||||
walletProvider,
|
walletProvider,
|
||||||
mzansiProfileProvider.user!,
|
mzansiProfileProvider.user!.app_id,
|
||||||
widget.cardList[index].idloyalty_cards,
|
context,
|
||||||
widget.cardList[index].shop_name,
|
);
|
||||||
"Yes",
|
context.read<MzansiWalletProvider>().setToolIndex(1);
|
||||||
_noFavourites,
|
MihAlertServices().successBasicAlert(
|
||||||
widget.cardList[index].nickname,
|
"Success!",
|
||||||
widget.cardList[index].card_number,
|
"You have successfully added the loyalty card to your favourites.",
|
||||||
ctxt,
|
context,
|
||||||
);
|
);
|
||||||
if (statusCode == 200) {
|
} else {
|
||||||
context.pop();
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
context.pop();
|
}
|
||||||
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
},
|
||||||
walletProvider,
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
mzansiProfileProvider.user!.app_id,
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
context,
|
width: 300,
|
||||||
);
|
child: Text(
|
||||||
context.read<MzansiWalletProvider>().setToolIndex(1);
|
"Add",
|
||||||
} else {
|
style: TextStyle(
|
||||||
MihAlertServices().internetConnectionLost(context);
|
color: MihColors.getSecondaryColor(
|
||||||
}
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
},
|
fontSize: 20,
|
||||||
buttonColor: MihColors.getGreenColor(
|
fontWeight: FontWeight.bold,
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
),
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Add",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeFromFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
void removeFromFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
|
||||||
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
|
||||||
showDialog(
|
MihAlertServices().errorAdvancedAlert(
|
||||||
context: context,
|
"Remove From Favourites?",
|
||||||
barrierDismissible: false,
|
"Are you sure you want to remove this card from your favourites?",
|
||||||
builder: (context) {
|
[
|
||||||
return MihPackageAlert(
|
MihButton(
|
||||||
alertColour: MihColors.getRedColor(
|
onPressed: () async {
|
||||||
|
int statusCode = await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
||||||
|
walletProvider,
|
||||||
|
mzansiProfileProvider.user!,
|
||||||
|
widget.cardList[index].idloyalty_cards,
|
||||||
|
widget.cardList[index].shop_name,
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
widget.cardList[index].nickname,
|
||||||
|
widget.cardList[index].card_number,
|
||||||
|
ctxt,
|
||||||
|
);
|
||||||
|
if (statusCode == 200) {
|
||||||
|
context.pop();
|
||||||
|
context.pop();
|
||||||
|
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
||||||
|
walletProvider,
|
||||||
|
mzansiProfileProvider.user!.app_id,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
context.read<MzansiWalletProvider>().setToolIndex(0);
|
||||||
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
"You have successfully removed the loyalty card to your favourites.",
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
alertIcon: Icon(
|
width: 300,
|
||||||
Icons.favorite_border,
|
child: Text(
|
||||||
color: MihColors.getRedColor(
|
"Remove",
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
style: TextStyle(
|
||||||
size: 100,
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
alertTitle: "Remove From Favourites",
|
),
|
||||||
alertBody: Column(
|
MihButton(
|
||||||
children: [
|
onPressed: () async {
|
||||||
Text(
|
context.pop();
|
||||||
"Are you sure you want to remove this card from your favourites?",
|
},
|
||||||
style: TextStyle(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
fontSize: 20,
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
color: MihColors.getSecondaryColor(
|
width: 300,
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
child: Text(
|
||||||
),
|
"Cancel",
|
||||||
),
|
style: TextStyle(
|
||||||
const SizedBox(
|
color: MihColors.getPrimaryColor(
|
||||||
height: 15,
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
),
|
fontSize: 20,
|
||||||
MihButton(
|
fontWeight: FontWeight.bold,
|
||||||
onPressed: () async {
|
),
|
||||||
int statusCode =
|
|
||||||
await MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
|
||||||
walletProvider,
|
|
||||||
mzansiProfileProvider.user!,
|
|
||||||
widget.cardList[index].idloyalty_cards,
|
|
||||||
widget.cardList[index].shop_name,
|
|
||||||
"",
|
|
||||||
0,
|
|
||||||
widget.cardList[index].nickname,
|
|
||||||
widget.cardList[index].card_number,
|
|
||||||
ctxt,
|
|
||||||
);
|
|
||||||
if (statusCode == 200) {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
await MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
|
||||||
walletProvider,
|
|
||||||
mzansiProfileProvider.user!.app_id,
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
context.read<MzansiWalletProvider>().setToolIndex(0);
|
|
||||||
} else {
|
|
||||||
MihAlertServices().internetConnectionLost(context);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getRedColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Remove",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
],
|
||||||
|
ctxt,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,56 +590,31 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
KenLogger.success("Brightness set to: $newBrightness");
|
KenLogger.success("Brightness set to: $newBrightness");
|
||||||
} else {
|
} else {
|
||||||
context.pop();
|
context.pop();
|
||||||
showDialog(
|
MihAlertServices().errorAdvancedAlert(
|
||||||
context: context,
|
"Permission Required",
|
||||||
builder: (context) {
|
"Sometimes it can be tough to scan your loyalty card if your phone screen is dim. To make sure your scan is successful every time, we need your permission to temporarily increase your screen brightness.\n\nWould you mind enabling this in your device settings?",
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.brightness_7_rounded,
|
onPressed: () async {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getSecondaryColor(
|
await ScreenBrightness.instance
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
.setSystemScreenBrightness(newBrightness);
|
||||||
),
|
},
|
||||||
alertTitle: "Permission Required",
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Sometimes it can be tough to scan your loyalty card if your phone screen is dim. To make sure your scan is successful every time, we need your permission to temporarily increase your screen brightness.\n\nWould you mind enabling this in your device settings?",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () async {
|
|
||||||
context.pop();
|
|
||||||
await ScreenBrightness.instance
|
|
||||||
.setSystemScreenBrightness(newBrightness);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Grant Permission",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
width: 300,
|
||||||
},
|
child: Text(
|
||||||
|
"Grant Permission",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:mzansi_innovation_hub/main.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -34,56 +33,10 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
final ValueNotifier<String> _shopName = ValueNotifier("");
|
final ValueNotifier<String> _shopName = ValueNotifier("");
|
||||||
|
|
||||||
void successPopUp(String title, String message, int packageIndex) {
|
void successPopUp(String title, String message, int packageIndex) {
|
||||||
showDialog(
|
MihAlertServices().successBasicAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 150,
|
|
||||||
color: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: title,
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +235,7 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
if (_shopController.text == "") {
|
if (_shopController.text == "") {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
} else {
|
} else {
|
||||||
int statusCode = await MIHMzansiWalletApis
|
int statusCode = await MIHMzansiWalletApis
|
||||||
.addLoyaltyCardAPICall(
|
.addLoyaltyCardAPICall(
|
||||||
@@ -306,11 +259,11 @@ class _MihAddCardWindowState extends State<MihAddCardWindow> {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices()
|
MihAlertServices()
|
||||||
.internetConnectionLost(context);
|
.internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_add_card_window.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_add_card_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart';
|
||||||
@@ -14,6 +11,7 @@ import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MihCards extends StatefulWidget {
|
class MihCards extends StatefulWidget {
|
||||||
@@ -56,56 +54,10 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message, int packageIndex) {
|
void successPopUp(String title, String message, int packageIndex) {
|
||||||
showDialog(
|
MihAlertServices().successBasicAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
context,
|
||||||
alertIcon: Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 150,
|
|
||||||
color: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
alertTitle: title,
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,12 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
|
|||||||
return accessStatus;
|
return accessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> refreshMyPatientList(MzansiProfileProvider mzansiProfileProvider,
|
||||||
|
PatientManagerProvider patientManagerProvider) async {
|
||||||
|
await MihPatientServices().getPatientAccessListOfBusiness(
|
||||||
|
patientManagerProvider, mzansiProfileProvider.business!.business_id);
|
||||||
|
}
|
||||||
|
|
||||||
void patientProfileChoicePopUp(
|
void patientProfileChoicePopUp(
|
||||||
MzansiProfileProvider profileProvider,
|
MzansiProfileProvider profileProvider,
|
||||||
PatientManagerProvider patientManagerProvider,
|
PatientManagerProvider patientManagerProvider,
|
||||||
@@ -300,7 +306,7 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
|
|||||||
// "business",
|
// "business",
|
||||||
// ));
|
// ));
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().warningMessage(
|
MihAlertServices().warningAlert(
|
||||||
"Access Pending",
|
"Access Pending",
|
||||||
"Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.",
|
"Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.",
|
||||||
context,
|
context,
|
||||||
@@ -344,6 +350,8 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
|
|||||||
),
|
),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
refreshMyPatientList(
|
||||||
|
profileProvider, patientManagerProvider);
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
@@ -380,6 +388,8 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
|
|||||||
),
|
),
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
refreshMyPatientList(
|
||||||
|
profileProvider, patientManagerProvider);
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -64,69 +63,43 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
|
|||||||
successPopUp("Successfully Added Appointment",
|
successPopUp("Successfully Added Appointment",
|
||||||
"You appointment has been successfully added to your calendar.");
|
"You appointment has been successfully added to your calendar.");
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
setState(() {
|
||||||
),
|
dateController.clear();
|
||||||
alertTitle: title,
|
timeController.clear();
|
||||||
alertBody: Column(
|
idController.clear();
|
||||||
children: [
|
fnameController.clear();
|
||||||
Text(
|
lnameController.clear();
|
||||||
message,
|
});
|
||||||
style: TextStyle(
|
},
|
||||||
color: MihColors.getSecondaryColor(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
setState(() {
|
|
||||||
dateController.clear();
|
|
||||||
timeController.clear();
|
|
||||||
idController.clear();
|
|
||||||
fnameController.clear();
|
|
||||||
lnameController.clear();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,10 +215,10 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
|
|||||||
submitApointment(
|
submitApointment(
|
||||||
profileProvider, patientManagerProvider, index);
|
profileProvider, patientManagerProvider, index);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -276,13 +249,13 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
|
|||||||
void noAccessWarning(
|
void noAccessWarning(
|
||||||
PatientManagerProvider patientManagerProvider, int index) {
|
PatientManagerProvider patientManagerProvider, int index) {
|
||||||
if (patientManagerProvider.myPaitentList![index].status == "pending") {
|
if (patientManagerProvider.myPaitentList![index].status == "pending") {
|
||||||
MihAlertServices().warningMessage(
|
MihAlertServices().warningAlert(
|
||||||
"Access Pending",
|
"Access Pending",
|
||||||
"Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.",
|
"Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.",
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().warningMessage(
|
MihAlertServices().errorBasicAlert(
|
||||||
"Access Declined",
|
"Access Declined",
|
||||||
"Your request to access the patient's profile has been denied. Please contact the patient directly to inquire about the reason for this restriction.",
|
"Your request to access the patient's profile has been denied. Please contact the patient directly to inquire about the reason for this restriction.",
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
||||||
@@ -266,7 +265,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
patientManagerProvider.setPatientManagerIndex(1);
|
patientManagerProvider.setPatientManagerIndex(1);
|
||||||
context.pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
width: 300,
|
width: 300,
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -285,7 +284,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
patientManagerProvider.setPatientManagerIndex(2);
|
patientManagerProvider.setPatientManagerIndex(2);
|
||||||
context.pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
width: 300,
|
width: 300,
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -305,7 +304,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
addAppointmentWindow(
|
addAppointmentWindow(
|
||||||
profileProvider, mihCalendarProvider, width);
|
profileProvider, mihCalendarProvider, width);
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
width: 300,
|
width: 300,
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -410,7 +409,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
addAppointmentCall(
|
addAppointmentCall(
|
||||||
profileProvider, mihCalendarProvider);
|
profileProvider, mihCalendarProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -462,71 +461,45 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
"You appointment has been successfully added to your calendar.");
|
"You appointment has been successfully added to your calendar.");
|
||||||
_loadInitialAppointments();
|
_loadInitialAppointments();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
checkforchange();
|
checkforchange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
setState(() {
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
_appointmentDateController.clear();
|
||||||
),
|
_appointmentTimeController.clear();
|
||||||
alertTitle: title,
|
_appointmentTitleController.clear();
|
||||||
alertBody: Column(
|
_appointmentDescriptionIDController.clear();
|
||||||
children: [
|
});
|
||||||
Text(
|
},
|
||||||
message,
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
setState(() {
|
|
||||||
_appointmentDateController.clear();
|
|
||||||
_appointmentTimeController.clear();
|
|
||||||
_appointmentTitleController.clear();
|
|
||||||
_appointmentDescriptionIDController.clear();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -388,10 +388,10 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
|
|||||||
AppEnviroment.getEnv(),
|
AppEnviroment.getEnv(),
|
||||||
context);
|
context);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class _MedicineSearchState extends State<MedicineSearch> {
|
|||||||
// medicines.forEach((element) => meds.add(element.name));
|
// medicines.forEach((element) => meds.add(element.name));
|
||||||
return medicines;
|
return medicines;
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
throw Exception('failed to load medicine');
|
throw Exception('failed to load medicine');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
||||||
@@ -67,7 +66,7 @@ class _MihEditPatientDetailsWindowState
|
|||||||
"${fnameController.text} ${lnameController.text}'s information has been updated successfully! Their medical records and details are now current.",
|
"${fnameController.text} ${lnameController.text}'s information has been updated successfully! Their medical records and details are now current.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().errorAlert(
|
MihAlertServices().errorBasicAlert(
|
||||||
"Error Updating Profile",
|
"Error Updating Profile",
|
||||||
"There was an error updating your profile. Please try again later.",
|
"There was an error updating your profile. Please try again later.",
|
||||||
context,
|
context,
|
||||||
@@ -76,67 +75,31 @@ class _MihEditPatientDetailsWindowState
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
},
|
||||||
),
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
alertTitle: title,
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
// context.goNamed(
|
|
||||||
// "patientProfile",
|
|
||||||
// extra: PatientViewArguments(
|
|
||||||
// widget.signedInUser,
|
|
||||||
// widget.selectedPatient,
|
|
||||||
// null,
|
|
||||||
// null,
|
|
||||||
// "personal",
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,7 +385,7 @@ class _MihEditPatientDetailsWindowState
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
updatePatientApiCall(patientManagerProvider);
|
updatePatientApiCall(patientManagerProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -543,7 +506,7 @@ class _MihEditPatientDetailsWindowState
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
updatePatientApiCall(patientManagerProvider);
|
updatePatientApiCall(patientManagerProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
@@ -17,6 +17,8 @@ import 'package:mzansi_innovation_hub/mih_objects/business_user.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_objects/patients.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/patients.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/perscription.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/perscription.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_services/mih_patient_services.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
|
||||||
class PrescripInput extends StatefulWidget {
|
class PrescripInput extends StatefulWidget {
|
||||||
@@ -94,7 +96,9 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
"30"
|
"30"
|
||||||
];
|
];
|
||||||
|
|
||||||
Future<void> generatePerscription() async {
|
Future<void> generatePerscription(
|
||||||
|
PatientManagerProvider patManProvider,
|
||||||
|
) async {
|
||||||
//start loading circle
|
//start loading circle
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -161,84 +165,25 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
String message =
|
String message =
|
||||||
"The perscription $fileName has been successfully generated and added to ${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}'s record. You can now access and download it for their use.";
|
"The perscription $fileName has been successfully generated and added to ${widget.selectedPatient.first_name} ${widget.selectedPatient.last_name}'s record. You can now access and download it for their use.";
|
||||||
successPopUp(message);
|
|
||||||
|
await MihPatientServices().getPatientDocuments(patManProvider);
|
||||||
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void getMedsPopUp(TextEditingController medSearch) {
|
void getMedsPopUp(TextEditingController medSearch) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MedicineSearch(
|
return MedicineSearch(
|
||||||
searchVlaue: medSearch,
|
searchVlaue: medSearch,
|
||||||
@@ -485,10 +430,10 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
widget.noRepeatsController.text = "0";
|
widget.noRepeatsController.text = "0";
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
@@ -511,7 +456,7 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget displayPerscList() {
|
Widget displayPerscList(PatientManagerProvider patManProvider) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@@ -573,9 +518,9 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (perscriptionObjOutput.isNotEmpty) {
|
if (perscriptionObjOutput.isNotEmpty) {
|
||||||
//print(jsonEncode(perscriptionObjOutput));
|
//print(jsonEncode(perscriptionObjOutput));
|
||||||
await generatePerscription();
|
await generatePerscription(patManProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -613,18 +558,23 @@ class _PrescripInputState extends State<PrescripInput> {
|
|||||||
var size = MediaQuery.of(context).size;
|
var size = MediaQuery.of(context).size;
|
||||||
width = size.width;
|
width = size.width;
|
||||||
height = size.height;
|
height = size.height;
|
||||||
return Wrap(
|
return Consumer<PatientManagerProvider>(
|
||||||
direction: Axis.horizontal,
|
builder: (BuildContext context, PatientManagerProvider patManProvider,
|
||||||
alignment: WrapAlignment.center,
|
Widget? child) {
|
||||||
spacing: 10,
|
return Wrap(
|
||||||
runSpacing: 10,
|
direction: Axis.horizontal,
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
// mainAxisSize: MainAxisSize.max,
|
spacing: 10,
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
runSpacing: 10,
|
||||||
children: [
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
SizedBox(width: 500, child: displayMedInput()),
|
// mainAxisSize: MainAxisSize.max,
|
||||||
displayPerscList(),
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
],
|
children: [
|
||||||
|
SizedBox(width: 500, child: displayMedInput()),
|
||||||
|
displayPerscList(patManProvider),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:fl_downloader/fl_downloader.dart';
|
|||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -51,70 +50,6 @@ class _BuildClaimStatementFileListState
|
|||||||
return teporaryFileUrl;
|
return teporaryFileUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String getFileName(String path) {
|
String getFileName(String path) {
|
||||||
//print(pdfLink.split(".")[1]);
|
//print(pdfLink.split(".")[1]);
|
||||||
return path.split("/").last;
|
return path.split("/").last;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -51,72 +50,6 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
return teporaryFileUrl;
|
return teporaryFileUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String getFileName(String path) {
|
String getFileName(String path) {
|
||||||
//print(pdfLink.split(".")[1]);
|
//print(pdfLink.split(".")[1]);
|
||||||
return path.split("/").last;
|
return path.split("/").last;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -45,68 +44,42 @@ class _BuildNotesListState extends State<BuildNotesList> {
|
|||||||
"The note has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
|
"The note has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
|
||||||
successPopUp("Successfuly Deleted", message);
|
successPopUp("Successfuly Deleted", message);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
},
|
||||||
),
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
alertTitle: title,
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deletePatientPopUp(
|
void deletePatientPopUp(
|
||||||
PatientManagerProvider patientManagerProvider, int NoteId) {
|
PatientManagerProvider patientManagerProvider, int NoteId) {
|
||||||
MihAlertServices().deleteConfirmationMessage(
|
MihAlertServices().deleteConfirmationAlert(
|
||||||
"This note will be deleted permanently. Are you certain you want to delete it?",
|
"This note will be deleted permanently. Are you certain you want to delete it?",
|
||||||
() {
|
() {
|
||||||
deleteNoteApiCall(patientManagerProvider, NoteId);
|
deleteNoteApiCall(patientManagerProvider, NoteId);
|
||||||
|
|||||||
@@ -51,14 +51,18 @@ class _PatientConsultationState extends State<PatientConsultation> {
|
|||||||
);
|
);
|
||||||
if (statuscode == 201) {
|
if (statuscode == 201) {
|
||||||
context.pop();
|
context.pop();
|
||||||
successPopUp("Note added successfully.");
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
"Note added successfully.",
|
||||||
|
context,
|
||||||
|
);
|
||||||
titleController.clear();
|
titleController.clear();
|
||||||
noteTextController.clear();
|
noteTextController.clear();
|
||||||
officeController.clear();
|
officeController.clear();
|
||||||
dateController.clear();
|
dateController.clear();
|
||||||
doctorController.clear();
|
doctorController.clear();
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +207,7 @@ class _PatientConsultationState extends State<PatientConsultation> {
|
|||||||
addPatientNoteAPICall(
|
addPatientNoteAPICall(
|
||||||
profileProvider, patManProvider);
|
profileProvider, patManProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -251,72 +255,6 @@ class _PatientConsultationState extends State<PatientConsultation> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String message) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
titleController.dispose();
|
titleController.dispose();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -56,7 +55,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
if (isFileFieldsFilled()) {
|
if (isFileFieldsFilled()) {
|
||||||
await uploadSelectedFile(patientManagerProvider, selected);
|
await uploadSelectedFile(patientManagerProvider, selected);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +80,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
"The file $fname has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use.";
|
"The file $fname has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use.";
|
||||||
successPopUp("Successfully Uplouded File", message);
|
successPopUp("Successfully Uplouded File", message);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +96,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
if (response == 200) {
|
if (response == 200) {
|
||||||
await addPatientFileLocationToDB(patientManagerProvider, file);
|
await addPatientFileLocationToDB(patientManagerProvider, file);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,9 +125,10 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
context.pop(); //Loading removal
|
context.pop(); //Loading removal
|
||||||
String message =
|
String message =
|
||||||
"The medical certificate $fileName has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use.";
|
"The medical certificate $fileName has been successfully generated and added to ${patientManagerProvider.selectedPatient!.first_name} ${patientManagerProvider.selectedPatient!.last_name}'s record. You can now access and download it for their use.";
|
||||||
|
await MihPatientServices().getPatientDocuments(patientManagerProvider);
|
||||||
successPopUp("Successfully Generated Certificate", message);
|
successPopUp("Successfully Generated Certificate", message);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
submitDocUploadForm(patientManagerProvider);
|
submitDocUploadForm(patientManagerProvider);
|
||||||
// uploadSelectedFile(selected);
|
// uploadSelectedFile(selected);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -303,7 +303,7 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
profileProvider, patientManagerProvider);
|
profileProvider, patientManagerProvider);
|
||||||
//Navigator.pop(context);
|
//Navigator.pop(context);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
@@ -496,57 +496,31 @@ class _PatientDocumentsState extends State<PatientDocuments> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.pop();
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
},
|
||||||
),
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
alertTitle: title,
|
|
||||||
alertBody: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ class _PatientInfoState extends State<PatientInfo> {
|
|||||||
void showEditPatientWindow() {
|
void showEditPatientWindow() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihEditPatientDetailsWindow();
|
return MihEditPatientDetailsWindow();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
@@ -65,64 +64,38 @@ class _PatientSetupFormState extends State<PatientSetupForm> {
|
|||||||
"${fnameController.text} ${lnameController.text} patient profile has been successfully added!\n";
|
"${fnameController.text} ${lnameController.text} patient profile has been successfully added!\n";
|
||||||
successPopUp("Successfully created Patient Profile", message);
|
successPopUp("Successfully created Patient Profile", message);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void successPopUp(String title, String message) {
|
void successPopUp(String title, String message) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.pop();
|
||||||
color: MihColors.getGreenColor(
|
context.goNamed(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
'patientProfile',
|
||||||
),
|
);
|
||||||
alertTitle: title,
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
context.goNamed(
|
|
||||||
'patientProfile',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +431,7 @@ class _PatientSetupFormState extends State<PatientSetupForm> {
|
|||||||
addPatientService(
|
addPatientService(
|
||||||
profileProvider, patientManagerProvider);
|
profileProvider, patientManagerProvider);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().inputErrorMessage(context);
|
MihAlertServices().inputErrorAlert(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ class _PatientProfileState extends State<PatientProfile> {
|
|||||||
icon: const Icon(Icons.arrow_back),
|
icon: const Icon(Icons.arrow_back),
|
||||||
iconSize: 35,
|
iconSize: 35,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
patientManagerProvider.setPatientProfileIndex(0);
|
|
||||||
if (!patientManagerProvider.personalMode) {
|
if (!patientManagerProvider.personalMode) {
|
||||||
context.pop();
|
context.pop();
|
||||||
} else {
|
} else {
|
||||||
@@ -111,6 +110,8 @@ class _PatientProfileState extends State<PatientProfile> {
|
|||||||
'mihHome',
|
'mihHome',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
patientManagerProvider.setPatientProfileIndex(0);
|
||||||
|
patientManagerProvider.setHidePatientDetails(true);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class MihAccessControlsServices {
|
|||||||
await MihNotificationApis.addAccessRequestNotificationAPICall(
|
await MihNotificationApis.addAccessRequestNotificationAPICall(
|
||||||
app_id, requested_by, personalSelected, args, context);
|
app_id, requested_by, personalSelected, args, context);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ class MihAccessControlsServices {
|
|||||||
app_id, personalSelected, args, context);
|
app_id, personalSelected, args, context);
|
||||||
//notification here
|
//notification here
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -100,6 +100,7 @@ class MihAuthenticationServices {
|
|||||||
void loginError(String error, BuildContext context) {
|
void loginError(String error, BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(error),
|
title: Text(error),
|
||||||
@@ -111,6 +112,7 @@ class MihAuthenticationServices {
|
|||||||
void signUpError(BuildContext context) {
|
void signUpError(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return MihPackageWindow(
|
return MihPackageWindow(
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/claim_statement_file.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/claim_statement_file.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
@@ -98,12 +94,16 @@ class MIHClaimStatementGenerationApi {
|
|||||||
getClaimStatementFilesByPatient(patientManagerProvider);
|
getClaimStatementFilesByPatient(patientManagerProvider);
|
||||||
String message =
|
String message =
|
||||||
"The ${data.document_type}: $fileName has been successfully generated and added to ${data.patient_full_name}'s record. You can now access and download it for their use.";
|
"The ${data.document_type}: $fileName has been successfully generated and added to ${data.patient_full_name}'s record. You can now access and download it for their use.";
|
||||||
successPopUp(message, context);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,80 +230,17 @@ class MIHClaimStatementGenerationApi {
|
|||||||
// setState(() {});
|
// setState(() {});
|
||||||
String message =
|
String message =
|
||||||
"The File has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
|
"The File has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
|
||||||
successPopUp(message, context);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//================== POP UPS ==========================================================================
|
|
||||||
|
|
||||||
static void successPopUp(String message, BuildContext context) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//================== POP UPS ==========================================================================
|
||||||
|
|||||||
@@ -3,11 +3,7 @@ import 'dart:convert';
|
|||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
@@ -107,87 +103,8 @@ class MihFileApi {
|
|||||||
return response.statusCode;
|
return response.statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<void> signOut() async {
|
|
||||||
// await SuperTokens.signOut(completionHandler: (error) {
|
|
||||||
// print(error);
|
|
||||||
// });
|
|
||||||
// if (await SuperTokens.doesSessionExist() == false) {
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// Navigator.of(context).popAndPushNamed(
|
|
||||||
// '/',
|
|
||||||
// arguments: AuthArguments(true, false),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//================== POP UPS ==========================================================================
|
//================== POP UPS ==========================================================================
|
||||||
|
|
||||||
static void successPopUp(String message, BuildContext context) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadingPopUp(BuildContext context) {
|
static void loadingPopUp(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ class MIHLocationAPI {
|
|||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
permission = await Geolocator.requestPermission();
|
permission = await Geolocator.requestPermission();
|
||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
MihAlertServices().locationPermissionError(context);
|
MihAlertServices().locationPermissionAlert(context);
|
||||||
return null;
|
return null;
|
||||||
} else if (permission == LocationPermission.deniedForever) {
|
} else if (permission == LocationPermission.deniedForever) {
|
||||||
MihAlertServices().locationPermissionError(context);
|
MihAlertServices().locationPermissionAlert(context);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Position location = await Geolocator.getCurrentPosition(
|
Position location = await Geolocator.getCurrentPosition(
|
||||||
@@ -30,7 +30,7 @@ class MIHLocationAPI {
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
} else if (permission == LocationPermission.deniedForever) {
|
} else if (permission == LocationPermission.deniedForever) {
|
||||||
MihAlertServices().locationPermissionError(context);
|
MihAlertServices().locationPermissionAlert(context);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Position location = await Geolocator.getCurrentPosition(
|
Position location = await Geolocator.getCurrentPosition(
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class MihMyBusinessUserServices {
|
|||||||
);
|
);
|
||||||
return 201;
|
return 201;
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ class MihMyBusinessUserServices {
|
|||||||
provider.setBusinessUserSignatureUrl(newProPicUrl);
|
provider.setBusinessUserSignatureUrl(newProPicUrl);
|
||||||
return 200;
|
return 200;
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/appointment.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/appointment.dart';
|
||||||
@@ -11,7 +8,6 @@ import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_objects/business_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/business_user.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
|
||||||
@@ -539,72 +535,6 @@ class MihMzansiCalendarApis {
|
|||||||
|
|
||||||
//================== POP UPS ==========================================================================
|
//================== POP UPS ==========================================================================
|
||||||
|
|
||||||
static void successPopUp(String message, BuildContext context) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadingPopUp(BuildContext context) {
|
static void loadingPopUp(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@@ -2,15 +2,11 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
|
||||||
@@ -215,72 +211,6 @@ class MIHMzansiWalletApis {
|
|||||||
|
|
||||||
//================== POP UPS ==========================================================================
|
//================== POP UPS ==========================================================================
|
||||||
|
|
||||||
static void successPopUp(String message, BuildContext context) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadingPopUp(BuildContext context) {
|
static void loadingPopUp(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/notification.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/notification.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
@@ -74,9 +70,13 @@ class MihNotificationApis {
|
|||||||
args.businessUser,
|
args.businessUser,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
successPopUp(message, context);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,9 +130,13 @@ class MihNotificationApis {
|
|||||||
// args.businessUser,
|
// args.businessUser,
|
||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
successPopUp(message, context);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,9 +190,13 @@ class MihNotificationApis {
|
|||||||
);
|
);
|
||||||
String message = "The appointment has been successfully rescheduled.";
|
String message = "The appointment has been successfully rescheduled.";
|
||||||
|
|
||||||
successPopUp(message, context);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,9 +247,13 @@ class MihNotificationApis {
|
|||||||
);
|
);
|
||||||
String message =
|
String message =
|
||||||
"The appointment has been cancelled successfully. This means it will no longer be visible in your waiting room and calender.";
|
"The appointment has been cancelled successfully. This means it will no longer be visible in your waiting room and calender.";
|
||||||
successPopUp(message, context);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,76 +306,14 @@ class MihNotificationApis {
|
|||||||
);
|
);
|
||||||
String message =
|
String message =
|
||||||
"The appointment was been created successfully. This means it will now be visible in your waiting room and calender.";
|
"The appointment was been created successfully. This means it will now be visible in your waiting room and calender.";
|
||||||
successPopUp(message, context);
|
MihAlertServices().successBasicAlert(
|
||||||
|
"Success!",
|
||||||
|
message,
|
||||||
|
context,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//================== POP UPS ==========================================================================
|
|
||||||
|
|
||||||
static void successPopUp(String message, BuildContext context) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: null,
|
|
||||||
onWindowTapClose: null,
|
|
||||||
backgroundColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
windowBody: Column(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.check_circle_outline_rounded,
|
|
||||||
size: 100,
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Success!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
width: 300,
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//================== POP UPS ==========================================================================
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -73,7 +71,7 @@ class MihUserServices {
|
|||||||
extra: true,
|
extra: true,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,66 +263,40 @@ class MihUserServices {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pop(); // Pop loading dialog
|
Navigator.of(context).pop(); // Pop loading dialog
|
||||||
MihAlertServices().internetConnectionLost(context);
|
MihAlertServices().internetConnectionAlert(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//================== POP UPS ==========================================================================
|
//================== POP UPS ==========================================================================
|
||||||
|
|
||||||
static void successPopUp(String title, String message, BuildContext context) {
|
static void successPopUp(String title, String message, BuildContext context) {
|
||||||
showDialog(
|
MihAlertServices().successAdvancedAlert(
|
||||||
context: context,
|
title,
|
||||||
builder: (context) {
|
message,
|
||||||
return MihPackageAlert(
|
[
|
||||||
alertIcon: Icon(
|
MihButton(
|
||||||
Icons.check_circle_outline_rounded,
|
onPressed: () {
|
||||||
size: 150,
|
context.goNamed(
|
||||||
color: MihColors.getGreenColor(
|
'mihHome',
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
extra: true,
|
||||||
),
|
);
|
||||||
alertTitle: title,
|
},
|
||||||
alertBody: Column(
|
buttonColor: MihColors.getPrimaryColor(
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
message,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
context.goNamed(
|
|
||||||
'mihHome',
|
|
||||||
extra: true,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Dismiss",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
alertColour: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
);
|
elevation: 10,
|
||||||
},
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Dismiss",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user