Merge branch 'feature/derivable-formula-screen' of ssh://codeberg.org/alvarogonzalezsotillo/d4rt_formulas into feature/derivable-formula-screen
This commit is contained in:
commit
42f556565b
1 changed files with 14 additions and 17 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;
|
||||||
|
|
@ -484,16 +488,9 @@ class _FormulaScreenState extends State<FormulaScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the current FormulaScreen with the new DerivedFormula screen
|
// Replace the current FormulaScreen with the new DerivedFormula screen
|
||||||
Navigator.pushReplacement(
|
setState( (){
|
||||||
context,
|
formula = derivedFormula;
|
||||||
MaterialPageRoute(
|
});
|
||||||
builder: (context) => FormulaScreen(
|
|
||||||
formula: derivedFormula,
|
|
||||||
corpus: widget.corpus,
|
|
||||||
onSave: widget.onSave,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} catch (e, st) {
|
} catch (e, st) {
|
||||||
errorHandler.notify(e,st);
|
errorHandler.notify(e,st);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue