QOL: MIH Go Router get data on package open pt2
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_print_prevew
|
|||||||
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_components/mih_package_components/Example/package_test.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/Example/package_test.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/about_mih/about_mih.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/about_mih/about_mih.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/access_review/mih_access.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/access_review/mih_access.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/calculator/mih_calculator.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/calculator/mih_calculator.dart';
|
||||||
@@ -153,12 +152,6 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.mzansiProfileManage,
|
path: MihGoRouterPaths.mzansiProfileManage,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: mzansiProfileManage");
|
KenLogger.success("MihGoRouter: mzansiProfileManage");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return MzansiProfile();
|
return MzansiProfile();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -184,16 +177,7 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.businessProfileManage,
|
path: MihGoRouterPaths.businessProfileManage,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: businessProfileManage");
|
KenLogger.success("MihGoRouter: businessProfileManage");
|
||||||
if (context.watch<MzansiProfileProvider>().business == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return BusinesProfile();
|
return BusinesProfile();
|
||||||
// return MzansiBusinessProfile(
|
|
||||||
// key: UniqueKey(),
|
|
||||||
// );
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
@@ -213,7 +197,6 @@ class MihGoRouter {
|
|||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
return MzansiBusinessProfileView(
|
return MzansiBusinessProfileView(
|
||||||
key: UniqueKey(),
|
|
||||||
businessId: businessId,
|
businessId: businessId,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -241,15 +224,7 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.calendar,
|
path: MihGoRouterPaths.calendar,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: mihCalendar");
|
KenLogger.success("MihGoRouter: mihCalendar");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
return MzansiCalendar();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return MzansiCalendar(
|
|
||||||
key: UniqueKey(),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// ========================== Mzansi AI ==================================
|
// ========================== Mzansi AI ==================================
|
||||||
@@ -258,12 +233,6 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.mzansiAi,
|
path: MihGoRouterPaths.mzansiAi,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: mzansiAi");
|
KenLogger.success("MihGoRouter: mzansiAi");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return MzansiAi();
|
return MzansiAi();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -273,15 +242,7 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.mzansiWallet,
|
path: MihGoRouterPaths.mzansiWallet,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: mzansiWallet");
|
KenLogger.success("MihGoRouter: mzansiWallet");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
return MihWallet();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return MihWallet(
|
|
||||||
key: UniqueKey(),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
@@ -306,14 +267,7 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.packageDevTest,
|
path: MihGoRouterPaths.packageDevTest,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: testPackage");
|
KenLogger.success("MihGoRouter: testPackage");
|
||||||
final TestArguments? args = state.extra as TestArguments?;
|
return PackageTest();
|
||||||
if (args == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return PackageTest(arguments: args);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// ========================== MIH Access Controls ==================================
|
// ========================== MIH Access Controls ==================================
|
||||||
@@ -322,15 +276,7 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.mihAccess,
|
path: MihGoRouterPaths.mihAccess,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: mihAccess");
|
KenLogger.success("MihGoRouter: mihAccess");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
return MihAccess();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return MihAccess(
|
|
||||||
key: UniqueKey(),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// ========================== Patient Profile ==================================
|
// ========================== Patient Profile ==================================
|
||||||
@@ -339,12 +285,6 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.patientProfile,
|
path: MihGoRouterPaths.patientProfile,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: patientProfile");
|
KenLogger.success("MihGoRouter: patientProfile");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return PatientProfile();
|
return PatientProfile();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -353,12 +293,6 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.patientProfileSetup,
|
path: MihGoRouterPaths.patientProfileSetup,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: patientProfileSetup");
|
KenLogger.success("MihGoRouter: patientProfileSetup");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return PatientSetUp();
|
return PatientSetUp();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -367,15 +301,7 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.patientManager,
|
path: MihGoRouterPaths.patientManager,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: patientManager");
|
KenLogger.success("MihGoRouter: patientManager");
|
||||||
if (context.watch<MzansiProfileProvider>().business == null) {
|
return PatManager();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return PatManager(
|
|
||||||
key: UniqueKey(),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
@@ -383,12 +309,6 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.patientManagerPatient,
|
path: MihGoRouterPaths.patientManagerPatient,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: patientManagerPatient");
|
KenLogger.success("MihGoRouter: patientManagerPatient");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return PatientProfile();
|
return PatientProfile();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -398,12 +318,6 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.mzansiDirectory,
|
path: MihGoRouterPaths.mzansiDirectory,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: mzansiDirectory");
|
KenLogger.success("MihGoRouter: mzansiDirectory");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return MzansiDirectory();
|
return MzansiDirectory();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -414,7 +328,13 @@ class MihGoRouter {
|
|||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: fileViewer");
|
KenLogger.success("MihGoRouter: fileViewer");
|
||||||
final FileViewArguments? args = state.extra as FileViewArguments?;
|
final FileViewArguments? args = state.extra as FileViewArguments?;
|
||||||
return FullScreenFileViewer(arguments: args!);
|
if (args == null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
context.go(MihGoRouterPaths.mihHome);
|
||||||
|
});
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return FullScreenFileViewer(arguments: args);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
@@ -424,7 +344,13 @@ class MihGoRouter {
|
|||||||
KenLogger.success("MihGoRouter: printPreview");
|
KenLogger.success("MihGoRouter: printPreview");
|
||||||
final PrintPreviewArguments? args =
|
final PrintPreviewArguments? args =
|
||||||
state.extra as PrintPreviewArguments?;
|
state.extra as PrintPreviewArguments?;
|
||||||
return MIHPrintPreview(arguments: args!);
|
if (args == null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
context.go(MihGoRouterPaths.mihHome);
|
||||||
|
});
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return MIHPrintPreview(arguments: args);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// ========================== MIH Minesweeper ==================================
|
// ========================== MIH Minesweeper ==================================
|
||||||
@@ -433,12 +359,6 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.mihMineSweeper,
|
path: MihGoRouterPaths.mihMineSweeper,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: mihMineSweeper");
|
KenLogger.success("MihGoRouter: mihMineSweeper");
|
||||||
if (context.watch<MzansiProfileProvider>().user == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return MihMineSweeper();
|
return MihMineSweeper();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user