forked from yaso_meth/mih-project
use new home logic
This commit is contained in:
@@ -35,10 +35,7 @@ class _PackageTestState extends State<PackageTest> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
// Navigator.of(context).pop();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||
@@ -59,10 +58,7 @@ class _AboutMihState extends State<AboutMih> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||
@@ -44,10 +43,7 @@ class _MihAccessState extends State<MihAccess> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.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_validation_services.dart';
|
||||
@@ -186,10 +185,7 @@ class _ForgotPasswordState extends State<ForgotPassword> {
|
||||
onPressed: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
true,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
@@ -246,10 +242,7 @@ class _ForgotPasswordState extends State<ForgotPassword> {
|
||||
// Navigator.of(context).pop();
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
true,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||
@@ -46,10 +45,7 @@ class _MIHCalculatorState extends State<MIHCalculator> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
widget.personalSelected,
|
||||
false,
|
||||
),
|
||||
extra: widget.personalSelected,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -45,10 +45,7 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
|
||||
// Navigator.of(context).pop();
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_tile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_form.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||
@@ -62,10 +61,7 @@ class _MihSignInState extends State<MihSignIn> {
|
||||
if (successfulSignIn) {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
true,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,10 +268,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
||||
false) {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
true,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
// Navigator.of(context).pop();
|
||||
// Navigator.of(context).popAndPushNamed(
|
||||
|
||||
@@ -1,44 +1,45 @@
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/notification.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/patients.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/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_packages/mih_home/components/mih_app_drawer.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home_error.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/package_tools/mih_business_home.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/package_tools/mih_personal_home.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_service_calls.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MihHome extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final BusinessUser? businessUser;
|
||||
final Business? business;
|
||||
final Patient? patient;
|
||||
final List<MIHNotification> notifications;
|
||||
final ImageProvider<Object>? propicFile;
|
||||
final bool isUserNew;
|
||||
final bool isBusinessUser;
|
||||
final bool isBusinessUserNew;
|
||||
final bool isDevActive;
|
||||
bool personalSelected;
|
||||
MihHome({
|
||||
// final AppUser signedInUser;
|
||||
// final BusinessUser? businessUser;
|
||||
// final Business? business;
|
||||
// final Patient? patient;
|
||||
// final List<MIHNotification> notifications;
|
||||
// final ImageProvider<Object>? propicFile;
|
||||
// final bool isUserNew;
|
||||
// final bool isBusinessUser;
|
||||
// final bool isBusinessUserNew;
|
||||
// final bool isDevActive;
|
||||
final bool personalSelected;
|
||||
const MihHome({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.businessUser,
|
||||
required this.business,
|
||||
required this.patient,
|
||||
required this.notifications,
|
||||
required this.propicFile,
|
||||
required this.isUserNew,
|
||||
required this.isBusinessUser,
|
||||
required this.isBusinessUserNew,
|
||||
required this.isDevActive,
|
||||
// required this.signedInUser,
|
||||
// required this.businessUser,
|
||||
// required this.business,
|
||||
// required this.patient,
|
||||
// required this.notifications,
|
||||
// required this.propicFile,
|
||||
// required this.isUserNew,
|
||||
// required this.isBusinessUser,
|
||||
// required this.isBusinessUserNew,
|
||||
// required this.isDevActive,
|
||||
required this.personalSelected,
|
||||
});
|
||||
|
||||
@@ -50,6 +51,7 @@ class _MihHomeState extends State<MihHome> {
|
||||
final proPicController = TextEditingController();
|
||||
late int _selcetedIndex;
|
||||
late bool _personalSelected;
|
||||
late Future<HomeArguments> profileData;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -59,7 +61,7 @@ class _MihHomeState extends State<MihHome> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
profileData = MIHApiCalls().getProfile(10, context);
|
||||
if (widget.personalSelected == true) {
|
||||
setState(() {
|
||||
_selcetedIndex = 0;
|
||||
@@ -83,36 +85,60 @@ class _MihHomeState extends State<MihHome> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackage(
|
||||
appActionButton: getAction(),
|
||||
appTools: getTools(),
|
||||
appBody: getToolBody(),
|
||||
appToolTitles: getToolTitle(),
|
||||
actionDrawer: getActionDrawer(),
|
||||
selectedbodyIndex: _selcetedIndex,
|
||||
onIndexChange: (newValue) {
|
||||
if (_selcetedIndex == 0) {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
_personalSelected = true;
|
||||
});
|
||||
return FutureBuilder(
|
||||
future: profileData,
|
||||
builder: (context, asyncSnapshot) {
|
||||
if (asyncSnapshot.connectionState == ConnectionState.waiting) {
|
||||
return Scaffold(
|
||||
body: const Mihloadingcircle(
|
||||
message: "Getting your Data...",
|
||||
),
|
||||
);
|
||||
} else if (asyncSnapshot.connectionState == ConnectionState.done &&
|
||||
asyncSnapshot.hasData) {
|
||||
return MihPackage(
|
||||
appActionButton: getAction(asyncSnapshot.data!.profilePicUrl),
|
||||
appTools:
|
||||
getTools(asyncSnapshot.data!.signedInUser.type != "personal"),
|
||||
appBody: getToolBody(asyncSnapshot.data!),
|
||||
appToolTitles: getToolTitle(),
|
||||
actionDrawer: getActionDrawer(
|
||||
asyncSnapshot.data!.signedInUser,
|
||||
asyncSnapshot.data!.profilePicUrl,
|
||||
),
|
||||
selectedbodyIndex: _selcetedIndex,
|
||||
onIndexChange: (newValue) {
|
||||
if (_selcetedIndex == 0) {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
_personalSelected = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
_personalSelected = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
_personalSelected = false;
|
||||
});
|
||||
return MihHomeError(
|
||||
errorMessage: asyncSnapshot.hasError
|
||||
? asyncSnapshot.error.toString()
|
||||
: "An unknown error occurred",
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget getAction() {
|
||||
Widget getAction(String proPicUrl) {
|
||||
return Builder(builder: (context) {
|
||||
return MihPackageAction(
|
||||
icon: Padding(
|
||||
padding: const EdgeInsets.only(left: 5.0),
|
||||
child: MihCircleAvatar(
|
||||
imageFile: widget.propicFile,
|
||||
imageFile: proPicUrl != "" ? NetworkImage(proPicUrl) : null,
|
||||
width: 50,
|
||||
editable: false,
|
||||
fileNameController: proPicController,
|
||||
@@ -147,14 +173,14 @@ class _MihHomeState extends State<MihHome> {
|
||||
});
|
||||
}
|
||||
|
||||
MIHAppDrawer getActionDrawer() {
|
||||
MIHAppDrawer getActionDrawer(AppUser signedInUser, String proPicUrl) {
|
||||
return MIHAppDrawer(
|
||||
signedInUser: widget.signedInUser,
|
||||
propicFile: widget.propicFile,
|
||||
signedInUser: signedInUser,
|
||||
propicFile: proPicUrl != "" ? NetworkImage(proPicUrl) : null,
|
||||
);
|
||||
}
|
||||
|
||||
MihPackageTools getTools() {
|
||||
MihPackageTools getTools(bool isBusinessUser) {
|
||||
Map<Widget, void Function()?> temp = {};
|
||||
temp[const Icon(Icons.person)] = () {
|
||||
setState(() {
|
||||
@@ -162,7 +188,7 @@ class _MihHomeState extends State<MihHome> {
|
||||
_personalSelected = true;
|
||||
});
|
||||
};
|
||||
if (widget.isBusinessUser) {
|
||||
if (isBusinessUser) {
|
||||
temp[const Icon(Icons.business_center)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 1;
|
||||
@@ -176,27 +202,29 @@ class _MihHomeState extends State<MihHome> {
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> getToolBody() {
|
||||
List<Widget> getToolBody(HomeArguments profData) {
|
||||
List<Widget> toolBodies = [];
|
||||
toolBodies.add(
|
||||
MihPersonalHome(
|
||||
signedInUser: widget.signedInUser,
|
||||
signedInUser: profData.signedInUser,
|
||||
personalSelected: _personalSelected,
|
||||
business: widget.business,
|
||||
businessUser: widget.businessUser,
|
||||
propicFile: widget.propicFile,
|
||||
isUserNew: widget.isUserNew,
|
||||
isDevActive: widget.isDevActive,
|
||||
business: profData.business,
|
||||
businessUser: profData.businessUser,
|
||||
propicFile: profData.profilePicUrl != ""
|
||||
? NetworkImage(profData.profilePicUrl)
|
||||
: null,
|
||||
isDevActive: AppEnviroment.getEnv() == "Dev",
|
||||
isUserNew: profData.signedInUser.username == "",
|
||||
),
|
||||
);
|
||||
if (widget.isBusinessUser) {
|
||||
if (profData.signedInUser.type != "personal") {
|
||||
toolBodies.add(
|
||||
MihBusinessHome(
|
||||
signedInUser: widget.signedInUser,
|
||||
signedInUser: profData.signedInUser,
|
||||
personalSelected: _personalSelected,
|
||||
businessUser: widget.businessUser,
|
||||
business: widget.business,
|
||||
isBusinessUserNew: widget.isBusinessUserNew,
|
||||
businessUser: profData.businessUser,
|
||||
business: profData.business,
|
||||
isBusinessUserNew: profData.businessUser == null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
150
Frontend/lib/mih_packages/mih_home/mih_home_error.dart
Normal file
150
Frontend/lib/mih_packages/mih_home/mih_home_error.dart
Normal file
@@ -0,0 +1,150 @@
|
||||
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_components/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
|
||||
class MihHomeError extends StatefulWidget {
|
||||
final String errorMessage;
|
||||
const MihHomeError({
|
||||
super.key,
|
||||
required this.errorMessage,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MihHomeError> createState() => _MihHomeErrorState();
|
||||
}
|
||||
|
||||
class _MihHomeErrorState extends State<MihHomeError> {
|
||||
int _selcetedIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackage(
|
||||
appActionButton: getErrorAction(),
|
||||
appTools: getErrorTools(),
|
||||
appBody: getErrorToolBody(widget.errorMessage),
|
||||
selectedbodyIndex: _selcetedIndex,
|
||||
onIndexChange: (newValue) {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
});
|
||||
//print("Index: $_selcetedIndex");
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
MihPackageAction getErrorAction() {
|
||||
return MihPackageAction(
|
||||
icon: const Icon(Icons.refresh),
|
||||
iconSize: 35,
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
MihPackageTools getErrorTools() {
|
||||
Map<Widget, void Function()?> temp = {};
|
||||
temp[const Icon(Icons.power_off_outlined)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 0;
|
||||
});
|
||||
};
|
||||
return MihPackageTools(
|
||||
tools: temp,
|
||||
selcetedIndex: _selcetedIndex,
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> getErrorToolBody(String error) {
|
||||
List<Widget> toolBodies = [
|
||||
MihPackageToolBody(
|
||||
borderOn: true,
|
||||
bodyItem: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Connection Error",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fontSize: 35,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.power_off_outlined,
|
||||
size: 150,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
SizedBox(
|
||||
width: 500,
|
||||
child: Text(
|
||||
"Looks like we ran into an issue getting your data.\nPlease check you internet connection and try again.",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
MihButton(
|
||||
onPressed: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Refresh",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: SizedBox(
|
||||
width: 500,
|
||||
child: SelectionArea(
|
||||
child: Text(
|
||||
"Error: $error",
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
];
|
||||
return toolBodies;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,6 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
|
||||
_selcetedIndex = 0;
|
||||
});
|
||||
};
|
||||
|
||||
return MihPackageTools(
|
||||
tools: temp,
|
||||
selcetedIndex: _selcetedIndex,
|
||||
@@ -244,18 +243,18 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasData) {
|
||||
return MihHome(
|
||||
signedInUser: snapshot.requireData.signedInUser,
|
||||
businessUser: snapshot.data!.businessUser,
|
||||
business: snapshot.data!.business,
|
||||
patient: snapshot.data!.patient,
|
||||
notifications: snapshot.data!.notifi,
|
||||
propicFile: snapshot.data!.profilePicUrl != ""
|
||||
? NetworkImage(snapshot.data!.profilePicUrl)
|
||||
: null,
|
||||
isUserNew: isUserNew(snapshot.requireData.signedInUser),
|
||||
isBusinessUser: isBusinessUser(snapshot.requireData.signedInUser),
|
||||
isBusinessUserNew: isBusinessUserNew(snapshot.data!.businessUser),
|
||||
isDevActive: isDevActive(),
|
||||
// signedInUser: snapshot.requireData.signedInUser,
|
||||
// businessUser: snapshot.data!.businessUser,
|
||||
// business: snapshot.data!.business,
|
||||
// patient: snapshot.data!.patient,
|
||||
// notifications: snapshot.data!.notifi,
|
||||
// propicFile: snapshot.data!.profilePicUrl != ""
|
||||
// ? NetworkImage(snapshot.data!.profilePicUrl)
|
||||
// : null,
|
||||
// isUserNew: isUserNew(snapshot.requireData.signedInUser),
|
||||
// isBusinessUser: isBusinessUser(snapshot.requireData.signedInUser),
|
||||
// isBusinessUserNew: isBusinessUserNew(snapshot.data!.businessUser),
|
||||
// isDevActive: isDevActive(),
|
||||
personalSelected: widget.personalSelected,
|
||||
);
|
||||
// return MIHHomeLegacy(
|
||||
|
||||
@@ -31,10 +31,7 @@ class _MzansiAiState extends State<MzansiAi> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -100,10 +100,7 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -45,10 +45,7 @@ class _MzansiProfileState extends State<MzansiProfile> {
|
||||
// Navigator.of(context).pop();
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -182,10 +182,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||
onPressed: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
stayOnPersonalSide,
|
||||
false,
|
||||
),
|
||||
extra: stayOnPersonalSide,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
|
||||
@@ -55,10 +55,7 @@ class _MihWalletState extends State<MihWallet> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -525,10 +525,7 @@ class _AddPatientState extends State<AddPatient> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -45,10 +45,7 @@ class _PatientProfileState extends State<PatientProfile> {
|
||||
onTap: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
false,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||
@@ -102,10 +103,10 @@ class MihAuthenticationServices {
|
||||
if (response.statusCode == 200) {
|
||||
var userSignedin = jsonDecode(response.body);
|
||||
if (userSignedin["status"] == "OK") {
|
||||
Navigator.of(context).pop();
|
||||
context.pop();
|
||||
return true;
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
context.pop();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:convert';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||
@@ -52,10 +51,7 @@ class MihUserServices {
|
||||
if (response.statusCode == 201) {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
true,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
} else {
|
||||
internetConnectionPopUp(context);
|
||||
@@ -262,10 +258,7 @@ class MihUserServices {
|
||||
onPressed: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: AuthArguments(
|
||||
true,
|
||||
true,
|
||||
),
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
|
||||
Reference in New Issue
Block a user