rename container folders
This commit is contained in:
140
mih_ui/lib/mih_config/mih_colors.dart
Normal file
140
mih_ui/lib/mih_config/mih_colors.dart
Normal file
@@ -0,0 +1,140 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MihColors {
|
||||
bool women4Change = true;
|
||||
static Color getPrimaryColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
// return const Color(0XFF3A4454); // Original
|
||||
return const Color(0XFF6641b2); // Women4change
|
||||
} else {
|
||||
// return const Color(0XFFbedcfe); // Original
|
||||
return const Color(0xFFE0D1FF); // Women4change
|
||||
}
|
||||
}
|
||||
|
||||
static Color getSecondaryColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
// return const Color(0XFFbedcfe); // Original
|
||||
return const Color(0xFFE0D1FF); // Women4change
|
||||
} else {
|
||||
// return const Color(0XFF3A4454); // Original
|
||||
return const Color(0XFF6641b2); // Women4change
|
||||
}
|
||||
}
|
||||
|
||||
static Color getSecondaryInvertedColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
// return const Color(0XFF412301); // Original
|
||||
return const Color(0XFF1f2e00); // Women4change
|
||||
} else {
|
||||
// return const Color(0XFFc5bbab); // Original
|
||||
return const Color(0XFF99be4d); // Women4change
|
||||
}
|
||||
}
|
||||
|
||||
static Color getHighlightColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
// return const Color(0XFF9bc7fa);
|
||||
return const Color(0xFFC8AFFB); // Women4change
|
||||
} else {
|
||||
// return const Color(0XFF354866);
|
||||
return const Color(0XFF6641b2); // Women4change
|
||||
}
|
||||
}
|
||||
|
||||
static Color getGreyColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0XFFc8c8c8);
|
||||
} else {
|
||||
return const Color(0XFF747474);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getGreenColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xff8ae290);
|
||||
} else {
|
||||
return const Color(0xFF41B349);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getRedColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xffD87E8B);
|
||||
} else {
|
||||
return const Color(0xffbb3d4f);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getPinkColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xffdaa2e9);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xffdaa2e9);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getOrangeColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xffd69d7d);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xFFBD7145);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getYellowColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xfff4e467);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xffd4af37);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getBluishPurpleColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xff6e7dcc);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xFF5567C0);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getPurpleColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xffb682e7);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xFF9857D4);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getGoldColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xFFD4AF37);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xffFFD700);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getSilverColor(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xffC0C0C0);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xFFA6A6A6);
|
||||
}
|
||||
}
|
||||
|
||||
static Color getBronze(bool darkMode) {
|
||||
if (darkMode == true) {
|
||||
return const Color(0xffB1560F);
|
||||
} else {
|
||||
// Add a different shade of pink for light mode
|
||||
return const Color(0xFFCD7F32);
|
||||
}
|
||||
}
|
||||
}
|
||||
89
mih_ui/lib/mih_config/mih_env.dart
Normal file
89
mih_ui/lib/mih_config/mih_env.dart
Normal file
@@ -0,0 +1,89 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
enum Enviroment { dev, prod }
|
||||
|
||||
//
|
||||
abstract class AppEnviroment {
|
||||
static late String baseAppUrl;
|
||||
static late String baseApiUrl;
|
||||
static late String baseAiUrl;
|
||||
static late String baseFileUrl;
|
||||
static late String bannerAdUnitId;
|
||||
static late String whatsappAccessToken;
|
||||
static late String fingerPrintPluginKey;
|
||||
static late Enviroment _enviroment;
|
||||
static Enviroment get enviroment => _enviroment;
|
||||
static setupEnv(Enviroment env) {
|
||||
_enviroment = env;
|
||||
switch (env) {
|
||||
case Enviroment.dev:
|
||||
{
|
||||
if (kIsWeb) {
|
||||
//================= Web Dev Urls =================
|
||||
baseAppUrl = "http://localhost:80";
|
||||
baseApiUrl = "http://localhost:8080";
|
||||
baseFileUrl = "http://localhost:9000";
|
||||
baseAiUrl = "http://localhost:11434";
|
||||
bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174';
|
||||
break;
|
||||
} else if (Platform.isAndroid) {
|
||||
//================= Android Dev Urls =================
|
||||
baseAppUrl = "http://10.0.2.2:80";
|
||||
baseApiUrl = "http://10.0.2.2:8080";
|
||||
baseFileUrl = "http://10.0.2.2:9000";
|
||||
baseAiUrl = "http://10.0.2.2:11434";
|
||||
bannerAdUnitId = 'ca-app-pub-3940256099942544/9214589741';
|
||||
} else {
|
||||
//================= Web & iOS Dev Urls =================
|
||||
baseAppUrl = "http://localhost:80";
|
||||
baseApiUrl = "http://localhost:8080";
|
||||
baseFileUrl = "http://localhost:9000";
|
||||
baseAiUrl = "http://localhost:11434";
|
||||
bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174';
|
||||
break;
|
||||
}
|
||||
}
|
||||
case Enviroment.prod:
|
||||
{
|
||||
baseAppUrl = "https://app.mzansi-innovation-hub.co.za";
|
||||
baseApiUrl = "https://api.mzansi-innovation-hub.co.za";
|
||||
baseFileUrl = "https://minio.mzansi-innovation-hub.co.za";
|
||||
baseAiUrl = "https://ai.mzansi-innovation-hub.co.za";
|
||||
if (kIsWeb) {
|
||||
// No banner ads on web, or use a placeholder/specific web ad unit
|
||||
bannerAdUnitId = ''; // Or a specific web ad unit ID if you have one
|
||||
} else if (Platform.isAndroid) {
|
||||
bannerAdUnitId =
|
||||
'ca-app-pub-4781880856775334/8868663088'; // Android
|
||||
} else if (Platform.isIOS) {
|
||||
// Use Platform.isIOS for clarity
|
||||
bannerAdUnitId = 'ca-app-pub-4781880856775334/6640324682'; // iOS
|
||||
} else {
|
||||
// Fallback for other platforms if necessary
|
||||
bannerAdUnitId = '';
|
||||
}
|
||||
// bannerAdUnitId = Platform.isAndroid
|
||||
// ? 'ca-app-pub-4781880856775334/8868663088' // Android
|
||||
// : 'ca-app-pub-4781880856775334/6640324682'; // iOS
|
||||
//fingerPrintPluginKey = 'h5X7a5j14iUZCobI1ZeX';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String getEnv() {
|
||||
//_enviroment = env;
|
||||
switch (_enviroment) {
|
||||
case Enviroment.dev:
|
||||
{
|
||||
return "Dev";
|
||||
}
|
||||
case Enviroment.prod:
|
||||
{
|
||||
return "Prod";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
375
mih_ui/lib/mih_config/mih_go_router.dart
Normal file
375
mih_ui/lib/mih_config/mih_go_router.dart
Normal file
@@ -0,0 +1,375 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/components/mih_print_prevew.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_test.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.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/calculator/mih_calculator.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/calendar/mzansi_calendar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_forgot_password.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_file_viewer/mih_fle_viewer.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/mine_sweeper/mih_mine_sweeper.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_profile/business_profile/busines_profile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_business_profile_view.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/mzansi_set_up_business_profile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/mzansi_profile_view.dart';
|
||||
import 'package:ken_logger/ken_logger.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/mih_wallet.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/pat_manager.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_profile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_set_up.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:supertokens_flutter/supertokens.dart';
|
||||
|
||||
class MihGoRouterPaths {
|
||||
// External
|
||||
static const String resetPassword = '/auth/reset-password';
|
||||
static const String privacyPolicyExternal = '/privacy-policy';
|
||||
static const String termsOfServiceExternal = '/terms-of-service';
|
||||
|
||||
// Internal
|
||||
// static const String authCheck = '/';
|
||||
static const String mihAuthentication = '/mih-authentication';
|
||||
static const String mihHome = '/';
|
||||
static const String notifications = '/notifications';
|
||||
static const String forgotPassword = '/mih-authentication/forgot-password';
|
||||
static const String aboutMih = '/about';
|
||||
static const String mzansiProfileManage = '/mzansi-profile';
|
||||
static const String mzansiProfileView = '/mzansi-profile/view';
|
||||
static const String businessProfileSetup = '/business-profile/set-up';
|
||||
static const String businessProfileManage = '/business-profile/manage';
|
||||
static const String businessProfileView = '/business-profile/view';
|
||||
static const String patientProfile = '/patient-profile';
|
||||
static const String patientProfileSetup = '/patient-profile/set-up';
|
||||
static const String mzansiWallet = '/mzansi-wallet';
|
||||
static const String mzansiDirectory = '/mzansi-directory';
|
||||
static const String mihAccess = '/mih-access';
|
||||
static const String calendar = '/calendar';
|
||||
static const String appointments = '/appointments';
|
||||
static const String patientManager = '/patient-manager';
|
||||
static const String patientManagerPatient = '/patient-manager/patient';
|
||||
static const String fileViewer = '/file-veiwer';
|
||||
static const String printPreview = '/file-veiwer/print-preview';
|
||||
static const String barcodeScanner = '/scanner';
|
||||
static const String calculator = '/calculator';
|
||||
static const String mzansiAi = '/mzansi-ai';
|
||||
static const String mihMineSweeper = '/mih-minesweeper';
|
||||
static const String packageDevTest = '/package-dev';
|
||||
}
|
||||
|
||||
class MihGoRouter {
|
||||
final GoRouter mihRouter = GoRouter(
|
||||
initialLocation: MihGoRouterPaths.mihHome,
|
||||
redirect: (BuildContext context, GoRouterState state) async {
|
||||
final bool isUserSignedIn = await SuperTokens.doesSessionExist();
|
||||
final unauthenticatedPaths = [
|
||||
MihGoRouterPaths.mihAuthentication,
|
||||
MihGoRouterPaths.forgotPassword,
|
||||
MihGoRouterPaths.resetPassword,
|
||||
MihGoRouterPaths.aboutMih,
|
||||
MihGoRouterPaths.businessProfileView,
|
||||
];
|
||||
KenLogger.success(
|
||||
"Redirect Check: ${state.fullPath}, isUserSignedIn: $isUserSignedIn");
|
||||
if (!isUserSignedIn && !unauthenticatedPaths.contains(state.fullPath)) {
|
||||
return MihGoRouterPaths.mihAuthentication;
|
||||
}
|
||||
if (isUserSignedIn &&
|
||||
unauthenticatedPaths.contains(state.fullPath) &&
|
||||
state.fullPath != MihGoRouterPaths.aboutMih &&
|
||||
state.fullPath != MihGoRouterPaths.businessProfileView) {
|
||||
return MihGoRouterPaths.mihHome;
|
||||
}
|
||||
return null; // Stay on current route
|
||||
},
|
||||
routes: [
|
||||
// ========================== MIH Auth ==================================
|
||||
GoRoute(
|
||||
name: "mihAuthentication",
|
||||
path: MihGoRouterPaths.mihAuthentication,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mihAuthentication");
|
||||
return MihAuthentication();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "forgotPassword",
|
||||
path: MihGoRouterPaths.forgotPassword,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: forgotPassword");
|
||||
return const MihAuthForgotPassword();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "resetPassword",
|
||||
path: MihGoRouterPaths.resetPassword,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: resetPassword");
|
||||
String? token = state.uri.queryParameters['token'];
|
||||
KenLogger.success("token: $token");
|
||||
if (token == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.go(MihGoRouterPaths.mihHome);
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return MihAuthPasswordReset(token: token);
|
||||
},
|
||||
),
|
||||
// ========================== MIH Home ==================================
|
||||
GoRoute(
|
||||
name: "mihHome",
|
||||
path: MihGoRouterPaths.mihHome,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mihHome");
|
||||
return MihHome(
|
||||
key: UniqueKey(),
|
||||
);
|
||||
},
|
||||
),
|
||||
// ========================== About MIH ==================================
|
||||
GoRoute(
|
||||
name: "aboutMih",
|
||||
path: MihGoRouterPaths.aboutMih,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: aboutMih");
|
||||
return AboutMih();
|
||||
},
|
||||
),
|
||||
// ========================== Mzansi Profile Personal ==================================
|
||||
GoRoute(
|
||||
name: "mzansiProfileManage",
|
||||
path: MihGoRouterPaths.mzansiProfileManage,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mzansiProfileManage");
|
||||
return MzansiProfile();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "mzansiProfileView",
|
||||
path: MihGoRouterPaths.mzansiProfileView,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mzansiProfileView");
|
||||
MzansiDirectoryProvider directoryProvider =
|
||||
context.read<MzansiDirectoryProvider>();
|
||||
if (directoryProvider.selectedUser == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.go(MihGoRouterPaths.mihHome);
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return MzansiProfileView();
|
||||
},
|
||||
),
|
||||
// ========================== Mzansi Profile Business ==================================
|
||||
GoRoute(
|
||||
name: "businessProfileManage",
|
||||
path: MihGoRouterPaths.businessProfileManage,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: businessProfileManage");
|
||||
return BusinesProfile();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "businessProfileView",
|
||||
path: MihGoRouterPaths.businessProfileView,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: businessProfileView");
|
||||
String? businessId = state.uri.queryParameters['business_id'];
|
||||
KenLogger.success("businessId: $businessId");
|
||||
MzansiDirectoryProvider directoryProvider =
|
||||
context.read<MzansiDirectoryProvider>();
|
||||
if (directoryProvider.selectedBusiness == null &&
|
||||
businessId == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.go(MihGoRouterPaths.mihHome);
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return MzansiBusinessProfileView(
|
||||
businessId: businessId,
|
||||
fromMzansiDirectory: businessId == null,
|
||||
);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "businessProfileSetup",
|
||||
path: MihGoRouterPaths.businessProfileSetup,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: businessProfileSetup");
|
||||
return MzansiSetUpBusinessProfile();
|
||||
},
|
||||
),
|
||||
// ========================== MIH Calculator ==================================
|
||||
GoRoute(
|
||||
name: "mihCalculator",
|
||||
path: MihGoRouterPaths.calculator,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mihCalculator");
|
||||
return MIHCalculator();
|
||||
},
|
||||
),
|
||||
// ========================== MIH Calculator ==================================
|
||||
GoRoute(
|
||||
name: "mihCalendar",
|
||||
path: MihGoRouterPaths.calendar,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mihCalendar");
|
||||
return MzansiCalendar();
|
||||
},
|
||||
),
|
||||
// ========================== Mzansi AI ==================================
|
||||
GoRoute(
|
||||
name: "mzansiAi",
|
||||
path: MihGoRouterPaths.mzansiAi,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mzansiAi");
|
||||
return MzansiAi();
|
||||
},
|
||||
),
|
||||
// ========================== Mzansi Wallet ==================================
|
||||
GoRoute(
|
||||
name: "mzansiWallet",
|
||||
path: MihGoRouterPaths.mzansiWallet,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mzansiWallet");
|
||||
return MihWallet();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "barcodeScanner",
|
||||
path: MihGoRouterPaths.barcodeScanner,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: barcodeScanner");
|
||||
final TextEditingController? args =
|
||||
state.extra as TextEditingController?;
|
||||
if (args == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.go(MihGoRouterPaths.mihHome);
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return MihBarcodeScanner(cardNumberController: args);
|
||||
},
|
||||
),
|
||||
// ========================== Test Package ==================================
|
||||
GoRoute(
|
||||
name: "testPackage",
|
||||
path: MihGoRouterPaths.packageDevTest,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: testPackage");
|
||||
return PackageTest();
|
||||
},
|
||||
),
|
||||
// ========================== MIH Access Controls ==================================
|
||||
GoRoute(
|
||||
name: "mihAccess",
|
||||
path: MihGoRouterPaths.mihAccess,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mihAccess");
|
||||
return MihAccess();
|
||||
},
|
||||
),
|
||||
// ========================== Patient Profile ==================================
|
||||
GoRoute(
|
||||
name: "patientProfile",
|
||||
path: MihGoRouterPaths.patientProfile,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: patientProfile");
|
||||
return PatientProfile();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "patientProfileSetup",
|
||||
path: MihGoRouterPaths.patientProfileSetup,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: patientProfileSetup");
|
||||
return PatientSetUp();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "patientManager",
|
||||
path: MihGoRouterPaths.patientManager,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: patientManager");
|
||||
return PatManager();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "patientManagerPatient",
|
||||
path: MihGoRouterPaths.patientManagerPatient,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: patientManagerPatient");
|
||||
return PatientProfile();
|
||||
},
|
||||
),
|
||||
// ========================== Mzansi Directory ==================================
|
||||
GoRoute(
|
||||
name: "mzansiDirectory",
|
||||
path: MihGoRouterPaths.mzansiDirectory,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mzansiDirectory");
|
||||
return MzansiDirectory();
|
||||
},
|
||||
),
|
||||
// ========================== End ==================================
|
||||
GoRoute(
|
||||
name: "fileViewer",
|
||||
path: MihGoRouterPaths.fileViewer,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: fileViewer");
|
||||
return MihFleViewer();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
name: "printPreview",
|
||||
path: MihGoRouterPaths.printPreview,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: printPreview");
|
||||
final PrintPreviewArguments? args =
|
||||
state.extra as PrintPreviewArguments?;
|
||||
if (args == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.go(MihGoRouterPaths.mihHome);
|
||||
});
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return MIHPrintPreview(arguments: args);
|
||||
},
|
||||
),
|
||||
// ========================== MIH Minesweeper ==================================
|
||||
GoRoute(
|
||||
name: "mihMinesweeper",
|
||||
path: MihGoRouterPaths.mihMineSweeper,
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.success("MihGoRouter: mihMineSweeper");
|
||||
return MihMineSweeper();
|
||||
},
|
||||
),
|
||||
// ========================== End ==================================
|
||||
// GoRoute(
|
||||
// name: "notifications",
|
||||
// path: MihGoRouterPaths.notifications,
|
||||
// builder: (BuildContext context, GoRouterState state) {
|
||||
// final NotificationArguments? args = state.extra as NotificationArguments?;
|
||||
// return MIHNotificationMessage(arguments: args!);
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
// 3. Error handling with `errorBuilder` and `redirect`
|
||||
errorBuilder: (BuildContext context, GoRouterState state) {
|
||||
KenLogger.error('Invalid Route');
|
||||
return const MihRouteError();
|
||||
},
|
||||
);
|
||||
}
|
||||
145
mih_ui/lib/mih_config/mih_theme.dart
Normal file
145
mih_ui/lib/mih_config/mih_theme.dart
Normal file
@@ -0,0 +1,145 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import "package:universal_html/html.dart" as html;
|
||||
|
||||
class MihTheme {
|
||||
late String mode;
|
||||
late String screenType;
|
||||
late AssetImage loading;
|
||||
late String loadingAssetText;
|
||||
late TargetPlatform platform;
|
||||
bool kIsWeb = const bool.fromEnvironment('dart.library.js_util');
|
||||
String latestVersion = "1.2.5";
|
||||
MihTheme() {
|
||||
mode = "Dark";
|
||||
}
|
||||
|
||||
ThemeData getData(bool bool) {
|
||||
return ThemeData(
|
||||
fontFamily: 'Segoe UI',
|
||||
scaffoldBackgroundColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
colorScheme: ColorScheme(
|
||||
brightness: getBritness(),
|
||||
primary: MihColors.getSecondaryColor(mode == "Dark"),
|
||||
onPrimary: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
secondary: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
onSecondary: MihColors.getSecondaryColor(mode == "Dark"),
|
||||
error: MihColors.getRedColor(mode == "Dark"),
|
||||
onError: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
surface: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
onSurface: MihColors.getSecondaryColor(mode == "Dark"),
|
||||
),
|
||||
datePickerTheme: DatePickerThemeData(
|
||||
backgroundColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
headerBackgroundColor: MihColors.getSecondaryColor(mode == "Dark"),
|
||||
headerForegroundColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
color: MihColors.getSecondaryColor(mode == "Dark"),
|
||||
foregroundColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
titleTextStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||
backgroundColor: MihColors.getSecondaryColor(mode == "Dark"),
|
||||
foregroundColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
extendedTextStyle:
|
||||
TextStyle(color: MihColors.getPrimaryColor(mode == "Dark")),
|
||||
),
|
||||
drawerTheme: DrawerThemeData(
|
||||
backgroundColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
),
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
cursorColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
selectionColor:
|
||||
MihColors.getPrimaryColor(mode == "Dark").withOpacity(0.25),
|
||||
selectionHandleColor: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
),
|
||||
tooltipTheme: TooltipThemeData(
|
||||
decoration: BoxDecoration(
|
||||
color: MihColors.getSecondaryColor(mode == "Dark"),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border.all(
|
||||
width: 1.0,
|
||||
color: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color:
|
||||
MihColors.getPrimaryColor(mode == "Dark").withOpacity(0.18),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
textStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(mode == "Dark"),
|
||||
fontSize: 13,
|
||||
height: 1.2,
|
||||
),
|
||||
waitDuration: const Duration(milliseconds: 500),
|
||||
showDuration: const Duration(seconds: 3),
|
||||
preferBelow: true,
|
||||
verticalOffset: 24,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
triggerMode: TooltipTriggerMode.longPress,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getPlatform() {
|
||||
if (kIsWeb) {
|
||||
return "Web";
|
||||
} else if (!kIsWeb) {
|
||||
if (platform == TargetPlatform.android) {
|
||||
return "Android";
|
||||
} else if (platform == TargetPlatform.iOS) {
|
||||
return "iOS";
|
||||
}
|
||||
}
|
||||
return "Other";
|
||||
}
|
||||
|
||||
bool isPwa() {
|
||||
return html.window.matchMedia('(display-mode: standalone)').matches;
|
||||
}
|
||||
|
||||
void setMode(String m) {
|
||||
mode;
|
||||
}
|
||||
|
||||
String getLatestVersion() {
|
||||
return latestVersion;
|
||||
}
|
||||
|
||||
ThemeData getThemeData() {
|
||||
return getData(mode == "Dark");
|
||||
}
|
||||
|
||||
ThemeData darkMode() {
|
||||
return getData(mode == "Dark");
|
||||
}
|
||||
|
||||
ThemeData lightMode() {
|
||||
return getData(mode == "Dark");
|
||||
}
|
||||
|
||||
Brightness getBritness() {
|
||||
if (mode == "Dark") {
|
||||
return Brightness.dark;
|
||||
} else {
|
||||
return Brightness.light;
|
||||
}
|
||||
}
|
||||
|
||||
void setScreenType(double width) {
|
||||
if (width <= 800) {
|
||||
screenType = "mobile";
|
||||
} else {
|
||||
screenType = "desktop";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user