NEW: MIH Shortcuts pt1
This commit is contained in:
31
Frontend/android/app/src/main/res/drawable/mih_home_sc.xml
Normal file
31
Frontend/android/app/src/main/res/drawable/mih_home_sc.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
|
||||
<solid android:color="@color/mih_icon_background" />
|
||||
|
||||
<padding
|
||||
android:left="0dp"
|
||||
android:top="0dp"
|
||||
android:right="0dp"
|
||||
android:bottom="0dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:gravity="center"
|
||||
|
||||
android:drawable="@drawable/mih_logo"
|
||||
|
||||
android:width="45dp"
|
||||
android:height="45dp"
|
||||
|
||||
android:left="9dp"
|
||||
android:top="9dp"
|
||||
android:right="9dp"
|
||||
android:bottom="9dp">
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
12
Frontend/android/app/src/main/res/drawable/mih_logo.xml
Normal file
12
Frontend/android/app/src/main/res/drawable/mih_logo.xml
Normal file
File diff suppressed because one or more lines are too long
12
Frontend/android/app/src/main/res/drawable/mzansi_wallet.xml
Normal file
12
Frontend/android/app/src/main/res/drawable/mzansi_wallet.xml
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
|
||||
<solid android:color="@color/mih_icon_background" />
|
||||
|
||||
<padding
|
||||
android:left="0dp"
|
||||
android:top="0dp"
|
||||
android:right="0dp"
|
||||
android:bottom="0dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:gravity="center"
|
||||
|
||||
android:drawable="@drawable/mzansi_wallet"
|
||||
|
||||
android:width="45dp"
|
||||
android:height="45dp"
|
||||
|
||||
android:left="9dp"
|
||||
android:top="9dp"
|
||||
android:right="9dp"
|
||||
android:bottom="9dp">
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
12
Frontend/android/app/src/main/res/drawable/test.xml
Normal file
12
Frontend/android/app/src/main/res/drawable/test.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
|
||||
|
||||
</vector>
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#3A4454</color>
|
||||
<color name="mih_icon_background">#3A4454</color>
|
||||
</resources>
|
||||
@@ -12,7 +12,6 @@ import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_direct
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_wallet_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:upgrader/upgrader.dart';
|
||||
import 'mih_config/mih_env.dart';
|
||||
@@ -36,40 +35,10 @@ class MzansiInnovationHub extends StatefulWidget {
|
||||
class _MzansiInnovationHubState extends State<MzansiInnovationHub> {
|
||||
late MihTheme theme;
|
||||
|
||||
Color getPrimany() {
|
||||
return MihColors.getPrimaryColor(theme.mode == "Dark");
|
||||
}
|
||||
|
||||
String getTitle() {
|
||||
if (AppEnviroment.getEnv() == "Dev") {
|
||||
return "Dev | MIH App: Mzansi Innovation Hub";
|
||||
} else {
|
||||
return "MIH App: Mzansi Innovation Hub";
|
||||
}
|
||||
}
|
||||
|
||||
void changeTheme(ThemeMode themeMode) {
|
||||
setState(() {
|
||||
if (themeMode == ThemeMode.light) {
|
||||
setState(() {
|
||||
theme.mode = "Light";
|
||||
});
|
||||
} else if (themeMode == ThemeMode.dark) {
|
||||
setState(() {
|
||||
theme.mode = "Dark";
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
theme.mode = "Dark";
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
theme = MihTheme();
|
||||
super.initState();
|
||||
theme = MihTheme();
|
||||
theme.mode = "Dark";
|
||||
theme.platform = Theme.of(context).platform;
|
||||
}
|
||||
@@ -119,7 +88,9 @@ class _MzansiInnovationHubState extends State<MzansiInnovationHub> {
|
||||
),
|
||||
],
|
||||
child: MaterialApp.router(
|
||||
title: getTitle(),
|
||||
title: AppEnviroment.getEnv() == "Dev"
|
||||
? "Dev | MIH App: Mzansi Innovation Hub"
|
||||
: "MIH App: Mzansi Innovation Hub",
|
||||
themeMode: ThemeMode.dark,
|
||||
theme: theme.getThemeData(),
|
||||
darkTheme: theme.getThemeData(),
|
||||
|
||||
@@ -28,6 +28,7 @@ import 'package:mzansi_innovation_hub/mih_services/mih_my_business_user_services
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_user_consent_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:quick_actions/quick_actions.dart';
|
||||
|
||||
class MihHome extends StatefulWidget {
|
||||
const MihHome({
|
||||
@@ -42,6 +43,35 @@ class _MihHomeState extends State<MihHome> {
|
||||
DateTime latestPrivacyPolicyDate = DateTime.parse("2024-12-01");
|
||||
DateTime latestTermOfServiceDate = DateTime.parse("2024-12-01");
|
||||
bool _isLoadingInitialData = true;
|
||||
final QuickActions quickActions = QuickActions();
|
||||
String shortcut = 'no action set';
|
||||
|
||||
void _initializeQuickActions() {
|
||||
quickActions.initialize((String shortcutType) {
|
||||
setState(() {
|
||||
shortcut = shortcutType;
|
||||
});
|
||||
if (shortcutType == 'mihHome') {
|
||||
context.goNamed("mihHome");
|
||||
}
|
||||
if (shortcutType == 'mzansiWallet') {
|
||||
context.goNamed("mzansiWallet");
|
||||
}
|
||||
});
|
||||
// Set the quick actions
|
||||
quickActions.setShortcutItems(<ShortcutItem>[
|
||||
const ShortcutItem(
|
||||
type: 'mzansiWallet',
|
||||
localizedTitle: 'Mzansi Wallet',
|
||||
icon: 'mzansi_wallet_sc'),
|
||||
]).then((void _) {
|
||||
setState(() {
|
||||
if (shortcut == 'no action set') {
|
||||
shortcut = 'mihHome';
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _loadInitialData() async {
|
||||
if (mounted) {
|
||||
@@ -205,6 +235,7 @@ class _MihHomeState extends State<MihHome> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadInitialData();
|
||||
_initializeQuickActions();
|
||||
}
|
||||
|
||||
List<String> getToolTitle() {
|
||||
|
||||
@@ -1456,6 +1456,38 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
quick_actions:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: quick_actions
|
||||
sha256: "7e35dd6a21f5bbd21acf6899039eaf85001a5ac26d52cbd6a8a2814505b90798"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
quick_actions_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quick_actions_android
|
||||
sha256: "612c9d53364c641ddcdeafed83c68fc14efb1bf4f686979d755024fc976fc888"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.23"
|
||||
quick_actions_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quick_actions_ios
|
||||
sha256: ee2cd54e3bd674eb031ca195b3b9974583638d141493aec1066dee3b2599ed08
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
quick_actions_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quick_actions_platform_interface
|
||||
sha256: "1fec7068db5122cd019e9340d3d7be5d36eab099695ef3402c7059ee058329a4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
record:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -61,6 +61,7 @@ dependencies:
|
||||
flutter_ai_toolkit: ^0.10.0
|
||||
flutter_markdown_plus: ^1.0.5
|
||||
speech_to_text: ^7.3.0
|
||||
quick_actions: ^1.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user