Migration to mih_package_toolkit
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_three.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_zero.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_one.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/Example/package_tools/package_tool_two.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_data_helper_services.dart';
|
||||
@@ -23,7 +20,7 @@ class PackageTest extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PackageTestState extends State<PackageTest> {
|
||||
int _selcetedIndex = 0;
|
||||
int _selectedIndex = 0;
|
||||
bool _isLoadingInitialData = true;
|
||||
|
||||
Future<void> _loadInitialData() async {
|
||||
@@ -65,27 +62,27 @@ class _PackageTestState extends State<PackageTest> {
|
||||
Map<Widget, void Function()?> temp = Map();
|
||||
temp[const Icon(Icons.link)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 0;
|
||||
_selectedIndex = 0;
|
||||
});
|
||||
};
|
||||
temp[const Icon(Icons.warning)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 1;
|
||||
_selectedIndex = 1;
|
||||
});
|
||||
};
|
||||
temp[const Icon(Icons.inbox)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 2;
|
||||
_selectedIndex = 2;
|
||||
});
|
||||
};
|
||||
temp[const Icon(Icons.outbond)] = () {
|
||||
setState(() {
|
||||
_selcetedIndex = 3;
|
||||
_selectedIndex = 3;
|
||||
});
|
||||
};
|
||||
return MihPackageTools(
|
||||
tools: temp,
|
||||
selcetedIndex: _selcetedIndex,
|
||||
selectedIndex: _selectedIndex,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,16 +133,16 @@ class _PackageTestState extends State<PackageTest> {
|
||||
);
|
||||
}
|
||||
return MihPackage(
|
||||
appActionButton: getAction(),
|
||||
appTools: getTools(),
|
||||
appBody: getToolBody(),
|
||||
appToolTitles: getToolTitle(),
|
||||
selectedbodyIndex: _selcetedIndex,
|
||||
packageActionButton: getAction(),
|
||||
packageTools: getTools(),
|
||||
packageToolBodies: getToolBody(),
|
||||
packageToolTitles: getToolTitle(),
|
||||
selectedBodyIndex: _selectedIndex,
|
||||
onIndexChange: (newValue) {
|
||||
setState(() {
|
||||
_selcetedIndex = newValue;
|
||||
_selectedIndex = newValue;
|
||||
});
|
||||
print("Index: $_selcetedIndex");
|
||||
print("Index: $_selectedIndex");
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
|
||||
class TestPackageTile extends StatefulWidget {
|
||||
final double packageSize;
|
||||
@@ -31,15 +29,13 @@ class _TestPackageTileState extends State<TestPackageTile> {
|
||||
// ),
|
||||
// );
|
||||
},
|
||||
appName: "Test",
|
||||
appIcon: Icon(
|
||||
packageName: "Test",
|
||||
packageIcon: Icon(
|
||||
Icons.warning_amber_rounded,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
textColor: MihColors.secondary(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,33 +7,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:ken_logger/ken_logger.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_loading_circle.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_business_info_card.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_date_field.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_floating_menu.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_image_display.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_radio_options.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_search_bar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_time_field.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
||||
import 'package:redacted/redacted.dart';
|
||||
|
||||
class PackageToolOne extends StatefulWidget {
|
||||
@@ -97,28 +81,22 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
return MihPackageWindow(
|
||||
fullscreen: false,
|
||||
borderOn: true,
|
||||
foregroundColor: MihColors.getOrangeColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
backgroundColor: MihColors.getBluishPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
foregroundColor: MihColors.orange(),
|
||||
backgroundColor: MihColors.bluishPurple(),
|
||||
windowTitle: "Test No Full",
|
||||
menuOptions: [
|
||||
SpeedDialChild(
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
label: "Show New Window",
|
||||
labelBackgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
labelBackgroundColor: MihColors.green(),
|
||||
labelStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
backgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
backgroundColor: MihColors.green(),
|
||||
onTap: () {
|
||||
// showTestWindow();
|
||||
},
|
||||
@@ -138,6 +116,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
Widget build(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
return MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
borderOn: false,
|
||||
bodyItem: getBody(screenWidth),
|
||||
);
|
||||
@@ -184,9 +163,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -197,16 +174,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {
|
||||
KenLogger.success("Successfully tested");
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Success Logger",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -219,16 +193,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {
|
||||
KenLogger.error("Successfully tested");
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Error Logger",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -241,16 +212,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {
|
||||
KenLogger.warning("Successfully tested");
|
||||
},
|
||||
buttonColor: MihColors.getOrangeColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.orange(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Warning Logger",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -263,16 +231,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {
|
||||
KenLogger.info("Successfully tested");
|
||||
},
|
||||
buttonColor: MihColors.getBluishPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.bluishPurple(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Info Logger",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -288,10 +253,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
initialSelection: '+27',
|
||||
showDropDownButton: false,
|
||||
pickerStyle: PickerStyle.bottomSheet,
|
||||
dialogBackgroundColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
barrierColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
dialogBackgroundColor: MihColors.primary(),
|
||||
barrierColor: MihColors.primary(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
@@ -306,16 +269,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
},
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Show Loading",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -332,9 +292,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -353,9 +311,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -433,8 +389,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
thickness: 2,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
@@ -447,9 +402,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -458,8 +411,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
MihBannerAd(),
|
||||
const SizedBox(height: 10),
|
||||
Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
thickness: 2,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
@@ -468,12 +420,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
formFields: [
|
||||
MihTextFormField(
|
||||
width: 200,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _textFieldZeroController,
|
||||
multiLineInput: false,
|
||||
requiredText: false,
|
||||
@@ -484,12 +432,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _textFieldOneController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
@@ -501,12 +445,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _textFieldTwoController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
@@ -519,12 +459,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _textFieldThreeController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
@@ -537,12 +473,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
const SizedBox(height: 10),
|
||||
MihNumericStepper(
|
||||
controller: _textFieldFiveController,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
hintText: "Number Stepper",
|
||||
requiredText: true,
|
||||
minValue: 1,
|
||||
@@ -553,12 +485,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
MihToggle(
|
||||
hintText: "Toggle",
|
||||
initialPostion: switchpositioin,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
secondaryFillColor: MihColors.primary(),
|
||||
readOnly: false,
|
||||
onChange: (value) {
|
||||
setState(() {
|
||||
@@ -571,12 +499,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
MihRadioOptions(
|
||||
controller: _textFieldSixController,
|
||||
hintText: "Radio Options",
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
secondaryFillColor: MihColors.primary(),
|
||||
requiredText: true,
|
||||
radioOptions: const ["Option 1", "Option 2"],
|
||||
),
|
||||
@@ -617,12 +541,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
height: 250,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _textFieldFourController,
|
||||
multiLineInput: true,
|
||||
requiredText: false,
|
||||
@@ -646,17 +566,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
MihAlertServices().inputErrorAlert(context);
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Submit Form",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -667,8 +583,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
thickness: 2,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
@@ -679,10 +594,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
prefixIcon: Icons.search,
|
||||
prefixAltIcon: MihIcons.mzansiAi,
|
||||
width: 300,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
hintColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
hintColor: MihColors.primary(),
|
||||
onPrefixIconTap: () {
|
||||
print("Search Icon Pressed: ${_searchController.text}");
|
||||
},
|
||||
@@ -693,16 +606,13 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {
|
||||
print("Button Pressed");
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Click Me",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -713,24 +623,19 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {
|
||||
print("Button Pressed");
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
width: 300,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delete,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
Text(
|
||||
"Click Me",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -743,15 +648,12 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {
|
||||
print("Button Pressed");
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Click Me",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -768,9 +670,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
onPressed: () {},
|
||||
icon: Icon(
|
||||
MihIcons.mihLogo,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -782,10 +682,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
editable: false,
|
||||
fileNameController: _fileNameController,
|
||||
userSelectedfile: file,
|
||||
frameColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
backgroundColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
frameColor: MihColors.secondary(),
|
||||
backgroundColor: MihColors.primary(),
|
||||
onChange: (selectedImage) {
|
||||
setState(() {
|
||||
file = selectedImage;
|
||||
@@ -794,10 +692,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _fileNameController,
|
||||
hintText: "Selected Avatar File",
|
||||
requiredText: false,
|
||||
@@ -819,10 +715,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _imagefileController,
|
||||
hintText: "Selected Image File",
|
||||
requiredText: false,
|
||||
@@ -842,19 +736,15 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
SpeedDialChild(
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
label: "Show New Window",
|
||||
labelBackgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
labelBackgroundColor: MihColors.green(),
|
||||
labelStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
backgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
backgroundColor: MihColors.green(),
|
||||
onTap: () {
|
||||
showTestWindow();
|
||||
},
|
||||
@@ -862,19 +752,15 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
SpeedDialChild(
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
label: "Show New Full Window",
|
||||
labelBackgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
labelBackgroundColor: MihColors.green(),
|
||||
labelStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
backgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
backgroundColor: MihColors.green(),
|
||||
onTap: () {
|
||||
showTestFullWindow();
|
||||
},
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_profile_links.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||
|
||||
class PackageToolThree extends StatefulWidget {
|
||||
const PackageToolThree({super.key});
|
||||
@@ -15,6 +14,7 @@ class _PackageToolThreeState extends State<PackageToolThree> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
borderOn: false,
|
||||
bodyItem: getBody(),
|
||||
);
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import 'package:custom_rating_bar/custom_rating_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
|
||||
class PackageToolTwo extends StatefulWidget {
|
||||
const PackageToolTwo({super.key});
|
||||
@@ -17,6 +13,7 @@ class _PackageToolTwoState extends State<PackageToolTwo> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
borderOn: false,
|
||||
bodyItem: getBody(),
|
||||
);
|
||||
@@ -35,8 +32,7 @@ class _PackageToolTwoState extends State<PackageToolTwo> {
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
@@ -58,8 +54,7 @@ class _PackageToolTwoState extends State<PackageToolTwo> {
|
||||
onPressed: () {},
|
||||
icon: Icon(
|
||||
MihIcons.mihLogo,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
|
||||
class PackageToolZero extends StatefulWidget {
|
||||
@@ -18,6 +14,7 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
borderOn: false,
|
||||
bodyItem: getBody(),
|
||||
);
|
||||
@@ -35,8 +32,7 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
@@ -49,13 +45,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
context,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
child: Text(
|
||||
"Basic Success Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -73,16 +67,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
buttonColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.primary(),
|
||||
width: 300,
|
||||
elevation: 10,
|
||||
child: Text(
|
||||
"Okay",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -92,16 +83,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
width: 300,
|
||||
elevation: 10,
|
||||
child: Text(
|
||||
"Dismiss",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -111,13 +99,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
context,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
child: Text(
|
||||
"Advanced Success Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -130,13 +116,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
MihAlertServices().warningAlert(
|
||||
"Warning Alert!", "This is a friendly warning mee", context);
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
child: Text(
|
||||
"Warning Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -154,16 +138,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
buttonColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.primary(),
|
||||
width: 300,
|
||||
elevation: 10,
|
||||
child: Text(
|
||||
"Okay",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -173,16 +154,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
width: 300,
|
||||
elevation: 10,
|
||||
child: Text(
|
||||
"Dismiss",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -192,13 +170,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
context,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
child: Text(
|
||||
"Advanced Warning Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -214,13 +190,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
context,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Basic Error Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -238,16 +212,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
buttonColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.primary(),
|
||||
width: 300,
|
||||
elevation: 10,
|
||||
child: Text(
|
||||
"Okay",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -257,16 +228,13 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
width: 300,
|
||||
elevation: 10,
|
||||
child: Text(
|
||||
"Dismiss",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -276,13 +244,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
context,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Advanced Error Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -300,13 +266,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
context,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Delete Confirmation Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -318,13 +282,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().internetConnectionAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Internet Connection Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -336,13 +298,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().locationPermissionAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Location Permission Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -354,13 +314,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().inputErrorAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Input Error Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -372,14 +330,12 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().passwordRequirementAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: FittedBox(
|
||||
child: Text(
|
||||
"Password Requirement Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -392,13 +348,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().passwordMatchAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Password Match Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -410,13 +364,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().loginErrorAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Login Error Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -428,13 +380,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().emailExistsAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Email Exists Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -446,13 +396,11 @@ class _PackageToolZeroState extends State<PackageToolZero> {
|
||||
onPressed: () {
|
||||
MihAlertServices().invalidEmailAlert(context);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode != "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Text(
|
||||
"Invalid Email Alert",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
|
||||
@@ -50,8 +46,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
RedactedConfiguration getRedactedConfiguration() {
|
||||
return RedactedConfiguration(
|
||||
// redactedColor: Colors.pink,
|
||||
redactedColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
redactedColor: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -159,13 +154,10 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
Function()? ontap,
|
||||
) {
|
||||
return Material(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
child: InkWell(
|
||||
onTap: ontap,
|
||||
splashColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
|
||||
.withOpacity(0.2),
|
||||
splashColor: MihColors.primary().withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsGeometry.symmetric(
|
||||
@@ -186,8 +178,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
child: Icon(
|
||||
icon,
|
||||
// size: 35,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
).redacted(
|
||||
@@ -207,9 +198,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
height: 1.0,
|
||||
),
|
||||
).redacted(
|
||||
@@ -222,9 +211,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
).redacted(
|
||||
context: context,
|
||||
@@ -278,16 +265,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||
MzansiDirectoryProvider directoryProvider, Widget? child) {
|
||||
return Material(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
|
||||
.withValues(alpha: 0.6),
|
||||
color: MihColors.secondary().withValues(alpha: 0.6),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
elevation: 10,
|
||||
shadowColor: Colors.black,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
@@ -297,8 +281,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
"Call",
|
||||
"Give us a quick call.",
|
||||
Icons.phone,
|
||||
MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
MihColors.green(),
|
||||
false,
|
||||
() {
|
||||
// print("Calling ${widget.cellNumber}");
|
||||
@@ -306,15 +289,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
},
|
||||
),
|
||||
Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
_buildContactInfo(
|
||||
"Email",
|
||||
"Send us an email.",
|
||||
Icons.email,
|
||||
MihColors.getPinkColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
MihColors.pink(),
|
||||
false,
|
||||
() {
|
||||
// print("Emailing ${widget.email}");
|
||||
@@ -330,17 +311,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
_buildContactInfo(
|
||||
"Location",
|
||||
"Come visit us.",
|
||||
Icons.location_on,
|
||||
MihColors.getOrangeColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
MihColors.orange(),
|
||||
false,
|
||||
() {
|
||||
final latitude = double.parse(
|
||||
@@ -362,17 +339,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
_buildContactInfo(
|
||||
"Website",
|
||||
"Find out more about us.",
|
||||
Icons.vpn_lock,
|
||||
MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
MihColors.red(),
|
||||
false,
|
||||
() {
|
||||
_launchWebsite(widget.business.website);
|
||||
@@ -393,9 +366,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
@@ -403,9 +374,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
"Loading Rating",
|
||||
"Loading your rating.",
|
||||
Icons.star_rate_rounded,
|
||||
MihColors.getYellowColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
MihColors.yellow(),
|
||||
true,
|
||||
null,
|
||||
),
|
||||
@@ -426,18 +395,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
_buildContactInfo(
|
||||
ratingDisplayTitle,
|
||||
"Let us know how we are doing.",
|
||||
Icons.star_rate_rounded,
|
||||
MihColors.getYellowColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
MihColors.yellow(),
|
||||
false,
|
||||
() {
|
||||
businessReviewRatingWindow(directoryProvider,
|
||||
@@ -461,9 +426,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
@@ -471,9 +434,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
"Loading Bookmark",
|
||||
"Loading your bookmark.",
|
||||
Icons.bookmark_add_rounded,
|
||||
MihColors.getBluishPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
MihColors.bluishPurple(),
|
||||
true,
|
||||
null,
|
||||
),
|
||||
@@ -494,9 +455,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Divider(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
_buildContactInfo(
|
||||
@@ -505,9 +464,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
bookmarkBusiness == null
|
||||
? Icons.bookmark_add_rounded
|
||||
: Icons.bookmark_remove_rounded,
|
||||
MihColors.getBluishPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
MihColors.bluishPurple(),
|
||||
false,
|
||||
() {
|
||||
// _launchWebsite(widget.website);
|
||||
@@ -526,14 +483,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
// child: Divider(
|
||||
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// color: MihColors.primary(),
|
||||
// ),
|
||||
// ),
|
||||
// _buildContactInfo(
|
||||
// "Bookmark",
|
||||
// "Save us for later.",
|
||||
// Icons.bookmark_add_rounded,
|
||||
// MihColors.getBluishPurpleColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// MihColors.bluishPurple(),
|
||||
// () {
|
||||
// // _launchWebsite(widget.website);
|
||||
// print("Saving ${widget.business.Name} to Directory");
|
||||
@@ -544,7 +501,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
// child: Divider(
|
||||
// color: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// color: MihColors.primary(),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
@@ -646,16 +603,14 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
Icon(
|
||||
MihIcons.mihLogo,
|
||||
size: 125,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Let's Get Started",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -664,8 +619,7 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
Text(
|
||||
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
@@ -678,16 +632,13 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Sign In/ Create Account",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/bookmarked_business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business_review.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_add_bookmark_alert.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_delete_bookmark_alert.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_review_business_window.dart';
|
||||
@@ -50,8 +46,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
RedactedConfiguration getRedactedConfiguration() {
|
||||
return RedactedConfiguration(
|
||||
// redactedColor: Colors.pink,
|
||||
redactedColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
redactedColor: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -200,12 +195,10 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
onPressed: () {
|
||||
_makePhoneCall(widget.business.contact_no);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
child: Icon(
|
||||
Icons.phone,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
),
|
||||
@@ -215,9 +208,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
"Call",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
@@ -236,12 +227,10 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
"Dear ${widget.business.Name},\n\nI would like to inquire about your services.\n\nBest regards,\n",
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getPinkColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.pink(),
|
||||
child: Icon(
|
||||
Icons.email,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
),
|
||||
@@ -251,9 +240,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
"Email",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
@@ -276,13 +263,10 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
longitude: longitude,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getOrangeColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.orange(),
|
||||
child: Icon(
|
||||
Icons.location_on,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
),
|
||||
@@ -292,9 +276,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
"Maps",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
@@ -311,13 +293,10 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
onPressed: () {
|
||||
_launchWebsite(widget.business.website);
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
child: Icon(
|
||||
Icons.language,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
),
|
||||
@@ -327,9 +306,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
"Website",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
@@ -346,14 +323,10 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
width: 80,
|
||||
height: 80,
|
||||
onPressed: () {},
|
||||
buttonColor: MihColors.getGreyColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.grey(),
|
||||
child: Icon(
|
||||
Icons.star_rate_rounded,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
).redacted(context: context, redact: true),
|
||||
@@ -363,9 +336,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
"Rate Us",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
).redacted(context: context, redact: true),
|
||||
@@ -389,14 +360,10 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
businessReviewRatingWindow(directoryProvider,
|
||||
businessReview, true, widget.width);
|
||||
},
|
||||
buttonColor: MihColors.getYellowColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.yellow(),
|
||||
child: Icon(
|
||||
Icons.star_rate_rounded,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
),
|
||||
@@ -406,9 +373,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
ratingTitle,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
@@ -428,14 +393,10 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
width: 80,
|
||||
height: 80,
|
||||
onPressed: () {},
|
||||
buttonColor: MihColors.getGreyColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.grey(),
|
||||
child: Icon(
|
||||
Icons.bookmark_add_rounded,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
).redacted(context: context, redact: true),
|
||||
@@ -445,9 +406,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
"bookmark",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
).redacted(context: context, redact: true),
|
||||
@@ -474,16 +433,12 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
showDeleteBookmarkAlert(bookmarkBusiness);
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getBluishPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.bluishPurple(),
|
||||
child: Icon(
|
||||
bookmarkBusiness == null
|
||||
? Icons.bookmark_add_rounded
|
||||
: Icons.bookmark_remove_rounded,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
size: iconSize,
|
||||
),
|
||||
),
|
||||
@@ -493,9 +448,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
bookmarkDisplayTitle,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
@@ -602,16 +555,14 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
Icon(
|
||||
MihIcons.mihLogo,
|
||||
size: 125,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Let's Get Started",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -620,8 +571,7 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
Text(
|
||||
"Ready to dive in to the world of MIH?\nSign in or create a free MIH account to unlock all the powerful features of the MIH app. It's quick and easy!",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
@@ -634,16 +584,13 @@ class _MihBusinessCardV2State extends State<MihBusinessCardV2> {
|
||||
extra: true,
|
||||
);
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
elevation: 10,
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Sign In/ Create Account",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -54,16 +52,13 @@ class _MihBusinessProfilePreviewState extends State<MihBusinessProfilePreview> {
|
||||
? Icon(
|
||||
MihIcons.mihRing,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
)
|
||||
: widget.imageFile == null
|
||||
? Icon(
|
||||
MihIcons.iDontKnow,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
)
|
||||
: MihCircleAvatar(
|
||||
imageFile: widget.imageFile,
|
||||
@@ -72,12 +67,8 @@ class _MihBusinessProfilePreviewState extends State<MihBusinessProfilePreview> {
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: null,
|
||||
frameColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
backgroundColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
frameColor: MihColors.secondary(),
|
||||
backgroundColor: MihColors.primary(),
|
||||
onChange: () {},
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ken_logger/ken_logger.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
|
||||
@@ -54,8 +53,7 @@ class _MIHCalendarState extends State<MIHCalendar> {
|
||||
formatButtonDecoration: BoxDecoration(
|
||||
border: Border.fromBorderSide(
|
||||
BorderSide(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
borderRadius: const BorderRadius.all(
|
||||
@@ -79,36 +77,29 @@ class _MIHCalendarState extends State<MIHCalendar> {
|
||||
calendarStyle: CalendarStyle(
|
||||
outsideDaysVisible: false,
|
||||
todayTextStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
todayDecoration: BoxDecoration(
|
||||
color: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.green(),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
selectedTextStyle: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
selectedDecoration: BoxDecoration(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
weekendTextStyle: TextStyle(
|
||||
color: MihColors.getGreyColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.grey(),
|
||||
),
|
||||
),
|
||||
daysOfWeekStyle: DaysOfWeekStyle(
|
||||
weekdayStyle: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
weekendStyle: TextStyle(
|
||||
color: MihColors.getGreyColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.grey(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -4,10 +4,8 @@ import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:ken_logger/ken_logger.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||
|
||||
class MihCircleAvatar extends StatefulWidget {
|
||||
final ImageProvider<Object>? imageFile;
|
||||
@@ -126,9 +124,7 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
|
||||
child: IconButton.filled(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(
|
||||
MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
MihColors.green(),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,295 +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(
|
||||
scrollbarTheme: ScrollbarThemeData(
|
||||
thumbColor: WidgetStatePropertyAll(
|
||||
MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark")),
|
||||
thickness: const WidgetStatePropertyAll(6),
|
||||
radius: const Radius.circular(10),
|
||||
thumbVisibility: const WidgetStatePropertyAll(
|
||||
true), // Always show when scrolling
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -3,8 +3,8 @@ import 'dart:io';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ken_logger/ken_logger.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
|
||||
class MihImageDisplay extends StatefulWidget {
|
||||
final ImageProvider<Object>? imageFile;
|
||||
@@ -67,9 +67,7 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
|
||||
// width: widget.width,
|
||||
height: widget.height,
|
||||
decoration: BoxDecoration(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
borderRadius: BorderRadius.circular(widget.width * 0.1),
|
||||
),
|
||||
child: Image(image: imagePreview!),
|
||||
@@ -79,15 +77,13 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
decoration: BoxDecoration(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
borderRadius: BorderRadius.circular(widget.width * 0.1),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.image_not_supported_rounded,
|
||||
size: widget.width * 0.3,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
@@ -97,11 +93,9 @@ class _MihImageDisplayState extends State<MihImageDisplay> {
|
||||
right: 5,
|
||||
child: IconButton.filled(
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
backgroundColor: MihColors.green(),
|
||||
),
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.primary(),
|
||||
onPressed: () async {
|
||||
try {
|
||||
FilePickerResult? result =
|
||||
|
||||
@@ -1,97 +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;
|
||||
|
||||
@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"),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
if (widget.message != null)
|
||||
Text(
|
||||
widget.message!,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/notification.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
@@ -69,15 +68,13 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
subtitle,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
onTap: () {},
|
||||
@@ -94,8 +91,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
children: [
|
||||
Icon(
|
||||
Icons.circle_notifications,
|
||||
color: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.red(),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
@@ -104,8 +100,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -119,8 +114,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -132,8 +126,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
subtitle: Text(
|
||||
subtitle,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
@@ -156,8 +149,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
separatorBuilder: (BuildContext context, index) {
|
||||
return Divider(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
);
|
||||
},
|
||||
itemCount: widget.notifications.length,
|
||||
@@ -196,15 +188,14 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Drawer(
|
||||
//backgroundColor: MihColors.getPrimaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
//backgroundColor: MihColors.primary(),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@@ -214,9 +205,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
child: Text(
|
||||
"Notifications",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
),
|
||||
@@ -231,7 +220,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// separatorBuilder: (BuildContext context, index) {
|
||||
// return Divider(
|
||||
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// color: MihColors.secondary(),
|
||||
// );
|
||||
// },
|
||||
// itemCount: widget.notifications.length,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import '../main.dart';
|
||||
import '../mih_objects/arguments.dart';
|
||||
|
||||
@@ -131,10 +131,8 @@ class _MIHNotificationMessageState extends State<MIHNotificationMessage>
|
||||
void initState() {
|
||||
super.initState();
|
||||
setState(() {
|
||||
primary = MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||
secondary = MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||
primary = MihColors.primary();
|
||||
secondary = MihColors.red();
|
||||
});
|
||||
_animationController = AnimationController(
|
||||
vsync: this,
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:ken_logger/ken_logger.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 (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
|
||||
// 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);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
import 'dart:io';
|
||||
|
||||
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 &&
|
||||
!Platform.isLinux) {
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,221 +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;
|
||||
final bool? scrollbarOn;
|
||||
const MihPackageWindow({
|
||||
super.key,
|
||||
required this.fullscreen,
|
||||
required this.windowTitle,
|
||||
this.menuOptions,
|
||||
required this.onWindowTapClose,
|
||||
required this.windowBody,
|
||||
this.borderOn,
|
||||
this.scrollbarOn,
|
||||
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: widget.scrollbarOn != null || !widget.scrollbarOn!
|
||||
? widget.windowBody
|
||||
: MihSingleChildScroll(
|
||||
scrollbarOn: true,
|
||||
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(
|
||||
scrollbarOn: true,
|
||||
child: widget.windowBody,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
|
||||
class MihPersonalProfilePreview extends StatefulWidget {
|
||||
final AppUser user;
|
||||
@@ -36,15 +34,13 @@ class _MihPersonalProfilePreviewState extends State<MihPersonalProfilePreview> {
|
||||
? Icon(
|
||||
MihIcons.mihRing,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
)
|
||||
: widget.imageFile == null
|
||||
? Icon(
|
||||
MihIcons.iDontKnow,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
)
|
||||
: MihCircleAvatar(
|
||||
imageFile: widget.imageFile,
|
||||
@@ -53,10 +49,8 @@ class _MihPersonalProfilePreviewState extends State<MihPersonalProfilePreview> {
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: null,
|
||||
frameColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
backgroundColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
frameColor: MihColors.secondary(),
|
||||
backgroundColor: MihColors.primary(),
|
||||
onChange: () {},
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -77,8 +76,7 @@ class _MihProfileLinksState extends State<MihProfileLinks> {
|
||||
break;
|
||||
default:
|
||||
iconData = FontAwesomeIcons.link;
|
||||
btnColor = MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||
btnColor = MihColors.primary();
|
||||
}
|
||||
return MihButton(
|
||||
width: 80,
|
||||
@@ -97,15 +95,15 @@ class _MihProfileLinksState extends State<MihProfileLinks> {
|
||||
// onTap: () {
|
||||
// launchSocialUrl(Uri.parse(link.web_link));
|
||||
// },
|
||||
// appName: link.destination,
|
||||
// appIcon: Icon(
|
||||
// packageName: link.destination,
|
||||
// packageIcon: Icon(
|
||||
// iconData,
|
||||
// color: btnColor,
|
||||
// ),
|
||||
// iconSize: 200,
|
||||
// textColor: Colors.black,
|
||||
// // MihColors.getPrimaryColor(
|
||||
// // MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// // MihColors.primary(
|
||||
// // ),
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -136,9 +134,7 @@ class _MihProfileLinksState extends State<MihProfileLinks> {
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -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),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
@@ -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
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MihSingleChildScroll extends StatefulWidget {
|
||||
final Widget child;
|
||||
final bool? scrollbarOn;
|
||||
const MihSingleChildScroll({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.scrollbarOn,
|
||||
});
|
||||
|
||||
@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: widget.scrollbarOn ?? false),
|
||||
child: SingleChildScrollView(
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
|
||||
class MihTimeField extends StatefulWidget {
|
||||
final TextEditingController controller;
|
||||
final String labelText;
|
||||
final bool required;
|
||||
final double? width;
|
||||
final double? height;
|
||||
final double? borderRadius;
|
||||
final double? elevation;
|
||||
final FormFieldValidator<String>? validator;
|
||||
|
||||
const MihTimeField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.labelText,
|
||||
required this.required,
|
||||
this.width,
|
||||
this.height,
|
||||
this.borderRadius,
|
||||
this.elevation,
|
||||
this.validator,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MihTimeField> createState() => _MihTimeFieldState();
|
||||
}
|
||||
|
||||
class _MihTimeFieldState extends State<MihTimeField> {
|
||||
FormFieldState<String>? _formFieldState;
|
||||
|
||||
Future<void> _selectTime(BuildContext context) async {
|
||||
TimeOfDay? picked = await showTimePicker(
|
||||
context: context,
|
||||
initialTime: widget.controller.text.isNotEmpty
|
||||
? TimeOfDay(
|
||||
hour: int.tryParse(widget.controller.text.split(":")[0]) ?? 0,
|
||||
minute: int.tryParse(widget.controller.text.split(":")[1]) ?? 0,
|
||||
)
|
||||
: TimeOfDay.now(),
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
|
||||
child: child as Widget,
|
||||
);
|
||||
},
|
||||
);
|
||||
if (picked != null) {
|
||||
final hours = picked.hour.toString().padLeft(2, '0');
|
||||
final minutes = picked.minute.toString().padLeft(2, '0');
|
||||
widget.controller.text = "$hours:$minutes";
|
||||
_formFieldState?.didChange(widget.controller.text);
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
widget.labelText,
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
if (!widget.required)
|
||||
Text(
|
||||
"(Optional)",
|
||||
style: TextStyle(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
FormField<String>(
|
||||
initialValue: widget.controller.text,
|
||||
validator: widget.validator,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
builder: (field) {
|
||||
_formFieldState = field;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Material(
|
||||
elevation: widget.elevation ?? 4.0,
|
||||
borderRadius:
|
||||
BorderRadius.circular(widget.borderRadius ?? 8.0),
|
||||
child: TextFormField(
|
||||
controller: widget.controller,
|
||||
readOnly: true,
|
||||
onTap: () => _selectTime(context),
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Icon(
|
||||
Icons.access_time,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
errorStyle: const TextStyle(height: 0, fontSize: 0),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 10.0, vertical: 8.0),
|
||||
filled: true,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
widget.borderRadius ?? 8.0),
|
||||
borderSide: field.hasError
|
||||
? BorderSide(
|
||||
color: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
width: 2.0,
|
||||
)
|
||||
: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
widget.borderRadius ?? 8.0),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
widget.borderRadius ?? 8.0),
|
||||
borderSide: BorderSide(
|
||||
color: field.hasError
|
||||
? MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark")
|
||||
: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
width: 3.0,
|
||||
),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
widget.borderRadius ?? 8.0),
|
||||
borderSide: BorderSide(
|
||||
color: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
width: 3.0,
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
widget.borderRadius ?? 8.0),
|
||||
borderSide: BorderSide(
|
||||
color: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
width: 3.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
field.didChange(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
if (field.hasError)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 4.0),
|
||||
child: Text(
|
||||
field.errorText ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
|
||||
class MihToggle extends StatefulWidget {
|
||||
final String hintText;
|
||||
final bool initialPostion;
|
||||
final Color fillColor;
|
||||
final Color secondaryFillColor;
|
||||
final bool? readOnly;
|
||||
final double? elevation;
|
||||
final void Function(bool) onChange;
|
||||
const MihToggle({
|
||||
super.key,
|
||||
required this.hintText,
|
||||
required this.initialPostion,
|
||||
required this.fillColor,
|
||||
required this.secondaryFillColor,
|
||||
this.readOnly,
|
||||
this.elevation,
|
||||
required this.onChange,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MihToggle> createState() => _MihToggleState();
|
||||
}
|
||||
|
||||
class _MihToggleState extends State<MihToggle> {
|
||||
late bool togglePosition;
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant MihToggle oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.initialPostion != oldWidget.initialPostion) {
|
||||
setState(() {
|
||||
togglePosition = widget.initialPostion;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
togglePosition = widget.initialPostion;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.hintText,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: widget.fillColor,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
// Material(
|
||||
// elevation: widget.elevation ?? 0.01,
|
||||
// shadowColor: widget.secondaryFillColor.withOpacity(0.5),
|
||||
// color: Colors.transparent,
|
||||
// shape: StadiumBorder(),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(
|
||||
30), // Adjust the border radius to match the toggle
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: Offset(
|
||||
0, widget.elevation ?? 10), // Adjust the vertical offset
|
||||
blurRadius: widget.elevation ?? 10,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Switch(
|
||||
value: togglePosition,
|
||||
trackOutlineColor: WidgetStateProperty.resolveWith<Color?>(
|
||||
(states) {
|
||||
if (widget.readOnly == true) {
|
||||
return Colors.grey;
|
||||
}
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"); // Outline color when active
|
||||
}
|
||||
return MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"); // Outline color when active
|
||||
},
|
||||
),
|
||||
activeColor: widget.readOnly == true
|
||||
? Colors.grey
|
||||
: widget.secondaryFillColor,
|
||||
activeTrackColor: widget.readOnly == true
|
||||
? Colors.grey.shade400
|
||||
: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inactiveThumbColor: widget.readOnly == true
|
||||
? Colors.grey
|
||||
: widget.secondaryFillColor,
|
||||
inactiveTrackColor: widget.readOnly == true
|
||||
? Colors.grey.shade400
|
||||
: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// activeColor: widget.secondaryFillColor,
|
||||
// activeTrackColor: widget.fillColor,
|
||||
// inactiveThumbColor: widget.fillColor,
|
||||
// inactiveTrackColor: widget.secondaryFillColor,
|
||||
// onChanged: widget.readOnly != true ? widget.onChange : null,
|
||||
onChanged: widget.readOnly != true
|
||||
? (newValue) {
|
||||
setState(() {
|
||||
togglePosition = newValue; // Update internal state
|
||||
});
|
||||
widget.onChange(newValue); // Call the parent's onChange
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user