Simplify formula evaluation in FormulaScreen
This commit is contained in:
parent
76d17f3a03
commit
127f486cde
1 changed files with 11 additions and 7 deletions
|
|
@ -55,6 +55,10 @@ class _FormulaScreenState extends State<FormulaScreen> {
|
||||||
_selectedOutputUnit = formula.output.unit;
|
_selectedOutputUnit = formula.output.unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _initInputs( Map<String,dynamic> inputValues ){
|
||||||
|
// TODO: FIND WIDGETS AND SET VALUES
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
@ -117,14 +121,14 @@ class _FormulaScreenState extends State<FormulaScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
late final dynamic result;
|
late final dynamic result;
|
||||||
if( formula is DerivedFormula) {
|
//if( formula is DerivedFormula) {
|
||||||
result = formulaSolver(formula, formula.output.name, inputValues,);
|
result = formulaSolver(formula, formula.output.name, inputValues,);
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
print( "TODO: MAYBE ONLY FORMULASOLVER IS NECCESSARY");
|
// TODO: MAYBE ONLY FORMULASOLVER IS NECCESSARY"
|
||||||
final evaluator = FormulaEvaluator();
|
//final evaluator = FormulaEvaluator();
|
||||||
result = evaluator.evaluate(formula as Formula, inputValues);
|
//result = evaluator.evaluate(formula as Formula, inputValues);
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Convert output to selected unit if needed
|
// Convert output to selected unit if needed
|
||||||
String? unit = formula.output.unit;
|
String? unit = formula.output.unit;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue