QOL: Package Tile Update
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_three.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_zero.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
|
||||
@@ -62,21 +63,26 @@ class _PackageTestState extends State<PackageTest> {
|
||||
|
||||
MihPackageTools getTools() {
|
||||
Map<Widget, void Function()?> temp = Map();
|
||||
temp[const Icon(Icons.warning)] = () {
|
||||
temp[const Icon(Icons.link)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 0;
|
||||
});
|
||||
};
|
||||
temp[const Icon(Icons.inbox)] = () {
|
||||
temp[const Icon(Icons.warning)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 1;
|
||||
});
|
||||
};
|
||||
temp[const Icon(Icons.outbond)] = () {
|
||||
temp[const Icon(Icons.inbox)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 2;
|
||||
});
|
||||
};
|
||||
temp[const Icon(Icons.outbond)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 3;
|
||||
});
|
||||
};
|
||||
return MihPackageTools(
|
||||
tools: temp,
|
||||
selcetedIndex: _selcetedIndex,
|
||||
@@ -91,6 +97,7 @@ class _PackageTestState extends State<PackageTest> {
|
||||
MzansiProfileProvider profileProvider =
|
||||
context.read<MzansiProfileProvider>();
|
||||
List<Widget> toolBodies = [
|
||||
const PackageToolThree(),
|
||||
const PackageToolZero(),
|
||||
PackageToolOne(
|
||||
user: profileProvider.user!,
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/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_location_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||
|
||||
@@ -15,8 +15,7 @@ class MihPackageTile extends StatefulWidget {
|
||||
final Widget appIcon;
|
||||
final void Function() onTap;
|
||||
final double iconSize;
|
||||
final Color primaryColor;
|
||||
final Color secondaryColor;
|
||||
final Color textColor;
|
||||
final bool? authenticateUser;
|
||||
const MihPackageTile({
|
||||
super.key,
|
||||
@@ -25,8 +24,7 @@ class MihPackageTile extends StatefulWidget {
|
||||
this.ytVideoID,
|
||||
required this.appIcon,
|
||||
required this.iconSize,
|
||||
required this.primaryColor,
|
||||
required this.secondaryColor,
|
||||
required this.textColor,
|
||||
this.authenticateUser,
|
||||
});
|
||||
|
||||
@@ -204,8 +202,7 @@ class _MihPackageTileState extends State<MihPackageTile> {
|
||||
// softWrap: true,
|
||||
// overflow: TextOverflow.visible,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: widget.textColor,
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
@@ -37,9 +37,7 @@ class _AboutMihTileState extends State<AboutMihTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -356,9 +356,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -376,9 +374,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -396,9 +392,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -416,9 +410,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -436,9 +428,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -456,9 +446,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -477,9 +465,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -497,9 +483,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -517,9 +501,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -537,9 +519,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
),
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
@@ -565,9 +545,7 @@ class _MihInfoState extends State<MihInfo> {
|
||||
// ),
|
||||
),
|
||||
iconSize: 100,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
));
|
||||
//==================================================================
|
||||
|
||||
@@ -39,9 +39,7 @@ class _MihAccessTileState extends State<MihAccessTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,9 +34,7 @@ class _MihCalculatorTileState extends State<MihCalculatorTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,7 @@ class _MzansiCalendarTileState extends State<MzansiCalendarTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -87,8 +87,7 @@ class _MihSignInState extends State<MihSignIn> {
|
||||
size: 200,
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: getPrim(),
|
||||
secondaryColor: getSec(),
|
||||
textColor: getPrim(),
|
||||
authenticateUser: false,
|
||||
));
|
||||
tileList.add(MihPackageTile(
|
||||
@@ -110,8 +109,7 @@ class _MihSignInState extends State<MihSignIn> {
|
||||
size: 200,
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: getPrim(),
|
||||
secondaryColor: getSec(),
|
||||
textColor: getPrim(),
|
||||
authenticateUser: false,
|
||||
));
|
||||
//if (AppEnviroment.getEnv() == "Dev") {
|
||||
@@ -134,8 +132,7 @@ class _MihSignInState extends State<MihSignIn> {
|
||||
size: 200,
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: getPrim(),
|
||||
secondaryColor: getSec(),
|
||||
textColor: getPrim(),
|
||||
authenticateUser: false,
|
||||
));
|
||||
tileList.add(MihPackageTile(
|
||||
@@ -157,8 +154,7 @@ class _MihSignInState extends State<MihSignIn> {
|
||||
size: 200,
|
||||
),
|
||||
iconSize: 200,
|
||||
primaryColor: getPrim(),
|
||||
secondaryColor: getSec(),
|
||||
textColor: getPrim(),
|
||||
authenticateUser: false,
|
||||
));
|
||||
//}
|
||||
|
||||
@@ -33,9 +33,7 @@ class _MihMineSweeperTileState extends State<MihMineSweeperTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,9 +41,7 @@ class _MzansiAiTileState extends State<MzansiAiTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_ai_toolkit/flutter_ai_toolkit.dart';
|
||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:flutter_tts/flutter_tts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:ken_logger/ken_logger.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
@@ -12,6 +13,7 @@ import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.d
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_ai_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MihAiChat extends StatefulWidget {
|
||||
@@ -123,26 +125,63 @@ class _MihAiChatState extends State<MihAiChat> with WidgetsBindingObserver {
|
||||
}
|
||||
}
|
||||
|
||||
void saveHistory(MzansiAiProvider aiProvider) {
|
||||
void saveHistory(
|
||||
MzansiProfileProvider profileProvider, MzansiAiProvider aiProvider) {
|
||||
final history = aiProvider.ollamaProvider.history.toList();
|
||||
String jsonHistory = '{"conversation_id":"1234-asdf-5678-qwert",\n';
|
||||
// jsonHistory += '"app_id":"${}"\n';
|
||||
jsonHistory += '"messages":[\n';
|
||||
KenLogger.success("History Length: ${history.length}");
|
||||
for (int i = 0; i != history.length; i++) {
|
||||
DateTime now = DateTime.now();
|
||||
DateFormat formatter = DateFormat('yyyy-MM-ddTHH:mm:ss');
|
||||
String formattedDateTimeNow = formatter.format(now);
|
||||
|
||||
// 1. Build the list of message Maps
|
||||
List<Map<String, dynamic>> messages = [];
|
||||
for (int i = 0; i < history.length; i++) {
|
||||
final map = history[i].toJson();
|
||||
final json = JsonEncoder.withIndent(' ').convert(map);
|
||||
jsonHistory += json;
|
||||
if (i != history.length - 1) {
|
||||
KenLogger.success("i: $i");
|
||||
jsonHistory += ",";
|
||||
}
|
||||
jsonHistory += "\n";
|
||||
map["order"] = i; // Add the order field
|
||||
messages.add(map);
|
||||
}
|
||||
jsonHistory += ']}';
|
||||
|
||||
// 2. Build the main history Map (the root JSON object)
|
||||
final historyMap = <String, dynamic>{
|
||||
"conversation_id": "1234-asdf-5678-qwert",
|
||||
"app_id": profileProvider.user!.app_id,
|
||||
"modified_date": formattedDateTimeNow,
|
||||
"messages": messages, // The list of messages is included here
|
||||
};
|
||||
|
||||
// 3. Use JsonEncoder to convert the entire Map to a formatted JSON string
|
||||
const encoder = JsonEncoder.withIndent(' ');
|
||||
String jsonHistory = encoder.convert(historyMap);
|
||||
|
||||
// The output string will now be a correctly formatted and escaped JSON object.
|
||||
debugPrint("History: $jsonHistory");
|
||||
}
|
||||
|
||||
// void saveHistory(
|
||||
// MzansiProfileProvider profileProvider, MzansiAiProvider aiProvider) {
|
||||
// final history = aiProvider.ollamaProvider.history.toList();
|
||||
// DateTime now = DateTime.now();
|
||||
// DateFormat formatter = DateFormat('yyyy-MM-ddTHH:mm:ss');
|
||||
// String formattedDateTimeNow = formatter.format(now);
|
||||
// String jsonHistory = '{"conversation_id":"1234-asdf-5678-qwert",\n';
|
||||
// jsonHistory += '"app_id":"${profileProvider.user!.app_id}",\n';
|
||||
// jsonHistory += '"modified_date":"$formattedDateTimeNow",\n';
|
||||
// jsonHistory += '"messages":[\n';
|
||||
// KenLogger.success("History Length: ${history.length}");
|
||||
// for (int i = 0; i != history.length; i++) {
|
||||
// final map = history[i].toJson();
|
||||
// map["order"] = i;
|
||||
// final json = JsonEncoder.withIndent(' ').convert(map);
|
||||
// jsonHistory += json;
|
||||
// if (i != history.length - 1) {
|
||||
// KenLogger.success("i: $i");
|
||||
// jsonHistory += ",";
|
||||
// }
|
||||
// jsonHistory += "\n";
|
||||
// }
|
||||
// jsonHistory += ']}';
|
||||
// debugPrint("History: $jsonHistory");
|
||||
// }
|
||||
|
||||
void stopTTS(MzansiAiProvider aiProvider) {
|
||||
_flutterTts.stop();
|
||||
aiProvider.setTTSstate(false);
|
||||
@@ -235,9 +274,9 @@ class _MihAiChatState extends State<MihAiChat> with WidgetsBindingObserver {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<MzansiAiProvider>(
|
||||
builder:
|
||||
(BuildContext context, MzansiAiProvider aiProvider, Widget? child) {
|
||||
return Consumer2<MzansiProfileProvider, MzansiAiProvider>(
|
||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||
MzansiAiProvider aiProvider, Widget? child) {
|
||||
bool hasHistory = aiProvider.ollamaProvider.history.isNotEmpty;
|
||||
String? lastMessage;
|
||||
if (hasHistory) {
|
||||
@@ -269,7 +308,7 @@ class _MihAiChatState extends State<MihAiChat> with WidgetsBindingObserver {
|
||||
width: 200,
|
||||
height: 30,
|
||||
onPressed: () {
|
||||
saveHistory(aiProvider);
|
||||
saveHistory(profileProvider, aiProvider);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
|
||||
@@ -40,9 +40,7 @@ class _MzansiDirectoryTileState extends State<MzansiDirectoryTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,703 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
|
||||
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 MihBusinessCard extends StatefulWidget {
|
||||
final Business business;
|
||||
final double width;
|
||||
const MihBusinessCard({
|
||||
super.key,
|
||||
required this.business,
|
||||
required this.width,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MihBusinessCard> createState() => _MihBusinessCardState();
|
||||
}
|
||||
|
||||
class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
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.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildContactInfo(
|
||||
String label,
|
||||
String subLabel,
|
||||
IconData icon,
|
||||
Color? iconColor,
|
||||
bool redacted,
|
||||
Function()? ontap,
|
||||
) {
|
||||
return Material(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
child: InkWell(
|
||||
onTap: ontap,
|
||||
splashColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
|
||||
.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsGeometry.symmetric(
|
||||
// vertical: 5,
|
||||
horizontal: 25,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 45,
|
||||
height: 45,
|
||||
decoration: BoxDecoration(
|
||||
color: iconColor,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: FittedBox(
|
||||
child: Icon(
|
||||
icon,
|
||||
// size: 35,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
),
|
||||
).redacted(
|
||||
context: context,
|
||||
redact: redacted,
|
||||
configuration: getRedactedConfiguration(),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
height: 1.0,
|
||||
),
|
||||
).redacted(
|
||||
context: context,
|
||||
redact: redacted,
|
||||
configuration: getRedactedConfiguration(),
|
||||
),
|
||||
Text(
|
||||
subLabel,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
).redacted(
|
||||
context: context,
|
||||
redact: redacted,
|
||||
configuration: getRedactedConfiguration(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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) {
|
||||
return Material(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
|
||||
.withValues(alpha: 0.6),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
elevation: 10,
|
||||
shadowColor: Colors.black,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
_buildContactInfo(
|
||||
"Call",
|
||||
"Give us a quick call.",
|
||||
Icons.phone,
|
||||
MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
false,
|
||||
() {
|
||||
// print("Calling ${widget.cellNumber}");
|
||||
_makePhoneCall(widget.business.contact_no);
|
||||
},
|
||||
),
|
||||
Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
_buildContactInfo(
|
||||
"Email",
|
||||
"Send us an email.",
|
||||
Icons.email,
|
||||
MihColors.getPinkColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
false,
|
||||
() {
|
||||
// print("Emailing ${widget.email}");
|
||||
_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",
|
||||
);
|
||||
},
|
||||
),
|
||||
Visibility(
|
||||
visible: isValidGps(widget.business.gps_location),
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
_buildContactInfo(
|
||||
"Location",
|
||||
"Come visit us.",
|
||||
Icons.location_on,
|
||||
MihColors.getOrangeColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
false,
|
||||
() {
|
||||
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,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: widget.business.website.isNotEmpty &&
|
||||
widget.business.website != "",
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
_buildContactInfo(
|
||||
"Website",
|
||||
"Find out more about us.",
|
||||
Icons.vpn_lock,
|
||||
MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
false,
|
||||
() {
|
||||
_launchWebsite(widget.business.website);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
FutureBuilder(
|
||||
future: _businessReviewFuture,
|
||||
builder: (context, asyncSnapshot) {
|
||||
if (asyncSnapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
// return const SizedBox.shrink();
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: _buildContactInfo(
|
||||
"Loading Rating",
|
||||
"Loading your rating.",
|
||||
Icons.star_rate_rounded,
|
||||
MihColors.getYellowColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
true,
|
||||
null,
|
||||
),
|
||||
).redacted(context: context, redact: true),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
BusinessReview? businessReview = asyncSnapshot.data;
|
||||
String ratingDisplayTitle = "";
|
||||
if (businessReview == null) {
|
||||
ratingDisplayTitle = "Rate Us";
|
||||
} else {
|
||||
ratingDisplayTitle = "Update Rating";
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
_buildContactInfo(
|
||||
ratingDisplayTitle,
|
||||
"Let us know how we are doing.",
|
||||
Icons.star_rate_rounded,
|
||||
MihColors.getYellowColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
false,
|
||||
() {
|
||||
businessReviewRatingWindow(directoryProvider,
|
||||
businessReview, true, widget.width);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
FutureBuilder(
|
||||
future: _bookmarkedBusinessFuture,
|
||||
builder: (context, asyncSnapshot) {
|
||||
if (asyncSnapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
// return const SizedBox.shrink();
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: _buildContactInfo(
|
||||
"Loading Bookmark",
|
||||
"Loading your bookmark.",
|
||||
Icons.bookmark_add_rounded,
|
||||
MihColors.getBluishPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
true,
|
||||
null,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
BookmarkedBusiness? bookmarkBusiness = asyncSnapshot.data;
|
||||
String bookmarkDisplayTitle = "";
|
||||
if (bookmarkBusiness == null) {
|
||||
bookmarkDisplayTitle = "Bookmark Us";
|
||||
} else {
|
||||
bookmarkDisplayTitle = "Remove Bookmark";
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
_buildContactInfo(
|
||||
bookmarkDisplayTitle,
|
||||
"Save us for later.",
|
||||
bookmarkBusiness == null
|
||||
? Icons.bookmark_add_rounded
|
||||
: Icons.bookmark_remove_rounded,
|
||||
MihColors.getBluishPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
false,
|
||||
() {
|
||||
// _launchWebsite(widget.website);
|
||||
if (bookmarkBusiness == null) {
|
||||
showAddBookmarkAlert();
|
||||
} else {
|
||||
showDeleteBookmarkAlert(bookmarkBusiness);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
// child: Divider(
|
||||
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// ),
|
||||
// ),
|
||||
// _buildContactInfo(
|
||||
// "Bookmark",
|
||||
// "Save us for later.",
|
||||
// Icons.bookmark_add_rounded,
|
||||
// MihColors.getBluishPurpleColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// () {
|
||||
// // _launchWebsite(widget.website);
|
||||
// print("Saving ${widget.business.Name} to Directory");
|
||||
// showBookmarkAlert();
|
||||
// },
|
||||
// ),
|
||||
const SizedBox(height: 10),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
// child: Divider(
|
||||
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
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.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Let's Get Started",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
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.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
Center(
|
||||
child: MihButton(
|
||||
onPressed: () {
|
||||
context.goNamed(
|
||||
'mihHome',
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Sign In/ Create Account",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,7 @@ class _MzansiBusinessProfileTileState extends State<MzansiBusinessProfileTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,9 +43,7 @@ class _MzansiSetupBusinessProfileTileState
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/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_packages/mzansi_profile/business_profile/components/mih_update_business_details_window.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';
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/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_file_services.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';
|
||||
|
||||
@@ -35,9 +35,7 @@ class _MzansiProfileTileState extends State<MzansiProfileTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,9 +34,7 @@ class _MzansiSetupProfileTileState extends State<MzansiSetupProfileTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ class _MihWalletTileState extends State<MihWalletTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,9 +41,7 @@ class _PatManagerTileState extends State<PatManagerTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,7 @@ class _PatientProfileTileState extends State<PatientProfileTile> {
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
primaryColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryColor: MihColors.getPrimaryColor(
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user