Migration to mih_package_toolkit
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_action.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tools.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/currency_exchange_rate.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/calculator/package_tools/simple_calc.dart';
|
||||
@@ -42,11 +40,11 @@ class _MIHCalculatorState extends State<MIHCalculator> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackage(
|
||||
appActionButton: getAction(),
|
||||
appTools: getTools(),
|
||||
appBody: getToolBody(),
|
||||
appToolTitles: getToolTitle(),
|
||||
selectedbodyIndex: context.watch<MihCalculatorProvider>().toolIndex,
|
||||
packageActionButton: getAction(),
|
||||
packageTools: getTools(),
|
||||
packageToolBodies: getToolBody(),
|
||||
packageToolTitles: getToolTitle(),
|
||||
selectedBodyIndex: context.watch<MihCalculatorProvider>().toolIndex,
|
||||
onIndexChange: (newIndex) {
|
||||
context.read<MihCalculatorProvider>().setToolIndex(newIndex);
|
||||
},
|
||||
@@ -79,7 +77,7 @@ class _MIHCalculatorState extends State<MIHCalculator> {
|
||||
};
|
||||
return MihPackageTools(
|
||||
tools: temp,
|
||||
selcetedIndex: context.watch<MihCalculatorProvider>().toolIndex,
|
||||
selectedIndex: context.watch<MihCalculatorProvider>().toolIndex,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
|
||||
class MihCalculatorTile extends StatefulWidget {
|
||||
final double packageSize;
|
||||
@@ -26,16 +23,14 @@ class _MihCalculatorTileState extends State<MihCalculatorTile> {
|
||||
"mihCalculator",
|
||||
);
|
||||
},
|
||||
appName: "Calculator",
|
||||
appIcon: Icon(
|
||||
packageName: "Calculator",
|
||||
packageIcon: Icon(
|
||||
MihIcons.calculator,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
// size: widget.packageSize,
|
||||
),
|
||||
iconSize: widget.packageSize,
|
||||
textColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
textColor: MihColors.secondary(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,10 @@ import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_dropdwn_field.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mih_calculator_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_currency_exchange_rate_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||
@@ -76,8 +69,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
Icon(
|
||||
Icons.currency_exchange,
|
||||
size: 150,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
FittedBox(
|
||||
@@ -87,8 +79,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -103,9 +94,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -117,9 +106,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -136,9 +123,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -150,9 +135,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -194,8 +177,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -215,8 +197,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
'$companyName makes no representations or warranties of any kind, express or implied, as to the accuracy, completeness, reliability, or suitability of the information and calculations generated by the Tool. All exchange rates and results are estimates and are subject to change without notice.',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
@@ -227,8 +208,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
'The information provided by the Tool should not be construed as financial, investment, trading, or any other form of advice. You should not make any financial decisions based solely on the output of this Tool. We expressly recommend that you seek independent professional advice and verify all data with a qualified financial advisor and/or through alternative, reliable market data sources before executing any foreign exchange transactions.',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
@@ -239,8 +219,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
'By using the Tool, you agree that $companyName, its affiliates, directors, and employees shall not be held liable for any direct, indirect, incidental, special, consequential, or exemplary damages, including but not limited to, damages for loss of profits, goodwill, use, data, or other intangible losses, resulting from: (i) the use or the inability to use the Tool; (ii) any inaccuracies, errors, or omissions in the Tool\'s calculations or data; or (iii) any reliance placed by you on the information provided by the Tool.',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
@@ -255,8 +234,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
@@ -287,6 +265,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
Widget build(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
return MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
borderOn: false,
|
||||
innerHorizontalPadding: 10,
|
||||
bodyItem: getBody(screenWidth),
|
||||
@@ -309,12 +288,8 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
formKey: _formKey,
|
||||
formFields: <Widget>[
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: _fromAmountController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
@@ -354,9 +329,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.red(),
|
||||
),
|
||||
children: [
|
||||
const TextSpan(
|
||||
@@ -365,9 +338,7 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
text: "Diclaimer",
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
@@ -398,18 +369,12 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
MihAlertServices().inputErrorAlert(context);
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Calculate",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -419,18 +384,12 @@ class _CurrencyExchangeRateState extends State<CurrencyExchangeRate> {
|
||||
onPressed: () {
|
||||
clearInput();
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Clear",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:math_expressions/math_expressions.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
|
||||
class SimpleCalc extends StatefulWidget {
|
||||
const SimpleCalc({super.key});
|
||||
@@ -73,6 +70,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
borderOn: false,
|
||||
innerHorizontalPadding: 10,
|
||||
bodyItem: getBody(),
|
||||
@@ -109,8 +107,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
userInput,
|
||||
style: TextStyle(
|
||||
fontSize: 40,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -124,8 +121,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
answer,
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
@@ -160,18 +156,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
answer = '0';
|
||||
});
|
||||
},
|
||||
buttonColor: MihColors.getPurpleColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.purple(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
child: Text(
|
||||
buttons[index],
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -190,18 +182,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
userInput += buttons[index];
|
||||
});
|
||||
},
|
||||
buttonColor: MihColors.getGreyColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.grey(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
child: Text(
|
||||
buttons[index],
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -219,18 +207,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
userInput += buttons[index];
|
||||
});
|
||||
},
|
||||
buttonColor: MihColors.getGreyColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.grey(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
child: Text(
|
||||
buttons[index],
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -259,18 +243,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
});
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getGreyColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.grey(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
child: Text(
|
||||
buttons[index],
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -299,17 +279,13 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
equalPressed();
|
||||
});
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
child: Icon(
|
||||
Icons.backspace,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -325,18 +301,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
userInput = answer;
|
||||
});
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
child: Text(
|
||||
buttons[index],
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -355,18 +327,14 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
||||
equalPressed();
|
||||
});
|
||||
},
|
||||
buttonColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.secondary(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
borderRadius: 5,
|
||||
child: Text(
|
||||
buttons[index],
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_form.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_numeric_stepper.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tool_body.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_window.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_text_form_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:math_expressions/math_expressions.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_toggle.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class TipCalc extends StatefulWidget {
|
||||
@@ -111,8 +103,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.coins,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
size: 35,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
@@ -122,8 +113,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -134,8 +124,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
@@ -145,8 +134,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.moneyBills,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
size: 35,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
@@ -156,8 +144,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -168,8 +155,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
@@ -178,8 +164,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
if (splitBillController.text == "Yes") const Divider(),
|
||||
@@ -190,8 +175,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.peopleGroup,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
size: 35,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
@@ -201,9 +185,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -215,8 +197,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
if (splitBillController.text == "Yes")
|
||||
@@ -226,8 +207,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
color: MihColors.secondary(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
@@ -258,6 +238,7 @@ class _TipCalcState extends State<TipCalc> {
|
||||
Widget build(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
return MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
borderOn: false,
|
||||
innerHorizontalPadding: 10,
|
||||
bodyItem: getBody(screenWidth),
|
||||
@@ -278,10 +259,8 @@ class _TipCalcState extends State<TipCalc> {
|
||||
formKey: _formKey,
|
||||
formFields: [
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: billAmountController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
@@ -293,10 +272,8 @@ class _TipCalcState extends State<TipCalc> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihTextFormField(
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
controller: tipPercentageController,
|
||||
multiLineInput: false,
|
||||
requiredText: true,
|
||||
@@ -310,10 +287,8 @@ class _TipCalcState extends State<TipCalc> {
|
||||
MihToggle(
|
||||
hintText: "Split Bill",
|
||||
initialPostion: splitPosition,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
secondaryFillColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
secondaryFillColor: MihColors.primary(),
|
||||
onChange: (value) {
|
||||
setState(() {
|
||||
splitBillController.text = value ? "Yes" : "No";
|
||||
@@ -350,12 +325,8 @@ class _TipCalcState extends State<TipCalc> {
|
||||
children: [
|
||||
MihNumericStepper(
|
||||
controller: noPeopleController,
|
||||
fillColor: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
inputColor: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
fillColor: MihColors.secondary(),
|
||||
inputColor: MihColors.primary(),
|
||||
hintText: "No. People",
|
||||
requiredText: temp == "Yes",
|
||||
minValue: 2,
|
||||
@@ -406,16 +377,12 @@ class _TipCalcState extends State<TipCalc> {
|
||||
MihAlertServices().inputErrorAlert(context);
|
||||
}
|
||||
},
|
||||
buttonColor: MihColors.getGreenColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.green(),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Calculate",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -425,16 +392,12 @@ class _TipCalcState extends State<TipCalc> {
|
||||
onPressed: () {
|
||||
clearInput();
|
||||
},
|
||||
buttonColor: MihColors.getRedColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
buttonColor: MihColors.red(),
|
||||
width: 300,
|
||||
child: Text(
|
||||
"Clear",
|
||||
style: TextStyle(
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
color: MihColors.primary(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user