QOL: MIH Calculator Package performance improvements
This commit is contained in:
@@ -20,6 +20,10 @@ class MIHCalculator extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MIHCalculatorState extends State<MIHCalculator> {
|
class _MIHCalculatorState extends State<MIHCalculator> {
|
||||||
|
late final SimpleCalc _simpleCalc;
|
||||||
|
late final TipCalc _tipCalc;
|
||||||
|
late final CurrencyExchangeRate _currencyExchangeRate;
|
||||||
|
|
||||||
Future<void> getCurrencyCodeList() async {
|
Future<void> getCurrencyCodeList() async {
|
||||||
await MihCurrencyExchangeRateServices.getCurrencyCodeList(context);
|
await MihCurrencyExchangeRateServices.getCurrencyCodeList(context);
|
||||||
}
|
}
|
||||||
@@ -27,6 +31,9 @@ class _MIHCalculatorState extends State<MIHCalculator> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_simpleCalc = SimpleCalc();
|
||||||
|
_tipCalc = TipCalc();
|
||||||
|
_currencyExchangeRate = CurrencyExchangeRate();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
await getCurrencyCodeList();
|
await getCurrencyCodeList();
|
||||||
});
|
});
|
||||||
@@ -77,12 +84,11 @@ class _MIHCalculatorState extends State<MIHCalculator> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getToolBody() {
|
List<Widget> getToolBody() {
|
||||||
List<Widget> toolBodies = [
|
return [
|
||||||
const SimpleCalc(),
|
_simpleCalc,
|
||||||
const TipCalc(),
|
_tipCalc,
|
||||||
const CurrencyExchangeRate(),
|
_currencyExchangeRate,
|
||||||
];
|
];
|
||||||
return toolBodies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> getToolTitle() {
|
List<String> getToolTitle() {
|
||||||
|
|||||||
Reference in New Issue
Block a user