51 Commits

Author SHA1 Message Date
e5ce03e396 migrate to mih_package_tooklit 2026-03-20 12:04:18 +02:00
c67529dbac Migration to mih_package_toolkit 2026-03-18 16:42:12 +02:00
84cb6b2e83 linux icon image fix 2026-02-26 15:15:49 +02:00
6e07a55885 Flatpak linux build 2026-02-26 13:54:38 +02:00
8fb31695a8 linux flatpak config pt11 2026-02-26 12:34:01 +02:00
4fafa35888 linux flatpak config pt10 2026-02-26 12:17:14 +02:00
0cf9634c5d linux flatpak config pt9 2026-02-26 12:15:59 +02:00
787a8057b2 linux flatpak config pt8 2026-02-26 12:15:04 +02:00
5f911d51f9 linux flatpak config pt7 2026-02-26 09:31:20 +02:00
8da29792b4 linux flatpak config pt6 2026-02-26 09:28:18 +02:00
5e003a4d71 linux flatpak config pt5 2026-02-25 15:50:02 +02:00
fcf1bbbb15 linux flatpak config pt4 2026-02-25 15:44:10 +02:00
ff7f363983 linux flatpak config pt3 2026-02-25 15:35:45 +02:00
843997e58c linux flatpak config pt2 2026-02-25 15:09:23 +02:00
3778ebb261 linux flatpak config 2026-02-25 14:51:15 +02:00
b1487839a7 linux name change 2026-02-25 13:58:42 +02:00
221030eff3 fix platform specific code not working on web pt2 2026-02-25 12:16:53 +02:00
5135629b33 fix platform specific code not working on web 2026-02-25 12:05:07 +02:00
281ea863e8 api cros fix 2026-02-25 11:54:49 +02:00
1c0dd6d328 update build number to 130 2026-02-25 10:25:28 +02:00
07d4ba4afa Support linux version of MIHpt2 2026-02-24 16:30:06 +02:00
6ad6b6ccbd Support linux version of MIH 2026-02-24 15:41:55 +02:00
ce2575035f make profile picture the full height of the window 2026-02-24 12:43:34 +02:00
baea2c9fdb fix file display on Dev Web & iOS 2026-02-24 12:37:31 +02:00
27639cb964 add scroll bar to dropdown fields 2026-02-24 11:05:24 +02:00
1143d11054 fix supertoken versioning error 2026-02-24 11:02:30 +02:00
213f3d418d update build number to 129 2026-02-18 15:41:37 +02:00
e33a62b909 update look & feel of attribution list 2026-02-18 14:03:04 +02:00
ebab9bae52 update build no to 128 2026-02-18 11:52:30 +02:00
82c25c5406 make profile picture expandable 2026-02-18 11:51:44 +02:00
3f0fc08a5c update business user edit workflow 2026-02-18 10:56:34 +02:00
f137ea41ac fix loading indicator alignment for business QR code 2026-02-18 10:41:49 +02:00
a7effa3576 Update profile link and business card Icons alignment 2026-02-18 10:26:41 +02:00
74341a9cc6 Enhance Mzansi Profile Look & Feel and workflow 2026-02-18 10:18:03 +02:00
c5267c0540 change follow us link alignments 2026-02-16 16:27:39 +02:00
d4ba3aaa03 fix short cut icon issue 2026-02-16 15:34:27 +02:00
103ccdc022 Add scroll bar to mih 2026-02-16 15:23:16 +02:00
f8a722eb50 change design on profile links and add git option 2026-02-16 14:43:34 +02:00
fdb28080e3 fix web cros issues with fixed dev port pt2 2026-02-16 14:42:33 +02:00
8a384921c5 fix web cros issues with fixed dev port 2026-02-16 14:41:51 +02:00
4b47bf5288 enhacne install/ update mih button to cater for huawei 2026-02-16 14:08:00 +02:00
141611b84d fix mzansi ai modal 2026-02-16 13:43:15 +02:00
a29d0afeb8 update version number of mih 2026-02-16 13:25:46 +02:00
eb93714022 add ds_store file to ingore file 2026-02-16 13:09:33 +02:00
071612a521 BUG: API Wildcard CROS issue 2026-02-16 13:09:33 +02:00
726a60ad25 BUG: Fix exposed ports on mih server 2026-02-16 13:09:33 +02:00
b897986c1f BUG: Fix hardcoded supertoken api key 2026-02-16 13:09:33 +02:00
7d4d7fc713 BUG: Fix Security Flutter Web server 2026-02-16 13:09:33 +02:00
91075255f4 add scrolling to about package 2026-02-10 14:07:05 +02:00
5c2f19dcc4 enable linux platform & rename widnow 2026-02-10 11:58:35 +02:00
58aebbeabe Merge pull request 'ruleset test' (#1) from tester-branch into main
Reviewed-on: #1
2026-02-04 11:18:21 +00:00
206 changed files with 4366 additions and 9372 deletions

BIN
.DS_Store vendored

Binary file not shown.

1
.gitignore vendored
View File

@@ -11,3 +11,4 @@ Mzansi_Mail/
google-chrome-stable_current_amd64.deb
.env
Frontend/android/app/.cxx/
.DS_Store

11
.vscode/launch.json vendored
View File

@@ -11,6 +11,17 @@
"type": "dart",
"program": "lib/main_dev.dart"
},
{
"name": "Debug (web)",
"cwd": "mih_ui",
"request": "launch",
"type": "dart",
"program": "lib/main_dev.dart",
"args": [
"--web-port",
"1995"
]
},
{
"name": "Profile",
"cwd": "mih_ui",

View File

@@ -4,37 +4,6 @@ networks:
driver: bridge
#============== MIH Containers ====================================================================
services:
#============== Nginx Proxy Server Old ====================================================================
# nginx:
# container_name: nginx
# restart: unless-stopped
# image: nginx
# ports:
# - 80:80
# - 443:443
# volumes:
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf
# - certbotConf:/etc/letsencrypt
# - certbotChall:/var/www/certbot
# depends_on:
# - mih-ux
# networks:
# - mih-network
# profiles: [ 'prod' ]
#============== Cert Bot Old ====================================================================
# certbot:
# image: certbot/certbot
# container_name: certbot
# volumes:
# - certbotConf:/etc/letsencrypt
# - certbotChall:/var/www/certbot
# #command: certonly --test-cert --webroot -w /var/www/certbot --force-renewal --email yasienmeth@gmail.com -d mzansi-innovation-hub.co.za -d www.mzansi-innovation-hub.co.za --agree-tos
# command: certonly --webroot -w /var/www/certbot --force-renewal --email ${CERTBOT_EMAIL} -d ${CERTBOT_APP_DOMAIN} -d ${CERTBOT_API_DOMAIN} -d ${CERTBOT_STORAGE_DOMAIN} -d ${CERTBOT_MONITOR_DOMAIN} -d ${CERTBOT_AI_DOMAIN} --agree-tos
# networks:
# - mih-network
# depends_on:
# - nginx
# profiles: [ 'withCert' ]
#============== Nginx Proxy Manager ====================================================================
mih-nginx:
container_name: mih-nginx
@@ -43,7 +12,7 @@ services:
ports:
- '80:80' # Public HTTP
- '443:443' # Public HTTPS
- '81:81' # Admin Web Port
- '127.0.0.1:81:81' # Admin Web Port
volumes:
- ./mih_nginx/data:/data
- ./mih_nginx/letsencrypt:/etc/letsencrypt
@@ -69,8 +38,8 @@ services:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
- "127.0.0.1:3000:3000"
- "127.0.0.1:222:22"
depends_on:
mih-gitea-db:
condition: service_healthy
@@ -99,7 +68,7 @@ services:
depends_on:
- mih-db
ports:
- 3567:3567
- '127.0.0.1:3567:3567'
environment:
REFRESH_TOKEN_VALIDITY: '604800'
ACCESS_TOKEN_VALIDITY: '86400'
@@ -125,7 +94,7 @@ services:
image: wordpress
restart: always
ports:
- 8081:80
- '127.0.0.1:8081:80'
environment:
WORDPRESS_DB_HOST: mih-wp-db
WORDPRESS_DB_USER: ${WP_SQL_USER}
@@ -154,7 +123,7 @@ services:
build:
context: ./mih_ui
ports:
- "83:83"
- "127.0.0.1:83:83"
networks:
- mih-network
depends_on:
@@ -166,7 +135,7 @@ services:
target: builder
container_name: mih-api-hub
ports:
- 8080:80
- "127.0.0.1:8080:80"
volumes:
- ./mih_api_hub:/app
networks:
@@ -187,7 +156,7 @@ services:
networks:
- mih-network
ports:
- '3306:3306'
- '127.0.0.1:3306:3306'
volumes:
- ./mih_db:/var/lib/mysql
#============== PHP My Admin ====================================================================
@@ -213,8 +182,8 @@ services:
hostname: mih-minio
image: minio/minio
ports:
- '9000:9000'
- '9001:9001'
- '127.0.0.1:9000:9000'
- '127.0.0.1:9001:9001'
volumes:
- './mih_minio:/data'
environment:
@@ -228,7 +197,7 @@ services:
container_name: mih-monitor
image: portainer/portainer-ce:2.20.3
ports:
- 9444:9443
- '127.0.0.1:9444:9443'
volumes:
- ./mih_monitor/data:/data
- /var/run/docker.sock:/var/run/docker.sock
@@ -240,7 +209,7 @@ services:
container_name: mih-ai
image: ollama/ollama:latest
ports:
- 11434:11434
- '127.0.0.1:11434:11434'
volumes:
- ./mih_ai/ollama/ollama:/root/.ollama
pull_policy: always

View File

@@ -1,3 +1,4 @@
.env
__pycache__/
temp*.pdf
.DS_Store

View File

@@ -1,28 +0,0 @@
# from supertokens_python import init, InputAppInfo, SupertokensConfig
# from supertokens_python.recipe import emailpassword, session, dashboard
# init(
# app_info=InputAppInfo(
# app_name="MIH_API_HUB",
# api_domain="http://localhost:8080/",
# website_domain="http://mzansi-innovation-hub.co.za",
# api_base_path="/auth",
# website_base_path="/auth"
# ),
# supertokens_config=SupertokensConfig(
# # https://try.supertokens.com is for demo purposes. Replace this with the address of your core instance (sign up on supertokens.com), or self host a core.
# connection_uri="supertokens:3567/",
# api_key="leatucczyixqwkqqdrhayiwzeofkltds"
# ),
# framework='fastapi',
# recipe_list=[
# # SuperTokens.init(),
# session.init(), # initializes session features
# emailpassword.init(),
# dashboard.init(admins=[
# "yasienmeth@gmail.com",
# ],
# )
# ],
# mode='wsgi' # use wsgi instead of asgi if you are running using gunicorn
# )

View File

@@ -34,28 +34,36 @@ from supertokens_python.recipe.session.framework.fastapi import verify_session
from supertokens_python.recipe.emailverification import EmailVerificationClaim
from supertokens_python.recipe.session import SessionContainer
import os
from dotenv import load_dotenv
load_dotenv()
st_api_key = os.getenv("SUPERTOKENS_API_KEY")
origins = [
"http://localhost",
"http://localhost:80",
"http://localhost:1995",
"http://localhost:8080",
"http://MIH-API-Hub:80",
"http://MIH-API-Hub",
"http://api.mzansi-innovation-hub.co.za",
"*",
"http://app.mzansi-innovation-hub.co.za",
"https://api.mzansi-innovation-hub.co.za",
"https://app.mzansi-innovation-hub.co.za",
]
init(
app_info=InputAppInfo(
app_name="Mzansi Innovation Hub",
api_domain="http://localhost:8080/",
website_domain="http://app.mzansi-innovation-hub.co.za",
website_domain="https://app.mzansi-innovation-hub.co.za",
api_base_path="/auth",
website_base_path="/auth"
),
supertokens_config=SupertokensConfig(
# https://try.supertokens.com is for demo purposes. Replace this with the address of your core instance (sign up on supertokens.com), or self host a core.
connection_uri="http://mih-supertokens:3567/",
api_key="leatucczyixqwkqqdrhayiwzeofkltds"
api_key=st_api_key
),
framework='fastapi',
recipe_list=[

View File

@@ -9,5 +9,5 @@ watchfiles
python-multipart
python-dotenv
xlrd
supertokens-python
supertokens-python==0.24.0
sniffio

2
mih_ui/.gitignore vendored
View File

@@ -1,3 +1,5 @@
.env
# Miscellaneous
*.class
*.log

View File

@@ -1,48 +1,36 @@
# Install Operating system and dependencies
#FROM ubuntu:22.04
# --- STAGE 1: The Builder ---
FROM debian:latest AS build-env
#ENV DEBIAN_FRONTEND=noninteractive
# Install necessary dependencies for Flutter
RUN apt-get update && apt-get install -y \
curl git wget unzip libglu1-mesa fonts-droid-fallback python3 \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update --fix-missing
RUN apt-get install -y curl git wget unzip gdb libstdc++6 libglu1-mesa fonts-droid-fallback
# RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback
RUN apt-get install python3 -y
# download Flutter SDK from Flutter Github repo
# Clone Flutter SDK
RUN git clone -b flutter-3.32-candidate.0 https://github.com/flutter/flutter.git /usr/local/flutter
# RUN git clone -b stable https://github.com/flutter/flutter.git /usr/local/flutter
# Set flutter environment path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
#ENV PATH "$PATH:/home/developer/flutter/bin"
RUN flutter doctor -v
# Enable flutter web
RUN flutter channel flutter-3.32-candidate.0
# RUN flutter channel stable
RUN flutter config --enable-web
# Copy files to container and build
RUN mkdir /app/
COPY . /app/
# Build the Flutter web app
WORKDIR /app
# RUN flutter upgrade
COPY . .
RUN flutter config --enable-web
RUN flutter build web --release -t ./lib/main_prod.dart
# RUN flutter build web --release --web-renderer canvaskit -t ./lib/main_prod.dart
# --- STAGE 2: The Final Production Image ---
FROM nginx:alpine
# RUN cd ..
# Copy built files from the first stage
COPY --from=build-env /app/build/web /usr/share/nginx/html
# WORKDIR /app/build/web/
# Create the Nginx config inside the Dockerfile to handle SPA routing
RUN echo 'server { \
listen 83; \
location / { \
root /usr/share/nginx/html; \
index index.html; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 83
RUN ["chmod", "+x", "/app/server/server.sh"]
ENTRYPOINT [ "/app/server/server.sh"]
# RUN ["python3", "-u", "/app/server/MIH_web_server.py"]
CMD ["nginx", "-g", "daemon off;"]

File diff suppressed because one or more lines are too long

View File

@@ -5,5 +5,6 @@
<item>@drawable/mzansi_wallet_sc</item>
<item>@drawable/mzansi_ai_sc</item>
<item>@drawable/mih_calculator_sc</item>
<item>@drawable/mzansi_directory_sc</item>
</array>
</resources>

View File

@@ -489,7 +489,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_packageIcon_NAME = packageIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -672,7 +672,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_packageIcon_NAME = packageIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -699,7 +699,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_packageIcon_NAME = packageIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_web_plugins/url_strategy.dart'
if (dart.library.html) 'package:flutter_web_plugins/url_strategy.dart';
@@ -42,6 +43,7 @@ void main() async {
debugPrint('APP INSTALLED!');
});
final GoRouter appRouter = MihGoRouter().mihRouter;
await dotenv.load(fileName: ".env");
FlutterNativeSplash.remove();
runApp(MzansiInnovationHub(
router: appRouter,

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_web_plugins/url_strategy.dart'
if (dart.library.html) 'package:flutter_web_plugins/url_strategy.dart';
@@ -33,6 +34,7 @@ void main() async {
debugPrint('APP INSTALLED!');
});
final GoRouter appRouter = MihGoRouter().mihRouter;
await dotenv.load(fileName: ".env");
FlutterNativeSplash.remove();
runApp(MzansiInnovationHub(
router: appRouter,

View File

@@ -1,140 +0,0 @@
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);
}
}
}

View File

@@ -26,7 +26,15 @@ abstract class AppEnviroment {
baseApiUrl = "http://localhost:8080";
baseFileUrl = "http://localhost:9000";
baseAiUrl = "http://localhost:11434";
bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174';
bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174'; // IOS ID
break;
} else if (Platform.isIOS || Platform.isLinux) {
//================= 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'; // IOS ID
break;
} else if (Platform.isAndroid) {
//================= Android Dev Urls =================
@@ -35,14 +43,6 @@ abstract class AppEnviroment {
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:

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import "package:universal_html/html.dart" as html;
class MihTheme {
@@ -9,7 +9,7 @@ class MihTheme {
late String loadingAssetText;
late TargetPlatform platform;
bool kIsWeb = const bool.fromEnvironment('dart.library.js_util');
String latestVersion = "1.2.5";
String latestVersion = "1.2.6";
MihTheme() {
mode = "Dark";
}
@@ -17,66 +17,63 @@ class MihTheme {
ThemeData getData(bool bool) {
return ThemeData(
fontFamily: 'Segoe UI',
scaffoldBackgroundColor: MihColors.getPrimaryColor(mode == "Dark"),
scaffoldBackgroundColor: MihColors.primary(),
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"),
primary: MihColors.secondary(),
onPrimary: MihColors.primary(),
secondary: MihColors.primary(),
onSecondary: MihColors.secondary(),
error: MihColors.red(),
onError: MihColors.primary(),
surface: MihColors.primary(),
onSurface: MihColors.secondary(),
),
datePickerTheme: DatePickerThemeData(
backgroundColor: MihColors.getPrimaryColor(mode == "Dark"),
headerBackgroundColor: MihColors.getSecondaryColor(mode == "Dark"),
headerForegroundColor: MihColors.getPrimaryColor(mode == "Dark"),
backgroundColor: MihColors.primary(),
headerBackgroundColor: MihColors.secondary(),
headerForegroundColor: MihColors.primary(),
),
appBarTheme: AppBarTheme(
color: MihColors.getSecondaryColor(mode == "Dark"),
foregroundColor: MihColors.getPrimaryColor(mode == "Dark"),
color: MihColors.secondary(),
foregroundColor: MihColors.primary(),
titleTextStyle: TextStyle(
color: MihColors.getPrimaryColor(mode == "Dark"),
color: MihColors.primary(),
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: MihColors.getSecondaryColor(mode == "Dark"),
foregroundColor: MihColors.getPrimaryColor(mode == "Dark"),
extendedTextStyle:
TextStyle(color: MihColors.getPrimaryColor(mode == "Dark")),
backgroundColor: MihColors.secondary(),
foregroundColor: MihColors.primary(),
extendedTextStyle: TextStyle(color: MihColors.primary()),
),
drawerTheme: DrawerThemeData(
backgroundColor: MihColors.getPrimaryColor(mode == "Dark"),
backgroundColor: MihColors.primary(),
),
textSelectionTheme: TextSelectionThemeData(
cursorColor: MihColors.getPrimaryColor(mode == "Dark"),
selectionColor:
MihColors.getPrimaryColor(mode == "Dark").withOpacity(0.25),
selectionHandleColor: MihColors.getPrimaryColor(mode == "Dark"),
cursorColor: MihColors.primary(),
selectionColor: MihColors.primary().withOpacity(0.25),
selectionHandleColor: MihColors.primary(),
),
tooltipTheme: TooltipThemeData(
decoration: BoxDecoration(
color: MihColors.getSecondaryColor(mode == "Dark"),
color: MihColors.secondary(),
borderRadius: BorderRadius.circular(6),
border: Border.all(
width: 1.0,
color: MihColors.getPrimaryColor(mode == "Dark"),
color: MihColors.primary(),
),
boxShadow: [
BoxShadow(
color:
MihColors.getPrimaryColor(mode == "Dark").withOpacity(0.18),
color: MihColors.primary().withOpacity(0.18),
blurRadius: 6,
offset: const Offset(0, 2),
),
],
),
textStyle: TextStyle(
color: MihColors.getPrimaryColor(mode == "Dark"),
color: MihColors.primary(),
fontSize: 13,
height: 1.2,
),
@@ -98,6 +95,12 @@ class MihTheme {
return "Android";
} else if (platform == TargetPlatform.iOS) {
return "iOS";
} else if (platform == TargetPlatform.linux) {
return "Linux";
} else if (platform == TargetPlatform.macOS) {
return "macOS";
} else if (platform == TargetPlatform.windows) {
return "Windows";
}
}
return "Other";

View File

@@ -1,13 +1,10 @@
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_three.dart';
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_zero.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_one.dart';
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_two.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart';
@@ -23,7 +20,7 @@ class PackageTest extends StatefulWidget {
}
class _PackageTestState extends State<PackageTest> {
int _selcetedIndex = 0;
int _selectedIndex = 0;
bool _isLoadingInitialData = true;
Future<void> _loadInitialData() async {
@@ -44,6 +41,7 @@ class _PackageTestState extends State<PackageTest> {
MihPackageAction getAction() {
return MihPackageAction(
iconColor: MihColors.secondary(),
icon: const Icon(Icons.arrow_back),
iconSize: 35,
onTap: () {
@@ -65,27 +63,27 @@ class _PackageTestState extends State<PackageTest> {
Map<Widget, void Function()?> temp = Map();
temp[const Icon(Icons.link)] = () {
setState(() {
_selcetedIndex = 0;
_selectedIndex = 0;
});
};
temp[const Icon(Icons.warning)] = () {
setState(() {
_selcetedIndex = 1;
_selectedIndex = 1;
});
};
temp[const Icon(Icons.inbox)] = () {
setState(() {
_selcetedIndex = 2;
_selectedIndex = 2;
});
};
temp[const Icon(Icons.outbond)] = () {
setState(() {
_selcetedIndex = 3;
_selectedIndex = 3;
});
};
return MihPackageTools(
tools: temp,
selcetedIndex: _selcetedIndex,
selectedIndex: _selectedIndex,
);
}
@@ -136,16 +134,16 @@ class _PackageTestState extends State<PackageTest> {
);
}
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: _selcetedIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: getToolTitle(),
selectedBodyIndex: _selectedIndex,
onIndexChange: (newValue) {
setState(() {
_selcetedIndex = newValue;
_selectedIndex = newValue;
});
print("Index: $_selcetedIndex");
print("Index: $_selectedIndex");
},
);
},

View File

@@ -1,8 +1,6 @@
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_package_components/mih_package_tile.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
class TestPackageTile extends StatefulWidget {
final double packageSize;
@@ -31,15 +29,13 @@ class _TestPackageTileState extends State<TestPackageTile> {
// ),
// );
},
appName: "Test",
appIcon: Icon(
packageName: "Test",
packageIcon: Icon(
Icons.warning_amber_rounded,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
iconSize: widget.packageSize,
textColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
textColor: MihColors.secondary(),
);
}
}

View File

@@ -1,36 +1,23 @@
import 'dart:io';
import 'package:country_code_picker/country_code_picker.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:geolocator/geolocator.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_business_info_card.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_radio_options.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
import 'package:redacted/redacted.dart';
class PackageToolOne extends StatefulWidget {
@@ -94,28 +81,22 @@ class _PackageToolOneState extends State<PackageToolOne> {
return MihPackageWindow(
fullscreen: false,
borderOn: true,
foregroundColor: MihColors.getOrangeColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.getBluishPurpleColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
foregroundColor: MihColors.orange(),
backgroundColor: MihColors.bluishPurple(),
windowTitle: "Test No Full",
menuOptions: [
SpeedDialChild(
child: Icon(
Icons.add,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Show New Window",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
// showTestWindow();
},
@@ -135,6 +116,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(screenWidth),
);
@@ -161,6 +143,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
return Stack(
children: [
MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
@@ -180,9 +163,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
@@ -193,16 +174,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {
KenLogger.success("Successfully tested");
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
elevation: 10,
width: 300,
child: Text(
"Success Logger",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -215,16 +193,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {
KenLogger.error("Successfully tested");
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.red(),
elevation: 10,
width: 300,
child: Text(
"Error Logger",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -237,16 +212,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {
KenLogger.warning("Successfully tested");
},
buttonColor: MihColors.getOrangeColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.orange(),
elevation: 10,
width: 300,
child: Text(
"Warning Logger",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -259,16 +231,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {
KenLogger.info("Successfully tested");
},
buttonColor: MihColors.getBluishPurpleColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.bluishPurple(),
elevation: 10,
width: 300,
child: Text(
"Info Logger",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -284,10 +253,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
initialSelection: '+27',
showDropDownButton: false,
pickerStyle: PickerStyle.bottomSheet,
dialogBackgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
barrierColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
dialogBackgroundColor: MihColors.primary(),
barrierColor: MihColors.primary(),
),
const SizedBox(height: 10),
Center(
@@ -302,16 +269,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
},
);
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.secondary(),
elevation: 10,
width: 300,
child: Text(
"Show Loading",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -328,9 +292,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
@@ -349,9 +311,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
@@ -429,8 +389,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
),
const SizedBox(height: 10),
Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
thickness: 2,
),
const SizedBox(height: 10),
@@ -443,18 +402,16 @@ class _PackageToolOneState extends State<PackageToolOne> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
),
MihBannerAd(),
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS))
MihBannerAd(),
const SizedBox(height: 10),
Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
thickness: 2,
),
const SizedBox(height: 10),
@@ -463,12 +420,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
formFields: [
MihTextFormField(
width: 200,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _textFieldZeroController,
multiLineInput: false,
requiredText: false,
@@ -479,12 +432,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _textFieldOneController,
multiLineInput: false,
requiredText: true,
@@ -496,12 +445,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _textFieldTwoController,
multiLineInput: false,
requiredText: true,
@@ -514,12 +459,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _textFieldThreeController,
multiLineInput: false,
requiredText: true,
@@ -532,12 +473,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
const SizedBox(height: 10),
MihNumericStepper(
controller: _textFieldFiveController,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
hintText: "Number Stepper",
requiredText: true,
minValue: 1,
@@ -548,12 +485,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
MihToggle(
hintText: "Toggle",
initialPostion: switchpositioin,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
secondaryFillColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
secondaryFillColor: MihColors.primary(),
readOnly: false,
onChange: (value) {
setState(() {
@@ -566,12 +499,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
MihRadioOptions(
controller: _textFieldSixController,
hintText: "Radio Options",
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
secondaryFillColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
secondaryFillColor: MihColors.primary(),
requiredText: true,
radioOptions: const ["Option 1", "Option 2"],
),
@@ -612,12 +541,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
const SizedBox(height: 10),
MihTextFormField(
height: 250,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _textFieldFourController,
multiLineInput: true,
requiredText: false,
@@ -641,17 +566,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.secondary(),
elevation: 10,
width: 300,
child: Text(
"Submit Form",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -662,8 +583,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
),
const SizedBox(height: 10),
Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
thickness: 2,
),
const SizedBox(height: 10),
@@ -674,10 +594,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
prefixIcon: Icons.search,
prefixAltIcon: MihIcons.mzansiAi,
width: 300,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
hintColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
hintColor: MihColors.primary(),
onPrefixIconTap: () {
print("Search Icon Pressed: ${_searchController.text}");
},
@@ -688,16 +606,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {
print("Button Pressed");
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.secondary(),
elevation: 10,
width: 300,
child: Text(
"Click Me",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -708,24 +623,19 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {
print("Button Pressed");
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.delete,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
Text(
"Click Me",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -738,15 +648,12 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {
print("Button Pressed");
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Click Me",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -763,9 +670,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
onPressed: () {},
icon: Icon(
MihIcons.mihLogo,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
),
@@ -773,13 +678,12 @@ class _PackageToolOneState extends State<PackageToolOne> {
MihCircleAvatar(
imageFile: imagePreview,
width: 50,
expandable: true,
editable: false,
fileNameController: _fileNameController,
userSelectedfile: file,
frameColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
frameColor: MihColors.secondary(),
backgroundColor: MihColors.primary(),
onChange: (selectedImage) {
setState(() {
file = selectedImage;
@@ -788,10 +692,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _fileNameController,
hintText: "Selected Avatar File",
requiredText: false,
@@ -813,10 +715,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _imagefileController,
hintText: "Selected Image File",
requiredText: false,
@@ -836,19 +736,15 @@ class _PackageToolOneState extends State<PackageToolOne> {
SpeedDialChild(
child: Icon(
Icons.add,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Show New Window",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
showTestWindow();
},
@@ -856,19 +752,15 @@ class _PackageToolOneState extends State<PackageToolOne> {
SpeedDialChild(
child: Icon(
Icons.add,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Show New Full Window",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
showTestFullWindow();
},

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_profile_links.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
class PackageToolThree extends StatefulWidget {
const PackageToolThree({super.key});
@@ -15,6 +14,7 @@ class _PackageToolThreeState extends State<PackageToolThree> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(),
);
@@ -111,6 +111,7 @@ class _PackageToolThreeState extends State<PackageToolThree> {
return Stack(
children: [
MihSingleChildScroll(
scrollbarOn: true,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [

View File

@@ -1,10 +1,6 @@
import 'package:custom_rating_bar/custom_rating_bar.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
class PackageToolTwo extends StatefulWidget {
const PackageToolTwo({super.key});
@@ -17,6 +13,7 @@ class _PackageToolTwoState extends State<PackageToolTwo> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(),
);
@@ -24,6 +21,7 @@ class _PackageToolTwoState extends State<PackageToolTwo> {
Widget getBody() {
return MihSingleChildScroll(
scrollbarOn: true,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
@@ -34,8 +32,7 @@ class _PackageToolTwoState extends State<PackageToolTwo> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
const SizedBox(height: 10),
@@ -57,8 +54,7 @@ class _PackageToolTwoState extends State<PackageToolTwo> {
onPressed: () {},
icon: Icon(
MihIcons.mihLogo,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
),
)

View File

@@ -1,10 +1,6 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
class PackageToolZero extends StatefulWidget {
@@ -18,6 +14,7 @@ class _PackageToolZeroState extends State<PackageToolZero> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(),
);
@@ -25,6 +22,7 @@ class _PackageToolZeroState extends State<PackageToolZero> {
Widget getBody() {
return MihSingleChildScroll(
scrollbarOn: true,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
@@ -34,8 +32,7 @@ class _PackageToolZeroState extends State<PackageToolZero> {
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
const SizedBox(height: 20),
@@ -48,13 +45,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
context,
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
child: Text(
"Basic Success Alert",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -72,16 +67,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
context.pop();
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
width: 300,
elevation: 10,
child: Text(
"Okay",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -91,16 +83,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
context.pop();
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.secondary(),
width: 300,
elevation: 10,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -110,13 +99,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
context,
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
child: Text(
"Advanced Success Alert",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -129,13 +116,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
MihAlertServices().warningAlert(
"Warning Alert!", "This is a friendly warning mee", context);
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.secondary(),
child: Text(
"Warning Alert",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -153,16 +138,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
context.pop();
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
width: 300,
elevation: 10,
child: Text(
"Okay",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -172,16 +154,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
context.pop();
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.red(),
width: 300,
elevation: 10,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -191,13 +170,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
context,
);
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.secondary(),
child: Text(
"Advanced Warning Alert",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -213,13 +190,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
context,
);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Basic Error Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -237,16 +212,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
context.pop();
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
width: 300,
elevation: 10,
child: Text(
"Okay",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -256,16 +228,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
context.pop();
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.secondary(),
width: 300,
elevation: 10,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -275,13 +244,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
context,
);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Advanced Error Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -299,13 +266,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
context,
);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Delete Confirmation Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -317,13 +282,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().internetConnectionAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Internet Connection Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -335,13 +298,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().locationPermissionAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Location Permission Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -353,13 +314,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().inputErrorAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Input Error Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -371,14 +330,12 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().passwordRequirementAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: FittedBox(
child: Text(
"Password Requirement Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -391,13 +348,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().passwordMatchAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Password Match Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -409,13 +364,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().loginErrorAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Login Error Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -427,13 +380,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().emailExistsAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Email Exists Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -445,13 +396,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
onPressed: () {
MihAlertServices().invalidEmailAlert(context);
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
buttonColor: MihColors.red(),
child: Text(
"Invalid Email Alert",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -1,14 +1,10 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart';
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
@@ -50,8 +46,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
RedactedConfiguration getRedactedConfiguration() {
return RedactedConfiguration(
// redactedColor: Colors.pink,
redactedColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
redactedColor: MihColors.primary(),
);
}
@@ -159,13 +154,10 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
Function()? ontap,
) {
return Material(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
child: InkWell(
onTap: ontap,
splashColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
.withOpacity(0.2),
splashColor: MihColors.primary().withOpacity(0.2),
borderRadius: BorderRadius.circular(15),
child: Padding(
padding: EdgeInsetsGeometry.symmetric(
@@ -186,8 +178,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
child: Icon(
icon,
// size: 35,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
),
).redacted(
@@ -207,9 +198,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
height: 1.0,
),
).redacted(
@@ -222,9 +211,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
).redacted(
context: context,
@@ -278,16 +265,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
builder: (BuildContext context, MzansiProfileProvider profileProvider,
MzansiDirectoryProvider directoryProvider, Widget? child) {
return Material(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
.withValues(alpha: 0.6),
color: MihColors.secondary().withValues(alpha: 0.6),
borderRadius: BorderRadius.circular(25),
elevation: 10,
shadowColor: Colors.black,
child: Container(
decoration: BoxDecoration(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
borderRadius: BorderRadius.circular(10),
),
child: Column(
@@ -297,8 +281,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
"Call",
"Give us a quick call.",
Icons.phone,
MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
MihColors.green(),
false,
() {
// print("Calling ${widget.cellNumber}");
@@ -306,15 +289,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
},
),
Divider(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
_buildContactInfo(
"Email",
"Send us an email.",
Icons.email,
MihColors.getPinkColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
MihColors.pink(),
false,
() {
// print("Emailing ${widget.email}");
@@ -330,17 +311,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
child: Column(
children: [
Divider(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
_buildContactInfo(
"Location",
"Come visit us.",
Icons.location_on,
MihColors.getOrangeColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
MihColors.orange(),
false,
() {
final latitude = double.parse(
@@ -362,17 +339,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
child: Column(
children: [
Divider(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
_buildContactInfo(
"Website",
"Find out more about us.",
Icons.vpn_lock,
MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
MihColors.red(),
false,
() {
_launchWebsite(widget.business.website);
@@ -393,9 +366,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding:
const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
Container(
@@ -403,9 +374,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
"Loading Rating",
"Loading your rating.",
Icons.star_rate_rounded,
MihColors.getYellowColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
MihColors.yellow(),
true,
null,
),
@@ -426,18 +395,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding:
const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
_buildContactInfo(
ratingDisplayTitle,
"Let us know how we are doing.",
Icons.star_rate_rounded,
MihColors.getYellowColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
MihColors.yellow(),
false,
() {
businessReviewRatingWindow(directoryProvider,
@@ -461,9 +426,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding:
const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
Container(
@@ -471,9 +434,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
"Loading Bookmark",
"Loading your bookmark.",
Icons.bookmark_add_rounded,
MihColors.getBluishPurpleColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
MihColors.bluishPurple(),
true,
null,
),
@@ -494,9 +455,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding:
const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
_buildContactInfo(
@@ -505,9 +464,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
bookmarkBusiness == null
? Icons.bookmark_add_rounded
: Icons.bookmark_remove_rounded,
MihColors.getBluishPurpleColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
MihColors.bluishPurple(),
false,
() {
// _launchWebsite(widget.website);
@@ -526,14 +483,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
// child: Divider(
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.primary(),
// ),
// ),
// _buildContactInfo(
// "Bookmark",
// "Save us for later.",
// Icons.bookmark_add_rounded,
// MihColors.getBluishPurpleColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// MihColors.bluishPurple(),
// () {
// // _launchWebsite(widget.website);
// print("Saving ${widget.business.Name} to Directory");
@@ -544,7 +501,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
// child: Divider(
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.primary(),
// ),
// ),
],
@@ -646,16 +603,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
Icon(
MihIcons.mihLogo,
size: 125,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
const SizedBox(height: 10),
Text(
"Let's Get Started",
textAlign: TextAlign.center,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 25,
fontWeight: FontWeight.bold,
),
@@ -664,8 +619,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
Text(
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 15,
),
),
@@ -678,16 +632,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
extra: true,
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
elevation: 10,
width: 300,
child: Text(
"Sign In/ Create Account",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -0,0 +1,606 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart';
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_directory_services.dart';
import 'package:provider/provider.dart';
import 'package:redacted/redacted.dart';
import 'package:supertokens_flutter/supertokens.dart';
import 'package:url_launcher/url_launcher.dart';
class MihBusinessCardV2 extends StatefulWidget {
final Business business;
final double width;
const MihBusinessCardV2({
super.key,
required this.business,
required this.width,
});
@override
State<MihBusinessCardV2> createState() => _MihBusinessCardV2State();
}
class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
Future<BusinessReview?>? _businessReviewFuture;
Future<BookmarkedBusiness?>? _bookmarkedBusinessFuture;
bool _isUserSignedIn = false;
Future<void> _checkUserSession() async {
final doesSessionExist = await SuperTokens.doesSessionExist();
setState(() {
_isUserSignedIn = doesSessionExist;
});
}
RedactedConfiguration getRedactedConfiguration() {
return RedactedConfiguration(
// redactedColor: Colors.pink,
redactedColor: MihColors.primary(),
);
}
Future<void> _makePhoneCall(String phoneNumber) async {
String formattedNumber = phoneNumber.replaceAll("-", "");
final Uri url = Uri(scheme: 'tel', path: formattedNumber);
if (await canLaunchUrl(url)) {
await launchUrl(url);
} else {
MihAlertServices().errorBasicAlert(
"Error Making Call",
"We couldn't open your phone app to call $formattedNumber. To fix this, make sure you have a phone application installed and it's set as your default dialer.",
context,
);
}
}
String? _encodeQueryParameters(Map<String, String> params) {
return params.entries
.map((MapEntry<String, String> e) =>
'${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value)}')
.join('&');
}
Future<void> _launchEmail(
String recipient, String subject, String body) async {
final Uri emailLaunchUri = Uri(
scheme: 'mailto',
path: recipient,
query: _encodeQueryParameters(<String, String>{
'subject': subject,
'body': body,
}),
);
if (await canLaunchUrl(emailLaunchUri)) {
await launchUrl(emailLaunchUri);
} else {
MihAlertServices().errorBasicAlert(
"Error Creating Email",
"We couldn't launch your email app to send a message to $recipient. To fix this, please confirm that you have an email application installed and that it's set as your default.",
context,
);
}
}
Future<void> _launchGoogleMapsWithUrl({
required double latitude,
required double longitude,
String? label,
}) async {
final Uri googleMapsUrl = Uri.parse(
'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude${label != null ? '&query_place_id=' : ''}',
);
try {
if (await canLaunchUrl(googleMapsUrl)) {
await launchUrl(googleMapsUrl);
} else {
MihAlertServices().errorBasicAlert(
"Error Opening Maps",
"There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.",
context,
);
}
} catch (e) {
MihAlertServices().errorBasicAlert(
"Error Opening Maps",
"There was an issue opening maps for ${widget.business.Name}. This usually happens if you don't have a maps app installed or it's not set as your default. Please install one to proceed.",
context,
);
}
}
Future<void> _launchWebsite(String urlString) async {
String newUrl = urlString;
if (!newUrl.startsWith("https://")) {
newUrl = "https://$urlString";
}
final Uri url = Uri.parse(newUrl);
try {
if (await canLaunchUrl(url)) {
await launchUrl(url);
} else {
MihAlertServices().errorBasicAlert(
"Error Opening Website",
"We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.",
context,
);
}
} catch (e) {
MihAlertServices().errorBasicAlert(
"Error Opening Website",
"We couldn't open the link to $newUrl. To view this website, please ensure you have a web browser installed and set as your default.",
context,
);
}
}
Future<BusinessReview?> getUserReview() async {
String user_id = await SuperTokens.getUserId();
return await MihMzansiDirectoryServices().getUserReviewOfBusiness(
user_id,
widget.business.business_id,
);
}
Future<BookmarkedBusiness?> getUserBookmark() async {
String user_id = await SuperTokens.getUserId();
return await MihMzansiDirectoryServices().getUserBookmarkOfBusiness(
user_id,
widget.business.business_id,
);
}
bool isValidGps(String coordinateString) {
final RegExp gpsRegex = RegExp(
r"^-?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*-?(1[0-7]\d(\.\d+)?|180(\.0+)?|\d{1,2}(\.\d+)?)$");
return gpsRegex.hasMatch(coordinateString);
}
@override
void initState() {
super.initState();
_checkUserSession();
_businessReviewFuture = getUserReview();
_bookmarkedBusinessFuture = getUserBookmark();
}
@override
Widget build(BuildContext context) {
// double screenWidth = MediaQuery.of(context).size.width;
return Consumer2<MzansiProfileProvider, MzansiDirectoryProvider>(
builder: (BuildContext context, MzansiProfileProvider profileProvider,
MzansiDirectoryProvider directoryProvider, Widget? child) {
double iconSize = 50.0;
return Wrap(
alignment: WrapAlignment.center,
runSpacing: 10,
spacing: 10,
children: [
Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {
_makePhoneCall(widget.business.contact_no);
},
buttonColor: MihColors.green(),
child: Icon(
Icons.phone,
color: MihColors.primary(),
size: iconSize,
),
),
const SizedBox(height: 2),
FittedBox(
child: Text(
"Call",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
),
),
],
),
Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {
_launchEmail(
widget.business.bus_email,
"Inquiery about ${widget.business.Name}",
"Dear ${widget.business.Name},\n\nI would like to inquire about your services.\n\nBest regards,\n",
);
},
buttonColor: MihColors.pink(),
child: Icon(
Icons.email,
color: MihColors.primary(),
size: iconSize,
),
),
const SizedBox(height: 2),
FittedBox(
child: Text(
"Email",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
),
),
],
),
if (isValidGps(widget.business.gps_location))
Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {
final latitude = double.parse(
widget.business.gps_location.split(',')[0]);
final longitude = double.parse(
widget.business.gps_location.split(',')[1]);
_launchGoogleMapsWithUrl(
latitude: latitude,
longitude: longitude,
);
},
buttonColor: MihColors.orange(),
child: Icon(
Icons.location_on,
color: MihColors.primary(),
size: iconSize,
),
),
const SizedBox(height: 2),
FittedBox(
child: Text(
"Maps",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
),
),
],
),
if (widget.business.website.isNotEmpty &&
widget.business.website != "")
Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {
_launchWebsite(widget.business.website);
},
buttonColor: MihColors.red(),
child: Icon(
Icons.language,
color: MihColors.primary(),
size: iconSize,
),
),
const SizedBox(height: 2),
FittedBox(
child: Text(
"Website",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
),
),
],
),
FutureBuilder(
future: _businessReviewFuture,
builder: (context, asyncSnapshot) {
if (asyncSnapshot.connectionState == ConnectionState.waiting) {
return Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {},
buttonColor: MihColors.grey(),
child: Icon(
Icons.star_rate_rounded,
color: MihColors.primary(),
size: iconSize,
),
).redacted(context: context, redact: true),
const SizedBox(height: 2),
FittedBox(
child: Text(
"Rate Us",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
).redacted(context: context, redact: true),
),
],
);
} else {
BusinessReview? businessReview = asyncSnapshot.data;
String ratingTitle = "";
if (businessReview == null) {
ratingTitle = "Rate Us";
} else {
ratingTitle = "Edit";
}
return Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {
businessReviewRatingWindow(directoryProvider,
businessReview, true, widget.width);
},
buttonColor: MihColors.yellow(),
child: Icon(
Icons.star_rate_rounded,
color: MihColors.primary(),
size: iconSize,
),
),
const SizedBox(height: 2),
FittedBox(
child: Text(
ratingTitle,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
),
),
],
);
}
},
),
FutureBuilder(
future: _bookmarkedBusinessFuture,
builder: (context, asyncSnapshot) {
if (asyncSnapshot.connectionState == ConnectionState.waiting) {
return Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {},
buttonColor: MihColors.grey(),
child: Icon(
Icons.bookmark_add_rounded,
color: MihColors.primary(),
size: iconSize,
),
).redacted(context: context, redact: true),
const SizedBox(height: 2),
FittedBox(
child: Text(
"bookmark",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
).redacted(context: context, redact: true),
),
],
);
} else {
BookmarkedBusiness? bookmarkBusiness = asyncSnapshot.data;
String bookmarkDisplayTitle = "";
if (bookmarkBusiness == null) {
bookmarkDisplayTitle = "Bookmark";
} else {
bookmarkDisplayTitle = "Remove";
}
return Column(
children: [
MihButton(
width: 80,
height: 80,
onPressed: () {
if (bookmarkBusiness == null) {
showAddBookmarkAlert();
} else {
showDeleteBookmarkAlert(bookmarkBusiness);
}
},
buttonColor: MihColors.bluishPurple(),
child: Icon(
bookmarkBusiness == null
? Icons.bookmark_add_rounded
: Icons.bookmark_remove_rounded,
color: MihColors.primary(),
size: iconSize,
),
),
const SizedBox(height: 2),
FittedBox(
child: Text(
bookmarkDisplayTitle,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
fontSize: 20,
),
),
),
],
);
}
},
),
],
);
},
);
}
Future<void> businessReviewRatingWindow(
MzansiDirectoryProvider directoryProvider,
BusinessReview? myReview,
bool previouslyRated,
double width) async {
if (_isUserSignedIn) {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => MihReviewBusinessWindow(
business: widget.business,
businessReview: myReview,
screenWidth: width,
readOnly: false,
onSuccessDismissPressed: () async {
List<Business>? businessSearchResults = [];
businessSearchResults = await MihBusinessDetailsServices()
.searchBusinesses(directoryProvider.searchTerm,
directoryProvider.businessTypeFilter, context);
Map<String, Future<String>> busImagesUrl = {};
Future<String> businessLogoUrl;
for (var bus in businessSearchResults) {
businessLogoUrl = MihFileApi.getMinioFileUrl(bus.logo_path);
busImagesUrl[bus.business_id] = businessLogoUrl;
}
directoryProvider.setSearchedBusinesses(
searchedBusinesses: businessSearchResults,
businessesImagesUrl: busImagesUrl,
);
setState(() {
_businessReviewFuture = getUserReview();
});
},
),
);
} else {
showSignInRequiredAlert();
}
}
void showAddBookmarkAlert() {
if (_isUserSignedIn) {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => MihAddBookmarkAlert(
business: widget.business,
onSuccessDismissPressed: () async {
_bookmarkedBusinessFuture = getUserBookmark();
},
),
);
} else {
showSignInRequiredAlert();
}
}
void showDeleteBookmarkAlert(BookmarkedBusiness? bookmarkBusiness) {
if (_isUserSignedIn) {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => MihDeleteBookmarkAlert(
business: widget.business,
bookmarkBusiness: bookmarkBusiness,
onSuccessDismissPressed: () {
_bookmarkedBusinessFuture = getUserBookmark();
},
// startUpSearch: widget.startUpSearch,
));
} else {
showSignInRequiredAlert();
}
}
void showSignInRequiredAlert() {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) {
return MihPackageWindow(
fullscreen: false,
windowTitle: null,
onWindowTapClose: () {
context.pop();
},
windowBody: Column(
children: [
Icon(
MihIcons.mihLogo,
size: 125,
color: MihColors.secondary(),
),
const SizedBox(height: 10),
Text(
"Let's Get Started",
textAlign: TextAlign.center,
style: TextStyle(
color: MihColors.secondary(),
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 15),
Text(
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
style: TextStyle(
color: MihColors.secondary(),
fontSize: 15,
),
),
const SizedBox(height: 25),
Center(
child: MihButton(
onPressed: () {
context.goNamed(
'mihHome',
extra: true,
);
},
buttonColor: MihColors.green(),
elevation: 10,
width: 300,
child: Text(
"Sign In/ Create Account",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
);
},
);
}
}

View File

@@ -1,10 +1,8 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart';
import 'package:provider/provider.dart';
@@ -54,29 +52,23 @@ class _MihBusinessProfilePreviewState extends State<MihBusinessProfilePreview> {
? Icon(
MihIcons.mihRing,
size: profilePictureWidth,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
)
: widget.imageFile == null
? Icon(
MihIcons.iDontKnow,
size: profilePictureWidth,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
)
: MihCircleAvatar(
imageFile: widget.imageFile,
width: profilePictureWidth,
expandable: false,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: null,
frameColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
frameColor: MihColors.secondary(),
backgroundColor: MihColors.primary(),
onChange: () {},
),
const SizedBox(width: 15),

View File

@@ -1,68 +0,0 @@
import 'package:flutter/material.dart';
class MihButton extends StatelessWidget {
final void Function()? onPressed;
final void Function()? onLongPressed;
final Color buttonColor;
final double? width;
final double? height;
final double? borderRadius;
final double? elevation; // 0 = flat, higher = more shadow
final Widget child;
const MihButton({
super.key,
required this.onPressed,
this.onLongPressed,
required this.buttonColor,
this.width,
this.height,
this.borderRadius,
this.elevation,
required this.child,
});
Color _darkerColor(Color color, [double amount = .1]) {
final hsl = HSLColor.fromColor(color);
final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
return hslDark.toColor();
}
@override
Widget build(BuildContext context) {
final Color effectiveButtonColor = onPressed == null
? buttonColor.withValues(alpha: 0.6) // Example disabled color
: buttonColor;
final Color rippleColor = _darkerColor(effectiveButtonColor, 0.1);
final double radius = borderRadius ?? 25.0;
final double effectiveElevation =
onPressed == null ? 0.0 : (elevation ?? 4.0);
return MouseRegion(
cursor: onPressed == null
? SystemMouseCursors.basic
: SystemMouseCursors.click,
child: Material(
color: effectiveButtonColor,
borderRadius: BorderRadius.circular(radius),
elevation: effectiveElevation,
shadowColor: Colors.black,
child: InkWell(
borderRadius: BorderRadius.circular(radius),
splashColor: rippleColor,
highlightColor: rippleColor.withValues(alpha: 0.2),
hoverColor: rippleColor.withValues(alpha: 0.3),
onTap: onPressed,
onLongPress: onLongPressed,
child: Container(
width: width,
height: height,
padding: (width == null || height == null)
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
: null,
alignment: Alignment.center,
child: child,
),
),
),
);
}
}

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:provider/provider.dart';
import 'package:table_calendar/table_calendar.dart';
@@ -54,8 +53,7 @@ class _MIHCalendarState extends State<MIHCalendar> {
formatButtonDecoration: BoxDecoration(
border: Border.fromBorderSide(
BorderSide(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
borderRadius: const BorderRadius.all(
@@ -79,36 +77,29 @@ class _MIHCalendarState extends State<MIHCalendar> {
calendarStyle: CalendarStyle(
outsideDaysVisible: false,
todayTextStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
todayDecoration: BoxDecoration(
color: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.green(),
shape: BoxShape.circle,
),
selectedTextStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
selectedDecoration: BoxDecoration(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
shape: BoxShape.circle,
),
weekendTextStyle: TextStyle(
color: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.grey(),
),
),
daysOfWeekStyle: DaysOfWeekStyle(
weekdayStyle: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
weekendStyle: TextStyle(
color: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.grey(),
),
),
),

View File

@@ -2,13 +2,15 @@ import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihCircleAvatar extends StatefulWidget {
final ImageProvider<Object>? imageFile;
final double width;
final bool expandable;
final bool editable;
final TextEditingController? fileNameController;
final onChange;
@@ -19,6 +21,7 @@ class MihCircleAvatar extends StatefulWidget {
super.key,
required this.imageFile,
required this.width,
required this.expandable,
required this.editable,
required this.fileNameController,
required this.userSelectedfile,
@@ -35,23 +38,33 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
late ImageProvider<Object>? imagePreview;
ImageProvider<Object>? getAvatar() {
// Color dark = const Color(0XFF3A4454);
if (widget.imageFile == null) {
return null;
// if (widget.backgroundColor == dark) {
// print("here in light icon");
// return const AssetImage(
// 'lib/mih_package_components/assets/images/i-dont-know-light.png');
// } else {
// print("here in dark icon");
// return const AssetImage(
// 'lib/mih_package_components/assets/images/i-dont-know-dark.png');
// }
} else {
return widget.imageFile;
}
}
void expandAvatar() {
showDialog(
context: context,
builder: (context) {
return MihPackageWindow(
fullscreen: true,
windowTitle: "",
scrollbarOn: false,
onWindowTapClose: () {
context.pop();
},
windowBody: SizedBox.expand(
child: InteractiveViewer(
child: Image(image: imagePreview!),
),
),
);
});
}
@override
void initState() {
super.initState();
@@ -62,111 +75,119 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
@override
Widget build(BuildContext context) {
return Container(
// color: Colors.white,
alignment: Alignment.center,
width: widget.width,
height: widget.width,
child: Stack(
return GestureDetector(
onTap: widget.expandable
? () {
KenLogger.success("Avatar tapped");
expandAvatar();
}
: null,
child: Container(
alignment: Alignment.center,
children: [
Visibility(
visible: imagePreview != null,
child: Positioned(
right: widget.width * 0.03,
child: CircleAvatar(
radius: widget.width / 2.2,
backgroundColor: widget.backgroundColor,
backgroundImage: imagePreview,
width: widget.width,
height: widget.width,
child: Stack(
alignment: Alignment.center,
children: [
Visibility(
visible: imagePreview != null,
child: Positioned(
right: widget.width * 0.03,
child: CircleAvatar(
radius: widget.width / 2.2,
backgroundColor: widget.backgroundColor,
backgroundImage: imagePreview,
),
),
),
),
Visibility(
visible: imagePreview != null,
child: Icon(
size: widget.width,
MihIcons.mihRing,
color: widget.frameColor,
Visibility(
visible: imagePreview != null,
child: Icon(
size: widget.width,
MihIcons.mihRing,
color: widget.frameColor,
),
),
),
Visibility(
visible: imagePreview == null,
child: Icon(
MihIcons.iDontKnow,
size: widget.width,
color: widget.frameColor,
Visibility(
visible: imagePreview == null,
child: Icon(
MihIcons.iDontKnow,
size: widget.width,
color: widget.frameColor,
),
),
),
Visibility(
visible: widget.editable,
child: Positioned(
bottom: 0,
right: 0,
child: IconButton.filled(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
Visibility(
visible: widget.editable,
child: Positioned(
bottom: 0,
right: 0,
child: IconButton.filled(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
MihColors.green(),
),
),
),
onPressed: () async {
try {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.image,
);
// print("Here 1");
if (MzansiInnovationHub.of(context)!.theme.getPlatform() ==
"Web") {
// print("Here 2");
if (result == null) return;
// print("Here 3");
PlatformFile? selectedFile = result.files.first;
setState(() {
// print("Here 4");
widget.onChange(selectedFile);
// print("Here 5");
imagePreview = MemoryImage(selectedFile.bytes!);
});
setState(() {
widget.fileNameController!.text = selectedFile.name;
});
} else {
if (result != null) {
File file = File(result.files.single.path!);
PlatformFile? androidFile = PlatformFile(
path: file.path,
name: file.path.split('/').last,
size: file.lengthSync(),
bytes: await file.readAsBytes(), // Read file bytes
//extension: fileExtension,
);
onPressed: () async {
try {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.image,
);
// print("Here 1");
if (MzansiInnovationHub.of(context)!
.theme
.getPlatform() ==
"Web") {
// print("Here 2");
if (result == null) return;
// print("Here 3");
PlatformFile? selectedFile = result.files.first;
setState(() {
widget.onChange(androidFile);
imagePreview = FileImage(file);
// print("Here 4");
widget.onChange(selectedFile);
// print("Here 5");
imagePreview = MemoryImage(selectedFile.bytes!);
});
setState(() {
widget.fileNameController!.text =
file.path.split('/').last;
widget.fileNameController!.text = selectedFile.name;
});
} else {
print("here in else");
// User canceled the picker
if (result != null) {
File file = File(result.files.single.path!);
PlatformFile? androidFile = PlatformFile(
path: file.path,
name: file.path.split('/').last,
size: file.lengthSync(),
bytes: await file.readAsBytes(), // Read file bytes
//extension: fileExtension,
);
setState(() {
widget.onChange(androidFile);
imagePreview = FileImage(file);
});
setState(() {
widget.fileNameController!.text =
file.path.split('/').last;
});
} else {
print("here in else");
// User canceled the picker
}
}
} catch (e) {
print("Here Error: $e");
}
} catch (e) {
print("Here Error: $e");
}
},
icon: Icon(
Icons.camera_alt,
},
icon: Icon(
Icons.camera_alt,
),
),
),
),
),
],
],
),
),
);
}

View File

@@ -1,207 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihDateField extends StatefulWidget {
final TextEditingController controller;
final String labelText;
final bool required;
final double? width;
final double? height;
final double? borderRadius;
final double? elevation;
final FormFieldValidator<String>? validator;
const MihDateField({
super.key,
required this.controller,
required this.labelText,
required this.required,
this.width,
this.height,
this.borderRadius,
this.elevation,
this.validator,
});
@override
State<MihDateField> createState() => _MihDateFieldState();
}
class _MihDateFieldState extends State<MihDateField> {
FormFieldState<String>? _formFieldState;
Future<void> _selectDate(BuildContext context) async {
DateTime? picked = await showDatePicker(
context: context,
initialDate: widget.controller.text.isNotEmpty
? DateTime.tryParse(widget.controller.text) ?? DateTime.now()
: DateTime.now(),
firstDate: DateTime(2000),
lastDate: DateTime(2100),
);
if (picked != null) {
widget.controller.text = picked.toString().split(" ")[0];
_formFieldState?.didChange(widget.controller.text);
setState(() {});
}
}
@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
width: widget.width,
height: widget.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.labelText,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
if (!widget.required)
Text(
"(Optional)",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 4),
FormField<String>(
initialValue: widget.controller.text,
validator: widget.validator,
autovalidateMode: AutovalidateMode.onUserInteraction,
builder: (field) {
_formFieldState = field;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Material(
elevation: widget.elevation ?? 4.0,
borderRadius:
BorderRadius.circular(widget.borderRadius ?? 8.0),
child: TextFormField(
controller: widget.controller,
readOnly: true,
onTap: () => _selectDate(context),
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
suffixIcon: Icon(
Icons.calendar_today,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
errorStyle: const TextStyle(height: 0, fontSize: 0),
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
filled: true,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: field.hasError
? BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 2.0,
)
: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: field.hasError
? MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark")
: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 3.0,
),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 3.0,
),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 3.0,
),
),
),
onChanged: (value) {
field.didChange(value);
},
),
),
if (field.hasError)
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 4.0),
child: Text(
field.errorText ?? '',
style: TextStyle(
fontSize: 12,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontWeight: FontWeight.bold,
),
),
),
],
);
},
),
],
),
),
);
}
}

View File

@@ -1,283 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihDropdownField extends StatefulWidget {
final TextEditingController controller;
final String hintText;
final bool requiredText;
final List<String> dropdownOptions;
final bool editable;
final bool enableSearch;
final FormFieldValidator<String>? validator;
final Function(String?)? onSelected;
const MihDropdownField({
super.key,
required this.controller,
required this.hintText,
required this.dropdownOptions,
required this.requiredText,
required this.editable,
required this.enableSearch,
this.validator,
this.onSelected,
});
@override
State<MihDropdownField> createState() => _MihDropdownFieldState();
}
class _MihDropdownFieldState extends State<MihDropdownField> {
late List<DropdownMenuEntry<String>> menu;
List<DropdownMenuEntry<String>> buildMenuOptions(List<String> options) {
List<DropdownMenuEntry<String>> menuList = [];
for (final i in options) {
menuList.add(DropdownMenuEntry(
value: i,
label: i,
style: ButtonStyle(
foregroundColor: WidgetStatePropertyAll(MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")),
),
));
}
return menuList;
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
menu = buildMenuOptions(widget.dropdownOptions);
}
@override
void initState() {
super.initState();
menu = widget.dropdownOptions
.map((e) => DropdownMenuEntry(value: e, label: e))
.toList();
}
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.hintText,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
if (!widget.requiredText)
Text(
"(Optional)",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 4),
FormField<String>(
validator: widget.validator,
autovalidateMode: AutovalidateMode.onUserInteraction,
initialValue: widget.controller.text,
builder: (field) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Theme(
data: Theme.of(context).copyWith(
textSelectionTheme: TextSelectionThemeData(
cursorColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
selectionColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark")
.withValues(alpha: 0.3),
selectionHandleColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
),
child: DropdownMenu(
controller: widget.controller,
dropdownMenuEntries: menu,
enableSearch: widget.enableSearch,
enableFilter: widget.enableSearch,
enabled: widget.editable,
textInputAction: widget.enableSearch
? TextInputAction.search
: TextInputAction.none,
requestFocusOnTap: widget.enableSearch,
menuHeight: 400,
expandedInsets: EdgeInsets.zero,
textStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontWeight: FontWeight.w500,
),
trailingIcon: Icon(
Icons.arrow_drop_down,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
selectedTrailingIcon: Icon(
Icons.arrow_drop_up,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
// leadingIcon:
// IconButton(
// onPressed: () {
// widget.controller.clear();
// field.didChange('');
// },
// icon: Icon(
// Icons.delete_outline_rounded,
// color: MihColors.getPrimaryColor(
// MzansiInnovationHub.of(context)!.theme.mode ==
// "Dark"),
// ),
// ),
onSelected: (String? selectedValue) {
field.didChange(selectedValue);
widget.onSelected?.call(selectedValue);
},
menuStyle: MenuStyle(
backgroundColor: WidgetStatePropertyAll(
MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark")),
side: WidgetStatePropertyAll(
BorderSide(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 1.0),
),
shape: WidgetStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
10), // Increase for more roundness
),
),
),
inputDecorationTheme: InputDecorationTheme(
errorStyle: const TextStyle(height: 0, fontSize: 0),
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
filled: true,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: field.hasError
? MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark")
: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 3.0,
),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 3.0,
),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 3.0,
),
),
),
),
),
),
const SizedBox(width: 8),
GestureDetector(
onTap: () {
widget.controller.clear();
field.didChange('');
},
child: Icon(
size: 35,
Icons.delete_rounded,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
),
],
),
if (field.hasError)
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 4.0),
child: Text(
field.errorText ?? '',
style: TextStyle(
fontSize: 12,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontWeight: FontWeight.bold,
),
),
),
],
);
},
),
],
);
}
}

View File

@@ -1,48 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihFloatingMenu extends StatefulWidget {
final IconData? icon;
final double? iconSize;
final AnimatedIconData? animatedIcon;
final SpeedDialDirection? direction;
final List<SpeedDialChild> children;
const MihFloatingMenu({
super.key,
this.icon,
this.iconSize,
this.animatedIcon,
this.direction,
required this.children,
});
@override
State<MihFloatingMenu> createState() => _MihFloatingMenuState();
}
class _MihFloatingMenuState extends State<MihFloatingMenu> {
@override
Widget build(BuildContext context) {
return SpeedDial(
key: GlobalKey(),
icon: widget.icon,
buttonSize: Size(widget.iconSize ?? 56.0, widget.iconSize ?? 56.0),
animatedIcon: widget.animatedIcon,
direction: widget.direction ?? SpeedDialDirection.up,
activeIcon: Icons.close,
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
activeBackgroundColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
foregroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
overlayColor: Colors.black,
overlayOpacity: 0.5,
children: widget.children,
onOpen: () => debugPrint('OPENING DIAL'),
onClose: () => debugPrint('DIAL CLOSED'),
);
}
}

View File

@@ -1,27 +0,0 @@
import 'package:flutter/material.dart';
class MihForm extends StatefulWidget {
final GlobalKey<FormState> formKey;
final List<Widget> formFields;
const MihForm({
super.key,
required this.formKey,
required this.formFields,
});
@override
State<MihForm> createState() => _MihFormState();
}
class _MihFormState extends State<MihForm> {
@override
Widget build(BuildContext context) {
return Form(
key: widget.formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: widget.formFields,
),
);
}
}

View File

@@ -1,67 +0,0 @@
import 'package:flutter/widgets.dart'; // You need this import for IconData
class MihIcons {
MihIcons._(); // This makes the class non-instantiable (good practice for utility classes)
// This MUST match the 'family' name you specify in pubspec.yaml
static const _mihFontFam = 'MihIcons';
// Set to your package name ONLY if this font is part of a separate package you created
static const String? _mihFontPkg = null;
// IconData constants based on your style.css file
// Note: We convert the hex code from CSS (\eXXX) to an integer (0xeXXX)
static const IconData mineSweeper =
IconData(0xe900, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData mzansiDirectory =
IconData(0xe901, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData personalProfile =
IconData(0xe902, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData aboutMih =
IconData(0xe903, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData accessControl =
IconData(0xe904, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData businessProfile =
IconData(0xe905, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData businessSetup =
IconData(0xe906, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData calculator =
IconData(0xe907, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData calendar =
IconData(0xe908, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData iDontKnow =
IconData(0xe909, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData mihLogo =
IconData(0xe90a, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData mihRing =
IconData(0xe90b, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData mzansiAi =
IconData(0xe90c, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData mzansiWallet =
IconData(0xe90d, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData notifications =
IconData(0xe90e, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData patientManager =
IconData(0xe90f, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData patientProfile =
IconData(0xe910, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
static const IconData profileSetup =
IconData(0xe911, fontFamily: _mihFontFam, fontPackage: _mihFontPkg);
}

View File

@@ -3,8 +3,8 @@ import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihImageDisplay extends StatefulWidget {
final ImageProvider<Object>? imageFile;
@@ -67,9 +67,7 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
// width: widget.width,
height: widget.height,
decoration: BoxDecoration(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
borderRadius: BorderRadius.circular(widget.width * 0.1),
),
child: Image(image: imagePreview!),
@@ -79,15 +77,13 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
width: widget.width,
height: widget.height,
decoration: BoxDecoration(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
borderRadius: BorderRadius.circular(widget.width * 0.1),
),
child: Icon(
Icons.image_not_supported_rounded,
size: widget.width * 0.3,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
),
Visibility(
@@ -97,11 +93,9 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
right: 5,
child: IconButton.filled(
style: IconButton.styleFrom(
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
),
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
onPressed: () async {
try {
FilePickerResult? result =

View File

@@ -1,101 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import '../main.dart';
class Mihloadingcircle extends StatefulWidget {
final String? message;
const Mihloadingcircle({
super.key,
this.message,
});
@override
State<Mihloadingcircle> createState() => _MihloadingcircleState();
}
class _MihloadingcircleState extends State<Mihloadingcircle>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
late double width;
late double height;
@override
void initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(
milliseconds: 500), // Duration for one pulse (grow and shrink)
vsync: this,
);
_animation = Tween<double>(
begin: 200,
end: 200 * 0.5, // Pulse to 50% of the initial size
).animate(CurvedAnimation(
parent: _controller,
curve: Curves.easeInOut, // Smooth start and end of the pulse
));
_controller.repeat(reverse: true);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Dialog(
child: IntrinsicWidth(
child: IntrinsicHeight(
child: Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 5.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 200,
height: 200,
child: AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Icon(
MihIcons.mihLogo,
size: _animation
.value, // The size changes based on the animation value
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
);
},
),
),
widget.message != null
? Text(
widget.message!,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
)
: SizedBox(),
],
)),
),
),
);
}
}

View File

@@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
import 'package:mzansi_innovation_hub/mih_objects/notification.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:supertokens_flutter/http.dart' as http;
@@ -69,15 +68,13 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
title: Text(
title,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
subtitle: Text(
subtitle,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
onTap: () {},
@@ -94,8 +91,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
children: [
Icon(
Icons.circle_notifications,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.red(),
),
const SizedBox(
width: 5,
@@ -104,8 +100,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
child: Text(
title,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
),
@@ -119,8 +114,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
child: Text(
title,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
),
@@ -132,8 +126,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
subtitle: Text(
subtitle,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
onTap: () {
@@ -156,8 +149,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
);
},
itemCount: widget.notifications.length,
@@ -196,15 +188,14 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
Widget build(BuildContext context) {
return SafeArea(
child: Drawer(
//backgroundColor: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
//backgroundColor: MihColors.primary(),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@@ -214,9 +205,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
child: Text(
"Notifications",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
fontSize: 20,
),
@@ -231,7 +220,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
// physics: const NeverScrollableScrollPhysics(),
// separatorBuilder: (BuildContext context, index) {
// return Divider(
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// );
// },
// itemCount: widget.notifications.length,

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import '../main.dart';
import '../mih_objects/arguments.dart';
@@ -131,10 +131,8 @@ class _MIHNotificationMessageState extends State<MIHNotificationMessage>
void initState() {
super.initState();
setState(() {
primary = MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
secondary = MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
primary = MihColors.primary();
secondary = MihColors.red();
});
_animationController = AnimationController(
vsync: this,

View File

@@ -1,238 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
class MihNumericStepper extends StatefulWidget {
final TextEditingController controller;
final Color fillColor;
final Color inputColor;
final String hintText;
final bool requiredText;
final double? width;
final int? minValue;
final int? maxValue;
final bool validationOn;
const MihNumericStepper({
super.key,
required this.controller,
required this.fillColor,
required this.inputColor,
required this.hintText,
required this.requiredText,
this.width,
this.minValue,
this.maxValue,
required this.validationOn,
});
@override
State<MihNumericStepper> createState() => _MihNumericStepperState();
}
class _MihNumericStepperState extends State<MihNumericStepper> {
late int _currentValue;
late bool error;
@override
void dispose() {
widget.controller.removeListener(_syncCurrentValue);
super.dispose();
}
@override
void initState() {
super.initState();
_currentValue =
int.tryParse(widget.controller.text) ?? widget.minValue ?? 0;
widget.controller.text = _currentValue.toString();
int.tryParse(widget.controller.text) ?? widget.minValue ?? 0;
widget.controller.addListener(_syncCurrentValue);
// print("Current Value: $_currentValue");
}
void _syncCurrentValue() {
final newValue =
int.tryParse(widget.controller.text) ?? widget.minValue ?? 0;
if (newValue != _currentValue) {
setState(() {
_currentValue = newValue;
});
}
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
children: [
Text(
widget.hintText,
style: TextStyle(
fontWeight: FontWeight.bold,
color: widget.fillColor,
fontSize: 18,
),
),
],
),
const SizedBox(height: 4),
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Column(
children: [
Container(
// color: Colors.white,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
25), // Optional: rounds the corners
boxShadow: const [
BoxShadow(
color: Color.fromARGB(60, 0, 0,
0), // 0.2 opacity = 51 in alpha (255 * 0.2)
spreadRadius: -2,
blurRadius: 10,
offset: Offset(0, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.only(
top: 2.0,
left: 5.0,
),
child: SizedBox(
width: 40,
child: IconButton.filled(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark")),
),
color: widget.inputColor,
iconSize: 20,
onPressed: () {
print("Current Value: $_currentValue");
if (_currentValue >= (widget.minValue ?? 0)) {
setState(() {
widget.controller.text =
(_currentValue - 1).toString();
_currentValue =
int.tryParse(widget.controller.text)!;
});
}
print("New Current Value: $_currentValue");
},
icon: const Icon(
Icons.remove,
),
),
),
),
),
Visibility(
visible: _currentValue < (widget.minValue ?? 0) ||
(widget.maxValue != null &&
_currentValue > widget.maxValue!),
child: const SizedBox(
height: 21,
),
),
],
),
const SizedBox(width: 15),
Expanded(
child: MihTextFormField(
width: widget.width,
fillColor: widget.fillColor,
inputColor: widget.inputColor,
controller: widget.controller,
hintText: null,
requiredText: widget.requiredText,
readOnly: true,
numberMode: true,
textIputAlignment: TextAlign.center,
validator: (value) {
if (widget.validationOn) {
return MihValidationServices().validateNumber(
value, widget.minValue, widget.maxValue);
}
return null;
},
),
),
const SizedBox(width: 10),
Column(
children: [
Container(
// color: Colors.white,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
25), // Optional: rounds the corners
boxShadow: const [
BoxShadow(
color: Color.fromARGB(60, 0, 0,
0), // 0.2 opacity = 51 in alpha (255 * 0.2)
spreadRadius: -2,
blurRadius: 10,
offset: Offset(0, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.only(
top: 2.0,
left: 5.0,
),
child: SizedBox(
width: 40,
child: IconButton.filled(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all<Color>(
MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark")),
),
color: widget.inputColor,
iconSize: 20,
onPressed: () {
print("Current Value: $_currentValue");
if (widget.maxValue == null ||
_currentValue <= widget.maxValue!) {
setState(() {
widget.controller.text =
(_currentValue + 1).toString();
_currentValue =
int.tryParse(widget.controller.text)!;
});
}
print("New Current Value: $_currentValue");
},
icon: const Icon(
Icons.add,
),
),
),
),
),
Visibility(
visible: _currentValue < (widget.minValue ?? 0) ||
(widget.maxValue != null &&
_currentValue > widget.maxValue!),
child: const SizedBox(
height: 21,
),
),
],
),
],
),
],
);
}
}

View File

@@ -1,217 +0,0 @@
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_scack_bar.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_home/components/mih_app_drawer.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:flutter/material.dart';
class MihPackage extends StatefulWidget {
final Widget appActionButton;
final MihPackageTools appTools;
final List<Widget> appBody;
final List<String> appToolTitles;
final MIHAppDrawer? actionDrawer;
final int selectedbodyIndex;
final Function(int) onIndexChange;
const MihPackage({
super.key,
required this.appActionButton,
required this.appTools,
required this.appBody,
required this.appToolTitles,
this.actionDrawer,
required this.selectedbodyIndex,
required this.onIndexChange,
});
@override
State<MihPackage> createState() => _MihPackageState();
}
class _MihPackageState extends State<MihPackage>
with SingleTickerProviderStateMixin {
late int _currentIndex;
late PageController _pageController;
late AnimationController _animationController;
DateTime? lastPressedAt;
void unfocusAll() {
FocusScope.of(context).unfocus();
}
Future<void> _peakAnimation() async {
int currentPage = _currentIndex;
double peakOffset = _pageController.position.viewportDimension * 0.075;
double currentOffset =
_pageController.page! * _pageController.position.viewportDimension;
int nextPage =
currentPage + 1 < widget.appBody.length ? currentPage + 1 : currentPage;
if (nextPage != currentPage) {
await Future.delayed(const Duration(milliseconds: 100));
await _pageController.animateTo(
currentOffset + peakOffset,
duration: const Duration(milliseconds: 300),
curve: Curves.easeOut,
);
// await Future.delayed(const Duration(milliseconds: 100));
await _pageController.animateTo(
currentPage * _pageController.position.viewportDimension,
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
);
}
}
@override
void dispose() {
_pageController.dispose();
_animationController.dispose();
super.dispose();
}
@override
void didUpdateWidget(covariant MihPackage oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.selectedbodyIndex != widget.selectedbodyIndex &&
_currentIndex != widget.selectedbodyIndex) {
_currentIndex = widget.selectedbodyIndex;
_pageController.animateToPage(
widget.selectedbodyIndex,
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
}
}
@override
void initState() {
super.initState();
_currentIndex = widget.selectedbodyIndex;
_pageController = PageController(initialPage: widget.selectedbodyIndex);
_animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 400),
);
// if (!MzansiInnovationHub.of(context)!.theme.kIsWeb) {
// // Trigger the peak animation on start (or call this elsewhere)
// WidgetsBinding.instance.addPostFrameCallback((_) {
// _peakAnimation();
// });
// }
if (!MzansiInnovationHub.of(context)!.theme.kIsWeb) {
// Trigger the peak animation only AFTER the route transition is complete
WidgetsBinding.instance.addPostFrameCallback((_) {
final ModalRoute? currentRoute = ModalRoute.of(context);
if (currentRoute != null) {
currentRoute.animation?.addStatusListener((status) {
if (status == AnimationStatus.completed && mounted) {
// Ensure the widget is still mounted and the animation is completed
_peakAnimation();
}
});
}
});
}
}
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
return GestureDetector(
onTap: unfocusAll,
child: PopScope(
canPop: false,
onPopInvokedWithResult: (bool didPop, Object? result) {
if (GoRouterState.of(context).name == 'mihHome' ||
GoRouterState.of(context).name == 'mihAuthentication') {
if (lastPressedAt == null ||
DateTime.now().difference(lastPressedAt!) >
const Duration(seconds: 2)) {
// First press: show a message and update the timestamp.
lastPressedAt = DateTime.now();
ScaffoldMessenger.of(context).showSnackBar(
MihSnackBar(
child: Text("Press back again to exit"),
),
);
} else {
// Second press within 2 seconds: exit the app.
KenLogger.warning('Exiting app...'); // Your custom logger
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
}
} else {
context.goNamed(
'mihHome',
extra: true,
);
}
},
child: Scaffold(
drawer: widget.actionDrawer,
body: SafeArea(
bottom: false,
minimum: EdgeInsets.only(bottom: 0),
child: Container(
width: screenSize.width,
height: screenSize.height,
//color: Colors.black,
padding: const EdgeInsets.only(top: 5),
child: Column(
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
widget.appActionButton,
const SizedBox(
width: 10,
),
Expanded(
child: Container(
// alignment: Alignment.center,
// alignment: Alignment.centerRight,
alignment: Alignment.centerLeft,
// color: Colors.black,
child: FittedBox(
child: Text(
widget.appToolTitles[_currentIndex],
style: const TextStyle(
fontSize: 23,
fontWeight: FontWeight.w600,
),
),
),
),
),
const SizedBox(width: 5),
widget.appTools,
const SizedBox(width: 5),
],
),
const SizedBox(height: 5),
Expanded(
child: PageView.builder(
controller: _pageController,
itemCount: widget.appBody.length,
itemBuilder: (context, index) {
return widget.appBody[index];
},
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
widget.onIndexChange(index);
},
),
),
],
),
),
),
),
),
);
}
}

View File

@@ -1,38 +0,0 @@
import 'package:flutter/material.dart';
class MihPackageAction extends StatefulWidget {
final void Function()? onTap;
final double iconSize;
final Widget icon;
const MihPackageAction({
super.key,
required this.icon,
required this.iconSize,
required this.onTap,
});
@override
State<MihPackageAction> createState() => _MihPackageActionState();
}
class _MihPackageActionState extends State<MihPackageAction> {
@override
void dispose() {
super.dispose();
}
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return IconButton(
iconSize: widget.iconSize,
padding: const EdgeInsets.all(0),
onPressed: widget.onTap,
icon: widget.icon,
);
}
}

View File

@@ -1,211 +0,0 @@
import 'package:app_settings/app_settings.dart';
import 'package:flutter/foundation.dart';
import 'package:local_auth/local_auth.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_yt_video_player.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
class MihPackageTile extends StatefulWidget {
final String appName;
final String? ytVideoID;
final Widget appIcon;
final void Function() onTap;
final double iconSize;
final Color textColor;
final bool? authenticateUser;
const MihPackageTile({
super.key,
required this.onTap,
required this.appName,
this.ytVideoID,
required this.appIcon,
required this.iconSize,
required this.textColor,
this.authenticateUser,
});
@override
State<MihPackageTile> createState() => _MihPackageTileState();
}
class _MihPackageTileState extends State<MihPackageTile> {
final LocalAuthentication _auth = LocalAuthentication();
void displayHint() {
if (widget.ytVideoID != null) {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) {
return MihPackageWindow(
fullscreen: false,
windowTitle: widget.appName,
// windowTools: const [],
onWindowTapClose: () {
Navigator.pop(context);
},
windowBody: MIHYTVideoPlayer(
videoYTLink: widget.ytVideoID!,
),
);
},
);
}
}
Future<bool> isUserAuthenticated() async {
final bool canAuthWithBio = await _auth.canCheckBiometrics;
final bool canAuthenticate =
canAuthWithBio || await _auth.isDeviceSupported();
print("Auth Available: $canAuthenticate");
if (canAuthenticate) {
try {
final bool didBioAuth = await _auth.authenticate(
localizedReason: "Authenticate to access ${widget.appName}",
options: const AuthenticationOptions(
biometricOnly: false,
),
);
if (didBioAuth) {
return true;
} else {
authErrorPopUp();
}
// print("Authenticated: $didBioAuth");
} catch (error) {
print("Auth Error: $error");
authErrorPopUp();
}
} else {
print("Auth Error: No Biometrics Available");
authErrorPopUp();
}
return false;
}
void authErrorPopUp() {
MihAlertServices().errorAdvancedAlert(
"Biometric Authentication Required",
"Hi there! To jump into the ${widget.appName} Package, you'll need to authenticate yourself with your devices biometrics, please set up biometric authentication (like fingerprint, face ID, pattern or pin) on your device first.\n\nIf you have already set up biometric authentication, press \"Authenticate now\" to try again or press \"Set Up Authentication\" to go to your device settings.",
[
MihButton(
onPressed: () {
Navigator.of(context).pop();
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () {
AppSettings.openAppSettings(
type: AppSettingsType.security,
);
Navigator.of(context).pop();
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 300,
child: Text(
"Set Up Authentication",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () {
Navigator.of(context).pop();
authenticateUser();
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 300,
child: Text(
"Authenticate Now",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
context,
);
}
Future<void> authenticateUser() async {
if (widget.authenticateUser != null &&
widget.authenticateUser! &&
!kIsWeb) {
if (await isUserAuthenticated()) {
widget.onTap();
}
} else {
widget.onTap();
}
}
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.topCenter,
// color: Colors.black,
width: widget.iconSize,
height: widget.iconSize,
child: GestureDetector(
onTap: () async {
authenticateUser();
},
onLongPress: null, // Do this later
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: FittedBox(
fit: BoxFit.contain,
alignment: Alignment.center,
child: widget.appIcon,
),
),
const SizedBox(height: 10),
Padding(
// Add a little padding for better visual spacing
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: FittedBox(
child: Text(
widget.appName,
textAlign: TextAlign.center, // This centers the text content
maxLines: 1, // Allow up to 2 lines to prevent clipping
style: TextStyle(
color: widget.textColor,
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
);
}
}

View File

@@ -1,95 +0,0 @@
import 'package:mzansi_innovation_hub/main.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihPackageToolBody extends StatefulWidget {
final bool borderOn;
final Widget bodyItem;
final double? innerHorizontalPadding;
const MihPackageToolBody({
super.key,
required this.borderOn,
required this.bodyItem,
this.innerHorizontalPadding,
});
@override
State<MihPackageToolBody> createState() => _MihPackageToolBodyState();
}
class _MihPackageToolBodyState extends State<MihPackageToolBody> {
late double _innerBodyPadding;
double getHorizontalPaddingSize(Size screenSize) {
if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") {
if (widget.borderOn) {
return widget.innerHorizontalPadding ?? 10;
} else {
return widget.innerHorizontalPadding ?? 0;
}
} else {
// mobile
if (widget.borderOn) {
return widget.innerHorizontalPadding ?? 10;
} else {
return widget.innerHorizontalPadding ?? 0;
}
}
}
double getVerticalPaddingSize(Size screenSize) {
// mobile
if (widget.borderOn) {
return 10;
} else {
return 0;
}
}
Decoration? getBoader() {
if (widget.borderOn) {
_innerBodyPadding = 10.0;
return BoxDecoration(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 3.0),
);
} else {
_innerBodyPadding = 0.0;
return BoxDecoration(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 3.0),
);
}
}
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.sizeOf(context);
return Padding(
padding: EdgeInsets.only(
left: getHorizontalPaddingSize(screenSize),
right: getHorizontalPaddingSize(screenSize),
bottom: getVerticalPaddingSize(screenSize),
top: 0,
),
child: Container(
height: screenSize.height,
decoration: getBoader(),
child: Padding(
padding: EdgeInsets.all(_innerBodyPadding),
child: widget.bodyItem,
),
),
);
}
}

View File

@@ -1,52 +0,0 @@
import 'package:flutter/material.dart';
// ignore: must_be_immutable
class MihPackageTools extends StatefulWidget {
final Map<Widget, void Function()?> tools;
int selcetedIndex;
MihPackageTools({
super.key,
required this.tools,
required this.selcetedIndex,
});
@override
State<MihPackageTools> createState() => _MihPackageToolsState();
}
class _MihPackageToolsState extends State<MihPackageTools> {
List<Widget> getTools() {
List<Widget> temp = [];
int index = 0;
widget.tools.forEach((icon, onTap) {
temp.add(
Visibility(
visible: widget.selcetedIndex != index,
child: IconButton(
onPressed: onTap,
icon: icon,
),
),
);
temp.add(
Visibility(
visible: widget.selcetedIndex == index,
child: IconButton.filled(
onPressed: onTap,
icon: icon,
),
),
);
index += 1;
});
return temp;
}
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: getTools(),
);
}
}

View File

@@ -1,210 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihPackageWindow extends StatefulWidget {
final String? windowTitle;
final Widget windowBody;
final List<SpeedDialChild>? menuOptions;
final void Function()? onWindowTapClose;
final Color? backgroundColor;
final Color? foregroundColor;
final bool? borderOn;
final bool fullscreen;
const MihPackageWindow({
super.key,
required this.fullscreen,
required this.windowTitle,
this.menuOptions,
required this.onWindowTapClose,
required this.windowBody,
this.borderOn,
this.backgroundColor,
this.foregroundColor,
});
@override
State<MihPackageWindow> createState() => _MihPackageWindowState();
}
class _MihPackageWindowState extends State<MihPackageWindow> {
late double windowTitleSize;
late double horizontralWindowPadding;
late double vertticalWindowPadding;
late double windowWidth;
late double windowHeight;
late double width;
late double height;
void checkScreenSize() {
// print("screen width: $width");
// print("screen height: $height");
if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") {
setState(() {
windowTitleSize = 25;
horizontralWindowPadding = width / 7;
vertticalWindowPadding = 10;
windowWidth = width;
windowHeight = height;
});
} else {
setState(() {
windowTitleSize = 20;
horizontralWindowPadding = 10;
vertticalWindowPadding = 10;
windowWidth = width;
windowHeight = height;
});
}
}
Widget getHeader() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (widget.onWindowTapClose != null)
Padding(
padding: const EdgeInsets.only(
top: 5.0,
left: 5.0,
),
child: MihButton(
width: 40,
height: 40,
elevation: 10,
onPressed: widget.onWindowTapClose,
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
child: Icon(
Icons.close,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
),
),
),
if (widget.windowTitle != null)
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Text(
widget.windowTitle!,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: windowTitleSize,
fontWeight: FontWeight.bold,
color: widget.foregroundColor ??
MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
),
),
),
if (widget.menuOptions != null)
Padding(
padding: const EdgeInsets.only(
top: 5.0,
right: 5.0,
),
child: SizedBox(
width: 40,
child: MihFloatingMenu(
iconSize: 40,
animatedIcon: AnimatedIcons.menu_close,
direction: SpeedDialDirection.down,
children: widget.menuOptions != null ? widget.menuOptions! : [],
),
),
),
],
);
}
@override
void dispose() {
super.dispose();
}
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
setState(() {
width = size.width;
height = size.height;
});
checkScreenSize();
return Dialog(
insetPadding: EdgeInsets.symmetric(
horizontal: horizontralWindowPadding,
vertical: vertticalWindowPadding,
),
insetAnimationCurve: Easing.emphasizedDecelerate,
insetAnimationDuration: Durations.short1,
child: Material(
elevation: 10,
shadowColor: Colors.black,
color: widget.backgroundColor ??
MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
borderRadius: BorderRadius.circular(25.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.0),
border: widget.borderOn == null || !widget.borderOn!
? null
: Border.all(
color: widget.foregroundColor ??
MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 5.0),
),
child: widget.fullscreen
? Column(
mainAxisSize: MainAxisSize.max,
children: [
getHeader(),
const SizedBox(height: 5),
Expanded(
child: SingleChildScrollView(child: widget.windowBody)),
],
)
: Column(
mainAxisSize: MainAxisSize.min,
children: [
getHeader(),
const SizedBox(height: 5),
Flexible(
child: Padding(
padding: EdgeInsets.only(
left: 25,
right: 25,
bottom: vertticalWindowPadding,
),
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: windowHeight * 0.85,
maxWidth: windowWidth * 0.85,
),
child: MihSingleChildScroll(child: widget.windowBody),
),
),
),
],
),
),
),
);
}
}

View File

@@ -1,9 +1,7 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
class MihPersonalProfilePreview extends StatefulWidget {
final AppUser user;
@@ -36,26 +34,23 @@ class _MihPersonalProfilePreviewState extends State<MihPersonalProfilePreview> {
? Icon(
MihIcons.mihRing,
size: profilePictureWidth,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
)
: widget.imageFile == null
? Icon(
MihIcons.iDontKnow,
size: profilePictureWidth,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
)
: MihCircleAvatar(
imageFile: widget.imageFile,
width: profilePictureWidth,
expandable: false,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: null,
frameColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
frameColor: MihColors.secondary(),
backgroundColor: MihColors.primary(),
onChange: () {},
),
const SizedBox(width: 15),

View File

@@ -1,21 +1,18 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class MihProfileLinks extends StatefulWidget {
final List<ProfileLink> links;
final double? buttonSize;
final bool? paddingOn;
const MihProfileLinks({
super.key,
required this.links,
this.buttonSize,
this.paddingOn,
});
@@ -26,72 +23,88 @@ class MihProfileLinks extends StatefulWidget {
class _MihProfileLinksState extends State<MihProfileLinks> {
Widget displayLinkButton(ProfileLink link) {
IconData iconData;
Color iconColor;
Color btnColor;
Color iconColor = Colors.white;
switch (link.destination.toLowerCase()) {
case "youtube":
iconData = FontAwesomeIcons.youtube;
iconColor = const Color(0xFFFF0000);
btnColor = const Color(0xFFFF0000);
break;
case "tiktok":
iconData = FontAwesomeIcons.tiktok;
iconColor = const Color(0xFF000000);
btnColor = const Color(0xFF000000);
break;
case "twitch":
iconData = FontAwesomeIcons.twitch;
iconColor = const Color(0xFF6441a5);
btnColor = const Color(0xFF6441a5);
break;
case "threads":
iconData = FontAwesomeIcons.threads;
iconColor = const Color(0xFF000000);
btnColor = const Color(0xFF000000);
break;
case "whatsapp":
iconData = FontAwesomeIcons.whatsapp;
iconColor = const Color(0xFF25D366);
btnColor = const Color(0xFF25D366);
break;
case "instagram":
iconData = FontAwesomeIcons.instagram;
iconColor = const Color(0xFFF56040);
btnColor = const Color(0xFFF56040);
break;
case "x":
iconData = FontAwesomeIcons.xTwitter;
iconColor = const Color(0xFF000000);
btnColor = const Color(0xFF000000);
break;
case "linkedin":
iconData = FontAwesomeIcons.linkedin;
iconColor = const Color(0xFF0a66c2);
btnColor = const Color(0xFF0a66c2);
break;
case "facebook":
iconData = FontAwesomeIcons.facebook;
iconColor = const Color(0xFF4267B2);
btnColor = const Color(0xFF4267B2);
break;
case "reddit":
iconData = FontAwesomeIcons.reddit;
iconColor = const Color(0xFFFF4500);
btnColor = const Color(0xFFFF4500);
break;
case "discord":
iconData = FontAwesomeIcons.discord;
iconColor = const Color(0xFF5865F2);
btnColor = const Color(0xFF5865F2);
break;
case "git":
iconData = FontAwesomeIcons.git;
btnColor = const Color(0xFF73A952);
break;
default:
iconData = FontAwesomeIcons.link;
iconColor = MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
btnColor = MihColors.primary();
}
return MihPackageTile(
onTap: () {
return MihButton(
width: 80,
height: 80,
onPressed: () {
launchSocialUrl(Uri.parse(link.web_link));
},
appName: link.destination,
appIcon: Icon(
buttonColor: btnColor,
child: FaIcon(
iconData,
color: iconColor,
size: 40,
),
iconSize: 200,
textColor: Colors.black,
// MihColors.getPrimaryColor(
// MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
);
// return MihPackageTile(
// onTap: () {
// launchSocialUrl(Uri.parse(link.web_link));
// },
// packageName: link.destination,
// packageIcon: Icon(
// iconData,
// color: btnColor,
// ),
// iconSize: 200,
// textColor: Colors.black,
// // MihColors.primary(
// // ),
// );
}
Future<void> launchSocialUrl(Uri linkUrl) async {
@@ -110,54 +123,31 @@ class _MihProfileLinksState extends State<MihProfileLinks> {
padding: widget.paddingOn == null || widget.paddingOn!
? MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
: EdgeInsets.symmetric(horizontal: width * 0.075)
: EdgeInsets.symmetric(horizontal: width * 0)
: EdgeInsetsGeometry.all(0),
child: Material(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
.withValues(alpha: 0.6),
borderRadius: BorderRadius.circular(25),
elevation: 10,
shadowColor: Colors.black,
child: Container(
width: 500,
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
borderRadius: BorderRadius.circular(10),
),
child: widget.links.isEmpty
? SizedBox(
height: 35,
child: Text(
"No Profile Links",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
),
)
: Wrap(
alignment: WrapAlignment.center,
runSpacing: 15,
spacing: 15,
children: widget.links.map(
(link) {
return SizedBox(
width: widget.buttonSize ?? 80,
height: widget.buttonSize ?? 80,
child: displayLinkButton(link),
);
},
).toList(),
child: widget.links.isEmpty
? SizedBox(
height: 35,
child: Text(
"No Profile Links",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
),
),
),
),
)
: Wrap(
alignment: WrapAlignment.center,
runSpacing: 10,
spacing: 10,
children: widget.links.map(
(link) {
return displayLinkButton(link);
},
).toList(),
),
);
},
);

View File

@@ -1,140 +0,0 @@
import 'package:flutter/material.dart';
class MihRadioOptions extends StatefulWidget {
final TextEditingController controller;
final String hintText;
final Color fillColor;
final Color secondaryFillColor;
final bool requiredText;
final List<String> radioOptions;
const MihRadioOptions({
super.key,
required this.controller,
required this.hintText,
required this.fillColor,
required this.secondaryFillColor,
required this.requiredText,
required this.radioOptions,
});
@override
State<MihRadioOptions> createState() => _MihRadioOptionsState();
}
class _MihRadioOptionsState extends State<MihRadioOptions> {
// late String _currentSelection;
@override
void initState() {
super.initState();
if (widget.controller.text.isEmpty && widget.radioOptions.isNotEmpty) {
widget.controller.text = widget.radioOptions[0];
}
// else{
// int index = widget.radioOptions
// .indexWhere((element) => element == option);
// _currentSelection = widget.radioOptions[index];
// widget.controller.text = option;
// }
// _currentSelection = widget.radioOptions[0];
}
// The method to handle a change in selection.
void _onChanged(String? value) {
if (value != null) {
widget.controller.text = value;
}
}
Widget displayRadioOptions(String selection) {
return Material(
elevation: 4.0,
borderRadius: BorderRadius.circular(8.0),
child: Container(
decoration: BoxDecoration(
color: widget.fillColor,
borderRadius: BorderRadius.circular(8.0),
),
child: Column(
children: widget.radioOptions.map((option) {
return GestureDetector(
onTap: () {
_onChanged(option);
},
child: Row(
children: [
const SizedBox(width: 10),
Expanded(
child: Text(
option,
style: TextStyle(
color: widget.secondaryFillColor,
fontWeight: FontWeight.w500,
fontSize: 15,
),
),
),
Radio<String>(
value: option,
groupValue: selection,
onChanged: _onChanged,
activeColor: widget.secondaryFillColor,
fillColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.selected)) {
return widget.secondaryFillColor; // Color when selected
}
return widget.secondaryFillColor;
}),
),
],
),
);
}).toList(),
),
),
);
}
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: widget.controller,
builder: (context, child) {
final currentSelection = widget.controller.text;
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.hintText,
textAlign: TextAlign.left,
style: TextStyle(
color: widget.fillColor,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
Visibility(
visible: !widget.requiredText,
child: Text(
"(Optional)",
textAlign: TextAlign.right,
style: TextStyle(
color: widget.fillColor,
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
),
],
),
const SizedBox(height: 4),
displayRadioOptions(currentSelection),
],
);
});
}
}

View File

@@ -1,18 +0,0 @@
import 'package:flutter/material.dart';
SnackBar MihSnackBar({
required Widget child,
}) {
return SnackBar(
content: child,
shape: StadiumBorder(),
behavior: SnackBarBehavior.floating,
duration: Duration(seconds: 2),
width: null,
action: SnackBarAction(
label: "Dismiss",
onPressed: () {},
),
// elevation: 30,
);
}

View File

@@ -1,190 +0,0 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class MihSearchBar extends StatefulWidget {
final TextEditingController controller;
final String hintText;
final IconData prefixIcon;
final IconData? prefixAltIcon;
final List<Widget>? suffixTools;
final double? width;
final double? height;
final Color fillColor;
final Color hintColor;
final void Function()? onPrefixIconTap;
final void Function()? onClearIconTap;
final double? elevation;
final FocusNode searchFocusNode;
const MihSearchBar({
Key? key,
required this.controller,
required this.hintText,
required this.prefixIcon,
this.prefixAltIcon,
this.suffixTools,
this.width,
this.height,
required this.fillColor,
required this.hintColor,
required this.onPrefixIconTap,
this.onClearIconTap,
this.elevation,
required this.searchFocusNode,
}) : super(key: key);
@override
State<MihSearchBar> createState() => _MihSearchBarState();
}
class _MihSearchBarState extends State<MihSearchBar> {
bool _showClearIcon = false;
Widget getPrefixIcon() {
if (_showClearIcon) {
// If the clear icon is shown and an alternative prefix icon is provided, use it
return widget.prefixAltIcon != null
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Icon(
widget.prefixAltIcon,
color: widget.hintColor,
size: 35,
),
)
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Icon(
Icons.search,
color: widget.hintColor,
size: 35,
),
); // Default to search icon if no alt icon
} else {
// Return the primary prefix icon or the alternative if provided
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Icon(
Icons.search,
color: widget.hintColor,
size: 35,
),
);
}
}
@override
void initState() {
super.initState();
// 1. Add the listener to the controller
widget.controller.addListener(_updateClearIconVisibility);
// 2. Initialize the clear icon visibility based on the current text
_updateClearIconVisibility();
}
@override
void dispose() {
widget.controller.removeListener(_updateClearIconVisibility);
super.dispose();
}
void _updateClearIconVisibility() {
if (!mounted) {
return;
}
final bool shouldShow = widget.controller.text.isNotEmpty;
// Only call setState if the visibility state actually changes
if (_showClearIcon != shouldShow) {
setState(() {
_showClearIcon = shouldShow;
});
}
}
@override
Widget build(BuildContext context) {
return Material(
elevation: widget.elevation ?? 4.0, // Use provided elevation or default
borderRadius: BorderRadius.circular(30.0),
color: widget.fillColor,
child: AnimatedContainer(
// Keep AnimatedContainer for width/height transitions
alignment: Alignment.centerLeft,
width: widget.width,
height: widget.height ?? 50,
duration: const Duration(milliseconds: 300),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
),
child: Theme(
data: Theme.of(context).copyWith(
textSelectionTheme: TextSelectionThemeData(
selectionColor: widget.hintColor.withValues(alpha: 0.3),
selectionHandleColor: widget.hintColor,
),
),
child: TextField(
textAlignVertical: TextAlignVertical.center,
controller: widget.controller, // Assign the controller
focusNode: widget.searchFocusNode,
autocorrect: true,
spellCheckConfiguration:
!kIsWeb && (Platform.isAndroid || Platform.isIOS)
? SpellCheckConfiguration()
: null,
onSubmitted: (value) {
widget.onPrefixIconTap
?.call(); // Call the prefix icon tap handler
},
style: TextStyle(
color: widget.hintColor,
fontWeight: FontWeight.w600,
fontSize: 16,
),
cursorColor: widget.hintColor,
decoration: InputDecoration(
isDense: true,
hintText: widget.hintText,
hintStyle: TextStyle(
color: widget.hintColor,
fontWeight: FontWeight.w600,
fontSize: 16,
),
border: InputBorder.none,
contentPadding:
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 15.0),
prefixIcon: GestureDetector(
onTap: widget.onPrefixIconTap,
child: getPrefixIcon(),
),
suffixIcon: Row(
// Use a Row for multiple suffix icons
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Optional suffix tools
if (widget.suffixTools != null) ...widget.suffixTools!,
// Clear Icon (conditionally visible)
if (_showClearIcon) // Only show if input is not empty
IconButton(
iconSize: 35,
icon: Icon(Icons.clear,
color: widget.hintColor), // Clear icon
onPressed: widget.onClearIconTap ??
() {
widget.controller.clear();
// No need for setState here, _updateClearIconVisibility will handle it
},
),
],
),
),
),
),
),
);
}
}

View File

@@ -1,28 +0,0 @@
import 'package:flutter/material.dart';
class MihSingleChildScroll extends StatefulWidget {
final Widget child;
const MihSingleChildScroll({
super.key,
required this.child,
});
@override
State<MihSingleChildScroll> createState() => _MihSingleChildScrollState();
}
class _MihSingleChildScrollState extends State<MihSingleChildScroll> {
@override
Widget build(BuildContext context) {
return SafeArea(
bottom: false,
minimum: EdgeInsets.only(bottom: 5),
child: ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
child: SingleChildScrollView(
child: widget.child,
),
),
);
}
}

View File

@@ -1,318 +0,0 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihTextFormField extends StatefulWidget {
final double? width;
final double? height;
final Color fillColor;
final Color inputColor;
final TextEditingController controller;
final bool? hasError;
final String? hintText;
final double? borderRadius;
final bool? multiLineInput;
final bool? readOnly;
final bool? passwordMode;
final bool? numberMode;
final bool requiredText;
final FormFieldValidator<String>? validator;
final List<String>? autofillHints;
final double? elevation;
final TextAlign? textIputAlignment;
const MihTextFormField({
Key? key,
this.width,
this.height,
required this.fillColor,
required this.inputColor,
required this.controller,
this.hasError,
required this.hintText,
required this.requiredText,
this.borderRadius,
this.multiLineInput,
this.readOnly,
this.passwordMode,
this.numberMode,
this.validator,
this.autofillHints,
this.elevation,
this.textIputAlignment,
}) : super(key: key);
@override
State<MihTextFormField> createState() => _MihTextFormFieldState();
}
class _MihTextFormFieldState extends State<MihTextFormField> {
late bool _obscureText;
FormFieldState<String>? _formFieldState;
@override
void initState() {
super.initState();
_obscureText = widget.passwordMode ?? false;
widget.controller.addListener(_onControllerTextChanged);
}
@override
void didUpdateWidget(covariant MihTextFormField oldWidget) {
super.didUpdateWidget(oldWidget);
// If the controller itself changes, remove listener from old and add to new
if (widget.controller != oldWidget.controller) {
oldWidget.controller.removeListener(_onControllerTextChanged);
widget.controller.addListener(_onControllerTextChanged);
// Immediately update form field state if controller changed and has value
_formFieldState?.didChange(widget.controller.text);
}
}
void _onControllerTextChanged() {
// Only update the FormField's value if it's not already the same
// and if the formFieldState is available.
if (_formFieldState != null &&
_formFieldState!.value != widget.controller.text) {
_formFieldState!.didChange(widget.controller.text);
}
}
@override
void dispose() {
widget.controller.removeListener(_onControllerTextChanged);
super.dispose();
}
@override
Widget build(BuildContext context) {
final isMultiline = widget.multiLineInput == true;
return Center(
child: SizedBox(
width: widget.width,
// height: widget.height,
height: isMultiline ? null : widget.height,
child: Theme(
data: Theme.of(context).copyWith(
textSelectionTheme: TextSelectionThemeData(
selectionColor: widget.inputColor.withValues(alpha: 0.3),
selectionHandleColor: widget.inputColor,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Visibility(
visible: widget.hintText != null,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.hintText ?? "",
textAlign: TextAlign.left,
style: TextStyle(
color: widget.fillColor,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
Visibility(
visible: !widget.requiredText,
child: Text(
"(Optional)",
textAlign: TextAlign.right,
style: TextStyle(
color: widget.fillColor,
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
const SizedBox(height: 4),
FormField<String>(
initialValue: widget.controller.text,
validator: widget.validator,
autovalidateMode: AutovalidateMode.onUserInteraction,
builder: (field) {
_formFieldState = field;
return Column(
crossAxisAlignment:
CrossAxisAlignment.start, // <-- Add this line
children: [
Material(
elevation: widget.elevation ?? 4.0,
borderRadius:
BorderRadius.circular(widget.borderRadius ?? 8.0),
child: SizedBox(
height: widget.height != null
? widget.height! - 30
: null,
child: TextFormField(
controller: widget.controller,
cursorColor: widget.inputColor,
autofillHints: widget.autofillHints,
autocorrect: true,
// spellCheckConfiguration: (kIsWeb ||
// widget.passwordMode == true ||
// widget.numberMode == true)
// ? null
// : SpellCheckConfiguration(),
spellCheckConfiguration: !kIsWeb &&
(Platform.isAndroid || Platform.isIOS)
? SpellCheckConfiguration()
: null,
textAlign:
widget.textIputAlignment ?? TextAlign.start,
textAlignVertical: widget.multiLineInput == true
? TextAlignVertical.top
: TextAlignVertical.center,
obscureText: widget.passwordMode == true
? _obscureText
: false,
expands: widget.passwordMode == true
? false
: (widget.multiLineInput ?? false),
maxLines: widget.passwordMode == true ? 1 : null,
readOnly: widget.readOnly ?? false,
keyboardType: widget.numberMode == true
? const TextInputType.numberWithOptions(
decimal: true)
: null,
inputFormatters: widget.numberMode == true
? [
FilteringTextInputFormatter.allow(
RegExp(r'^\d*\.?\d*'))
]
: null,
style: TextStyle(
color: widget.inputColor,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
suffixIcon: widget.passwordMode == true
? FocusScope(
canRequestFocus: false,
child: IconButton(
icon: Icon(
_obscureText
? Icons.visibility_off
: Icons.visibility,
color: widget.inputColor,
),
onPressed: () {
setState(() {
_obscureText = !_obscureText;
});
},
),
)
: null,
errorStyle: const TextStyle(
height: 0, fontSize: 0), // <-- Add this line
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
filled: true,
fillColor: widget.fillColor,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: field.hasError
? BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 2.0,
)
: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: field.hasError
? MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark")
: widget.inputColor,
width: 3.0,
),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 3.0,
),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 3.0,
),
),
),
onChanged: (value) {
field.didChange(value);
},
),
),
),
if (field.hasError)
Row(
children: [
Padding(
padding:
const EdgeInsets.only(left: 8.0, top: 4.0),
child: Text(
field.errorText ?? '',
style: TextStyle(
fontSize: 12,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
fontWeight: FontWeight.bold,
),
),
),
],
),
],
);
},
),
],
),
),
),
);
}
}

View File

@@ -1,217 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihTimeField extends StatefulWidget {
final TextEditingController controller;
final String labelText;
final bool required;
final double? width;
final double? height;
final double? borderRadius;
final double? elevation;
final FormFieldValidator<String>? validator;
const MihTimeField({
super.key,
required this.controller,
required this.labelText,
required this.required,
this.width,
this.height,
this.borderRadius,
this.elevation,
this.validator,
});
@override
State<MihTimeField> createState() => _MihTimeFieldState();
}
class _MihTimeFieldState extends State<MihTimeField> {
FormFieldState<String>? _formFieldState;
Future<void> _selectTime(BuildContext context) async {
TimeOfDay? picked = await showTimePicker(
context: context,
initialTime: widget.controller.text.isNotEmpty
? TimeOfDay(
hour: int.tryParse(widget.controller.text.split(":")[0]) ?? 0,
minute: int.tryParse(widget.controller.text.split(":")[1]) ?? 0,
)
: TimeOfDay.now(),
builder: (context, child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
child: child as Widget,
);
},
);
if (picked != null) {
final hours = picked.hour.toString().padLeft(2, '0');
final minutes = picked.minute.toString().padLeft(2, '0');
widget.controller.text = "$hours:$minutes";
_formFieldState?.didChange(widget.controller.text);
setState(() {});
}
}
@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
width: widget.width,
height: widget.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.labelText,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
if (!widget.required)
Text(
"(Optional)",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 4),
FormField<String>(
initialValue: widget.controller.text,
validator: widget.validator,
autovalidateMode: AutovalidateMode.onUserInteraction,
builder: (field) {
_formFieldState = field;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Material(
elevation: widget.elevation ?? 4.0,
borderRadius:
BorderRadius.circular(widget.borderRadius ?? 8.0),
child: TextFormField(
controller: widget.controller,
readOnly: true,
onTap: () => _selectTime(context),
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
suffixIcon: Icon(
Icons.access_time,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
),
errorStyle: const TextStyle(height: 0, fontSize: 0),
contentPadding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
filled: true,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: field.hasError
? BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 2.0,
)
: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: field.hasError
? MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark")
: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
width: 3.0,
),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 3.0,
),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
widget.borderRadius ?? 8.0),
borderSide: BorderSide(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 3.0,
),
),
),
onChanged: (value) {
field.didChange(value);
},
),
),
if (field.hasError)
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 4.0),
child: Text(
field.errorText ?? '',
style: TextStyle(
fontSize: 12,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontWeight: FontWeight.bold,
),
),
),
],
);
},
),
],
),
),
);
}
}

View File

@@ -1,134 +0,0 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihToggle extends StatefulWidget {
final String hintText;
final bool initialPostion;
final Color fillColor;
final Color secondaryFillColor;
final bool? readOnly;
final double? elevation;
final void Function(bool) onChange;
const MihToggle({
super.key,
required this.hintText,
required this.initialPostion,
required this.fillColor,
required this.secondaryFillColor,
this.readOnly,
this.elevation,
required this.onChange,
});
@override
State<MihToggle> createState() => _MihToggleState();
}
class _MihToggleState extends State<MihToggle> {
late bool togglePosition;
@override
void didUpdateWidget(covariant MihToggle oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.initialPostion != oldWidget.initialPostion) {
setState(() {
togglePosition = widget.initialPostion;
});
}
}
@override
void initState() {
super.initState();
togglePosition = widget.initialPostion;
}
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Text(
widget.hintText,
style: TextStyle(
fontWeight: FontWeight.bold,
color: widget.fillColor,
fontSize: 18,
),
),
),
const SizedBox(width: 10),
// Material(
// elevation: widget.elevation ?? 0.01,
// shadowColor: widget.secondaryFillColor.withOpacity(0.5),
// color: Colors.transparent,
// shape: StadiumBorder(),
Container(
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(
30), // Adjust the border radius to match the toggle
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: Offset(
0, widget.elevation ?? 10), // Adjust the vertical offset
blurRadius: widget.elevation ?? 10,
spreadRadius: 0,
),
],
),
child: Switch(
value: togglePosition,
trackOutlineColor: WidgetStateProperty.resolveWith<Color?>(
(states) {
if (widget.readOnly == true) {
return Colors.grey;
}
if (states.contains(WidgetState.selected)) {
return MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"); // Outline color when active
}
return MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"); // Outline color when active
},
),
activeColor: widget.readOnly == true
? Colors.grey
: widget.secondaryFillColor,
activeTrackColor: widget.readOnly == true
? Colors.grey.shade400
: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inactiveThumbColor: widget.readOnly == true
? Colors.grey
: widget.secondaryFillColor,
inactiveTrackColor: widget.readOnly == true
? Colors.grey.shade400
: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// activeColor: widget.secondaryFillColor,
// activeTrackColor: widget.fillColor,
// inactiveThumbColor: widget.fillColor,
// inactiveTrackColor: widget.secondaryFillColor,
// onChanged: widget.readOnly != true ? widget.onChange : null,
onChanged: widget.readOnly != true
? (newValue) {
setState(() {
togglePosition = newValue; // Update internal state
});
widget.onChange(newValue); // Call the parent's onChange
}
: null,
),
),
const SizedBox(width: 10),
],
);
}
}

View File

@@ -1,7 +1,5 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/about_mih_provider.dart';
import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tools/mih_%20attributes.dart';
import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tools/mih_info.dart';
@@ -37,11 +35,11 @@ class _AboutMihState extends State<AboutMih> {
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: context.watch<AboutMihProvider>().toolIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: getToolTitle(),
selectedBodyIndex: context.watch<AboutMihProvider>().toolIndex,
onIndexChange: (newIndex) {
context.read<AboutMihProvider>().setToolIndex(newIndex);
},
@@ -51,6 +49,7 @@ class _AboutMihState extends State<AboutMih> {
MihPackageAction getAction() {
return MihPackageAction(
icon: const Icon(Icons.arrow_back),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.goNamed(
@@ -77,7 +76,7 @@ class _AboutMihState extends State<AboutMih> {
};
return MihPackageTools(
tools: temp,
selcetedIndex: context.watch<AboutMihProvider>().toolIndex,
selectedIndex: context.watch<AboutMihProvider>().toolIndex,
);
}

View File

@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
class PolicyAndTermsText {
List<Widget> getPrivacyPolicyText(BuildContext context, bool english) {
@@ -40,8 +38,7 @@ class PolicyAndTermsText {
child: FittedBox(
child: Icon(
MihIcons.mihLogo,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
),
@@ -452,8 +449,7 @@ class PolicyAndTermsText {
child: FittedBox(
child: Icon(
MihIcons.mihLogo,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
),

View File

@@ -1,9 +1,6 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class AboutMihTile extends StatefulWidget {
final double packageSize;
@@ -29,16 +26,14 @@ class _AboutMihTileState extends State<AboutMihTile> {
// arguments: 0,
// );
},
appName: "About MIH",
appIcon: Icon(
packageName: "About MIH",
packageIcon: Icon(
MihIcons.aboutMih,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
// size: widget.packageSize,
),
iconSize: widget.packageSize,
textColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
textColor: MihColors.secondary(),
);
}
}

View File

@@ -1,10 +1,5 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:url_launcher/url_launcher.dart';
class MihAttributes extends StatefulWidget {
@@ -21,80 +16,37 @@ class _MihAttributesState extends State<MihAttributes> {
}
}
TableRow displayIcon(IconData icon, String creator, String link) {
return TableRow(
children: [
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: SizedBox(
height: 150,
child: Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: FittedBox(
child: Center(
child: Icon(
icon,
// size: 125,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
),
),
),
),
Widget displayAttribution(IconData resource, String creator, String link) {
return GestureDetector(
onTap: () {
launchUrlLink(
Uri.parse(
link,
),
),
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Center(
child: Text(
creator,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
);
},
child: Column(
children: [
Icon(
resource,
color: MihColors.secondary(),
size: 100,
),
),
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: MihButton(
onPressed: () {
launchUrlLink(
Uri.parse(
link,
),
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 100,
child: Text(
"Visit",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 5),
Text(
creator,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
),
],
],
),
);
}
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(),
);
}
@@ -108,179 +60,76 @@ class _MihAttributesState extends State<MihAttributes> {
"As per the terms for free use for these third party providers, the following assets require attribution";
return MihSingleChildScroll(
child: Column(
children: [
Icon(
MihIcons.mihLogo,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
size: 165,
),
const SizedBox(
height: 10,
),
SelectableText(
message,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
scrollbarOn: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
children: [
Icon(
MihIcons.mihLogo,
color: MihColors.secondary(),
size: 165,
),
),
const SizedBox(
height: 10,
),
SizedBox(
width: 700,
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
columnWidths: const {
0: FlexColumnWidth(1),
1: FlexColumnWidth(1),
2: FlexColumnWidth(1),
},
children: [
const TableRow(
children: [
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: Center(
child: Text(
"Resources",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
),
),
),
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: Center(
child: Text(
"Creator",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
),
),
),
TableCell(
child: Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: Center(
child: Text(
"Link",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
displayIcon(MihIcons.mihRing, "Tarah Meth",
"https://www.linkedin.com/in/tarah-meth-3b6309254/"),
displayIcon(MihIcons.mihLogo, "Tarah Meth",
"https://www.linkedin.com/in/tarah-meth-3b6309254/"),
displayIcon(MihIcons.mzansiAi, "Ollama", "https://ollama.com/"),
displayIcon(MihIcons.mzansiWallet, "Freepik",
"https://www.flaticon.com/free-icon/wallet-passes-app_3884407?term=wallet&page=1&position=21&origin=search&related_id=3884407"),
displayIcon(MihIcons.patientProfile, "RaftelDesign",
"https://www.flaticon.com/free-icon/patient_2376100?term=medication&page=1&position=6&origin=search&related_id=2376100"),
displayIcon(MihIcons.patientProfile, "Srip",
"https://www.flaticon.com/free-icon/hospital_1233930?term=medical+snake&page=1&position=7&origin=search&related_id=1233930"),
displayIcon(MihIcons.calendar, "Freepik",
"https://www.flaticon.com/free-icon/calendar_2278049?term=calendar&page=1&position=5&origin=search&related_id=2278049"),
displayIcon(MihIcons.calculator, "Freepik",
"https://www.flaticon.com/free-icon/calculator_2374409?term=calculator&page=1&position=20&origin=search&related_id=2374409"),
displayIcon(MihIcons.aboutMih, "Chanut",
"https://www.flaticon.com/free-icon/info_151776?term=about&page=1&position=8&origin=search&related_id=151776"),
displayIcon(MihIcons.personalProfile, "Freepik",
"https://www.flaticon.com/free-icon/user_1077063?term=profile&page=1&position=6&origin=search&related_id=1077063"),
displayIcon(MihIcons.businessProfile, "Gravisio",
"https://www.flaticon.com/free-icon/contractor_11813336?term=company+profile&page=1&position=2&origin=search&related_id=11813336"),
displayIcon(MihIcons.patientManager, "Vector Tank",
"https://www.flaticon.com/free-icon/doctor_10215061?term=doctor&page=1&position=73&origin=search&related_id=10215061"),
displayIcon(MihIcons.profileSetup, "Freepik",
"https://www.flaticon.com/free-icon/add-user_748137?term=profile+add&page=1&position=1&origin=search&related_id=748137"),
displayIcon(MihIcons.businessSetup, "kerismaker",
"https://www.flaticon.com/free-icon/business_13569850?term=company+add&page=1&position=25&origin=search&related_id=13569850"),
displayIcon(MihIcons.calculator, "fawazahmed0",
"https://github.com/fawazahmed0/exchange-api"),
displayIcon(MihIcons.iDontKnow, "Freepik",
"https://www.flaticon.com/free-icon/i-dont-know_5359909?term=i+dont+know&page=1&position=7&origin=search&related_id=5359909"),
],
const SizedBox(
height: 10,
),
),
// SizedBox(
// width: 500,
// child: Column(
// children: [
// const SizedBox(
// width: double.infinity,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// mainAxisSize: MainAxisSize.max,
// children: [
// Flexible(
// child: Text(
// "Icon",
// style: TextStyle(
// fontSize: 25,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// Flexible(
// child: Text(
// "Creator",
// style: TextStyle(
// fontSize: 25,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// Flexible(
// child: Text(
// "Link",
// style: TextStyle(
// fontSize: 25,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ],
// ),
// ),
// const Padding(
// padding: EdgeInsets.symmetric(vertical: 10.0),
// child: Divider(),
// ),
// displayIcon(MihIcons.mihLogo, "Tarah Meth",
// "https://app.mzansi-innovation-hub.co.za/"),
// const SizedBox(height: 10),
// displayIcon(MihIcons.mihLogo, "Test",
// "https://www.flaticon.com/free-icons/mih"),
// const SizedBox(height: 10),
// displayIcon(MihIcons.mihLogo, "Test",
// "https://www.flaticon.com/free-icons/mih"),
// const SizedBox(height: 10),
// displayIcon(MihIcons.mihLogo, "Test",
// "https://www.flaticon.com/free-icons/mih"),
// const SizedBox(height: 10),
// ],
// ),
// )
],
SelectableText(
message,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 10,
),
SizedBox(
width: 900,
child: Wrap(
alignment: WrapAlignment.center,
runSpacing: 10,
spacing: 10,
children: [
displayAttribution(MihIcons.mihRing, "Tarah Meth",
"https://www.linkedin.com/in/tarah-meth-3b6309254/"),
displayAttribution(MihIcons.mihLogo, "Tarah Meth",
"https://www.linkedin.com/in/tarah-meth-3b6309254/"),
displayAttribution(
MihIcons.mzansiAi, "Ollama", "https://ollama.com/"),
displayAttribution(MihIcons.mzansiWallet, "Freepik",
"https://www.flaticon.com/free-icon/wallet-passes-app_3884407?term=wallet&page=1&position=21&origin=search&related_id=3884407"),
displayAttribution(MihIcons.patientProfile, "RaftelDesign",
"https://www.flaticon.com/free-icon/patient_2376100?term=medication&page=1&position=6&origin=search&related_id=2376100"),
displayAttribution(MihIcons.patientProfile, "Srip",
"https://www.flaticon.com/free-icon/hospital_1233930?term=medical+snake&page=1&position=7&origin=search&related_id=1233930"),
displayAttribution(MihIcons.calendar, "Freepik",
"https://www.flaticon.com/free-icon/calendar_2278049?term=calendar&page=1&position=5&origin=search&related_id=2278049"),
displayAttribution(MihIcons.calculator, "Freepik",
"https://www.flaticon.com/free-icon/calculator_2374409?term=calculator&page=1&position=20&origin=search&related_id=2374409"),
displayAttribution(MihIcons.aboutMih, "Chanut",
"https://www.flaticon.com/free-icon/info_151776?term=about&page=1&position=8&origin=search&related_id=151776"),
displayAttribution(MihIcons.personalProfile, "Freepik",
"https://www.flaticon.com/free-icon/user_1077063?term=profile&page=1&position=6&origin=search&related_id=1077063"),
displayAttribution(MihIcons.businessProfile, "Gravisio",
"https://www.flaticon.com/free-icon/contractor_11813336?term=company+profile&page=1&position=2&origin=search&related_id=11813336"),
displayAttribution(MihIcons.patientManager, "Vector Tank",
"https://www.flaticon.com/free-icon/doctor_10215061?term=doctor&page=1&position=73&origin=search&related_id=10215061"),
displayAttribution(MihIcons.profileSetup, "Freepik",
"https://www.flaticon.com/free-icon/add-user_748137?term=profile+add&page=1&position=1&origin=search&related_id=748137"),
displayAttribution(MihIcons.businessSetup, "kerismaker",
"https://www.flaticon.com/free-icon/business_13569850?term=company+add&page=1&position=25&origin=search&related_id=13569850"),
displayAttribution(MihIcons.calculator, "fawazahmed0",
"https://github.com/fawazahmed0/exchange-api"),
displayAttribution(MihIcons.iDontKnow, "Freepik",
"https://www.flaticon.com/free-icon/i-dont-know_5359909?term=i+dont+know&page=1&position=7&origin=search&related_id=5359909"),
],
),
),
const SizedBox(
height: 30,
),
],
),
),
);
}

View File

@@ -1,18 +1,14 @@
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_profile_links.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_install_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:redacted/redacted.dart';
@@ -50,8 +46,7 @@ class _MihInfoState extends State<MihInfo> {
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: CircleAvatar(
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.primary(),
backgroundImage: const AssetImage(
"lib/mih_package_components/assets/images/founder.jpg"),
//'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'),
@@ -61,8 +56,7 @@ class _MihInfoState extends State<MihInfo> {
Icon(
MihIcons.mihRing,
size: 165,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
],
),
@@ -206,15 +200,13 @@ class _MihInfoState extends State<MihInfo> {
children: [
FaIcon(
platformIcon,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
const SizedBox(width: 10),
Text(
btnText,
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -265,9 +257,7 @@ class _MihInfoState extends State<MihInfo> {
redact: isLoading,
configuration: RedactedConfiguration(
defaultBorderRadius: BorderRadius.circular(5),
redactedColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
),
redactedColor: MihColors.secondary(),
),
);
},
@@ -320,9 +310,7 @@ class _MihInfoState extends State<MihInfo> {
redact: isLoading,
configuration: RedactedConfiguration(
defaultBorderRadius: BorderRadius.circular(5),
redactedColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
),
redactedColor: MihColors.secondary(),
),
);
},
@@ -348,8 +336,7 @@ class _MihInfoState extends State<MihInfo> {
),
child: Divider(
thickness: 1,
color: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.grey(),
),
);
}
@@ -362,8 +349,7 @@ class _MihInfoState extends State<MihInfo> {
child: FittedBox(
child: Icon(
MihIcons.mihLogo,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
),
@@ -432,10 +418,97 @@ class _MihInfoState extends State<MihInfo> {
children: [
MihButton(
onPressed: () {
MihInstallServices().installMihTrigger(context);
if (MzansiInnovationHub.of(context)!.theme.getPlatform() ==
"Android") {
showDialog(
context: context,
builder: (context) {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Select Option",
onWindowTapClose: () {
context.pop();
},
windowBody: Column(
children: [
Text(
"Please select the platform you want to install/ Update MIH from",
style: TextStyle(
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25),
MihButton(
onPressed: () {
launchSocialUrl(
Uri.parse(
"https://play.google.com/store/apps/details?id=za.co.mzansiinnovationhub.mih",
),
);
},
buttonColor: MihColors.green(),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FaIcon(
FontAwesomeIcons.googlePlay,
color: MihColors.primary(),
),
const SizedBox(width: 10),
Text(
"Play Store",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
],
),
),
const SizedBox(
height: 10,
),
MihButton(
onPressed: () {
launchSocialUrl(
Uri.parse(
"https://appgallery.huawei.com/app/C113315335?pkgName=za.co.mzansiinnovationhub.mih",
),
);
},
buttonColor: MihColors.green(),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FaIcon(
Icons.store,
color: MihColors.primary(),
),
const SizedBox(width: 10),
Text(
"App Gallery",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
],
),
),
],
),
);
},
);
} else {
MihInstallServices().installMihTrigger(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: getInstallButtonText(),
),
@@ -447,24 +520,20 @@ class _MihInfoState extends State<MihInfo> {
),
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FaIcon(
FontAwesomeIcons.youtube,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
const SizedBox(width: 10),
Text(
"MIH Beginners Guide",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -480,24 +549,20 @@ class _MihInfoState extends State<MihInfo> {
),
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FaIcon(
FontAwesomeIcons.patreon,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
const SizedBox(width: 10),
Text(
"Support Our Journey",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -550,25 +615,20 @@ class _MihInfoState extends State<MihInfo> {
),
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FaIcon(
FontAwesomeIcons.tiktok,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
const SizedBox(width: 10),
Text(
"@womenforchange.sa",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -584,25 +644,20 @@ class _MihInfoState extends State<MihInfo> {
),
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FaIcon(
Icons.edit,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
const SizedBox(width: 10),
Text(
"Sign Petition",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -736,6 +791,14 @@ class _MihInfoState extends State<MihInfo> {
destination: "Reddit",
web_link: "https://www.reddit.com/r/Mzani_Innovation_Hub/",
),
ProfileLink(
idprofile_links: 1,
app_id: "1234",
business_id: "",
destination: "Git",
web_link:
"https://git.mzansi-innovation-hub.co.za/yaso_meth/mih-project",
),
];
return Column(
children: [
@@ -752,7 +815,7 @@ class _MihInfoState extends State<MihInfo> {
),
MihProfileLinks(links: links),
const SizedBox(
height: 25,
height: 75,
),
],
);
@@ -768,6 +831,7 @@ class _MihInfoState extends State<MihInfo> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(),
);
@@ -777,6 +841,7 @@ class _MihInfoState extends State<MihInfo> {
return Stack(
children: [
MihSingleChildScroll(
scrollbarOn: true,
child: Column(
children: [
aboutHeadings(),
@@ -802,19 +867,15 @@ class _MihInfoState extends State<MihInfo> {
SpeedDialChild(
child: Icon(
Icons.android,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Android",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
shareMIHLink(
context,
@@ -826,19 +887,15 @@ class _MihInfoState extends State<MihInfo> {
SpeedDialChild(
child: Icon(
Icons.apple,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "iOS",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
shareMIHLink(
context,
@@ -850,19 +907,15 @@ class _MihInfoState extends State<MihInfo> {
SpeedDialChild(
child: Icon(
Icons.store,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Huawei",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
shareMIHLink(
context,
@@ -874,19 +927,15 @@ class _MihInfoState extends State<MihInfo> {
SpeedDialChild(
child: Icon(
Icons.vpn_lock,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Web",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
shareMIHLink(
context,

View File

@@ -1,8 +1,4 @@
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_packages/about_mih/mih_policy_tos_ext/policy_and_terms_text.dart';
import 'package:flutter/material.dart';
@@ -18,8 +14,8 @@ class _MihPrivacyPolicyState extends State<MihPrivacyPolicy> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(context),
);
}
@@ -35,14 +31,12 @@ class _MihPrivacyPolicyState extends State<MihPrivacyPolicy> {
englishOn = !englishOn;
});
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
elevation: 10,
child: Text(
englishOn ? "Simplified Chinese" : "English",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -55,9 +49,13 @@ class _MihPrivacyPolicyState extends State<MihPrivacyPolicy> {
children
.addAll(PolicyAndTermsText().getPrivacyPolicyText(context, englishOn));
return MihSingleChildScroll(
child: Column(
mainAxisSize: MainAxisSize.max,
children: children,
scrollbarOn: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
mainAxisSize: MainAxisSize.max,
children: children,
),
),
);
}

View File

@@ -1,8 +1,4 @@
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_packages/about_mih/mih_policy_tos_ext/policy_and_terms_text.dart';
import 'package:flutter/material.dart';
@@ -18,8 +14,8 @@ class _MIHTermsOfServiceState extends State<MIHTermsOfService> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(context),
);
}
@@ -35,14 +31,12 @@ class _MIHTermsOfServiceState extends State<MIHTermsOfService> {
englishOn = !englishOn;
});
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
elevation: 10,
child: Text(
englishOn ? "Simplified Chinese" : "English",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -55,8 +49,12 @@ class _MIHTermsOfServiceState extends State<MIHTermsOfService> {
children
.addAll(PolicyAndTermsText().getTermsOfServiceText(context, englishOn));
return MihSingleChildScroll(
child: Column(
children: children,
scrollbarOn: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
children: children,
),
),
);
}

View File

@@ -1,10 +1,8 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_objects/access_request.dart';
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
@@ -103,30 +101,20 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
TextSpan accessWithColour;
if (access == "APPROVED") {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
text: "$access\n", style: TextStyle(color: MihColors.green()));
} else if (access == "PENDING") {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
text: "$access\n", style: TextStyle(color: MihColors.grey()));
} else {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
accessWithColour =
TextSpan(text: "$access\n", style: TextStyle(color: MihColors.red()));
}
return ListTile(
title: Text(
line1,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
subtitle: RichText(
@@ -142,7 +130,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
// Text(
// subtitle,
// style: TextStyle(
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
// ),
onTap: () {
@@ -158,7 +146,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
},
// trailing: Icon(
// Icons.arrow_forward,
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
);
}
@@ -213,8 +201,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
subtitle,
textAlign: TextAlign.left,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: popUpBodySize,
//fontWeight: FontWeight.bold,
),
@@ -231,15 +218,12 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
onPressed: () {
updateAccessAPICall(index, "declined");
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Decline",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -249,15 +233,12 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
onPressed: () {
updateAccessAPICall(index, "approved");
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Approve",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -294,8 +275,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
);
},
itemCount: widget.accessRequests.length,

View File

@@ -1,14 +1,12 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_access_controls_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:provider/provider.dart';
@@ -58,30 +56,20 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
TextSpan accessWithColour;
if (access == "APPROVED") {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
text: "$access\n", style: TextStyle(color: MihColors.green()));
} else if (access == "PENDING") {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
text: "$access\n", style: TextStyle(color: MihColors.grey()));
} else {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
accessWithColour =
TextSpan(text: "$access\n", style: TextStyle(color: MihColors.red()));
}
return ListTile(
title: Text(
line1,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
subtitle: RichText(
@@ -96,7 +84,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
// Text(
// subtitle,
// style: TextStyle(
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
// ),
onTap: () {
@@ -104,7 +92,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
},
// trailing: Icon(
// Icons.arrow_forward,
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
);
}
@@ -173,8 +161,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
subtitle,
textAlign: TextAlign.left,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: popUpBodySize,
//fontWeight: FontWeight.bold,
),
@@ -191,18 +178,14 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"Important Notice: Approving Profile Access",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
Text(
"You are about to accept access to your patient's profile. Please be aware of the following important points:",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
SizedBox(
@@ -211,9 +194,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"1. Permanent Access: Once you accepts this access request, it will become permanent.",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
),
@@ -223,9 +204,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
),
@@ -235,9 +214,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"3. Irreversible Access: Once granted, you cannot revoke access to your patient's profile.",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
),
@@ -245,9 +222,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"By pressing the \"Approve\" button you accept the above terms.",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
],
@@ -263,18 +238,14 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"Important Notice: Approved Profile Access",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
Text(
"You have accepted access to your patient's profile. Please be aware of the following important points:",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
SizedBox(
@@ -283,9 +254,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"1. Permanent Access: This access is permanent.",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
),
@@ -295,9 +264,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"2. Shared Information: Any updates make to youe patient profile will be visible to all who have access to the profile.",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
),
@@ -307,9 +274,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
"3. Irreversible Access: You cannot revoke this access to your patient's profile.",
style: TextStyle(
fontWeight: FontWeight.normal,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
),
),
@@ -355,16 +320,12 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
MihAlertServices().internetConnectionAlert(context);
}
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Decline",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -396,16 +357,12 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
MihAlertServices().internetConnectionAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Approve",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -438,15 +395,13 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
widget.onSuccessUpate!();
}
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -488,8 +443,7 @@ class _BuildPatientsListState extends State<BuildBusinessAccessList> {
return ListView.separated(
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
);
},
itemCount: filterAccessList(accessProvider.accessList!).length,

View File

@@ -1,8 +1,5 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_packages/access_review/package_tools/mih_access_requests.dart';
@@ -59,11 +56,11 @@ class _MihAccessState extends State<MihAccess> {
);
}
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: accessProvider.toolIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: getToolTitle(),
selectedBodyIndex: accessProvider.toolIndex,
onIndexChange: (newValue) {
accessProvider.setToolIndex(newValue);
},
@@ -75,6 +72,7 @@ class _MihAccessState extends State<MihAccess> {
MihPackageAction getAction() {
return MihPackageAction(
icon: const Icon(Icons.arrow_back),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.goNamed(
@@ -92,7 +90,7 @@ class _MihAccessState extends State<MihAccess> {
};
return MihPackageTools(
tools: temp,
selcetedIndex: context.watch<MihAccessControllsProvider>().toolIndex,
selectedIndex: context.watch<MihAccessControllsProvider>().toolIndex,
);
}

View File

@@ -1,9 +1,6 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihAccessTile extends StatefulWidget {
final double packageSize;
@@ -31,16 +28,14 @@ class _MihAccessTileState extends State<MihAccessTile> {
// arguments: widget.signedInUser,
// );
},
appName: "Access Controls",
appIcon: Icon(
packageName: "Access Controls",
packageIcon: Icon(
MihIcons.accessControl,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
// size: widget.packageSize,
),
iconSize: widget.packageSize,
textColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
textColor: MihColors.secondary(),
);
}
}

View File

@@ -1,14 +1,12 @@
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/patient_access.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_packages/access_review/builder/build_business_access_list.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_access_controls_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -178,6 +176,7 @@ class _MihAccessRequestState extends State<MihAccessRequest> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(),

View File

@@ -1,7 +1,5 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart';
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/currency_exchange_rate.dart';
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/simple_calc.dart';
@@ -42,11 +40,11 @@ class _MIHCalculatorState extends State<MIHCalculator> {
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: context.watch<MihCalculatorProvider>().toolIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: getToolTitle(),
selectedBodyIndex: context.watch<MihCalculatorProvider>().toolIndex,
onIndexChange: (newIndex) {
context.read<MihCalculatorProvider>().setToolIndex(newIndex);
},
@@ -56,6 +54,7 @@ class _MIHCalculatorState extends State<MIHCalculator> {
MihPackageAction getAction() {
return MihPackageAction(
icon: const Icon(Icons.arrow_back),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.goNamed(
@@ -79,7 +78,7 @@ class _MIHCalculatorState extends State<MIHCalculator> {
};
return MihPackageTools(
tools: temp,
selcetedIndex: context.watch<MihCalculatorProvider>().toolIndex,
selectedIndex: context.watch<MihCalculatorProvider>().toolIndex,
);
}

View File

@@ -1,9 +1,6 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihCalculatorTile extends StatefulWidget {
final double packageSize;
@@ -26,16 +23,14 @@ class _MihCalculatorTileState extends State<MihCalculatorTile> {
"mihCalculator",
);
},
appName: "Calculator",
appIcon: Icon(
packageName: "Calculator",
packageIcon: Icon(
MihIcons.calculator,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
// size: widget.packageSize,
),
iconSize: widget.packageSize,
textColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
textColor: MihColors.secondary(),
);
}
}

View File

@@ -1,16 +1,12 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.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_currency_exchange_rate_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
@@ -73,8 +69,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
Icon(
Icons.currency_exchange,
size: 150,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
const SizedBox(height: 20),
FittedBox(
@@ -84,8 +79,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
),
@@ -100,9 +94,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
),
@@ -114,9 +106,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
),
@@ -133,9 +123,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
),
@@ -147,9 +135,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
),
@@ -157,7 +143,11 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
),
SizedBox(height: 10),
Consumer(builder: (context, bannerAdDisplay, child) {
return MihBannerAd();
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
return MihBannerAd();
} else {
return const SizedBox(height: 0);
}
}),
],
),
@@ -187,8 +177,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.bold,
),
),
@@ -208,8 +197,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
'$companyName makes no representations or warranties of any kind, express or implied, as to the accuracy, completeness, reliability, or suitability of the information and calculations generated by the Tool. All exchange rates and results are estimates and are subject to change without notice.',
style: TextStyle(
fontSize: 15,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.normal,
),
),
@@ -220,8 +208,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
'The information provided by the Tool should not be construed as financial, investment, trading, or any other form of advice. You should not make any financial decisions based solely on the output of this Tool. We expressly recommend that you seek independent professional advice and verify all data with a qualified financial advisor and/or through alternative, reliable market data sources before executing any foreign exchange transactions.',
style: TextStyle(
fontSize: 15,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.normal,
),
),
@@ -232,8 +219,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
'By using the Tool, you agree that $companyName, its affiliates, directors, and employees shall not be held liable for any direct, indirect, incidental, special, consequential, or exemplary damages, including but not limited to, damages for loss of profits, goodwill, use, data, or other intangible losses, resulting from: (i) the use or the inability to use the Tool; (ii) any inaccuracies, errors, or omissions in the Tool\'s calculations or data; or (iii) any reliance placed by you on the information provided by the Tool.',
style: TextStyle(
fontSize: 15,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.normal,
),
),
@@ -248,8 +234,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
text: TextSpan(
style: TextStyle(
fontSize: 15,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.normal,
),
children: <TextSpan>[
@@ -280,6 +265,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(screenWidth),
@@ -290,6 +276,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
return Consumer<MihCalculatorProvider>(
builder: (context, calculatorProvider, child) {
return MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
@@ -301,12 +288,8 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
formKey: _formKey,
formFields: <Widget>[
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _fromAmountController,
multiLineInput: false,
requiredText: true,
@@ -346,9 +329,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
text: TextSpan(
style: TextStyle(
fontSize: 15,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
),
children: [
const TextSpan(
@@ -357,9 +338,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
text: "Diclaimer",
style: TextStyle(
decoration: TextDecoration.underline,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.bold,
),
recognizer: TapGestureRecognizer()
@@ -390,18 +369,12 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Calculate",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -411,18 +384,12 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
onPressed: () {
clearInput();
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Clear",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -1,10 +1,7 @@
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:flutter/material.dart';
import 'package:math_expressions/math_expressions.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class SimpleCalc extends StatefulWidget {
const SimpleCalc({super.key});
@@ -73,6 +70,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(),
@@ -94,6 +92,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
}
}
return MihSingleChildScroll(
scrollbarOn: true,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
@@ -108,8 +107,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
userInput,
style: TextStyle(
fontSize: 40,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
),
@@ -123,8 +121,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
answer,
style: TextStyle(
fontSize: 30,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.bold),
),
),
@@ -159,18 +156,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
answer = '0';
});
},
buttonColor: MihColors.getPurpleColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.purple(),
width: 50,
height: 50,
borderRadius: 5,
child: Text(
buttons[index],
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -189,18 +182,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
userInput += buttons[index];
});
},
buttonColor: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.grey(),
width: 50,
height: 50,
borderRadius: 5,
child: Text(
buttons[index],
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -218,18 +207,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
userInput += buttons[index];
});
},
buttonColor: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.grey(),
width: 50,
height: 50,
borderRadius: 5,
child: Text(
buttons[index],
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -258,18 +243,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
});
}
},
buttonColor: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.grey(),
width: 50,
height: 50,
borderRadius: 5,
child: Text(
buttons[index],
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -298,17 +279,13 @@ class _SimpleCalcState extends State<SimpleCalc> {
equalPressed();
});
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.red(),
width: 50,
height: 50,
borderRadius: 5,
child: Icon(
Icons.backspace,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
);
@@ -324,18 +301,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
userInput = answer;
});
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 50,
height: 50,
borderRadius: 5,
child: Text(
buttons[index],
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -354,18 +327,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
equalPressed();
});
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.secondary(),
width: 50,
height: 50,
borderRadius: 5,
child: Text(
buttons[index],
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -1,19 +1,14 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.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';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:math_expressions/math_expressions.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
import 'package:provider/provider.dart';
class TipCalc extends StatefulWidget {
@@ -108,8 +103,7 @@ class _TipCalcState extends State<TipCalc> {
children: [
FaIcon(
FontAwesomeIcons.coins,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
size: 35,
),
const SizedBox(width: 15),
@@ -119,8 +113,7 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
],
@@ -131,8 +124,7 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
const Divider(),
@@ -142,8 +134,7 @@ class _TipCalcState extends State<TipCalc> {
children: [
FaIcon(
FontAwesomeIcons.moneyBills,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
size: 35,
),
const SizedBox(width: 15),
@@ -153,8 +144,7 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
],
@@ -165,8 +155,7 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
Text(
@@ -175,8 +164,7 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
if (splitBillController.text == "Yes") const Divider(),
@@ -187,8 +175,7 @@ class _TipCalcState extends State<TipCalc> {
children: [
FaIcon(
FontAwesomeIcons.peopleGroup,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
size: 35,
),
const SizedBox(width: 15),
@@ -198,9 +185,7 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
@@ -212,8 +197,7 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
if (splitBillController.text == "Yes")
@@ -223,13 +207,16 @@ class _TipCalcState extends State<TipCalc> {
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
SizedBox(height: 10),
Consumer(builder: (context, bannerAdDisplay, child) {
return MihBannerAd();
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
return MihBannerAd();
} else {
return const SizedBox(height: 0);
}
}),
// if (splitBillController.text == "Yes") const Divider(),
],
@@ -251,6 +238,7 @@ class _TipCalcState extends State<TipCalc> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(screenWidth),
@@ -259,6 +247,7 @@ class _TipCalcState extends State<TipCalc> {
Widget getBody(double width) {
return MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding: MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
@@ -270,10 +259,8 @@ class _TipCalcState extends State<TipCalc> {
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: billAmountController,
multiLineInput: false,
requiredText: true,
@@ -285,10 +272,8 @@ class _TipCalcState extends State<TipCalc> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: tipPercentageController,
multiLineInput: false,
requiredText: true,
@@ -302,10 +287,8 @@ class _TipCalcState extends State<TipCalc> {
MihToggle(
hintText: "Split Bill",
initialPostion: splitPosition,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
secondaryFillColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
secondaryFillColor: MihColors.primary(),
onChange: (value) {
setState(() {
splitBillController.text = value ? "Yes" : "No";
@@ -342,12 +325,8 @@ class _TipCalcState extends State<TipCalc> {
children: [
MihNumericStepper(
controller: noPeopleController,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
hintText: "No. People",
requiredText: temp == "Yes",
minValue: 2,
@@ -398,16 +377,12 @@ class _TipCalcState extends State<TipCalc> {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Calculate",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -417,16 +392,12 @@ class _TipCalcState extends State<TipCalc> {
onPressed: () {
clearInput();
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Clear",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -1,12 +1,10 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_objects/access_request.dart';
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:supertokens_flutter/http.dart' as http;
@@ -103,30 +101,20 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
TextSpan accessWithColour;
if (access == "APPROVED") {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
text: "$access\n", style: TextStyle(color: MihColors.green()));
} else if (access == "PENDING") {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
text: "$access\n", style: TextStyle(color: MihColors.grey()));
} else {
accessWithColour = TextSpan(
text: "$access\n",
style: TextStyle(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark")));
accessWithColour =
TextSpan(text: "$access\n", style: TextStyle(color: MihColors.red()));
}
return ListTile(
title: Text(
line1,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
subtitle: RichText(
@@ -142,7 +130,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
// Text(
// subtitle,
// style: TextStyle(
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
// ),
onTap: () {
@@ -158,7 +146,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
},
// trailing: Icon(
// Icons.arrow_forward,
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
);
}
@@ -213,8 +201,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
subtitle,
textAlign: TextAlign.left,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: popUpBodySize,
//fontWeight: FontWeight.bold,
),
@@ -231,15 +218,12 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
onPressed: () {
updateAccessAPICall(index, "declined");
},
buttonColor: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Decline",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -249,15 +233,12 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
onPressed: () {
updateAccessAPICall(index, "approved");
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Approve",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -294,8 +275,7 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
);
},
itemCount: widget.accessRequests.length,

View File

@@ -1,20 +1,14 @@
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_objects/appointment.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -106,20 +100,16 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
int appointHour = int.parse(timePart.split(':')[0]);
Color appointmentColor = MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
Color appointmentColor = MihColors.secondary();
if (currentDate == datePart) {
if (appointHour < hourNow) {
appointmentColor = MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
appointmentColor = MihColors.grey();
} else if (appointHour == hourNow) {
appointmentColor = MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
appointmentColor = MihColors.green();
}
} else if (DateTime.parse(datePart).isBefore(DateTime.parse(currentDate))) {
appointmentColor = MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
appointmentColor = MihColors.grey();
}
return Container(
@@ -179,19 +169,15 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
SpeedDialChild(
child: Icon(
Icons.edit,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Edit Appointment",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
appointmentUpdateWindow(mzansiProfileProvider,
mihCalendarProvider, index, bodyWidth);
@@ -200,19 +186,15 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
SpeedDialChild(
child: Icon(
Icons.delete,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Delete Appointment",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
deleteAppointmentConfirmationWindow(
mzansiProfileProvider, mihCalendarProvider, index);
@@ -232,10 +214,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
children: [
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.titleController,
multiLineInput: false,
requiredText: true,
@@ -244,10 +224,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.dateController,
multiLineInput: false,
requiredText: true,
@@ -256,10 +234,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.timeController,
multiLineInput: false,
requiredText: true,
@@ -268,10 +244,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.descriptionIDController,
multiLineInput: true,
height: 250,
@@ -304,19 +278,15 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
SpeedDialChild(
child: Icon(
Icons.edit,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Edit Appointment",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
appointmentUpdateWindow(mzansiProfileProvider,
mihCalendarProvider, index, bodyWidth);
@@ -325,19 +295,15 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
SpeedDialChild(
child: Icon(
Icons.delete,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
),
label: "Delete Appointment",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
deleteAppointmentConfirmationWindow(
mzansiProfileProvider, mihCalendarProvider, index);
@@ -357,10 +323,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
children: [
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.titleController,
multiLineInput: false,
requiredText: true,
@@ -369,10 +333,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.dateController,
multiLineInput: false,
requiredText: true,
@@ -381,10 +343,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.timeController,
multiLineInput: false,
requiredText: true,
@@ -393,10 +353,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.descriptionIDController,
multiLineInput: true,
height: 250,
@@ -460,12 +418,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.titleController,
multiLineInput: false,
requiredText: true,
@@ -494,12 +448,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: widget.descriptionIDController,
multiLineInput: true,
height: 250,
@@ -527,18 +477,12 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Update",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -681,15 +625,13 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
clearControllers();
Navigator.of(context).pop();
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
import 'package:mzansi_innovation_hub/mih_objects/patient_queue.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
class BuildQueueList extends StatefulWidget {
@@ -43,8 +42,7 @@ class _BuildQueueListState extends State<BuildQueueList> {
title: Text(
title,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
subtitle: RichText(
@@ -85,8 +83,7 @@ class _BuildQueueListState extends State<BuildQueueList> {
shrinkWrap: true,
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
);
},
itemCount: widget.patientQueue.length,

View File

@@ -1,8 +1,5 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_packages/calendar/package_tools/appointments.dart';
@@ -59,11 +56,11 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
);
}
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: calendarProvider.toolIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: getToolTitle(),
selectedBodyIndex: calendarProvider.toolIndex,
onIndexChange: (newIndex) {
calendarProvider.setToolIndex(newIndex);
},
@@ -75,6 +72,7 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
MihPackageAction getAction() {
return MihPackageAction(
icon: const Icon(Icons.arrow_back),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.read<MihCalendarProvider>().resetSelectedDay();
@@ -94,7 +92,7 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
return MihPackageTools(
tools: temp,
selcetedIndex: context.watch<MihCalendarProvider>().toolIndex,
selectedIndex: context.watch<MihCalendarProvider>().toolIndex,
);
}

View File

@@ -1,9 +1,6 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MzansiCalendarTile extends StatefulWidget {
final double packageSize;
@@ -30,16 +27,14 @@ class _MzansiCalendarTileState extends State<MzansiCalendarTile> {
// arguments: widget.arguments,
// );
},
appName: "Calendar",
appIcon: Icon(
packageName: "Calendar",
packageIcon: Icon(
MihIcons.calendar,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
// size: widget.packageSize,
),
iconSize: widget.packageSize,
textColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
textColor: MihColors.secondary(),
);
}
}

View File

@@ -1,24 +1,14 @@
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_calendar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.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_mzansi_calendar_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart';
import 'package:mzansi_innovation_hub/mih_objects/appointment.dart';
import 'package:mzansi_innovation_hub/mih_packages/calendar/builder/build_appointment_list.dart';
import 'package:provider/provider.dart';
@@ -75,8 +65,7 @@ class _PatientAccessRequestState extends State<Appointments> {
Icon(
MihIcons.calendar,
size: 165,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
const SizedBox(height: 10),
Text(
@@ -86,9 +75,7 @@ class _PatientAccessRequestState extends State<Appointments> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
const SizedBox(height: 25),
@@ -99,9 +86,7 @@ class _PatientAccessRequestState extends State<Appointments> {
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.normal,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
children: [
TextSpan(text: "Press "),
@@ -110,9 +95,7 @@ class _PatientAccessRequestState extends State<Appointments> {
child: Icon(
Icons.menu,
size: 20,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
TextSpan(
@@ -155,12 +138,8 @@ class _PatientAccessRequestState extends State<Appointments> {
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _appointmentTitleController,
multiLineInput: false,
requiredText: true,
@@ -189,12 +168,8 @@ class _PatientAccessRequestState extends State<Appointments> {
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: _appointmentDescriptionIDController,
multiLineInput: true,
height: 250,
@@ -215,16 +190,12 @@ class _PatientAccessRequestState extends State<Appointments> {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Add",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -324,15 +295,13 @@ class _PatientAccessRequestState extends State<Appointments> {
_appointmentDescriptionIDController.clear();
});
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -383,7 +352,7 @@ class _PatientAccessRequestState extends State<Appointments> {
});
}),
// Divider(
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
displayAppointmentList(
mzansiProfileProvider,
@@ -401,21 +370,15 @@ class _PatientAccessRequestState extends State<Appointments> {
SpeedDialChild(
child: Icon(
Icons.add,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
label: "Add Appointment",
labelBackgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.green(),
onTap: () {
addAppointmentWindow(
mzansiProfileProvider, mihCalendarProvider, width);
@@ -477,6 +440,7 @@ class _PatientAccessRequestState extends State<Appointments> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(screenWidth),
);

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_forgot_password.dart';
class MihAuthForgotPassword extends StatefulWidget {
@@ -13,7 +11,7 @@ class MihAuthForgotPassword extends StatefulWidget {
}
class _MihAuthForgotPasswordState extends State<MihAuthForgotPassword> {
int _selcetedIndex = 0;
int _selectedIndex = 0;
late final MihForgotPassword _forgotPassword;
@override
@@ -25,14 +23,14 @@ class _MihAuthForgotPasswordState extends State<MihAuthForgotPassword> {
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appToolTitles: ["Forgot Password"],
appBody: getToolBody(),
selectedbodyIndex: _selcetedIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolTitles: ["Forgot Password"],
packageToolBodies: getToolBody(),
selectedBodyIndex: _selectedIndex,
onIndexChange: (newValue) {
setState(() {
_selcetedIndex = newValue;
_selectedIndex = newValue;
});
},
);
@@ -41,6 +39,7 @@ class _MihAuthForgotPasswordState extends State<MihAuthForgotPassword> {
MihPackageAction getAction() {
return MihPackageAction(
icon: const Icon(Icons.arrow_back),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.goNamed(
@@ -56,12 +55,12 @@ class _MihAuthForgotPasswordState extends State<MihAuthForgotPassword> {
Map<Widget, void Function()?> temp = {};
temp[const Icon(Icons.question_mark_rounded)] = () {
setState(() {
_selcetedIndex = 0;
_selectedIndex = 0;
});
};
return MihPackageTools(
tools: temp,
selcetedIndex: _selcetedIndex,
selectedIndex: _selectedIndex,
);
}

View File

@@ -1,9 +1,6 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_reset_password.dart';
class MihAuthPasswordReset extends StatefulWidget {
@@ -18,7 +15,7 @@ class MihAuthPasswordReset extends StatefulWidget {
}
class _MihAuthPasswordResetState extends State<MihAuthPasswordReset> {
int _selcetedIndex = 0;
int _selectedIndex = 0;
late final MihResetPassword _resetPassword;
@override
@@ -30,14 +27,14 @@ class _MihAuthPasswordResetState extends State<MihAuthPasswordReset> {
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: ["Reset Password"],
selectedbodyIndex: _selcetedIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: ["Reset Password"],
selectedBodyIndex: _selectedIndex,
onIndexChange: (newValue) {
setState(() {
_selcetedIndex = newValue;
_selectedIndex = newValue;
});
},
);
@@ -48,6 +45,7 @@ class _MihAuthPasswordResetState extends State<MihAuthPasswordReset> {
padding: const EdgeInsets.only(left: 5.0),
child: MihPackageAction(
icon: const Icon(MihIcons.mihLogo),
iconColor: MihColors.secondary(),
iconSize: 45,
onTap: () {
context.goNamed(
@@ -64,12 +62,12 @@ class _MihAuthPasswordResetState extends State<MihAuthPasswordReset> {
Map<Widget, void Function()?> temp = {};
temp[const Icon(Icons.password_rounded)] = () {
setState(() {
_selcetedIndex = 0;
_selectedIndex = 0;
});
};
return MihPackageTools(
tools: temp,
selcetedIndex: _selcetedIndex,
selectedIndex: _selectedIndex,
);
}

View File

@@ -1,9 +1,6 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_register.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/package_tools/mih_sign_in.dart';
@@ -30,11 +27,11 @@ class _MihAuthenticationState extends State<MihAuthentication> {
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: context.watch<MihAuthenticationProvider>().toolIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: getToolTitle(),
selectedBodyIndex: context.watch<MihAuthenticationProvider>().toolIndex,
onIndexChange: (newIndex) {
context.read<MihAuthenticationProvider>().setToolIndex(newIndex);
},
@@ -66,7 +63,7 @@ class _MihAuthenticationState extends State<MihAuthentication> {
};
return MihPackageTools(
tools: temp,
selcetedIndex: context.watch<MihAuthenticationProvider>().toolIndex,
selectedIndex: context.watch<MihAuthenticationProvider>().toolIndex,
);
}
@@ -75,6 +72,7 @@ class _MihAuthenticationState extends State<MihAuthentication> {
padding: const EdgeInsets.only(left: 5.0),
child: MihPackageAction(
icon: const Icon(MihIcons.mihLogo),
iconColor: MihColors.secondary(),
iconSize: 45,
onTap: () {
context.goNamed("aboutMih", extra: true);

View File

@@ -1,13 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.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_authentication_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
@@ -60,14 +55,12 @@ class _MihForgotPasswordState extends State<MihForgotPassword> {
context.pop();
validateInput();
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
width: 300,
child: Text(
"Continue",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -90,14 +83,12 @@ class _MihForgotPasswordState extends State<MihForgotPassword> {
extra: true,
);
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -124,6 +115,7 @@ class _MihForgotPasswordState extends State<MihForgotPassword> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(screenWidth),
);
@@ -139,89 +131,77 @@ class _MihForgotPasswordState extends State<MihForgotPassword> {
validateInput();
}
},
child: SafeArea(
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Padding(
padding: MzansiInnovationHub.of(context)!.theme.screenType ==
"desktop"
? EdgeInsets.symmetric(vertical: 25, horizontal: width * 0.2)
: EdgeInsets.symmetric(vertical: 25, horizontal: width * 0.075),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
//logo
Icon(
Icons.lock,
size: 100,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
child: MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding: MzansiInnovationHub.of(context)!.theme.screenType ==
"desktop"
? EdgeInsets.symmetric(vertical: 25, horizontal: width * 0.2)
: EdgeInsets.symmetric(vertical: 25, horizontal: width * 0.075),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
//logo
Icon(
Icons.lock,
size: 100,
color: MihColors.secondary(),
),
//spacer
const SizedBox(height: 10),
//Heading
Text(
'Forgot Password',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
),
//spacer
const SizedBox(height: 10),
//Heading
Text(
'Forgot Password',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
),
const SizedBox(height: 25),
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: emailController,
multiLineInput: false,
requiredText: true,
hintText: "Email",
validator: (value) {
return MihValidationServices().validateEmail(value);
},
),
),
const SizedBox(height: 25),
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
controller: emailController,
multiLineInput: false,
requiredText: true,
hintText: "Email",
validator: (value) {
return MihValidationServices().validateEmail(value);
//spacer
const SizedBox(height: 20),
Align(
alignment: Alignment.center,
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
prePassResteWarning();
} else {
MihAlertServices().inputErrorAlert(context);
}
},
),
//spacer
const SizedBox(height: 20),
Align(
alignment: Alignment.center,
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
prePassResteWarning();
} else {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 300,
child: Text(
"Reset Password",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Reset Password",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
],
),
),
],
),
],
),
),
),

View File

@@ -2,16 +2,11 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart';
@@ -107,7 +102,7 @@ class _MihRegisterState extends State<MihRegister> {
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
"Authorization": "leatucczyixqwkqqdrhayiwzeofkltds"
"Authorization": dotenv.env['SUPERTOKENS_API_KEY'] ?? "",
},
);
//print("response 2: ${response2.statusCode}");
@@ -162,14 +157,12 @@ class _MihRegisterState extends State<MihRegister> {
onPressed: () {
Navigator.of(context).pop();
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.secondary(),
width: 200,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 18,
fontWeight: FontWeight.bold,
),
@@ -184,6 +177,7 @@ class _MihRegisterState extends State<MihRegister> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(screenWidth),
);
@@ -204,6 +198,7 @@ class _MihRegisterState extends State<MihRegister> {
}
},
child: MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
@@ -216,8 +211,7 @@ class _MihRegisterState extends State<MihRegister> {
Icon(
Icons.lock,
size: 100,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
//spacer
const SizedBox(height: 10),
@@ -227,8 +221,7 @@ class _MihRegisterState extends State<MihRegister> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
//spacer
@@ -238,10 +231,8 @@ class _MihRegisterState extends State<MihRegister> {
formFields: [
//email input
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: emailController,
multiLineInput: false,
requiredText: true,
@@ -255,10 +246,8 @@ class _MihRegisterState extends State<MihRegister> {
const SizedBox(height: 10),
//password input
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: passwordController,
multiLineInput: false,
requiredText: true,
@@ -272,10 +261,8 @@ class _MihRegisterState extends State<MihRegister> {
//spacer
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: confirmPasswordController,
multiLineInput: false,
requiredText: true,
@@ -304,16 +291,12 @@ class _MihRegisterState extends State<MihRegister> {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Create New Account",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -325,16 +308,12 @@ class _MihRegisterState extends State<MihRegister> {
.read<MihAuthenticationProvider>()
.setToolIndex(0);
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.secondary(),
width: 300,
child: Text(
"I have an account",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -1,13 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.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_authentication_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
@@ -62,15 +57,13 @@ class _MihResetPasswordState extends State<MihResetPassword> {
extra: true,
);
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.primary(),
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -85,6 +78,7 @@ class _MihResetPasswordState extends State<MihResetPassword> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(screenWidth),
);
@@ -104,110 +98,94 @@ class _MihResetPasswordState extends State<MihResetPassword> {
}
}
},
child: SafeArea(
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
: EdgeInsets.symmetric(horizontal: width * 0.075),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// Text("Token: ${widget.token}"), // For testing purposes only
//logo
Icon(
Icons.lock,
size: 100,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
child: MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
: EdgeInsets.symmetric(horizontal: width * 0.075),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// Text("Token: ${widget.token}"), // For testing purposes only
//logo
Icon(
Icons.lock,
size: 100,
color: MihColors.secondary(),
),
//spacer
const SizedBox(height: 10),
//Heading
Text(
'Reset Password',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.secondary(),
),
//spacer
const SizedBox(height: 10),
//Heading
Text(
'Reset Password',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
),
//spacer
const SizedBox(height: 25),
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: passwordController,
multiLineInput: false,
requiredText: true,
hintText: "Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices().validatePassword(value);
},
),
),
//spacer
const SizedBox(height: 25),
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
controller: passwordController,
multiLineInput: false,
requiredText: true,
hintText: "Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices().validatePassword(value);
//spacer
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: confirmPasswordController,
multiLineInput: false,
requiredText: true,
hintText: "Confirm Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices().validatePassword(value);
},
),
//spacer
const SizedBox(height: 25),
// sign in button
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitFormInput();
} else {
MihAlertServices().inputErrorAlert(context);
}
},
),
//spacer
const SizedBox(height: 10),
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
controller: confirmPasswordController,
multiLineInput: false,
requiredText: true,
hintText: "Confirm Password",
passwordMode: true,
autofillHints: const [AutofillHints.password],
validator: (value) {
return MihValidationServices().validatePassword(value);
},
),
//spacer
const SizedBox(height: 25),
// sign in button
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitFormInput();
} else {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 300,
child: Text(
"Reset Password",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Reset Password",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
],
),
),
],
),
],
),
),
),

View File

@@ -1,16 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_authentication_services.dart';
@@ -80,15 +74,15 @@ class _MihSignInState extends State<MihSignIn> {
MihAlertServices().inputErrorAlert(context);
}
},
appName: "Patient",
appIcon: Icon(
packageName: "Patient",
packageIcon: Icon(
Icons.perm_identity_rounded,
color: getPrim(),
size: 200,
),
iconSize: 200,
textColor: getPrim(),
authenticateUser: false,
// authenticateUser: false,
));
tileList.add(MihPackageTile(
onTap: () {
@@ -102,15 +96,15 @@ class _MihSignInState extends State<MihSignIn> {
MihAlertServices().inputErrorAlert(context);
}
},
appName: "Doctor",
appIcon: Icon(
packageName: "Doctor",
packageIcon: Icon(
Icons.medical_services,
color: getPrim(),
size: 200,
),
iconSize: 200,
textColor: getPrim(),
authenticateUser: false,
// authenticateUser: false,
));
//if (AppEnviroment.getEnv() == "Dev") {
tileList.add(MihPackageTile(
@@ -125,15 +119,15 @@ class _MihSignInState extends State<MihSignIn> {
MihAlertServices().inputErrorAlert(context);
}
},
appName: "Business",
appIcon: Icon(
packageName: "Business",
packageIcon: Icon(
Icons.business,
color: getPrim(),
size: 200,
),
iconSize: 200,
textColor: getPrim(),
authenticateUser: false,
// authenticateUser: false,
));
tileList.add(MihPackageTile(
onTap: () {
@@ -147,27 +141,25 @@ class _MihSignInState extends State<MihSignIn> {
MihAlertServices().inputErrorAlert(context);
}
},
appName: "Test",
appIcon: Icon(
packageName: "Test",
packageIcon: Icon(
Icons.warning_amber_rounded,
color: getPrim(),
size: 200,
),
iconSize: 200,
textColor: getPrim(),
authenticateUser: false,
// authenticateUser: false,
));
//}
}
Color getPrim() {
return MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.secondary();
}
Color getSec() {
return MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.primary();
}
@override
@@ -182,6 +174,7 @@ class _MihSignInState extends State<MihSignIn> {
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(screenWidth),
);
@@ -202,6 +195,7 @@ class _MihSignInState extends State<MihSignIn> {
}
},
child: MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
@@ -227,16 +221,12 @@ class _MihSignInState extends State<MihSignIn> {
onPressed: () {
MihInstallServices().installMihTrigger(context);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 150,
child: Text(
"Install MIH",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -250,8 +240,7 @@ class _MihSignInState extends State<MihSignIn> {
Icon(
Icons.lock,
size: 100,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
//spacer
const SizedBox(height: 10),
@@ -261,8 +250,7 @@ class _MihSignInState extends State<MihSignIn> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
),
//spacer
@@ -271,12 +259,8 @@ class _MihSignInState extends State<MihSignIn> {
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: emailController,
multiLineInput: false,
requiredText: true,
@@ -290,12 +274,8 @@ class _MihSignInState extends State<MihSignIn> {
const SizedBox(height: 10),
//password input
MihTextFormField(
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
inputColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
controller: passwordController,
multiLineInput: false,
requiredText: true,
@@ -327,11 +307,7 @@ class _MihSignInState extends State<MihSignIn> {
'Forgot Password?',
style: TextStyle(
fontSize: 15,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
fontWeight: FontWeight.bold,
),
),
@@ -358,18 +334,12 @@ class _MihSignInState extends State<MihSignIn> {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Sign In",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -381,18 +351,12 @@ class _MihSignInState extends State<MihSignIn> {
.read<MihAuthenticationProvider>()
.setToolIndex(1);
},
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.secondary(),
width: 300,
child: Text(
"Create New Account",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -429,11 +393,7 @@ class _MihSignInState extends State<MihSignIn> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark")),
color: MihColors.secondary()),
),
onTap: () {
setState(() {
@@ -480,11 +440,7 @@ class _MihSignInState extends State<MihSignIn> {
"NB: These accounts are used for test purposes. Please do not store personal information on these profiles.",
textAlign: TextAlign.center,
style: TextStyle(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.red(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),

View File

@@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:pdf/pdf.dart';
import 'package:printing/printing.dart';
import '../../../mih_package_components/mih_loading_circle.dart';
class MIHPrintPreview extends StatefulWidget {
final PrintPreviewArguments arguments;
@@ -22,6 +21,7 @@ class _MIHPrintPreviewState extends State<MIHPrintPreview> {
icon: const Icon(
Icons.close,
),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
Navigator.pop(context);

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/package_tools/mih_expanded_file_view.dart';
import 'package:provider/provider.dart';
@@ -21,11 +19,11 @@ class _MihFleViewerState extends State<MihFleViewer> {
builder: (BuildContext context, MihFileViewerProvider fileViewerProvider,
Widget? child) {
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: fileViewerProvider.toolIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolBodies: getToolBody(),
packageToolTitles: getToolTitle(),
selectedBodyIndex: fileViewerProvider.toolIndex,
onIndexChange: (newIndex) {
fileViewerProvider.setToolIndex(newIndex);
},
@@ -37,6 +35,7 @@ class _MihFleViewerState extends State<MihFleViewer> {
MihPackageAction getAction() {
return MihPackageAction(
icon: const Icon(Icons.fullscreen_exit),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.pop();
@@ -59,7 +58,7 @@ class _MihFleViewerState extends State<MihFleViewer> {
};
return MihPackageTools(
tools: temp,
selcetedIndex: context.watch<MihFileViewerProvider>().toolIndex,
selectedIndex: context.watch<MihFileViewerProvider>().toolIndex,
);
}

View File

@@ -2,11 +2,8 @@ import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_file_viewer_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:provider/provider.dart';
import 'package:syncfusion_flutter_core/theme.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
@@ -56,6 +53,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
double width = size.width;
double height = size.height;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(width, height),
);
@@ -75,9 +73,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
height: height - 70,
child: SfPdfViewerTheme(
data: SfPdfViewerThemeData(
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
backgroundColor: MihColors.primary(),
),
child: SfPdfViewer.network(
fileViewerProvider.fileLink,
@@ -111,8 +107,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
child: Material(
elevation: 10,
shadowColor: Colors.black,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
borderRadius: BorderRadius.circular(25.0),
child: Container(
decoration: BoxDecoration(
@@ -138,9 +133,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
},
icon: Icon(
Icons.arrow_back,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
if (isPDF)
@@ -149,9 +142,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
if (isPDF)
@@ -169,9 +160,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
},
icon: Icon(
Icons.arrow_forward,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
if (isPDF)
@@ -194,9 +183,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
},
icon: Icon(
Icons.zoom_in,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
if (isPDF)
@@ -221,9 +208,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
},
icon: Icon(
Icons.zoom_out,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
// IconButton(
@@ -234,7 +219,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
// },
// icon: Icon(
// Icons.print,
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.secondary(),
// ),
// ),
IconButton(
@@ -252,9 +237,7 @@ class _MihExpandedFileViewState extends State<MihExpandedFileView> {
},
icon: Icon(
Icons.download,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
],

View File

@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_providers/about_mih_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_access_controlls_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_authentication_provider.dart';
@@ -14,9 +14,7 @@ import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.da
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:provider/provider.dart';
import '../../../main.dart';
import 'package:supertokens_flutter/supertokens.dart';
class MIHAppDrawer extends StatefulWidget {
@@ -78,14 +76,13 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
? mzansiProfileProvider.userProfilePicture
: mzansiProfileProvider.businessProfilePicture,
width: 60,
expandable: false,
editable: false,
fileNameController: proPicController,
onChange: (_) {},
userSelectedfile: null,
frameColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
),
);
}
@@ -110,7 +107,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
MzansiProfileProvider mzansiProfileProvider, Widget? child) {
return SafeArea(
child: Drawer(
//backgroundColor: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
//backgroundColor: MihColors.primary(),
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Stack(
@@ -123,9 +120,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
children: [
DrawerHeader(
decoration: BoxDecoration(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
child: SizedBox(
// height: 300,
@@ -142,11 +137,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
"Setup Business",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
),
),
),
@@ -156,11 +147,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
"${mzansiProfileProvider.user!.fname} ${mzansiProfileProvider.user!.lname}",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
),
),
),
@@ -171,11 +158,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
),
),
),
@@ -186,11 +169,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
),
),
),
@@ -200,11 +179,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.primary(),
),
),
],
@@ -218,7 +193,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
// Icon(
// Icons.home_outlined,
// color:
// MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// MihColors.secondary(),
// ),
// const SizedBox(width: 25.0),
// Text(
@@ -248,22 +223,14 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
children: [
Icon(
Icons.policy,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
),
const SizedBox(width: 25.0),
Text(
"Privacy Policy",
style: TextStyle(
//fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
@@ -287,22 +254,14 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
children: [
Icon(
Icons.design_services_rounded,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
),
const SizedBox(width: 25.0),
Text(
"Terms of Service",
style: TextStyle(
//fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
@@ -326,22 +285,14 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
children: [
Icon(
Icons.logout,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
),
const SizedBox(width: 25.0),
Text(
"Sign Out",
style: TextStyle(
//fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],
@@ -394,9 +345,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
},
child: Icon(
MihIcons.mihLogo,
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
),
),
// IconButton(
@@ -416,7 +365,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
// },
// icon: Icon(
// Icons.light_mode,
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
// color: MihColors.primary(),
// size: 35,
// ),
// ),

View File

@@ -1,18 +1,10 @@
import 'package:go_router/go_router.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/user_consent.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_scack_bar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mzansi_innovation_hub/mih_providers/about_mih_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_packages/mih_home/components/mih_app_drawer.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';
@@ -143,18 +135,14 @@ class _MihHomeState extends State<MihHome> {
Icon(
Icons.policy,
size: 150,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
),
color: MihColors.secondary(),
),
const SizedBox(height: 10),
Text(
"Welcome to the MIH App",
textAlign: TextAlign.center,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
),
color: MihColors.secondary(),
fontSize: 30,
fontWeight: FontWeight.bold,
),
@@ -164,9 +152,7 @@ class _MihHomeState extends State<MihHome> {
"To keep using the MIH app, please take a moment to review and accept our Policies. Our agreements helps us keep things running smoothly and securely.",
textAlign: TextAlign.center,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
),
color: MihColors.secondary(),
fontSize: 18,
fontWeight: FontWeight.normal,
),
@@ -189,17 +175,13 @@ class _MihHomeState extends State<MihHome> {
context.goNamed("aboutMih",
extra: mzansiProfileProvider.personalHome);
},
buttonColor: MihColors.getOrangeColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.orange(),
elevation: 10,
width: 300,
child: Text(
"Privacy Policy",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -214,17 +196,13 @@ class _MihHomeState extends State<MihHome> {
context.goNamed("aboutMih",
extra: mzansiProfileProvider.personalHome);
},
buttonColor: MihColors.getYellowColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.yellow(),
elevation: 10,
width: 300,
child: Text(
"Terms of Service",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -236,17 +214,13 @@ class _MihHomeState extends State<MihHome> {
KenLogger.success("Date Time Now: $now");
createOrUpdateAccpetance(mzansiProfileProvider);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
elevation: 10,
width: 300,
child: Text(
"Accept",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -308,13 +282,13 @@ class _MihHomeState extends State<MihHome> {
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: MihPackage(
appActionButton: getAction(),
appTools: getTools(mzansiProfileProvider,
packageActionButton: getAction(),
packageTools: getTools(mzansiProfileProvider,
mzansiProfileProvider.user!.type != "personal"),
appBody: getToolBody(mzansiProfileProvider),
appToolTitles: getToolTitle(),
packageToolBodies: getToolBody(mzansiProfileProvider),
packageToolTitles: getToolTitle(),
actionDrawer: getActionDrawer(),
selectedbodyIndex:
selectedBodyIndex:
mzansiProfileProvider.personalHome ? 0 : 1,
onIndexChange: (newValue) {
mzansiProfileProvider.setPersonalHome(newValue == 0);
@@ -347,20 +321,20 @@ class _MihHomeState extends State<MihHome> {
'business_${mzansiProfileProvider.businessProfilePicUrl}';
}
return MihPackageAction(
iconColor: MihColors.secondary(),
icon: Padding(
padding: const EdgeInsets.only(left: 5.0),
child: MihCircleAvatar(
key: Key(imageKey),
imageFile: currentImage,
width: 50,
expandable: false,
editable: false,
fileNameController: null,
userSelectedfile: null,
// frameColor: frameColor,
frameColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
frameColor: MihColors.secondary(),
backgroundColor: MihColors.primary(),
onChange: (_) {},
),
),
@@ -394,7 +368,7 @@ class _MihHomeState extends State<MihHome> {
}
return MihPackageTools(
tools: temp,
selcetedIndex: mzansiProfileProvider.personalHome ? 0 : 1,
selectedIndex: mzansiProfileProvider.personalHome ? 0 : 1,
);
}

View File

@@ -1,12 +1,6 @@
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_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
class MihHomeError extends StatefulWidget {
final String errorMessage;
@@ -20,21 +14,21 @@ class MihHomeError extends StatefulWidget {
}
class _MihHomeErrorState extends State<MihHomeError> {
int _selcetedIndex = 0;
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getErrorAction(),
appTools: getErrorTools(),
appToolTitles: ["Connection Error"],
appBody: getErrorToolBody(widget.errorMessage),
selectedbodyIndex: _selcetedIndex,
packageActionButton: getErrorAction(),
packageTools: getErrorTools(),
packageToolTitles: ["Connection Error"],
packageToolBodies: getErrorToolBody(widget.errorMessage),
selectedBodyIndex: _selectedIndex,
onIndexChange: (newValue) {
setState(() {
_selcetedIndex = newValue;
_selectedIndex = newValue;
});
//print("Index: $_selcetedIndex");
//print("Index: $_selectedIndex");
},
);
}
@@ -42,6 +36,7 @@ class _MihHomeErrorState extends State<MihHomeError> {
MihPackageAction getErrorAction() {
return MihPackageAction(
icon: const Icon(Icons.refresh),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.goNamed(
@@ -56,18 +51,19 @@ class _MihHomeErrorState extends State<MihHomeError> {
Map<Widget, void Function()?> temp = {};
temp[const Icon(Icons.power_off_outlined)] = () {
setState(() {
_selcetedIndex = 0;
_selectedIndex = 0;
});
};
return MihPackageTools(
tools: temp,
selcetedIndex: _selcetedIndex,
selectedIndex: _selectedIndex,
);
}
List<Widget> getErrorToolBody(String error) {
List<Widget> toolBodies = [
MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: true,
bodyItem: Column(
mainAxisAlignment: MainAxisAlignment.start,
@@ -76,8 +72,7 @@ class _MihHomeErrorState extends State<MihHomeError> {
"Connection Error",
textAlign: TextAlign.center,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 35,
fontWeight: FontWeight.bold,
),
@@ -85,8 +80,7 @@ class _MihHomeErrorState extends State<MihHomeError> {
Icon(
Icons.power_off_outlined,
size: 150,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
SizedBox(
width: 500,
@@ -94,8 +88,7 @@ class _MihHomeErrorState extends State<MihHomeError> {
"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"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -109,14 +102,12 @@ class _MihHomeErrorState extends State<MihHomeError> {
extra: true,
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Refresh",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -132,9 +123,7 @@ class _MihHomeErrorState extends State<MihHomeError> {
"Error: $error",
textAlign: TextAlign.left,
style: TextStyle(
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.red(),
fontSize: 15,
fontWeight: FontWeight.bold,
),

View File

@@ -1,13 +1,6 @@
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_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
class MihRouteError extends StatefulWidget {
const MihRouteError({
@@ -19,21 +12,21 @@ class MihRouteError extends StatefulWidget {
}
class _MihRouteErrorState extends State<MihRouteError> {
int _selcetedIndex = 0;
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getErrorAction(),
appTools: getErrorTools(),
appToolTitles: ["Invalid Path"],
appBody: getErrorToolBody(),
selectedbodyIndex: _selcetedIndex,
packageActionButton: getErrorAction(),
packageTools: getErrorTools(),
packageToolTitles: ["Invalid Path"],
packageToolBodies: getErrorToolBody(),
selectedBodyIndex: _selectedIndex,
onIndexChange: (newValue) {
setState(() {
_selcetedIndex = newValue;
_selectedIndex = newValue;
});
//print("Index: $_selcetedIndex");
//print("Index: $_selectedIndex");
},
);
}
@@ -41,6 +34,7 @@ class _MihRouteErrorState extends State<MihRouteError> {
MihPackageAction getErrorAction() {
return MihPackageAction(
icon: const Icon(MihIcons.mihLogo),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
context.goNamed(
@@ -55,18 +49,19 @@ class _MihRouteErrorState extends State<MihRouteError> {
Map<Widget, void Function()?> temp = {};
temp[const Icon(Icons.link_off_rounded)] = () {
setState(() {
_selcetedIndex = 0;
_selectedIndex = 0;
});
};
return MihPackageTools(
tools: temp,
selcetedIndex: _selcetedIndex,
selectedIndex: _selectedIndex,
);
}
List<Widget> getErrorToolBody() {
List<Widget> toolBodies = [
MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: true,
bodyItem: Column(
mainAxisAlignment: MainAxisAlignment.start,
@@ -75,8 +70,7 @@ class _MihRouteErrorState extends State<MihRouteError> {
"Oops! Wrong Turn.",
textAlign: TextAlign.center,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
fontSize: 35,
fontWeight: FontWeight.bold,
),
@@ -84,8 +78,7 @@ class _MihRouteErrorState extends State<MihRouteError> {
Icon(
Icons.link_off_rounded,
size: 150,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
SizedBox(
width: 700,
@@ -93,8 +86,7 @@ class _MihRouteErrorState extends State<MihRouteError> {
"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"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.w500,
),
@@ -108,14 +100,12 @@ class _MihRouteErrorState extends State<MihRouteError> {
extra: true,
);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Back to MIH",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -131,7 +121,7 @@ class _MihRouteErrorState extends State<MihRouteError> {
// "Error: $error",
// textAlign: TextAlign.left,
// style: TextStyle(
// color: MihColors.getRedColor(
// color: MihColors.red(
// MzansiInnovationHub.of(context)!.theme.mode ==
// "Dark"),
// fontSize: 15,

View File

@@ -1,12 +1,9 @@
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart';
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tile/about_mih_tile.dart';
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tiles/mih_calculator_tile.dart';
import 'package:mzansi_innovation_hub/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart';
@@ -191,6 +188,7 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
final double width = size.width;
final double height = size.height;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(width, height),
);
@@ -213,10 +211,8 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
hintText: "Ask Mzansi",
prefixIcon: Icons.search,
prefixAltIcon: MihIcons.mzansiAi,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
hintColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
hintColor: MihColors.primary(),
onPrefixIconTap: () {
mzansiAiProvider.ollamaProvider.resetChat();
if (searchController.text.isNotEmpty) {
@@ -262,9 +258,7 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
Icon(
MihIcons.mzansiAi,
size: 165,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
const SizedBox(height: 10),
Text(
@@ -274,9 +268,7 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],

View File

@@ -1,12 +1,9 @@
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tiles/test_package_tile.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_packages/about_mih/package_tile/about_mih_tile.dart';
import 'package:mzansi_innovation_hub/mih_packages/access_review/package_tile/mih_access_tile.dart';
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tiles/mih_calculator_tile.dart';
@@ -213,6 +210,7 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
final double height = size.height;
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
borderOn: false,
bodyItem: getBody(width, height),
);
@@ -233,10 +231,8 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
hintText: "Ask Mzansi",
prefixIcon: Icons.search,
prefixAltIcon: MihIcons.mzansiAi,
fillColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
hintColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fillColor: MihColors.secondary(),
hintColor: MihColors.primary(),
onPrefixIconTap: () {
mzansiAiProvider.ollamaProvider.resetChat();
if (searchController.text.isNotEmpty) {
@@ -282,9 +278,7 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
Icon(
MihIcons.mzansiAi,
size: 165,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
const SizedBox(height: 10),
Text(
@@ -294,9 +288,7 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
),
),
],

View File

@@ -1,11 +1,9 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:provider/provider.dart';
class BuildMinesweeperLeaderboardList extends StatefulWidget {
@@ -21,17 +19,13 @@ class _BuildMinesweeperLeaderboardListState
Color getMedalColor(int index) {
switch (index) {
case (0):
return MihColors.getGoldColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.gold();
case (1):
return MihColors.getSilverColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.silver();
case (2):
return MihColors.getBronze(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.bronze();
default:
return MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.secondary();
}
}
@@ -44,8 +38,7 @@ class _BuildMinesweeperLeaderboardListState
return ListView.separated(
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
);
},
itemCount: mineSweeperProvider.leaderboard!.length,
@@ -84,35 +77,24 @@ class _BuildMinesweeperLeaderboardListState
? Icon(
MihIcons.mihRing,
size: 80,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
)
: imageFile == null
? Icon(
MihIcons.iDontKnow,
size: 80,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
color: MihColors.secondary(),
)
: MihCircleAvatar(
key: UniqueKey(),
imageFile: imageFile,
width: 80,
expandable: true,
editable: false,
fileNameController: null,
userSelectedfile: null,
frameColor: getMedalColor(index),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"),
backgroundColor: MihColors.primary(),
onChange: () {},
),
const SizedBox(width: 10),

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:provider/provider.dart';
class BuildMyScoreBoardList extends StatefulWidget {
@@ -18,17 +17,13 @@ class _BuildMinesweeperLeaderboardListState
Color getMedalColor(int index) {
switch (index) {
case (0):
return MihColors.getGoldColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.gold();
case (1):
return MihColors.getSilverColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.silver();
case (2):
return MihColors.getBronze(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.bronze();
default:
return MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
return MihColors.secondary();
}
}
@@ -41,8 +36,7 @@ class _BuildMinesweeperLeaderboardListState
return ListView.separated(
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
);
},
itemCount: mineSweeperProvider.myScoreboard!.length,

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:redacted/redacted.dart';
class LeaderboardUserRanking extends StatelessWidget {
@@ -50,13 +49,12 @@ class LeaderboardUserRanking extends StatelessWidget {
.toString()), // Use ValueKey for stable identity
imageFile: asyncSnapshot.data,
width: 60,
expandable: true,
editable: false,
fileNameController: null,
userSelectedfile: null,
frameColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
frameColor: MihColors.secondary(),
backgroundColor: MihColors.primary(),
onChange: () {},
),
],
@@ -66,16 +64,14 @@ class LeaderboardUserRanking extends StatelessWidget {
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
).redacted(context: context, redact: isLoading),
subtitle: Text(
"Score: $gameScore\nTime: $gameTime",
style: TextStyle(
fontSize: 18,
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
color: MihColors.secondary(),
),
).redacted(context: context, redact: isLoading),
);

View File

@@ -1,12 +1,7 @@
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_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:provider/provider.dart';
class MihMineSweeperStartGameWindow extends StatefulWidget {
@@ -132,9 +127,7 @@ class _MihMineSweeperStartGameWindowState
Text(
getModeConfig(),
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -147,16 +140,12 @@ class _MihMineSweeperStartGameWindowState
context.pop();
widget.onPressed?.call();
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Start Game",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/components/board_square.dart';
class MineTile extends StatelessWidget {
@@ -21,9 +19,7 @@ class MineTile extends StatelessWidget {
if (square.isFlagged) {
return Icon(
Icons.flag,
color: MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark",
),
color: MihColors.red(),
);
}
@@ -56,33 +52,23 @@ class MineTile extends StatelessWidget {
// Choose colors based on standard Minesweeper appearance
switch (bombsAround) {
case 1:
return MihColors.getBluishPurpleColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark",
);
return MihColors.bluishPurple();
// return Colors.blue;
case 2:
return MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark",
);
return MihColors.green();
// return Colors.green;
case 3:
return MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark",
);
return MihColors.red();
// return Colors.red;
case 4:
return MihColors.getPurpleColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark",
);
return MihColors.purple();
// return Colors.purple;
case 5:
return MihColors.getOrangeColor(
MzansiInnovationHub.of(context)!.theme.mode != "Dark",
);
return MihColors.orange();
// return Colors.brown;
default:
// return MihColors.getBluishPurpleColor(
// MzansiInnovationHub.of(context)!.theme.mode == "Dark",
// return MihColors.bluishPurple(
// ,
// );
return Colors.black;
}
@@ -95,13 +81,7 @@ class MineTile extends StatelessWidget {
child: MihButton(
onPressed: onTap,
onLongPressed: onLongPress,
buttonColor: square.isOpened
? MihColors.getGreyColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
)
: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark",
),
buttonColor: square.isOpened ? MihColors.grey() : MihColors.secondary(),
width: 50,
height: 50,
borderRadius: 3,

View File

@@ -1,10 +1,7 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_banner_ad_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_mine_sweeper_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
@@ -70,11 +67,11 @@ class _MihMineSweeperState extends State<MihMineSweeper> {
);
}
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appToolTitles: getToolTitle(),
appBody: getToolBody(),
selectedbodyIndex: context.watch<MihMineSweeperProvider>().toolIndex,
packageActionButton: getAction(),
packageTools: getTools(),
packageToolTitles: getToolTitle(),
packageToolBodies: getToolBody(),
selectedBodyIndex: context.watch<MihMineSweeperProvider>().toolIndex,
onIndexChange: (newIndex) {
context.read<MihMineSweeperProvider>().setToolIndex(newIndex);
},
@@ -86,6 +83,7 @@ class _MihMineSweeperState extends State<MihMineSweeper> {
MihPackageAction getAction() {
return MihPackageAction(
icon: const Icon(Icons.arrow_back),
iconColor: MihColors.secondary(),
iconSize: 35,
onTap: () {
MihMineSweeperProvider mineSweeperProvider =
@@ -116,7 +114,7 @@ class _MihMineSweeperState extends State<MihMineSweeper> {
};
return MihPackageTools(
tools: temp,
selcetedIndex: context.watch<MihMineSweeperProvider>().toolIndex,
selectedIndex: context.watch<MihMineSweeperProvider>().toolIndex,
);
}

Some files were not shown because too many files have changed in this diff Show More