Funciona hot-reload, no funciona cambiar las unidades del output

This commit is contained in:
alvaro@a37 2026-01-28 14:06:57 +01:00
parent 8d020f5807
commit 8283941125
3 changed files with 16 additions and 10 deletions

View file

@ -20,7 +20,10 @@ build-web-debug-container: pub-get-container
./docker-exec.sh exec flutter build web --debug ./docker-exec.sh exec flutter build web --debug
run-linux-debug-container: build-linux-debug-container run-linux-debug-container: build-linux-debug-container
./docker-exec.sh exec /app/build/linux/x64/debug/bundle/d4rt_formulas ./docker-exec.sh exec flutter run -d linux
run-linux-debug: build-linux-debug-container
./build/linux/x64/debug/bundle/d4rt_formulas
run-web-debug-container: build-web-debug-container run-web-debug-container: build-web-debug-container
cd build/web && python3 -m http.server 8080 cd build/web && python3 -m http.server 8080

View file

@ -53,6 +53,8 @@ exec_in_container(){
mkdir -p $BUILDCACHE mkdir -p $BUILDCACHE
$DOCKER run \ $DOCKER run \
-it \
--init \
--rm \ --rm \
$GRAPHICOPTIONS \ $GRAPHICOPTIONS \
$SPIOPTIONS \ $SPIOPTIONS \

View file

@ -93,6 +93,7 @@ class _FormulaScreenState extends State<FormulaScreen> {
} }
void _evaluateFormula() { void _evaluateFormula() {
print( "EVALUATE FORMULA");
if (!_formKey.currentState!.validate()) return; if (!_formKey.currentState!.validate()) return;
try { try {
@ -271,10 +272,10 @@ class _FormulaScreenState extends State<FormulaScreen> {
variable: widget.formula.output, variable: widget.formula.output,
selectedUnit: _selectedOutputUnit, selectedUnit: _selectedOutputUnit,
onUnitChanged: (unit) { onUnitChanged: (unit) {
setState(() {
_selectedOutputUnit = unit; _selectedOutputUnit = unit;
});
_evaluateFormula(); _evaluateFormula();
setState(() {
});
}, },
), ),
], ],
@ -301,10 +302,10 @@ class _FormulaScreenState extends State<FormulaScreen> {
.map((v) => DropdownMenuItem<String>(value: v, child: Text(v))) .map((v) => DropdownMenuItem<String>(value: v, child: Text(v)))
.toList(), .toList(),
onChanged: (v) { onChanged: (v) {
setState(() {
_selectedValues[variable.name] = v; _selectedValues[variable.name] = v;
});
_evaluateFormula(); _evaluateFormula();
setState(() {
});
}, },
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
@ -322,10 +323,10 @@ class _FormulaScreenState extends State<FormulaScreen> {
variable: variable, variable: variable,
selectedUnit: _selectedUnits[variable.name], selectedUnit: _selectedUnits[variable.name],
onUnitChanged: (unit) { onUnitChanged: (unit) {
setState(() {
_selectedUnits[variable.name] = unit; _selectedUnits[variable.name] = unit;
});
_evaluateFormula(); _evaluateFormula();
setState(() {
});
}, },
), ),
] else ...[ ] else ...[