58 Commits

Author SHA1 Message Date
26d3638d80 remove image url print 2026-04-16 10:00:53 +02:00
6c591172df update android skd to 36 2026-04-16 10:00:21 +02:00
0a5c4a3d20 Get all user and business data on any ackage load 2026-04-15 12:47:01 +02:00
c0077e532c Mzansi Wallet 2.0 update 2026-04-15 12:39:48 +02:00
379633d7f5 remove usage of user type 2026-04-15 08:40:55 +02:00
c855503edd Mzansi AI model update to qwen3.5 2026-04-14 10:43:04 +02:00
0f6c6e51ab New Business Setup Flow 2026-04-08 15:47:33 +02:00
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
256 changed files with 4610 additions and 9486 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 google-chrome-stable_current_amd64.deb
.env .env
Frontend/android/app/.cxx/ Frontend/android/app/.cxx/
.DS_Store

11
.vscode/launch.json vendored
View File

@@ -11,6 +11,17 @@
"type": "dart", "type": "dart",
"program": "lib/main_dev.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", "name": "Profile",
"cwd": "mih_ui", "cwd": "mih_ui",

View File

@@ -4,37 +4,6 @@ networks:
driver: bridge driver: bridge
#============== MIH Containers ==================================================================== #============== MIH Containers ====================================================================
services: 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 ==================================================================== #============== Nginx Proxy Manager ====================================================================
mih-nginx: mih-nginx:
container_name: mih-nginx container_name: mih-nginx
@@ -43,7 +12,7 @@ services:
ports: ports:
- '80:80' # Public HTTP - '80:80' # Public HTTP
- '443:443' # Public HTTPS - '443:443' # Public HTTPS
- '81:81' # Admin Web Port - '127.0.0.1:81:81' # Admin Web Port
volumes: volumes:
- ./mih_nginx/data:/data - ./mih_nginx/data:/data
- ./mih_nginx/letsencrypt:/etc/letsencrypt - ./mih_nginx/letsencrypt:/etc/letsencrypt
@@ -69,8 +38,8 @@ services:
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
ports: ports:
- "3000:3000" - "127.0.0.1:3000:3000"
- "222:22" - "127.0.0.1:222:22"
depends_on: depends_on:
mih-gitea-db: mih-gitea-db:
condition: service_healthy condition: service_healthy
@@ -99,7 +68,7 @@ services:
depends_on: depends_on:
- mih-db - mih-db
ports: ports:
- 3567:3567 - '127.0.0.1:3567:3567'
environment: environment:
REFRESH_TOKEN_VALIDITY: '604800' REFRESH_TOKEN_VALIDITY: '604800'
ACCESS_TOKEN_VALIDITY: '86400' ACCESS_TOKEN_VALIDITY: '86400'
@@ -125,7 +94,7 @@ services:
image: wordpress image: wordpress
restart: always restart: always
ports: ports:
- 8081:80 - '127.0.0.1:8081:80'
environment: environment:
WORDPRESS_DB_HOST: mih-wp-db WORDPRESS_DB_HOST: mih-wp-db
WORDPRESS_DB_USER: ${WP_SQL_USER} WORDPRESS_DB_USER: ${WP_SQL_USER}
@@ -154,7 +123,7 @@ services:
build: build:
context: ./mih_ui context: ./mih_ui
ports: ports:
- "83:83" - "127.0.0.1:83:83"
networks: networks:
- mih-network - mih-network
depends_on: depends_on:
@@ -166,7 +135,7 @@ services:
target: builder target: builder
container_name: mih-api-hub container_name: mih-api-hub
ports: ports:
- 8080:80 - "127.0.0.1:8080:80"
volumes: volumes:
- ./mih_api_hub:/app - ./mih_api_hub:/app
networks: networks:
@@ -187,7 +156,7 @@ services:
networks: networks:
- mih-network - mih-network
ports: ports:
- '3306:3306' - '127.0.0.1:3306:3306'
volumes: volumes:
- ./mih_db:/var/lib/mysql - ./mih_db:/var/lib/mysql
#============== PHP My Admin ==================================================================== #============== PHP My Admin ====================================================================
@@ -213,8 +182,8 @@ services:
hostname: mih-minio hostname: mih-minio
image: minio/minio image: minio/minio
ports: ports:
- '9000:9000' - '127.0.0.1:9000:9000'
- '9001:9001' - '127.0.0.1:9001:9001'
volumes: volumes:
- './mih_minio:/data' - './mih_minio:/data'
environment: environment:
@@ -228,7 +197,7 @@ services:
container_name: mih-monitor container_name: mih-monitor
image: portainer/portainer-ce:2.20.3 image: portainer/portainer-ce:2.20.3
ports: ports:
- 9444:9443 - '127.0.0.1:9444:9443'
volumes: volumes:
- ./mih_monitor/data:/data - ./mih_monitor/data:/data
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
@@ -240,7 +209,7 @@ services:
container_name: mih-ai container_name: mih-ai
image: ollama/ollama:latest image: ollama/ollama:latest
ports: ports:
- 11434:11434 - '127.0.0.1:11434:11434'
volumes: volumes:
- ./mih_ai/ollama/ollama:/root/.ollama - ./mih_ai/ollama/ollama:/root/.ollama
pull_policy: always pull_policy: always

View File

@@ -1,3 +1,4 @@
.env .env
__pycache__/ __pycache__/
temp*.pdf 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.emailverification import EmailVerificationClaim
from supertokens_python.recipe.session import SessionContainer 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 = [ origins = [
"http://localhost", "http://localhost",
"http://localhost:80", "http://localhost:80",
"http://localhost:1995",
"http://localhost:8080", "http://localhost:8080",
"http://MIH-API-Hub:80", "http://MIH-API-Hub:80",
"http://MIH-API-Hub", "http://MIH-API-Hub",
"http://api.mzansi-innovation-hub.co.za", "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( init(
app_info=InputAppInfo( app_info=InputAppInfo(
app_name="Mzansi Innovation Hub", app_name="Mzansi Innovation Hub",
api_domain="http://localhost:8080/", 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", api_base_path="/auth",
website_base_path="/auth" website_base_path="/auth"
), ),
supertokens_config=SupertokensConfig( 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. # 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/", connection_uri="http://mih-supertokens:3567/",
api_key="leatucczyixqwkqqdrhayiwzeofkltds" api_key=st_api_key
), ),
framework='fastapi', framework='fastapi',
recipe_list=[ recipe_list=[

View File

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

2
mih_ui/.gitignore vendored
View File

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

View File

@@ -1,48 +1,36 @@
# Install Operating system and dependencies # --- STAGE 1: The Builder ---
#FROM ubuntu:22.04
FROM debian:latest AS build-env 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 # Clone Flutter SDK
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
RUN git clone -b flutter-3.32-candidate.0 https://github.com/flutter/flutter.git /usr/local/flutter 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="/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 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 -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 EXPOSE 83
CMD ["nginx", "-g", "daemon off;"]
RUN ["chmod", "+x", "/app/server/server.sh"]
ENTRYPOINT [ "/app/server/server.sh"]
# RUN ["python3", "-u", "/app/server/MIH_web_server.py"]

View File

@@ -19,7 +19,7 @@ if (keystorePropertiesFile.exists()) {
android { android {
namespace = "za.co.mzansiinnovationhub.mih" namespace = "za.co.mzansiinnovationhub.mih"
compileSdk = 35 compileSdk = 36
ndkVersion = "27.0.12077973" ndkVersion = "27.0.12077973"
// ndkVersion = flutter.ndkVersion // ndkVersion = flutter.ndkVersion

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_wallet_sc</item>
<item>@drawable/mzansi_ai_sc</item> <item>@drawable/mzansi_ai_sc</item>
<item>@drawable/mih_calculator_sc</item> <item>@drawable/mih_calculator_sc</item>
<item>@drawable/mzansi_directory_sc</item>
</array> </array>
</resources> </resources>

View File

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

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.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_native_splash/flutter_native_splash.dart';
import 'package:flutter_web_plugins/url_strategy.dart' import 'package:flutter_web_plugins/url_strategy.dart'
if (dart.library.html) '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!'); debugPrint('APP INSTALLED!');
}); });
final GoRouter appRouter = MihGoRouter().mihRouter; final GoRouter appRouter = MihGoRouter().mihRouter;
await dotenv.load(fileName: ".env");
FlutterNativeSplash.remove(); FlutterNativeSplash.remove();
runApp(MzansiInnovationHub( runApp(MzansiInnovationHub(
router: appRouter, router: appRouter,

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.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_native_splash/flutter_native_splash.dart';
import 'package:flutter_web_plugins/url_strategy.dart' import 'package:flutter_web_plugins/url_strategy.dart'
if (dart.library.html) '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!'); debugPrint('APP INSTALLED!');
}); });
final GoRouter appRouter = MihGoRouter().mihRouter; final GoRouter appRouter = MihGoRouter().mihRouter;
await dotenv.load(fileName: ".env");
FlutterNativeSplash.remove(); FlutterNativeSplash.remove();
runApp(MzansiInnovationHub( runApp(MzansiInnovationHub(
router: appRouter, 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"; baseApiUrl = "http://localhost:8080";
baseFileUrl = "http://localhost:9000"; baseFileUrl = "http://localhost:9000";
baseAiUrl = "http://localhost:11434"; 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; break;
} else if (Platform.isAndroid) { } else if (Platform.isAndroid) {
//================= Android Dev Urls ================= //================= Android Dev Urls =================
@@ -35,14 +43,6 @@ abstract class AppEnviroment {
baseFileUrl = "http://10.0.2.2:9000"; baseFileUrl = "http://10.0.2.2:9000";
baseAiUrl = "http://10.0.2.2:11434"; baseAiUrl = "http://10.0.2.2:11434";
bannerAdUnitId = 'ca-app-pub-3940256099942544/9214589741'; 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: case Enviroment.prod:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -1,14 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.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/bookmarked_business.dart';
import 'package:mzansi_innovation_hub/mih_objects/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_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_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_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_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_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
@@ -50,8 +46,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
RedactedConfiguration getRedactedConfiguration() { RedactedConfiguration getRedactedConfiguration() {
return RedactedConfiguration( return RedactedConfiguration(
// redactedColor: Colors.pink, // redactedColor: Colors.pink,
redactedColor: MihColors.getPrimaryColor( redactedColor: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
); );
} }
@@ -159,13 +154,10 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
Function()? ontap, Function()? ontap,
) { ) {
return Material( return Material(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
child: InkWell( child: InkWell(
onTap: ontap, onTap: ontap,
splashColor: MihColors.getPrimaryColor( splashColor: MihColors.primary().withOpacity(0.2),
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
.withOpacity(0.2),
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
child: Padding( child: Padding(
padding: EdgeInsetsGeometry.symmetric( padding: EdgeInsetsGeometry.symmetric(
@@ -186,8 +178,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
child: Icon( child: Icon(
icon, icon,
// size: 35, // size: 35,
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
).redacted( ).redacted(
@@ -207,9 +198,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
height: 1.0, height: 1.0,
), ),
).redacted( ).redacted(
@@ -222,9 +211,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
), ),
).redacted( ).redacted(
context: context, context: context,
@@ -278,16 +265,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
builder: (BuildContext context, MzansiProfileProvider profileProvider, builder: (BuildContext context, MzansiProfileProvider profileProvider,
MzansiDirectoryProvider directoryProvider, Widget? child) { MzansiDirectoryProvider directoryProvider, Widget? child) {
return Material( return Material(
color: MihColors.getSecondaryColor( color: MihColors.secondary().withValues(alpha: 0.6),
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
.withValues(alpha: 0.6),
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(25),
elevation: 10, elevation: 10,
shadowColor: Colors.black, shadowColor: Colors.black,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Column( child: Column(
@@ -297,8 +281,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
"Call", "Call",
"Give us a quick call.", "Give us a quick call.",
Icons.phone, Icons.phone,
MihColors.getGreenColor( MihColors.green(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
false, false,
() { () {
// print("Calling ${widget.cellNumber}"); // print("Calling ${widget.cellNumber}");
@@ -306,15 +289,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
}, },
), ),
Divider( Divider(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
_buildContactInfo( _buildContactInfo(
"Email", "Email",
"Send us an email.", "Send us an email.",
Icons.email, Icons.email,
MihColors.getPinkColor( MihColors.pink(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
false, false,
() { () {
// print("Emailing ${widget.email}"); // print("Emailing ${widget.email}");
@@ -330,17 +311,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
child: Column( child: Column(
children: [ children: [
Divider( Divider(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
), ),
_buildContactInfo( _buildContactInfo(
"Location", "Location",
"Come visit us.", "Come visit us.",
Icons.location_on, Icons.location_on,
MihColors.getOrangeColor( MihColors.orange(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
false, false,
() { () {
final latitude = double.parse( final latitude = double.parse(
@@ -362,17 +339,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
child: Column( child: Column(
children: [ children: [
Divider( Divider(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
), ),
_buildContactInfo( _buildContactInfo(
"Website", "Website",
"Find out more about us.", "Find out more about us.",
Icons.vpn_lock, Icons.vpn_lock,
MihColors.getRedColor( MihColors.red(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
false, false,
() { () {
_launchWebsite(widget.business.website); _launchWebsite(widget.business.website);
@@ -393,9 +366,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 10.0), const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider( child: Divider(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
), ),
), ),
Container( Container(
@@ -403,9 +374,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
"Loading Rating", "Loading Rating",
"Loading your rating.", "Loading your rating.",
Icons.star_rate_rounded, Icons.star_rate_rounded,
MihColors.getYellowColor( MihColors.yellow(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
true, true,
null, null,
), ),
@@ -426,18 +395,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 10.0), const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider( child: Divider(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
), ),
), ),
_buildContactInfo( _buildContactInfo(
ratingDisplayTitle, ratingDisplayTitle,
"Let us know how we are doing.", "Let us know how we are doing.",
Icons.star_rate_rounded, Icons.star_rate_rounded,
MihColors.getYellowColor( MihColors.yellow(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
false, false,
() { () {
businessReviewRatingWindow(directoryProvider, businessReviewRatingWindow(directoryProvider,
@@ -461,9 +426,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 10.0), const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider( child: Divider(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
), ),
), ),
Container( Container(
@@ -471,9 +434,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
"Loading Bookmark", "Loading Bookmark",
"Loading your bookmark.", "Loading your bookmark.",
Icons.bookmark_add_rounded, Icons.bookmark_add_rounded,
MihColors.getBluishPurpleColor( MihColors.bluishPurple(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
true, true,
null, null,
), ),
@@ -494,9 +455,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
padding: padding:
const EdgeInsets.symmetric(horizontal: 10.0), const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider( child: Divider(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
), ),
), ),
_buildContactInfo( _buildContactInfo(
@@ -505,9 +464,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
bookmarkBusiness == null bookmarkBusiness == null
? Icons.bookmark_add_rounded ? Icons.bookmark_add_rounded
: Icons.bookmark_remove_rounded, : Icons.bookmark_remove_rounded,
MihColors.getBluishPurpleColor( MihColors.bluishPurple(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
false, false,
() { () {
// _launchWebsite(widget.website); // _launchWebsite(widget.website);
@@ -526,14 +483,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
// Padding( // Padding(
// padding: const EdgeInsets.symmetric(horizontal: 10.0), // padding: const EdgeInsets.symmetric(horizontal: 10.0),
// child: Divider( // child: Divider(
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), // color: MihColors.primary(),
// ), // ),
// ), // ),
// _buildContactInfo( // _buildContactInfo(
// "Bookmark", // "Bookmark",
// "Save us for later.", // "Save us for later.",
// Icons.bookmark_add_rounded, // Icons.bookmark_add_rounded,
// MihColors.getBluishPurpleColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), // MihColors.bluishPurple(),
// () { // () {
// // _launchWebsite(widget.website); // // _launchWebsite(widget.website);
// print("Saving ${widget.business.Name} to Directory"); // print("Saving ${widget.business.Name} to Directory");
@@ -544,7 +501,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
// Padding( // Padding(
// padding: const EdgeInsets.symmetric(horizontal: 10.0), // padding: const EdgeInsets.symmetric(horizontal: 10.0),
// child: Divider( // child: Divider(
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), // color: MihColors.primary(),
// ), // ),
// ), // ),
], ],
@@ -646,16 +603,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
Icon( Icon(
MihIcons.mihLogo, MihIcons.mihLogo,
size: 125, size: 125,
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
"Let's Get Started", "Let's Get Started",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -664,8 +619,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
Text( 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!", "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( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 15, fontSize: 15,
), ),
), ),
@@ -678,16 +632,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
extra: true, extra: true,
); );
}, },
buttonColor: MihColors.getGreenColor( buttonColor: MihColors.green(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
elevation: 10, elevation: 10,
width: 300, width: 300,
child: Text( child: Text(
"Sign In/ Create Account", "Sign In/ Create Account",
style: TextStyle( style: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, 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: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_objects/business.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.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_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:mzansi_innovation_hub/mih_services/mih_location_services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -54,29 +52,23 @@ class _MihBusinessProfilePreviewState extends State<MihBusinessProfilePreview> {
? Icon( ? Icon(
MihIcons.mihRing, MihIcons.mihRing,
size: profilePictureWidth, size: profilePictureWidth,
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
) )
: widget.imageFile == null : widget.imageFile == null
? Icon( ? Icon(
MihIcons.iDontKnow, MihIcons.iDontKnow,
size: profilePictureWidth, size: profilePictureWidth,
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
) )
: MihCircleAvatar( : MihCircleAvatar(
imageFile: widget.imageFile, imageFile: widget.imageFile,
width: profilePictureWidth, width: profilePictureWidth,
expandable: false,
editable: false, editable: false,
fileNameController: TextEditingController(), fileNameController: TextEditingController(),
userSelectedfile: null, userSelectedfile: null,
frameColor: MihColors.getSecondaryColor( frameColor: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == backgroundColor: MihColors.primary(),
"Dark"),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
onChange: () {}, onChange: () {},
), ),
const SizedBox(width: 15), 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:flutter/material.dart';
import 'package:ken_logger/ken_logger.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_providers/mih_calendar_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:table_calendar/table_calendar.dart'; import 'package:table_calendar/table_calendar.dart';
@@ -54,8 +53,7 @@ class _MIHCalendarState extends State<MIHCalendar> {
formatButtonDecoration: BoxDecoration( formatButtonDecoration: BoxDecoration(
border: Border.fromBorderSide( border: Border.fromBorderSide(
BorderSide( BorderSide(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(
@@ -79,36 +77,29 @@ class _MIHCalendarState extends State<MIHCalendar> {
calendarStyle: CalendarStyle( calendarStyle: CalendarStyle(
outsideDaysVisible: false, outsideDaysVisible: false,
todayTextStyle: TextStyle( todayTextStyle: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
todayDecoration: BoxDecoration( todayDecoration: BoxDecoration(
color: MihColors.getGreenColor( color: MihColors.green(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
selectedTextStyle: TextStyle( selectedTextStyle: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
selectedDecoration: BoxDecoration( selectedDecoration: BoxDecoration(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
weekendTextStyle: TextStyle( weekendTextStyle: TextStyle(
color: MihColors.getGreyColor( color: MihColors.grey(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
daysOfWeekStyle: DaysOfWeekStyle( daysOfWeekStyle: DaysOfWeekStyle(
weekdayStyle: TextStyle( weekdayStyle: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
weekendStyle: TextStyle( weekendStyle: TextStyle(
color: MihColors.getGreyColor( color: MihColors.grey(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
), ),

View File

@@ -2,13 +2,15 @@ import 'dart:io';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.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/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 { class MihCircleAvatar extends StatefulWidget {
final ImageProvider<Object>? imageFile; final ImageProvider<Object>? imageFile;
final double width; final double width;
final bool expandable;
final bool editable; final bool editable;
final TextEditingController? fileNameController; final TextEditingController? fileNameController;
final onChange; final onChange;
@@ -19,6 +21,7 @@ class MihCircleAvatar extends StatefulWidget {
super.key, super.key,
required this.imageFile, required this.imageFile,
required this.width, required this.width,
required this.expandable,
required this.editable, required this.editable,
required this.fileNameController, required this.fileNameController,
required this.userSelectedfile, required this.userSelectedfile,
@@ -35,23 +38,33 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
late ImageProvider<Object>? imagePreview; late ImageProvider<Object>? imagePreview;
ImageProvider<Object>? getAvatar() { ImageProvider<Object>? getAvatar() {
// Color dark = const Color(0XFF3A4454);
if (widget.imageFile == null) { if (widget.imageFile == null) {
return 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 { } else {
return widget.imageFile; 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 @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -62,111 +75,119 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return GestureDetector(
// color: Colors.white, onTap: widget.expandable
alignment: Alignment.center, ? () {
width: widget.width, KenLogger.success("Avatar tapped");
height: widget.width, expandAvatar();
child: Stack( }
: null,
child: Container(
alignment: Alignment.center, alignment: Alignment.center,
children: [ width: widget.width,
Visibility( height: widget.width,
visible: imagePreview != null, child: Stack(
child: Positioned( alignment: Alignment.center,
right: widget.width * 0.03, children: [
child: CircleAvatar( Visibility(
radius: widget.width / 2.2, visible: imagePreview != null,
backgroundColor: widget.backgroundColor, child: Positioned(
backgroundImage: imagePreview, right: widget.width * 0.03,
child: CircleAvatar(
radius: widget.width / 2.2,
backgroundColor: widget.backgroundColor,
backgroundImage: imagePreview,
),
), ),
), ),
), Visibility(
Visibility( visible: imagePreview != null,
visible: imagePreview != null, child: Icon(
child: Icon( size: widget.width,
size: widget.width, MihIcons.mihRing,
MihIcons.mihRing, color: widget.frameColor,
color: widget.frameColor, ),
), ),
), Visibility(
Visibility( visible: imagePreview == null,
visible: imagePreview == null, child: Icon(
child: Icon( MihIcons.iDontKnow,
MihIcons.iDontKnow, size: widget.width,
size: widget.width, color: widget.frameColor,
color: widget.frameColor, ),
), ),
), Visibility(
Visibility( visible: widget.editable,
visible: widget.editable, child: Positioned(
child: Positioned( bottom: 0,
bottom: 0, right: 0,
right: 0, child: IconButton.filled(
child: IconButton.filled( style: ButtonStyle(
style: ButtonStyle( backgroundColor: WidgetStateProperty.all<Color>(
backgroundColor: WidgetStateProperty.all<Color>( MihColors.green(),
MihColors.getGreenColor( ),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), onPressed: () async {
onPressed: () async { try {
try { FilePickerResult? result =
FilePickerResult? result = await FilePicker.platform.pickFiles(
await FilePicker.platform.pickFiles( type: FileType.image,
type: FileType.image, );
); // print("Here 1");
// print("Here 1"); if (MzansiInnovationHub.of(context)!
if (MzansiInnovationHub.of(context)!.theme.getPlatform() == .theme
"Web") { .getPlatform() ==
// print("Here 2"); "Web") {
if (result == null) return; // print("Here 2");
// print("Here 3"); if (result == null) return;
PlatformFile? selectedFile = result.files.first; // print("Here 3");
setState(() { PlatformFile? selectedFile = result.files.first;
// 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,
);
setState(() { setState(() {
widget.onChange(androidFile); // print("Here 4");
imagePreview = FileImage(file); widget.onChange(selectedFile);
// print("Here 5");
imagePreview = MemoryImage(selectedFile.bytes!);
}); });
setState(() { setState(() {
widget.fileNameController!.text = widget.fileNameController!.text = selectedFile.name;
file.path.split('/').last;
}); });
} else { } else {
print("here in else"); if (result != null) {
// User canceled the picker 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:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ken_logger/ken_logger.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/main.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
class MihImageDisplay extends StatefulWidget { class MihImageDisplay extends StatefulWidget {
final ImageProvider<Object>? imageFile; final ImageProvider<Object>? imageFile;
@@ -67,9 +67,7 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
// width: widget.width, // width: widget.width,
height: widget.height, height: widget.height,
decoration: BoxDecoration( decoration: BoxDecoration(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
borderRadius: BorderRadius.circular(widget.width * 0.1), borderRadius: BorderRadius.circular(widget.width * 0.1),
), ),
child: Image(image: imagePreview!), child: Image(image: imagePreview!),
@@ -79,15 +77,13 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
width: widget.width, width: widget.width,
height: widget.height, height: widget.height,
decoration: BoxDecoration( decoration: BoxDecoration(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
borderRadius: BorderRadius.circular(widget.width * 0.1), borderRadius: BorderRadius.circular(widget.width * 0.1),
), ),
child: Icon( child: Icon(
Icons.image_not_supported_rounded, Icons.image_not_supported_rounded,
size: widget.width * 0.3, size: widget.width * 0.3,
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
Visibility( Visibility(
@@ -97,11 +93,9 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
right: 5, right: 5,
child: IconButton.filled( child: IconButton.filled(
style: IconButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: MihColors.getGreenColor( backgroundColor: MihColors.green(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
onPressed: () async { onPressed: () async {
try { try {
FilePickerResult? result = 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: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/app_user.dart';
import 'package:mzansi_innovation_hub/mih_objects/arguments.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_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_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:supertokens_flutter/http.dart' as http; import 'package:supertokens_flutter/http.dart' as http;
@@ -69,15 +68,13 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
title: Text( title: Text(
title, title,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
subtitle: Text( subtitle: Text(
subtitle, subtitle,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
onTap: () {}, onTap: () {},
@@ -94,8 +91,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
children: [ children: [
Icon( Icon(
Icons.circle_notifications, Icons.circle_notifications,
color: MihColors.getRedColor( color: MihColors.red(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
const SizedBox( const SizedBox(
width: 5, width: 5,
@@ -104,8 +100,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
child: Text( child: Text(
title, title,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
), ),
@@ -119,8 +114,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
child: Text( child: Text(
title, title,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
), ),
@@ -132,8 +126,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
subtitle: Text( subtitle: Text(
subtitle, subtitle,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
), ),
), ),
onTap: () { onTap: () {
@@ -156,8 +149,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (BuildContext context, index) { separatorBuilder: (BuildContext context, index) {
return Divider( return Divider(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
); );
}, },
itemCount: widget.notifications.length, itemCount: widget.notifications.length,
@@ -196,15 +188,14 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea( return SafeArea(
child: Drawer( child: Drawer(
//backgroundColor: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), //backgroundColor: MihColors.primary(),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Container( Container(
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@@ -214,9 +205,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
child: Text( child: Text(
"Notifications", "Notifications",
style: TextStyle( style: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.primary(),
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 20, fontSize: 20,
), ),
@@ -231,7 +220,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
// physics: const NeverScrollableScrollPhysics(), // physics: const NeverScrollableScrollPhysics(),
// separatorBuilder: (BuildContext context, index) { // separatorBuilder: (BuildContext context, index) {
// return Divider( // return Divider(
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), // color: MihColors.secondary(),
// ); // );
// }, // },
// itemCount: widget.notifications.length, // itemCount: widget.notifications.length,

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; 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 '../main.dart';
import '../mih_objects/arguments.dart'; import '../mih_objects/arguments.dart';
@@ -131,10 +131,8 @@ class _MIHNotificationMessageState extends State<MIHNotificationMessage>
void initState() { void initState() {
super.initState(); super.initState();
setState(() { setState(() {
primary = MihColors.getPrimaryColor( primary = MihColors.primary();
MzansiInnovationHub.of(context)!.theme.mode == "Dark"); secondary = MihColors.red();
secondary = MihColors.getRedColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
}); });
_animationController = AnimationController( _animationController = AnimationController(
vsync: this, 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: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/app_user.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.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 { class MihPersonalProfilePreview extends StatefulWidget {
final AppUser user; final AppUser user;
@@ -36,26 +34,23 @@ class _MihPersonalProfilePreviewState extends State<MihPersonalProfilePreview> {
? Icon( ? Icon(
MihIcons.mihRing, MihIcons.mihRing,
size: profilePictureWidth, size: profilePictureWidth,
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
) )
: widget.imageFile == null : widget.imageFile == null
? Icon( ? Icon(
MihIcons.iDontKnow, MihIcons.iDontKnow,
size: profilePictureWidth, size: profilePictureWidth,
color: MihColors.getSecondaryColor( color: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
) )
: MihCircleAvatar( : MihCircleAvatar(
imageFile: widget.imageFile, imageFile: widget.imageFile,
width: profilePictureWidth, width: profilePictureWidth,
expandable: false,
editable: false, editable: false,
fileNameController: TextEditingController(), fileNameController: TextEditingController(),
userSelectedfile: null, userSelectedfile: null,
frameColor: MihColors.getSecondaryColor( frameColor: MihColors.secondary(),
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), backgroundColor: MihColors.primary(),
backgroundColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
onChange: () {}, onChange: () {},
), ),
const SizedBox(width: 15), const SizedBox(width: 15),

View File

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

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