The formula is updated when edited and saved

This commit is contained in:
Álvaro González 2026-03-06 08:52:23 +01:00
parent 0d20542825
commit 546966ccfa
2 changed files with 8 additions and 2 deletions

View file

@ -81,6 +81,11 @@ class _FormulaListState extends State<FormulaList> {
builder: (context) => FormulaEditor( builder: (context) => FormulaEditor(
formula: formula, formula: formula,
corpus: widget.corpus, corpus: widget.corpus,
onSave: (updatedFormula){
setState((){
// THIS UPDATES THE FORMULA LIST
});
}
), ),
), ),
); );

View file

@ -11,10 +11,10 @@ import 'unit_dropdown.dart';
import 'formula_editor.dart'; import 'formula_editor.dart';
class FormulaScreen extends StatefulWidget { class FormulaScreen extends StatefulWidget {
final Formula formula; Formula formula;
final Corpus corpus; final Corpus corpus;
const FormulaScreen({super.key, required this.formula, required this.corpus}); FormulaScreen({super.key, required this.formula, required this.corpus});
@override @override
State<FormulaScreen> createState() => _FormulaScreenState(); State<FormulaScreen> createState() => _FormulaScreenState();
@ -218,6 +218,7 @@ class _FormulaScreenState extends State<FormulaScreen> {
// Refresh the screen after saving // Refresh the screen after saving
setState(() { setState(() {
// The corpus has been updated, refresh the displayed formula // The corpus has been updated, refresh the displayed formula
widget.formula = updatedFormula;
}); });
}, },
), ),