Merge branch 'feature/derivable-formula-screen' of ssh://codeberg.org/alvarogonzalezsotillo/d4rt_formulas into feature/derivable-formula-screen

This commit is contained in:
Álvaro González 2026-03-11 09:56:34 +01:00
commit 42f556565b

View file

@ -55,6 +55,10 @@ class _FormulaScreenState extends State<FormulaScreen> {
_selectedOutputUnit = formula.output.unit;
}
void _initInputs( Map<String,dynamic> inputValues ){
// TODO: FIND WIDGETS AND SET VALUES
}
@override
void initState() {
super.initState();
@ -117,14 +121,14 @@ class _FormulaScreenState extends State<FormulaScreen> {
}
late final dynamic result;
if( formula is DerivedFormula) {
//if( formula is DerivedFormula) {
result = formulaSolver(formula, formula.output.name, inputValues,);
}
else {
print( "TODO: MAYBE ONLY FORMULASOLVER IS NECCESSARY");
final evaluator = FormulaEvaluator();
result = evaluator.evaluate(formula as Formula, inputValues);
}
//}
//else {
// TODO: MAYBE ONLY FORMULASOLVER IS NECCESSARY"
//final evaluator = FormulaEvaluator();
//result = evaluator.evaluate(formula as Formula, inputValues);
//}
// Convert output to selected unit if needed
String? unit = formula.output.unit;
@ -484,16 +488,9 @@ class _FormulaScreenState extends State<FormulaScreen> {
}
// Replace the current FormulaScreen with the new DerivedFormula screen
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => FormulaScreen(
formula: derivedFormula,
corpus: widget.corpus,
onSave: widget.onSave,
),
),
);
setState( (){
formula = derivedFormula;
});
} catch (e, st) {
errorHandler.notify(e,st);
}