Merge pull request #252 from yaso-meth/BUG--Testing-fixes
BUG--Testing-fixes
This commit is contained in:
@@ -221,10 +221,12 @@ class WalletArguments {
|
|||||||
class MzansiAiArguments {
|
class MzansiAiArguments {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
final String? startUpQuestion;
|
final String? startUpQuestion;
|
||||||
|
final bool personalSelected;
|
||||||
|
|
||||||
MzansiAiArguments(
|
MzansiAiArguments(
|
||||||
this.signedInUser,
|
this.signedInUser,
|
||||||
this.startUpQuestion,
|
this.startUpQuestion,
|
||||||
|
this.personalSelected,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,6 +242,16 @@ class MzansiDirectoryArguments {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AboutArguments {
|
||||||
|
final bool personalSelected;
|
||||||
|
final int? packageIndex;
|
||||||
|
|
||||||
|
AboutArguments(
|
||||||
|
this.personalSelected,
|
||||||
|
this.packageIndex,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
class TestArguments {
|
class TestArguments {
|
||||||
final AppUser user;
|
final AppUser user;
|
||||||
final Business? business;
|
final Business? business;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_f
|
|||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_password_reset.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_password_reset.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_authentication.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_authentication.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_route_error.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/mzansi_ai.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_ai/mzansi_ai.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/mzansi_directory.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_directory/mzansi_directory.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile.dart';
|
||||||
@@ -149,12 +150,14 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.aboutMih,
|
path: MihGoRouterPaths.aboutMih,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: aboutMih");
|
KenLogger.success("MihGoRouter: aboutMih");
|
||||||
final int? packageIndex = state.extra as int?;
|
final AboutArguments? args = state.extra as AboutArguments?;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if (packageIndex != null) {
|
bool personalSelected = true;
|
||||||
index = packageIndex;
|
if (args != null) {
|
||||||
|
index = args.packageIndex ?? 0;
|
||||||
|
personalSelected = args.personalSelected;
|
||||||
}
|
}
|
||||||
return AboutMih(packageIndex: index);
|
return AboutMih(arguments: AboutArguments(personalSelected, index));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// ========================== Mzansi Profile Personal ==================================
|
// ========================== Mzansi Profile Personal ==================================
|
||||||
@@ -473,7 +476,7 @@ class MihGoRouter {
|
|||||||
// 3. Error handling with `errorBuilder` and `redirect`
|
// 3. Error handling with `errorBuilder` and `redirect`
|
||||||
errorBuilder: (BuildContext context, GoRouterState state) {
|
errorBuilder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.error('Invalid Route');
|
KenLogger.error('Invalid Route');
|
||||||
return const Placeholder();
|
return const MihRouteError();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:go_router/go_router.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_components/mih_package_components/mih_package.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_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_package_tools.dart';
|
||||||
@@ -9,10 +10,10 @@ import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tools/mih_t
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class AboutMih extends StatefulWidget {
|
class AboutMih extends StatefulWidget {
|
||||||
final int? packageIndex;
|
final AboutArguments? arguments;
|
||||||
const AboutMih({
|
const AboutMih({
|
||||||
super.key,
|
super.key,
|
||||||
this.packageIndex,
|
this.arguments,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -21,15 +22,18 @@ class AboutMih extends StatefulWidget {
|
|||||||
|
|
||||||
class _AboutMihState extends State<AboutMih> {
|
class _AboutMihState extends State<AboutMih> {
|
||||||
late int _selcetedIndex;
|
late int _selcetedIndex;
|
||||||
|
late bool _personalSelected;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
setState(() {
|
setState(() {
|
||||||
if (widget.packageIndex == null) {
|
if (widget.arguments == null) {
|
||||||
_selcetedIndex = 0;
|
_selcetedIndex = 0;
|
||||||
|
_personalSelected = true;
|
||||||
} else {
|
} else {
|
||||||
_selcetedIndex = widget.packageIndex!;
|
_selcetedIndex = widget.arguments!.packageIndex!;
|
||||||
|
_personalSelected = widget.arguments!.personalSelected;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -58,7 +62,7 @@ class _AboutMihState extends State<AboutMih> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
'mihHome',
|
'mihHome',
|
||||||
extra: true,
|
extra: _personalSelected,
|
||||||
);
|
);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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_components/mih_objects/arguments.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tile.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tile.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
@@ -7,9 +8,11 @@ import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|||||||
|
|
||||||
class AboutMihTile extends StatefulWidget {
|
class AboutMihTile extends StatefulWidget {
|
||||||
final double packageSize;
|
final double packageSize;
|
||||||
|
final bool personalSelected;
|
||||||
const AboutMihTile({
|
const AboutMihTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.packageSize,
|
required this.packageSize,
|
||||||
|
required this.personalSelected,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -23,7 +26,10 @@ class _AboutMihTileState extends State<AboutMihTile> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
"aboutMih",
|
"aboutMih",
|
||||||
extra: 0,
|
extra: AboutArguments(
|
||||||
|
widget.personalSelected,
|
||||||
|
0,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
// Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
// '/about',
|
// '/about',
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
|
|||||||
// Navigator.of(context).pop();
|
// Navigator.of(context).pop();
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
'mihHome',
|
'mihHome',
|
||||||
extra: true,
|
extra: widget.arguments.personalSelected,
|
||||||
);
|
);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class _MihHomeState extends State<MihHome> {
|
|||||||
if (asyncSnapshot.connectionState == ConnectionState.waiting) {
|
if (asyncSnapshot.connectionState == ConnectionState.waiting) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: const Mihloadingcircle(
|
body: const Mihloadingcircle(
|
||||||
message: "Fetching your Data...",
|
// message: "Fetching your Data...",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (asyncSnapshot.connectionState == ConnectionState.done &&
|
} else if (asyncSnapshot.connectionState == ConnectionState.done &&
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,281 +0,0 @@
|
|||||||
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_objects/business_user.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_tool_body.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_config/mih_colors.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../../mih_services/mih_service_calls.dart';
|
|
||||||
import '../../mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
|
||||||
import '../../mih_config/mih_env.dart';
|
|
||||||
|
|
||||||
class MIHProfileGetter extends StatefulWidget {
|
|
||||||
final bool personalSelected;
|
|
||||||
const MIHProfileGetter({
|
|
||||||
super.key,
|
|
||||||
required this.personalSelected,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MIHProfileGetter> createState() => _MIHProfileGetterState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MIHProfileGetterState extends State<MIHProfileGetter> {
|
|
||||||
String useremail = "";
|
|
||||||
int amount = 10;
|
|
||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
|
||||||
late Future<HomeArguments> profile;
|
|
||||||
|
|
||||||
String proPicUrl = "empty";
|
|
||||||
ImageProvider<Object>? propicFile;
|
|
||||||
int _selcetedIndex = 0;
|
|
||||||
|
|
||||||
bool isUserNew(AppUser signedInUser) {
|
|
||||||
if (signedInUser.fname == "") {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isDevActive() {
|
|
||||||
if (AppEnviroment.getEnv() == "Dev") {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isBusinessUser(AppUser signedInUser) {
|
|
||||||
if (signedInUser.type == "personal") {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isBusinessUserNew(BusinessUser? businessUser) {
|
|
||||||
if (businessUser == null) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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: () {
|
|
||||||
Navigator.of(context).popAndPushNamed("/");
|
|
||||||
},
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget errorPage(String error) {
|
|
||||||
return MihPackage(
|
|
||||||
appActionButton: MihPackageAction(
|
|
||||||
icon: const Icon(Icons.refresh),
|
|
||||||
iconSize: 35,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).popAndPushNamed("/");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
appTools: getErrorTools(),
|
|
||||||
appBody: getErrorToolBody(error),
|
|
||||||
selectedbodyIndex: _selcetedIndex,
|
|
||||||
onIndexChange: (newValue) {
|
|
||||||
setState(() {
|
|
||||||
_selcetedIndex = newValue;
|
|
||||||
});
|
|
||||||
//print("Index: $_selcetedIndex");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
// return MIHLayoutBuilder(
|
|
||||||
// actionButton: MIHAction(
|
|
||||||
// icon: const Icon(Icons.refresh),
|
|
||||||
// iconSize: 35,
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.of(context).popAndPushNamed("/");
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// header: const MIHHeader(
|
|
||||||
// headerAlignment: MainAxisAlignment.center,
|
|
||||||
// headerItems: [
|
|
||||||
// Text(
|
|
||||||
// "Mzanzi Innovation Hub",
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// fontSize: 20,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// secondaryActionButton: null,
|
|
||||||
// body: MIHBody(
|
|
||||||
// borderOn: false,
|
|
||||||
// bodyItems: [
|
|
||||||
// Align(
|
|
||||||
// alignment: Alignment.center,
|
|
||||||
// child: Text(
|
|
||||||
// '$error occurred',
|
|
||||||
// style: const TextStyle(fontSize: 18),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// actionDrawer: null,
|
|
||||||
// secondaryActionDrawer: null,
|
|
||||||
// bottomNavBar: null,
|
|
||||||
// pullDownToRefresh: false,
|
|
||||||
// onPullDown: () async {},
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
// TODO: implement dispose
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
//profile = getProfile();
|
|
||||||
profile = MIHApiCalls().getProfile(amount, context);
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return FutureBuilder(
|
|
||||||
future: profile,
|
|
||||||
builder: (BuildContext context, snapshot) {
|
|
||||||
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(),
|
|
||||||
personalSelected: widget.personalSelected,
|
|
||||||
);
|
|
||||||
// return MIHHomeLegacy(
|
|
||||||
// signedInUser: snapshot.requireData.signedInUser,
|
|
||||||
// businessUser: snapshot.data!.businessUser,
|
|
||||||
// business: snapshot.data!.business,
|
|
||||||
// patient: snapshot.data!.patient,
|
|
||||||
// notifications: snapshot.data!.notifi,
|
|
||||||
// propicFile: isPictureAvailable(snapshot.data!.profilePicUrl),
|
|
||||||
// isUserNew: isUserNew(snapshot.requireData.signedInUser),
|
|
||||||
// isBusinessUser: isBusinessUser(snapshot.requireData.signedInUser),
|
|
||||||
// isBusinessUserNew: isBusinessUserNew(snapshot.data!.businessUser),
|
|
||||||
// isDevActive: isDevActive(),
|
|
||||||
// personalSelected: widget.personalSelected,
|
|
||||||
// );
|
|
||||||
} else {
|
|
||||||
return errorPage(snapshot.error.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return const Mihloadingcircle();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
149
Frontend/lib/mih_packages/mih_home/mih_route_error.dart
Normal file
149
Frontend/lib/mih_packages/mih_home/mih_route_error.dart
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
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_icons.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 MihRouteError extends StatefulWidget {
|
||||||
|
const MihRouteError({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MihRouteError> createState() => _MihRouteErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MihRouteErrorState extends State<MihRouteError> {
|
||||||
|
int _selcetedIndex = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MihPackage(
|
||||||
|
appActionButton: getErrorAction(),
|
||||||
|
appTools: getErrorTools(),
|
||||||
|
appBody: getErrorToolBody(),
|
||||||
|
selectedbodyIndex: _selcetedIndex,
|
||||||
|
onIndexChange: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
_selcetedIndex = newValue;
|
||||||
|
});
|
||||||
|
//print("Index: $_selcetedIndex");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
MihPackageAction getErrorAction() {
|
||||||
|
return MihPackageAction(
|
||||||
|
icon: const Icon(MihIcons.mihLogo),
|
||||||
|
iconSize: 35,
|
||||||
|
onTap: () {
|
||||||
|
context.goNamed(
|
||||||
|
'mihHome',
|
||||||
|
extra: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
MihPackageTools getErrorTools() {
|
||||||
|
Map<Widget, void Function()?> temp = {};
|
||||||
|
temp[const Icon(Icons.link_off_rounded)] = () {
|
||||||
|
setState(() {
|
||||||
|
_selcetedIndex = 0;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return MihPackageTools(
|
||||||
|
tools: temp,
|
||||||
|
selcetedIndex: _selcetedIndex,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> getErrorToolBody() {
|
||||||
|
List<Widget> toolBodies = [
|
||||||
|
MihPackageToolBody(
|
||||||
|
borderOn: true,
|
||||||
|
bodyItem: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Oops! Wrong Turn.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 35,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.link_off_rounded,
|
||||||
|
size: 150,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 700,
|
||||||
|
child: Text(
|
||||||
|
"It looks like you've taken a wrong turn and ended up on a package that doesn't exist within the MIH App.\n\nDon't worry, getting back is easy. Just click the button below or the MIH Logo to return to the correct path.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
context.goNamed(
|
||||||
|
'mihHome',
|
||||||
|
extra: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
width: 300,
|
||||||
|
child: Text(
|
||||||
|
"Back to MIH",
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -118,6 +118,7 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
|||||||
temp.add({
|
temp.add({
|
||||||
"Mzansi Directory": MzansiDirectoryTile(
|
"Mzansi Directory": MzansiDirectoryTile(
|
||||||
packageSize: packageSize,
|
packageSize: packageSize,
|
||||||
|
personalSelected: false,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
//=============== Calculator ===============
|
//=============== Calculator ===============
|
||||||
@@ -130,12 +131,21 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
|||||||
//=============== Mzansi AI ===============
|
//=============== Mzansi AI ===============
|
||||||
temp.add({
|
temp.add({
|
||||||
"Mzansi AI": MzansiAiTile(
|
"Mzansi AI": MzansiAiTile(
|
||||||
signedInUser: widget.signedInUser,
|
arguments: MzansiAiArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
),
|
||||||
packageSize: packageSize,
|
packageSize: packageSize,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
//=============== About MIH ===============
|
//=============== About MIH ===============
|
||||||
temp.add({"About MIH": AboutMihTile(packageSize: packageSize)});
|
temp.add({
|
||||||
|
"About MIH": AboutMihTile(
|
||||||
|
packageSize: packageSize,
|
||||||
|
personalSelected: false,
|
||||||
|
)
|
||||||
|
});
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +262,7 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
|||||||
searchController.text.isEmpty
|
searchController.text.isEmpty
|
||||||
? null
|
? null
|
||||||
: searchController.text,
|
: searchController.text,
|
||||||
|
false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
|||||||
temp.add({
|
temp.add({
|
||||||
"Mzansi Directory": MzansiDirectoryTile(
|
"Mzansi Directory": MzansiDirectoryTile(
|
||||||
packageSize: packageSize,
|
packageSize: packageSize,
|
||||||
|
personalSelected: true,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
//=============== Calendar ===============
|
//=============== Calendar ===============
|
||||||
@@ -137,7 +138,11 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
|||||||
//=============== Mzansi AI ===============
|
//=============== Mzansi AI ===============
|
||||||
temp.add({
|
temp.add({
|
||||||
"Mzansi AI": MzansiAiTile(
|
"Mzansi AI": MzansiAiTile(
|
||||||
signedInUser: widget.signedInUser,
|
arguments: MzansiAiArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
"",
|
||||||
|
true,
|
||||||
|
),
|
||||||
packageSize: packageSize,
|
packageSize: packageSize,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@@ -156,7 +161,12 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
//=============== About MIH ===============
|
//=============== About MIH ===============
|
||||||
temp.add({"About MIH": AboutMihTile(packageSize: packageSize)});
|
temp.add({
|
||||||
|
"About MIH": AboutMihTile(
|
||||||
|
packageSize: packageSize,
|
||||||
|
personalSelected: true,
|
||||||
|
)
|
||||||
|
});
|
||||||
//=============== Dev ===============
|
//=============== Dev ===============
|
||||||
if (widget.isDevActive) {
|
if (widget.isDevActive) {
|
||||||
temp.add({
|
temp.add({
|
||||||
@@ -290,6 +300,7 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
|||||||
searchController.text.isEmpty
|
searchController.text.isEmpty
|
||||||
? null
|
? null
|
||||||
: searchController.text,
|
: searchController.text,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class _MzansiAiState extends State<MzansiAi> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
'mihHome',
|
'mihHome',
|
||||||
extra: true,
|
extra: widget.arguments.personalSelected,
|
||||||
);
|
);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,18 +2,17 @@ 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_components/mih_package_components/mih_package_tile.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tile.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.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_config/mih_colors.dart';
|
||||||
|
|
||||||
class MzansiAiTile extends StatefulWidget {
|
class MzansiAiTile extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final MzansiAiArguments arguments;
|
||||||
final double packageSize;
|
final double packageSize;
|
||||||
|
|
||||||
const MzansiAiTile({
|
const MzansiAiTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.signedInUser,
|
required this.arguments,
|
||||||
required this.packageSize,
|
required this.packageSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -28,10 +27,7 @@ class _MzansiAiTileState extends State<MzansiAiTile> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
'mzansiAi',
|
'mzansiAi',
|
||||||
extra: MzansiAiArguments(
|
extra: widget.arguments,
|
||||||
widget.signedInUser,
|
|
||||||
"",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
// Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
// '/mzansi-ai',
|
// '/mzansi-ai',
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
'mihHome',
|
'mihHome',
|
||||||
extra: true,
|
extra: widget.arguments.personalSearch,
|
||||||
);
|
);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|||||||
|
|
||||||
class MzansiDirectoryTile extends StatefulWidget {
|
class MzansiDirectoryTile extends StatefulWidget {
|
||||||
final double packageSize;
|
final double packageSize;
|
||||||
|
final bool personalSelected;
|
||||||
const MzansiDirectoryTile({
|
const MzansiDirectoryTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.packageSize,
|
required this.packageSize,
|
||||||
|
required this.personalSelected,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -25,7 +27,7 @@ class _MzansiDirectoryTileState extends State<MzansiDirectoryTile> {
|
|||||||
context.goNamed(
|
context.goNamed(
|
||||||
"mzansiDirectory",
|
"mzansiDirectory",
|
||||||
extra: MzansiDirectoryArguments(
|
extra: MzansiDirectoryArguments(
|
||||||
personalSearch: true,
|
personalSearch: widget.personalSelected,
|
||||||
startSearchText: null,
|
startSearchText: null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
Center(
|
Center(
|
||||||
child: MihButton(
|
child: MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
shopController.clear();
|
||||||
|
_nicknameController.clear();
|
||||||
|
cardNumberController.clear();
|
||||||
context.pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: mzansi_innovation_hub
|
name: mzansi_innovation_hub
|
||||||
description: ""
|
description: ""
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
version: 1.2.0+95
|
version: 1.2.0+96
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.5.3 <4.0.0'
|
sdk: '>=3.5.3 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user